module Network.AWS.StorageGateway.CreateTapes
(
CreateTapes
, createTapes
, ctClientToken
, ctGatewayARN
, ctNumTapesToCreate
, ctTapeBarcodePrefix
, ctTapeSizeInBytes
, CreateTapesResponse
, createTapesResponse
, ctrTapeARNs
) where
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.StorageGateway.Types
import qualified GHC.Exts
data CreateTapes = CreateTapes
{ _ctClientToken :: Text
, _ctGatewayARN :: Text
, _ctNumTapesToCreate :: Nat
, _ctTapeBarcodePrefix :: Text
, _ctTapeSizeInBytes :: Nat
} deriving (Eq, Ord, Show)
createTapes :: Text
-> Natural
-> Text
-> Natural
-> Text
-> CreateTapes
createTapes p1 p2 p3 p4 p5 = CreateTapes
{ _ctGatewayARN = p1
, _ctTapeSizeInBytes = withIso _Nat (const id) p2
, _ctClientToken = p3
, _ctNumTapesToCreate = withIso _Nat (const id) p4
, _ctTapeBarcodePrefix = p5
}
ctClientToken :: Lens' CreateTapes Text
ctClientToken = lens _ctClientToken (\s a -> s { _ctClientToken = a })
ctGatewayARN :: Lens' CreateTapes Text
ctGatewayARN = lens _ctGatewayARN (\s a -> s { _ctGatewayARN = 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 })
ctTapeSizeInBytes :: Lens' CreateTapes Natural
ctTapeSizeInBytes =
lens _ctTapeSizeInBytes (\s a -> s { _ctTapeSizeInBytes = a })
. _Nat
newtype CreateTapesResponse = CreateTapesResponse
{ _ctrTapeARNs :: List "TapeARNs" Text
} deriving (Eq, Ord, Show, Monoid, Semigroup)
instance GHC.Exts.IsList CreateTapesResponse where
type Item CreateTapesResponse = Text
fromList = CreateTapesResponse . GHC.Exts.fromList
toList = GHC.Exts.toList . _ctrTapeARNs
createTapesResponse :: CreateTapesResponse
createTapesResponse = CreateTapesResponse
{ _ctrTapeARNs = mempty
}
ctrTapeARNs :: Lens' CreateTapesResponse [Text]
ctrTapeARNs = lens _ctrTapeARNs (\s a -> s { _ctrTapeARNs = a }) . _List
instance ToPath CreateTapes where
toPath = const "/"
instance ToQuery CreateTapes where
toQuery = const mempty
instance ToHeaders CreateTapes
instance ToJSON CreateTapes where
toJSON CreateTapes{..} = object
[ "GatewayARN" .= _ctGatewayARN
, "TapeSizeInBytes" .= _ctTapeSizeInBytes
, "ClientToken" .= _ctClientToken
, "NumTapesToCreate" .= _ctNumTapesToCreate
, "TapeBarcodePrefix" .= _ctTapeBarcodePrefix
]
instance AWSRequest CreateTapes where
type Sv CreateTapes = StorageGateway
type Rs CreateTapes = CreateTapesResponse
request = post "CreateTapes"
response = jsonResponse
instance FromJSON CreateTapesResponse where
parseJSON = withObject "CreateTapesResponse" $ \o -> CreateTapesResponse
<$> o .:? "TapeARNs" .!= mempty