module Network.AWS.EC2.DescribeSnapshotAttribute
(
describeSnapshotAttribute
, DescribeSnapshotAttribute
, dsaDryRun
, dsaSnapshotId
, dsaAttribute
, describeSnapshotAttributeResponse
, DescribeSnapshotAttributeResponse
, dsarsCreateVolumePermissions
, dsarsProductCodes
, dsarsSnapshotId
, dsarsResponseStatus
) where
import Network.AWS.EC2.Types
import Network.AWS.EC2.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DescribeSnapshotAttribute = DescribeSnapshotAttribute'
{ _dsaDryRun :: !(Maybe Bool)
, _dsaSnapshotId :: !Text
, _dsaAttribute :: !SnapshotAttributeName
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeSnapshotAttribute
:: Text
-> SnapshotAttributeName
-> DescribeSnapshotAttribute
describeSnapshotAttribute pSnapshotId_ pAttribute_ =
DescribeSnapshotAttribute'
{ _dsaDryRun = Nothing
, _dsaSnapshotId = pSnapshotId_
, _dsaAttribute = pAttribute_
}
dsaDryRun :: Lens' DescribeSnapshotAttribute (Maybe Bool)
dsaDryRun = lens _dsaDryRun (\ s a -> s{_dsaDryRun = a});
dsaSnapshotId :: Lens' DescribeSnapshotAttribute Text
dsaSnapshotId = lens _dsaSnapshotId (\ s a -> s{_dsaSnapshotId = a});
dsaAttribute :: Lens' DescribeSnapshotAttribute SnapshotAttributeName
dsaAttribute = lens _dsaAttribute (\ s a -> s{_dsaAttribute = a});
instance AWSRequest DescribeSnapshotAttribute where
type Rs DescribeSnapshotAttribute =
DescribeSnapshotAttributeResponse
request = postQuery eC2
response
= receiveXML
(\ s h x ->
DescribeSnapshotAttributeResponse' <$>
(x .@? "createVolumePermission" .!@ mempty >>=
may (parseXMLList "item"))
<*>
(x .@? "productCodes" .!@ mempty >>=
may (parseXMLList "item"))
<*> (x .@? "snapshotId")
<*> (pure (fromEnum s)))
instance ToHeaders DescribeSnapshotAttribute where
toHeaders = const mempty
instance ToPath DescribeSnapshotAttribute where
toPath = const "/"
instance ToQuery DescribeSnapshotAttribute where
toQuery DescribeSnapshotAttribute'{..}
= mconcat
["Action" =:
("DescribeSnapshotAttribute" :: ByteString),
"Version" =: ("2015-10-01" :: ByteString),
"DryRun" =: _dsaDryRun,
"SnapshotId" =: _dsaSnapshotId,
"Attribute" =: _dsaAttribute]
data DescribeSnapshotAttributeResponse = DescribeSnapshotAttributeResponse'
{ _dsarsCreateVolumePermissions :: !(Maybe [CreateVolumePermission])
, _dsarsProductCodes :: !(Maybe [ProductCode])
, _dsarsSnapshotId :: !(Maybe Text)
, _dsarsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeSnapshotAttributeResponse
:: Int
-> DescribeSnapshotAttributeResponse
describeSnapshotAttributeResponse pResponseStatus_ =
DescribeSnapshotAttributeResponse'
{ _dsarsCreateVolumePermissions = Nothing
, _dsarsProductCodes = Nothing
, _dsarsSnapshotId = Nothing
, _dsarsResponseStatus = pResponseStatus_
}
dsarsCreateVolumePermissions :: Lens' DescribeSnapshotAttributeResponse [CreateVolumePermission]
dsarsCreateVolumePermissions = lens _dsarsCreateVolumePermissions (\ s a -> s{_dsarsCreateVolumePermissions = a}) . _Default . _Coerce;
dsarsProductCodes :: Lens' DescribeSnapshotAttributeResponse [ProductCode]
dsarsProductCodes = lens _dsarsProductCodes (\ s a -> s{_dsarsProductCodes = a}) . _Default . _Coerce;
dsarsSnapshotId :: Lens' DescribeSnapshotAttributeResponse (Maybe Text)
dsarsSnapshotId = lens _dsarsSnapshotId (\ s a -> s{_dsarsSnapshotId = a});
dsarsResponseStatus :: Lens' DescribeSnapshotAttributeResponse Int
dsarsResponseStatus = lens _dsarsResponseStatus (\ s a -> s{_dsarsResponseStatus = a});