{-# 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.CreateVPNConnection
(
createVPNConnection
, CreateVPNConnection
, cvcOptions
, cvcDryRun
, cvcCustomerGatewayId
, cvcType
, cvcVPNGatewayId
, createVPNConnectionResponse
, CreateVPNConnectionResponse
, cvcrsVPNConnection
, cvcrsResponseStatus
) 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 CreateVPNConnection = CreateVPNConnection'
{ _cvcOptions :: !(Maybe VPNConnectionOptionsSpecification)
, _cvcDryRun :: !(Maybe Bool)
, _cvcCustomerGatewayId :: !Text
, _cvcType :: !Text
, _cvcVPNGatewayId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createVPNConnection
:: Text
-> Text
-> Text
-> CreateVPNConnection
createVPNConnection pCustomerGatewayId_ pType_ pVPNGatewayId_ =
CreateVPNConnection'
{ _cvcOptions = Nothing
, _cvcDryRun = Nothing
, _cvcCustomerGatewayId = pCustomerGatewayId_
, _cvcType = pType_
, _cvcVPNGatewayId = pVPNGatewayId_
}
cvcOptions :: Lens' CreateVPNConnection (Maybe VPNConnectionOptionsSpecification)
cvcOptions = lens _cvcOptions (\ s a -> s{_cvcOptions = a})
cvcDryRun :: Lens' CreateVPNConnection (Maybe Bool)
cvcDryRun = lens _cvcDryRun (\ s a -> s{_cvcDryRun = a})
cvcCustomerGatewayId :: Lens' CreateVPNConnection Text
cvcCustomerGatewayId = lens _cvcCustomerGatewayId (\ s a -> s{_cvcCustomerGatewayId = a})
cvcType :: Lens' CreateVPNConnection Text
cvcType = lens _cvcType (\ s a -> s{_cvcType = a})
cvcVPNGatewayId :: Lens' CreateVPNConnection Text
cvcVPNGatewayId = lens _cvcVPNGatewayId (\ s a -> s{_cvcVPNGatewayId = a})
instance AWSRequest CreateVPNConnection where
type Rs CreateVPNConnection =
CreateVPNConnectionResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
CreateVPNConnectionResponse' <$>
(x .@? "vpnConnection") <*> (pure (fromEnum s)))
instance Hashable CreateVPNConnection where
instance NFData CreateVPNConnection where
instance ToHeaders CreateVPNConnection where
toHeaders = const mempty
instance ToPath CreateVPNConnection where
toPath = const "/"
instance ToQuery CreateVPNConnection where
toQuery CreateVPNConnection'{..}
= mconcat
["Action" =: ("CreateVpnConnection" :: ByteString),
"Version" =: ("2016-11-15" :: ByteString),
"Options" =: _cvcOptions, "DryRun" =: _cvcDryRun,
"CustomerGatewayId" =: _cvcCustomerGatewayId,
"Type" =: _cvcType,
"VpnGatewayId" =: _cvcVPNGatewayId]
data CreateVPNConnectionResponse = CreateVPNConnectionResponse'
{ _cvcrsVPNConnection :: !(Maybe VPNConnection)
, _cvcrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createVPNConnectionResponse
:: Int
-> CreateVPNConnectionResponse
createVPNConnectionResponse pResponseStatus_ =
CreateVPNConnectionResponse'
{_cvcrsVPNConnection = Nothing, _cvcrsResponseStatus = pResponseStatus_}
cvcrsVPNConnection :: Lens' CreateVPNConnectionResponse (Maybe VPNConnection)
cvcrsVPNConnection = lens _cvcrsVPNConnection (\ s a -> s{_cvcrsVPNConnection = a})
cvcrsResponseStatus :: Lens' CreateVPNConnectionResponse Int
cvcrsResponseStatus = lens _cvcrsResponseStatus (\ s a -> s{_cvcrsResponseStatus = a})
instance NFData CreateVPNConnectionResponse where