module Network.AWS.Redshift.CreateSnapshotCopyGrant
(
createSnapshotCopyGrant
, CreateSnapshotCopyGrant
, cscgKMSKeyId
, cscgTags
, cscgSnapshotCopyGrantName
, createSnapshotCopyGrantResponse
, CreateSnapshotCopyGrantResponse
, cscgrsSnapshotCopyGrant
, cscgrsStatus
) where
import Network.AWS.Prelude
import Network.AWS.Redshift.Types
import Network.AWS.Redshift.Types.Product
import Network.AWS.Request
import Network.AWS.Response
data CreateSnapshotCopyGrant = CreateSnapshotCopyGrant'
{ _cscgKMSKeyId :: !(Maybe Text)
, _cscgTags :: !(Maybe [Tag])
, _cscgSnapshotCopyGrantName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createSnapshotCopyGrant
:: Text
-> CreateSnapshotCopyGrant
createSnapshotCopyGrant pSnapshotCopyGrantName_ =
CreateSnapshotCopyGrant'
{ _cscgKMSKeyId = Nothing
, _cscgTags = Nothing
, _cscgSnapshotCopyGrantName = pSnapshotCopyGrantName_
}
cscgKMSKeyId :: Lens' CreateSnapshotCopyGrant (Maybe Text)
cscgKMSKeyId = lens _cscgKMSKeyId (\ s a -> s{_cscgKMSKeyId = a});
cscgTags :: Lens' CreateSnapshotCopyGrant [Tag]
cscgTags = lens _cscgTags (\ s a -> s{_cscgTags = a}) . _Default . _Coerce;
cscgSnapshotCopyGrantName :: Lens' CreateSnapshotCopyGrant Text
cscgSnapshotCopyGrantName = lens _cscgSnapshotCopyGrantName (\ s a -> s{_cscgSnapshotCopyGrantName = a});
instance AWSRequest CreateSnapshotCopyGrant where
type Rs CreateSnapshotCopyGrant =
CreateSnapshotCopyGrantResponse
request = postQuery redshift
response
= receiveXMLWrapper "CreateSnapshotCopyGrantResult"
(\ s h x ->
CreateSnapshotCopyGrantResponse' <$>
(x .@? "SnapshotCopyGrant") <*> (pure (fromEnum s)))
instance ToHeaders CreateSnapshotCopyGrant where
toHeaders = const mempty
instance ToPath CreateSnapshotCopyGrant where
toPath = const "/"
instance ToQuery CreateSnapshotCopyGrant where
toQuery CreateSnapshotCopyGrant'{..}
= mconcat
["Action" =:
("CreateSnapshotCopyGrant" :: ByteString),
"Version" =: ("2012-12-01" :: ByteString),
"KmsKeyId" =: _cscgKMSKeyId,
"Tags" =: toQuery (toQueryList "Tag" <$> _cscgTags),
"SnapshotCopyGrantName" =:
_cscgSnapshotCopyGrantName]
data CreateSnapshotCopyGrantResponse = CreateSnapshotCopyGrantResponse'
{ _cscgrsSnapshotCopyGrant :: !(Maybe SnapshotCopyGrant)
, _cscgrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createSnapshotCopyGrantResponse
:: Int
-> CreateSnapshotCopyGrantResponse
createSnapshotCopyGrantResponse pStatus_ =
CreateSnapshotCopyGrantResponse'
{ _cscgrsSnapshotCopyGrant = Nothing
, _cscgrsStatus = pStatus_
}
cscgrsSnapshotCopyGrant :: Lens' CreateSnapshotCopyGrantResponse (Maybe SnapshotCopyGrant)
cscgrsSnapshotCopyGrant = lens _cscgrsSnapshotCopyGrant (\ s a -> s{_cscgrsSnapshotCopyGrant = a});
cscgrsStatus :: Lens' CreateSnapshotCopyGrantResponse Int
cscgrsStatus = lens _cscgrsStatus (\ s a -> s{_cscgrsStatus = a});