amazonka-ec2-1.4.4: gen/Network/AWS/EC2/CreateVPNGateway.hs
{-# 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.CreateVPNGateway
-- Copyright : (c) 2013-2016 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a virtual private gateway. A virtual private gateway is the endpoint on the VPC side of your VPN connection. You can create a virtual private gateway before creating the VPC itself.
--
-- For more information about virtual private gateways, see <http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html Adding a Hardware Virtual Private Gateway to Your VPC> in the /Amazon Virtual Private Cloud User Guide/.
module Network.AWS.EC2.CreateVPNGateway
(
-- * Creating a Request
createVPNGateway
, CreateVPNGateway
-- * Request Lenses
, cvgAvailabilityZone
, cvgDryRun
, cvgType
-- * Destructuring the Response
, createVPNGatewayResponse
, CreateVPNGatewayResponse
-- * Response Lenses
, 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
-- | Contains the parameters for CreateVpnGateway.
--
-- /See:/ 'createVPNGateway' smart constructor.
data CreateVPNGateway = CreateVPNGateway'
{ _cvgAvailabilityZone :: !(Maybe Text)
, _cvgDryRun :: !(Maybe Bool)
, _cvgType :: !GatewayType
} deriving (Eq,Read,Show,Data,Typeable,Generic)
-- | Creates a value of 'CreateVPNGateway' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cvgAvailabilityZone'
--
-- * 'cvgDryRun'
--
-- * 'cvgType'
createVPNGateway
:: GatewayType -- ^ 'cvgType'
-> CreateVPNGateway
createVPNGateway pType_ =
CreateVPNGateway'
{ _cvgAvailabilityZone = Nothing
, _cvgDryRun = Nothing
, _cvgType = pType_
}
-- | The Availability Zone for the virtual private gateway.
cvgAvailabilityZone :: Lens' CreateVPNGateway (Maybe Text)
cvgAvailabilityZone = lens _cvgAvailabilityZone (\ s a -> s{_cvgAvailabilityZone = 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'.
cvgDryRun :: Lens' CreateVPNGateway (Maybe Bool)
cvgDryRun = lens _cvgDryRun (\ s a -> s{_cvgDryRun = a});
-- | The type of VPN connection this virtual private gateway supports.
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
instance NFData CreateVPNGateway
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-04-01" :: ByteString),
"AvailabilityZone" =: _cvgAvailabilityZone,
"DryRun" =: _cvgDryRun, "Type" =: _cvgType]
-- | Contains the output of CreateVpnGateway.
--
-- /See:/ 'createVPNGatewayResponse' smart constructor.
data CreateVPNGatewayResponse = CreateVPNGatewayResponse'
{ _cvgrsVPNGateway :: !(Maybe VPNGateway)
, _cvgrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
-- | Creates a value of 'CreateVPNGatewayResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cvgrsVPNGateway'
--
-- * 'cvgrsResponseStatus'
createVPNGatewayResponse
:: Int -- ^ 'cvgrsResponseStatus'
-> CreateVPNGatewayResponse
createVPNGatewayResponse pResponseStatus_ =
CreateVPNGatewayResponse'
{ _cvgrsVPNGateway = Nothing
, _cvgrsResponseStatus = pResponseStatus_
}
-- | Information about the virtual private gateway.
cvgrsVPNGateway :: Lens' CreateVPNGatewayResponse (Maybe VPNGateway)
cvgrsVPNGateway = lens _cvgrsVPNGateway (\ s a -> s{_cvgrsVPNGateway = a});
-- | The response status code.
cvgrsResponseStatus :: Lens' CreateVPNGatewayResponse Int
cvgrsResponseStatus = lens _cvgrsResponseStatus (\ s a -> s{_cvgrsResponseStatus = a});
instance NFData CreateVPNGatewayResponse