{-# 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 #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Network.AWS.EC2.AllocateAddress -- Copyright : (c) 2013-2016 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Acquires an Elastic IP address. -- -- An Elastic IP address is for use either in the EC2-Classic platform or in a VPC. For more information, see in the /Amazon Elastic Compute Cloud User Guide/. module Network.AWS.EC2.AllocateAddress ( -- * Creating a Request allocateAddress , AllocateAddress -- * Request Lenses , aaDomain , aaDryRun -- * Destructuring the Response , allocateAddressResponse , AllocateAddressResponse -- * Response Lenses , 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 -- | Contains the parameters for AllocateAddress. -- -- /See:/ 'allocateAddress' smart constructor. data AllocateAddress = AllocateAddress' { _aaDomain :: !(Maybe DomainType) , _aaDryRun :: !(Maybe Bool) } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'AllocateAddress' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'aaDomain' -- -- * 'aaDryRun' allocateAddress :: AllocateAddress allocateAddress = AllocateAddress' { _aaDomain = Nothing , _aaDryRun = Nothing } -- | Set to 'vpc' to allocate the address for use with instances in a VPC. -- -- Default: The address is for use with instances in EC2-Classic. aaDomain :: Lens' AllocateAddress (Maybe DomainType) aaDomain = lens _aaDomain (\ s a -> s{_aaDomain = a}); -- | Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is 'DryRunOperation'. Otherwise, it is 'UnauthorizedOperation'. 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 NFData 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] -- | Contains the output of AllocateAddress. -- -- /See:/ 'allocateAddressResponse' smart constructor. data AllocateAddressResponse = AllocateAddressResponse' { _aarsAllocationId :: !(Maybe Text) , _aarsDomain :: !(Maybe DomainType) , _aarsPublicIP :: !(Maybe Text) , _aarsResponseStatus :: !Int } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'AllocateAddressResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'aarsAllocationId' -- -- * 'aarsDomain' -- -- * 'aarsPublicIP' -- -- * 'aarsResponseStatus' allocateAddressResponse :: Int -- ^ 'aarsResponseStatus' -> AllocateAddressResponse allocateAddressResponse pResponseStatus_ = AllocateAddressResponse' { _aarsAllocationId = Nothing , _aarsDomain = Nothing , _aarsPublicIP = Nothing , _aarsResponseStatus = pResponseStatus_ } -- | [EC2-VPC] The ID that AWS assigns to represent the allocation of the Elastic IP address for use with instances in a VPC. aarsAllocationId :: Lens' AllocateAddressResponse (Maybe Text) aarsAllocationId = lens _aarsAllocationId (\ s a -> s{_aarsAllocationId = a}); -- | Indicates whether this Elastic IP address is for use with instances in EC2-Classic ('standard') or instances in a VPC ('vpc'). aarsDomain :: Lens' AllocateAddressResponse (Maybe DomainType) aarsDomain = lens _aarsDomain (\ s a -> s{_aarsDomain = a}); -- | The Elastic IP address. aarsPublicIP :: Lens' AllocateAddressResponse (Maybe Text) aarsPublicIP = lens _aarsPublicIP (\ s a -> s{_aarsPublicIP = a}); -- | The response status code. aarsResponseStatus :: Lens' AllocateAddressResponse Int aarsResponseStatus = lens _aarsResponseStatus (\ s a -> s{_aarsResponseStatus = a}); instance NFData AllocateAddressResponse