{-# 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.CreateVPNGateway
(
createVPNGateway
, CreateVPNGateway
, cvgAmazonSideASN
, cvgAvailabilityZone
, cvgDryRun
, cvgType
, createVPNGatewayResponse
, CreateVPNGatewayResponse
, cvgrsVPNGateway
, cvgrsResponseStatus
) 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 CreateVPNGateway = CreateVPNGateway'
{ _cvgAmazonSideASN :: !(Maybe Integer)
, _cvgAvailabilityZone :: !(Maybe Text)
, _cvgDryRun :: !(Maybe Bool)
, _cvgType :: !GatewayType
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createVPNGateway
:: GatewayType
-> CreateVPNGateway
createVPNGateway pType_ =
CreateVPNGateway'
{ _cvgAmazonSideASN = Nothing
, _cvgAvailabilityZone = Nothing
, _cvgDryRun = Nothing
, _cvgType = pType_
}
cvgAmazonSideASN :: Lens' CreateVPNGateway (Maybe Integer)
cvgAmazonSideASN = lens _cvgAmazonSideASN (\ s a -> s{_cvgAmazonSideASN = a})
cvgAvailabilityZone :: Lens' CreateVPNGateway (Maybe Text)
cvgAvailabilityZone = lens _cvgAvailabilityZone (\ s a -> s{_cvgAvailabilityZone = a})
cvgDryRun :: Lens' CreateVPNGateway (Maybe Bool)
cvgDryRun = lens _cvgDryRun (\ s a -> s{_cvgDryRun = a})
cvgType :: Lens' CreateVPNGateway GatewayType
cvgType = lens _cvgType (\ s a -> s{_cvgType = a})
instance AWSRequest CreateVPNGateway where
type Rs CreateVPNGateway = CreateVPNGatewayResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
CreateVPNGatewayResponse' <$>
(x .@? "vpnGateway") <*> (pure (fromEnum s)))
instance Hashable CreateVPNGateway where
instance NFData CreateVPNGateway where
instance ToHeaders CreateVPNGateway where
toHeaders = const mempty
instance ToPath CreateVPNGateway where
toPath = const "/"
instance ToQuery CreateVPNGateway where
toQuery CreateVPNGateway'{..}
= mconcat
["Action" =: ("CreateVpnGateway" :: ByteString),
"Version" =: ("2016-11-15" :: ByteString),
"AmazonSideAsn" =: _cvgAmazonSideASN,
"AvailabilityZone" =: _cvgAvailabilityZone,
"DryRun" =: _cvgDryRun, "Type" =: _cvgType]
data CreateVPNGatewayResponse = CreateVPNGatewayResponse'
{ _cvgrsVPNGateway :: !(Maybe VPNGateway)
, _cvgrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createVPNGatewayResponse
:: Int
-> CreateVPNGatewayResponse
createVPNGatewayResponse pResponseStatus_ =
CreateVPNGatewayResponse'
{_cvgrsVPNGateway = Nothing, _cvgrsResponseStatus = pResponseStatus_}
cvgrsVPNGateway :: Lens' CreateVPNGatewayResponse (Maybe VPNGateway)
cvgrsVPNGateway = lens _cvgrsVPNGateway (\ s a -> s{_cvgrsVPNGateway = a})
cvgrsResponseStatus :: Lens' CreateVPNGatewayResponse Int
cvgrsResponseStatus = lens _cvgrsResponseStatus (\ s a -> s{_cvgrsResponseStatus = a})
instance NFData CreateVPNGatewayResponse where