{-# 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
, cvcType
, cvcCustomerGatewayId
, 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)
, _cvcType :: !Text
, _cvcCustomerGatewayId :: !Text
, _cvcVPNGatewayId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createVPNConnection
:: Text
-> Text
-> Text
-> CreateVPNConnection
createVPNConnection pType_ pCustomerGatewayId_ pVPNGatewayId_ =
CreateVPNConnection'
{ _cvcOptions = Nothing
, _cvcDryRun = Nothing
, _cvcType = pType_
, _cvcCustomerGatewayId = pCustomerGatewayId_
, _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});
cvcType :: Lens' CreateVPNConnection Text
cvcType = lens _cvcType (\ s a -> s{_cvcType = a});
cvcCustomerGatewayId :: Lens' CreateVPNConnection Text
cvcCustomerGatewayId = lens _cvcCustomerGatewayId (\ s a -> s{_cvcCustomerGatewayId = 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
instance NFData CreateVPNConnection
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-04-01" :: ByteString),
"Options" =: _cvcOptions, "DryRun" =: _cvcDryRun,
"Type" =: _cvcType,
"CustomerGatewayId" =: _cvcCustomerGatewayId,
"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