{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.EC2.DescribeSnapshotAttribute
(
describeSnapshotAttribute
, DescribeSnapshotAttribute
, dsaDryRun
, dsaAttribute
, dsaSnapshotId
, describeSnapshotAttributeResponse
, DescribeSnapshotAttributeResponse
, dsarsCreateVolumePermissions
, dsarsProductCodes
, dsarsSnapshotId
, dsarsResponseStatus
) where
import Network.AWS.EC2.Types
import Network.AWS.EC2.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data DescribeSnapshotAttribute = DescribeSnapshotAttribute'
{ _dsaDryRun :: !(Maybe Bool)
, _dsaAttribute :: !SnapshotAttributeName
, _dsaSnapshotId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeSnapshotAttribute
:: SnapshotAttributeName
-> Text
-> DescribeSnapshotAttribute
describeSnapshotAttribute pAttribute_ pSnapshotId_ =
DescribeSnapshotAttribute'
{ _dsaDryRun = Nothing
, _dsaAttribute = pAttribute_
, _dsaSnapshotId = pSnapshotId_
}
dsaDryRun :: Lens' DescribeSnapshotAttribute (Maybe Bool)
dsaDryRun = lens _dsaDryRun (\ s a -> s{_dsaDryRun = a})
dsaAttribute :: Lens' DescribeSnapshotAttribute SnapshotAttributeName
dsaAttribute = lens _dsaAttribute (\ s a -> s{_dsaAttribute = a})
dsaSnapshotId :: Lens' DescribeSnapshotAttribute Text
dsaSnapshotId = lens _dsaSnapshotId (\ s a -> s{_dsaSnapshotId = 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 Hashable DescribeSnapshotAttribute where
instance NFData DescribeSnapshotAttribute where
instance ToHeaders DescribeSnapshotAttribute where
toHeaders = const mempty
instance ToPath DescribeSnapshotAttribute where
toPath = const "/"
instance ToQuery DescribeSnapshotAttribute where
toQuery DescribeSnapshotAttribute'{..}
= mconcat
["Action" =:
("DescribeSnapshotAttribute" :: ByteString),
"Version" =: ("2016-11-15" :: ByteString),
"DryRun" =: _dsaDryRun, "Attribute" =: _dsaAttribute,
"SnapshotId" =: _dsaSnapshotId]
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})
instance NFData DescribeSnapshotAttributeResponse
where