module Network.AWS.StorageGateway.CreateTapes
(
createTapes
, CreateTapes
, ctGatewayARN
, ctTapeSizeInBytes
, ctClientToken
, ctNumTapesToCreate
, ctTapeBarcodePrefix
, createTapesResponse
, CreateTapesResponse
, ctrsTapeARNs
, ctrsResponseStatus
) where
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.StorageGateway.Types
import Network.AWS.StorageGateway.Types.Product
data CreateTapes = CreateTapes'
{ _ctGatewayARN :: !Text
, _ctTapeSizeInBytes :: !Integer
, _ctClientToken :: !Text
, _ctNumTapesToCreate :: !Nat
, _ctTapeBarcodePrefix :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createTapes
:: Text
-> Integer
-> Text
-> Natural
-> Text
-> CreateTapes
createTapes pGatewayARN_ pTapeSizeInBytes_ pClientToken_ pNumTapesToCreate_ pTapeBarcodePrefix_ =
CreateTapes'
{ _ctGatewayARN = pGatewayARN_
, _ctTapeSizeInBytes = pTapeSizeInBytes_
, _ctClientToken = pClientToken_
, _ctNumTapesToCreate = _Nat # pNumTapesToCreate_
, _ctTapeBarcodePrefix = pTapeBarcodePrefix_
}
ctGatewayARN :: Lens' CreateTapes Text
ctGatewayARN = lens _ctGatewayARN (\ s a -> s{_ctGatewayARN = a});
ctTapeSizeInBytes :: Lens' CreateTapes Integer
ctTapeSizeInBytes = lens _ctTapeSizeInBytes (\ s a -> s{_ctTapeSizeInBytes = a});
ctClientToken :: Lens' CreateTapes Text
ctClientToken = lens _ctClientToken (\ s a -> s{_ctClientToken = a});
ctNumTapesToCreate :: Lens' CreateTapes Natural
ctNumTapesToCreate = lens _ctNumTapesToCreate (\ s a -> s{_ctNumTapesToCreate = a}) . _Nat;
ctTapeBarcodePrefix :: Lens' CreateTapes Text
ctTapeBarcodePrefix = lens _ctTapeBarcodePrefix (\ s a -> s{_ctTapeBarcodePrefix = a});
instance AWSRequest CreateTapes where
type Rs CreateTapes = CreateTapesResponse
request = postJSON storageGateway
response
= receiveJSON
(\ s h x ->
CreateTapesResponse' <$>
(x .?> "TapeARNs" .!@ mempty) <*>
(pure (fromEnum s)))
instance ToHeaders CreateTapes where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("StorageGateway_20130630.CreateTapes" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateTapes where
toJSON CreateTapes'{..}
= object
(catMaybes
[Just ("GatewayARN" .= _ctGatewayARN),
Just ("TapeSizeInBytes" .= _ctTapeSizeInBytes),
Just ("ClientToken" .= _ctClientToken),
Just ("NumTapesToCreate" .= _ctNumTapesToCreate),
Just ("TapeBarcodePrefix" .= _ctTapeBarcodePrefix)])
instance ToPath CreateTapes where
toPath = const "/"
instance ToQuery CreateTapes where
toQuery = const mempty
data CreateTapesResponse = CreateTapesResponse'
{ _ctrsTapeARNs :: !(Maybe [Text])
, _ctrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createTapesResponse
:: Int
-> CreateTapesResponse
createTapesResponse pResponseStatus_ =
CreateTapesResponse'
{ _ctrsTapeARNs = Nothing
, _ctrsResponseStatus = pResponseStatus_
}
ctrsTapeARNs :: Lens' CreateTapesResponse [Text]
ctrsTapeARNs = lens _ctrsTapeARNs (\ s a -> s{_ctrsTapeARNs = a}) . _Default . _Coerce;
ctrsResponseStatus :: Lens' CreateTapesResponse Int
ctrsResponseStatus = lens _ctrsResponseStatus (\ s a -> s{_ctrsResponseStatus = a});