module Network.AWS.EC2.CreateSnapshot
(
CreateSnapshot
, createSnapshot
, cs2Description
, cs2DryRun
, cs2VolumeId
, CreateSnapshotResponse
, createSnapshotResponse
, csr1Description
, csr1Encrypted
, csr1OwnerAlias
, csr1OwnerId
, csr1Progress
, csr1SnapshotId
, csr1StartTime
, csr1State
, csr1Tags
, csr1VolumeId
, csr1VolumeSize
) where
import Network.AWS.Prelude
import Network.AWS.Request.Query
import Network.AWS.EC2.Types
import qualified GHC.Exts
data CreateSnapshot = CreateSnapshot
{ _cs2Description :: Maybe Text
, _cs2DryRun :: Maybe Bool
, _cs2VolumeId :: Text
} deriving (Eq, Ord, Show)
createSnapshot :: Text
-> CreateSnapshot
createSnapshot p1 = CreateSnapshot
{ _cs2VolumeId = p1
, _cs2DryRun = Nothing
, _cs2Description = Nothing
}
cs2Description :: Lens' CreateSnapshot (Maybe Text)
cs2Description = lens _cs2Description (\s a -> s { _cs2Description = a })
cs2DryRun :: Lens' CreateSnapshot (Maybe Bool)
cs2DryRun = lens _cs2DryRun (\s a -> s { _cs2DryRun = a })
cs2VolumeId :: Lens' CreateSnapshot Text
cs2VolumeId = lens _cs2VolumeId (\s a -> s { _cs2VolumeId = a })
data CreateSnapshotResponse = CreateSnapshotResponse
{ _csr1Description :: Maybe Text
, _csr1Encrypted :: Maybe Bool
, _csr1OwnerAlias :: Maybe Text
, _csr1OwnerId :: Maybe Text
, _csr1Progress :: Maybe Text
, _csr1SnapshotId :: Maybe Text
, _csr1StartTime :: Maybe RFC822
, _csr1State :: Maybe SnapshotState
, _csr1Tags :: List "item" Tag
, _csr1VolumeId :: Maybe Text
, _csr1VolumeSize :: Maybe Int
} deriving (Eq, Show)
createSnapshotResponse :: CreateSnapshotResponse
createSnapshotResponse = CreateSnapshotResponse
{ _csr1SnapshotId = Nothing
, _csr1VolumeId = Nothing
, _csr1State = Nothing
, _csr1StartTime = Nothing
, _csr1Progress = Nothing
, _csr1OwnerId = Nothing
, _csr1Description = Nothing
, _csr1VolumeSize = Nothing
, _csr1OwnerAlias = Nothing
, _csr1Tags = mempty
, _csr1Encrypted = Nothing
}
csr1Description :: Lens' CreateSnapshotResponse (Maybe Text)
csr1Description = lens _csr1Description (\s a -> s { _csr1Description = a })
csr1Encrypted :: Lens' CreateSnapshotResponse (Maybe Bool)
csr1Encrypted = lens _csr1Encrypted (\s a -> s { _csr1Encrypted = a })
csr1OwnerAlias :: Lens' CreateSnapshotResponse (Maybe Text)
csr1OwnerAlias = lens _csr1OwnerAlias (\s a -> s { _csr1OwnerAlias = a })
csr1OwnerId :: Lens' CreateSnapshotResponse (Maybe Text)
csr1OwnerId = lens _csr1OwnerId (\s a -> s { _csr1OwnerId = a })
csr1Progress :: Lens' CreateSnapshotResponse (Maybe Text)
csr1Progress = lens _csr1Progress (\s a -> s { _csr1Progress = a })
csr1SnapshotId :: Lens' CreateSnapshotResponse (Maybe Text)
csr1SnapshotId = lens _csr1SnapshotId (\s a -> s { _csr1SnapshotId = a })
csr1StartTime :: Lens' CreateSnapshotResponse (Maybe UTCTime)
csr1StartTime = lens _csr1StartTime (\s a -> s { _csr1StartTime = a }) . mapping _Time
csr1State :: Lens' CreateSnapshotResponse (Maybe SnapshotState)
csr1State = lens _csr1State (\s a -> s { _csr1State = a })
csr1Tags :: Lens' CreateSnapshotResponse [Tag]
csr1Tags = lens _csr1Tags (\s a -> s { _csr1Tags = a }) . _List
csr1VolumeId :: Lens' CreateSnapshotResponse (Maybe Text)
csr1VolumeId = lens _csr1VolumeId (\s a -> s { _csr1VolumeId = a })
csr1VolumeSize :: Lens' CreateSnapshotResponse (Maybe Int)
csr1VolumeSize = lens _csr1VolumeSize (\s a -> s { _csr1VolumeSize = a })
instance ToPath CreateSnapshot where
toPath = const "/"
instance ToQuery CreateSnapshot where
toQuery CreateSnapshot{..} = mconcat
[ "Description" =? _cs2Description
, "dryRun" =? _cs2DryRun
, "VolumeId" =? _cs2VolumeId
]
instance ToHeaders CreateSnapshot
instance AWSRequest CreateSnapshot where
type Sv CreateSnapshot = EC2
type Rs CreateSnapshot = CreateSnapshotResponse
request = post "CreateSnapshot"
response = xmlResponse
instance FromXML CreateSnapshotResponse where
parseXML x = CreateSnapshotResponse
<$> x .@? "description"
<*> x .@? "encrypted"
<*> x .@? "ownerAlias"
<*> x .@? "ownerId"
<*> x .@? "progress"
<*> x .@? "snapshotId"
<*> x .@? "startTime"
<*> x .@? "status"
<*> x .@ "tagSet"
<*> x .@? "volumeId"
<*> x .@? "volumeSize"