module Network.AWS.EC2.AllocateAddress
(
allocateAddress
, AllocateAddress
, aaDomain
, aaDryRun
, allocateAddressResponse
, AllocateAddressResponse
, aarsAllocationId
, aarsDomain
, aarsPublicIP
, aarsResponseStatus
) 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 AllocateAddress = AllocateAddress'
{ _aaDomain :: !(Maybe DomainType)
, _aaDryRun :: !(Maybe Bool)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
allocateAddress
:: AllocateAddress
allocateAddress =
AllocateAddress'
{ _aaDomain = Nothing
, _aaDryRun = Nothing
}
aaDomain :: Lens' AllocateAddress (Maybe DomainType)
aaDomain = lens _aaDomain (\ s a -> s{_aaDomain = a});
aaDryRun :: Lens' AllocateAddress (Maybe Bool)
aaDryRun = lens _aaDryRun (\ s a -> s{_aaDryRun = a});
instance AWSRequest AllocateAddress where
type Rs AllocateAddress = AllocateAddressResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
AllocateAddressResponse' <$>
(x .@? "allocationId") <*> (x .@? "domain") <*>
(x .@? "publicIp")
<*> (pure (fromEnum s)))
instance Hashable AllocateAddress
instance ToHeaders AllocateAddress where
toHeaders = const mempty
instance ToPath AllocateAddress where
toPath = const "/"
instance ToQuery AllocateAddress where
toQuery AllocateAddress'{..}
= mconcat
["Action" =: ("AllocateAddress" :: ByteString),
"Version" =: ("2015-10-01" :: ByteString),
"Domain" =: _aaDomain, "DryRun" =: _aaDryRun]
data AllocateAddressResponse = AllocateAddressResponse'
{ _aarsAllocationId :: !(Maybe Text)
, _aarsDomain :: !(Maybe DomainType)
, _aarsPublicIP :: !(Maybe Text)
, _aarsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
allocateAddressResponse
:: Int
-> AllocateAddressResponse
allocateAddressResponse pResponseStatus_ =
AllocateAddressResponse'
{ _aarsAllocationId = Nothing
, _aarsDomain = Nothing
, _aarsPublicIP = Nothing
, _aarsResponseStatus = pResponseStatus_
}
aarsAllocationId :: Lens' AllocateAddressResponse (Maybe Text)
aarsAllocationId = lens _aarsAllocationId (\ s a -> s{_aarsAllocationId = a});
aarsDomain :: Lens' AllocateAddressResponse (Maybe DomainType)
aarsDomain = lens _aarsDomain (\ s a -> s{_aarsDomain = a});
aarsPublicIP :: Lens' AllocateAddressResponse (Maybe Text)
aarsPublicIP = lens _aarsPublicIP (\ s a -> s{_aarsPublicIP = a});
aarsResponseStatus :: Lens' AllocateAddressResponse Int
aarsResponseStatus = lens _aarsResponseStatus (\ s a -> s{_aarsResponseStatus = a});