module Network.AWS.ElastiCache.CreateSnapshot
(
createSnapshot
, CreateSnapshot
, csCacheClusterId
, csSnapshotName
, createSnapshotResponse
, CreateSnapshotResponse
, crersSnapshot
, crersStatus
) where
import Network.AWS.ElastiCache.Types
import Network.AWS.ElastiCache.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateSnapshot = CreateSnapshot'
{ _csCacheClusterId :: !Text
, _csSnapshotName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createSnapshot
:: Text
-> Text
-> CreateSnapshot
createSnapshot pCacheClusterId_ pSnapshotName_ =
CreateSnapshot'
{ _csCacheClusterId = pCacheClusterId_
, _csSnapshotName = pSnapshotName_
}
csCacheClusterId :: Lens' CreateSnapshot Text
csCacheClusterId = lens _csCacheClusterId (\ s a -> s{_csCacheClusterId = a});
csSnapshotName :: Lens' CreateSnapshot Text
csSnapshotName = lens _csSnapshotName (\ s a -> s{_csSnapshotName = a});
instance AWSRequest CreateSnapshot where
type Sv CreateSnapshot = ElastiCache
type Rs CreateSnapshot = CreateSnapshotResponse
request = postQuery
response
= receiveXMLWrapper "CreateSnapshotResult"
(\ s h x ->
CreateSnapshotResponse' <$>
(x .@? "Snapshot") <*> (pure (fromEnum s)))
instance ToHeaders CreateSnapshot where
toHeaders = const mempty
instance ToPath CreateSnapshot where
toPath = const "/"
instance ToQuery CreateSnapshot where
toQuery CreateSnapshot'{..}
= mconcat
["Action" =: ("CreateSnapshot" :: ByteString),
"Version" =: ("2015-02-02" :: ByteString),
"CacheClusterId" =: _csCacheClusterId,
"SnapshotName" =: _csSnapshotName]
data CreateSnapshotResponse = CreateSnapshotResponse'
{ _crersSnapshot :: !(Maybe Snapshot)
, _crersStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createSnapshotResponse
:: Int
-> CreateSnapshotResponse
createSnapshotResponse pStatus_ =
CreateSnapshotResponse'
{ _crersSnapshot = Nothing
, _crersStatus = pStatus_
}
crersSnapshot :: Lens' CreateSnapshotResponse (Maybe Snapshot)
crersSnapshot = lens _crersSnapshot (\ s a -> s{_crersSnapshot = a});
crersStatus :: Lens' CreateSnapshotResponse Int
crersStatus = lens _crersStatus (\ s a -> s{_crersStatus = a});