{-# 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.CreateNatGateway
(
createNatGateway
, CreateNatGateway
, cngClientToken
, cngSubnetId
, cngAllocationId
, createNatGatewayResponse
, CreateNatGatewayResponse
, cngrsClientToken
, cngrsNatGateway
, cngrsResponseStatus
) 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 CreateNatGateway = CreateNatGateway'
{ _cngClientToken :: !(Maybe Text)
, _cngSubnetId :: !Text
, _cngAllocationId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createNatGateway
:: Text
-> Text
-> CreateNatGateway
createNatGateway pSubnetId_ pAllocationId_ =
CreateNatGateway'
{ _cngClientToken = Nothing
, _cngSubnetId = pSubnetId_
, _cngAllocationId = pAllocationId_
}
cngClientToken :: Lens' CreateNatGateway (Maybe Text)
cngClientToken = lens _cngClientToken (\ s a -> s{_cngClientToken = a});
cngSubnetId :: Lens' CreateNatGateway Text
cngSubnetId = lens _cngSubnetId (\ s a -> s{_cngSubnetId = a});
cngAllocationId :: Lens' CreateNatGateway Text
cngAllocationId = lens _cngAllocationId (\ s a -> s{_cngAllocationId = a});
instance AWSRequest CreateNatGateway where
type Rs CreateNatGateway = CreateNatGatewayResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
CreateNatGatewayResponse' <$>
(x .@? "clientToken") <*> (x .@? "natGateway") <*>
(pure (fromEnum s)))
instance Hashable CreateNatGateway
instance NFData CreateNatGateway
instance ToHeaders CreateNatGateway where
toHeaders = const mempty
instance ToPath CreateNatGateway where
toPath = const "/"
instance ToQuery CreateNatGateway where
toQuery CreateNatGateway'{..}
= mconcat
["Action" =: ("CreateNatGateway" :: ByteString),
"Version" =: ("2016-04-01" :: ByteString),
"ClientToken" =: _cngClientToken,
"SubnetId" =: _cngSubnetId,
"AllocationId" =: _cngAllocationId]
data CreateNatGatewayResponse = CreateNatGatewayResponse'
{ _cngrsClientToken :: !(Maybe Text)
, _cngrsNatGateway :: !(Maybe NatGateway)
, _cngrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createNatGatewayResponse
:: Int
-> CreateNatGatewayResponse
createNatGatewayResponse pResponseStatus_ =
CreateNatGatewayResponse'
{ _cngrsClientToken = Nothing
, _cngrsNatGateway = Nothing
, _cngrsResponseStatus = pResponseStatus_
}
cngrsClientToken :: Lens' CreateNatGatewayResponse (Maybe Text)
cngrsClientToken = lens _cngrsClientToken (\ s a -> s{_cngrsClientToken = a});
cngrsNatGateway :: Lens' CreateNatGatewayResponse (Maybe NatGateway)
cngrsNatGateway = lens _cngrsNatGateway (\ s a -> s{_cngrsNatGateway = a});
cngrsResponseStatus :: Lens' CreateNatGatewayResponse Int
cngrsResponseStatus = lens _cngrsResponseStatus (\ s a -> s{_cngrsResponseStatus = a});
instance NFData CreateNatGatewayResponse