{-# 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.AssociateAddress
(
associateAddress
, AssociateAddress
, aasInstanceId
, aasAllocationId
, aasNetworkInterfaceId
, aasAllowReassociation
, aasPrivateIPAddress
, aasPublicIP
, aasDryRun
, associateAddressResponse
, AssociateAddressResponse
, arsAssociationId
, arsResponseStatus
) 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 AssociateAddress = AssociateAddress'
{ _aasInstanceId :: !(Maybe Text)
, _aasAllocationId :: !(Maybe Text)
, _aasNetworkInterfaceId :: !(Maybe Text)
, _aasAllowReassociation :: !(Maybe Bool)
, _aasPrivateIPAddress :: !(Maybe Text)
, _aasPublicIP :: !(Maybe Text)
, _aasDryRun :: !(Maybe Bool)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
associateAddress
:: AssociateAddress
associateAddress =
AssociateAddress'
{ _aasInstanceId = Nothing
, _aasAllocationId = Nothing
, _aasNetworkInterfaceId = Nothing
, _aasAllowReassociation = Nothing
, _aasPrivateIPAddress = Nothing
, _aasPublicIP = Nothing
, _aasDryRun = Nothing
}
aasInstanceId :: Lens' AssociateAddress (Maybe Text)
aasInstanceId = lens _aasInstanceId (\ s a -> s{_aasInstanceId = a});
aasAllocationId :: Lens' AssociateAddress (Maybe Text)
aasAllocationId = lens _aasAllocationId (\ s a -> s{_aasAllocationId = a});
aasNetworkInterfaceId :: Lens' AssociateAddress (Maybe Text)
aasNetworkInterfaceId = lens _aasNetworkInterfaceId (\ s a -> s{_aasNetworkInterfaceId = a});
aasAllowReassociation :: Lens' AssociateAddress (Maybe Bool)
aasAllowReassociation = lens _aasAllowReassociation (\ s a -> s{_aasAllowReassociation = a});
aasPrivateIPAddress :: Lens' AssociateAddress (Maybe Text)
aasPrivateIPAddress = lens _aasPrivateIPAddress (\ s a -> s{_aasPrivateIPAddress = a});
aasPublicIP :: Lens' AssociateAddress (Maybe Text)
aasPublicIP = lens _aasPublicIP (\ s a -> s{_aasPublicIP = a});
aasDryRun :: Lens' AssociateAddress (Maybe Bool)
aasDryRun = lens _aasDryRun (\ s a -> s{_aasDryRun = a});
instance AWSRequest AssociateAddress where
type Rs AssociateAddress = AssociateAddressResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
AssociateAddressResponse' <$>
(x .@? "associationId") <*> (pure (fromEnum s)))
instance Hashable AssociateAddress
instance NFData AssociateAddress
instance ToHeaders AssociateAddress where
toHeaders = const mempty
instance ToPath AssociateAddress where
toPath = const "/"
instance ToQuery AssociateAddress where
toQuery AssociateAddress'{..}
= mconcat
["Action" =: ("AssociateAddress" :: ByteString),
"Version" =: ("2016-04-01" :: ByteString),
"InstanceId" =: _aasInstanceId,
"AllocationId" =: _aasAllocationId,
"NetworkInterfaceId" =: _aasNetworkInterfaceId,
"AllowReassociation" =: _aasAllowReassociation,
"PrivateIpAddress" =: _aasPrivateIPAddress,
"PublicIp" =: _aasPublicIP, "DryRun" =: _aasDryRun]
data AssociateAddressResponse = AssociateAddressResponse'
{ _arsAssociationId :: !(Maybe Text)
, _arsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
associateAddressResponse
:: Int
-> AssociateAddressResponse
associateAddressResponse pResponseStatus_ =
AssociateAddressResponse'
{ _arsAssociationId = Nothing
, _arsResponseStatus = pResponseStatus_
}
arsAssociationId :: Lens' AssociateAddressResponse (Maybe Text)
arsAssociationId = lens _arsAssociationId (\ s a -> s{_arsAssociationId = a});
arsResponseStatus :: Lens' AssociateAddressResponse Int
arsResponseStatus = lens _arsResponseStatus (\ s a -> s{_arsResponseStatus = a});
instance NFData AssociateAddressResponse