{-# 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.DirectConnect.CreateDirectConnectGatewayAssociation
(
createDirectConnectGatewayAssociation
, CreateDirectConnectGatewayAssociation
, cdcgaDirectConnectGatewayId
, cdcgaVirtualGatewayId
, createDirectConnectGatewayAssociationResponse
, CreateDirectConnectGatewayAssociationResponse
, cdcgarsDirectConnectGatewayAssociation
, cdcgarsResponseStatus
) where
import Network.AWS.DirectConnect.Types
import Network.AWS.DirectConnect.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateDirectConnectGatewayAssociation = CreateDirectConnectGatewayAssociation'
{ _cdcgaDirectConnectGatewayId :: !Text
, _cdcgaVirtualGatewayId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createDirectConnectGatewayAssociation
:: Text
-> Text
-> CreateDirectConnectGatewayAssociation
createDirectConnectGatewayAssociation pDirectConnectGatewayId_ pVirtualGatewayId_ =
CreateDirectConnectGatewayAssociation'
{ _cdcgaDirectConnectGatewayId = pDirectConnectGatewayId_
, _cdcgaVirtualGatewayId = pVirtualGatewayId_
}
cdcgaDirectConnectGatewayId :: Lens' CreateDirectConnectGatewayAssociation Text
cdcgaDirectConnectGatewayId = lens _cdcgaDirectConnectGatewayId (\ s a -> s{_cdcgaDirectConnectGatewayId = a})
cdcgaVirtualGatewayId :: Lens' CreateDirectConnectGatewayAssociation Text
cdcgaVirtualGatewayId = lens _cdcgaVirtualGatewayId (\ s a -> s{_cdcgaVirtualGatewayId = a})
instance AWSRequest
CreateDirectConnectGatewayAssociation
where
type Rs CreateDirectConnectGatewayAssociation =
CreateDirectConnectGatewayAssociationResponse
request = postJSON directConnect
response
= receiveJSON
(\ s h x ->
CreateDirectConnectGatewayAssociationResponse' <$>
(x .?> "directConnectGatewayAssociation") <*>
(pure (fromEnum s)))
instance Hashable
CreateDirectConnectGatewayAssociation
where
instance NFData CreateDirectConnectGatewayAssociation
where
instance ToHeaders
CreateDirectConnectGatewayAssociation
where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("OvertureService.CreateDirectConnectGatewayAssociation"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateDirectConnectGatewayAssociation
where
toJSON CreateDirectConnectGatewayAssociation'{..}
= object
(catMaybes
[Just
("directConnectGatewayId" .=
_cdcgaDirectConnectGatewayId),
Just ("virtualGatewayId" .= _cdcgaVirtualGatewayId)])
instance ToPath CreateDirectConnectGatewayAssociation
where
toPath = const "/"
instance ToQuery
CreateDirectConnectGatewayAssociation
where
toQuery = const mempty
data CreateDirectConnectGatewayAssociationResponse = CreateDirectConnectGatewayAssociationResponse'
{ _cdcgarsDirectConnectGatewayAssociation :: !(Maybe DirectConnectGatewayAssociation)
, _cdcgarsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createDirectConnectGatewayAssociationResponse
:: Int
-> CreateDirectConnectGatewayAssociationResponse
createDirectConnectGatewayAssociationResponse pResponseStatus_ =
CreateDirectConnectGatewayAssociationResponse'
{ _cdcgarsDirectConnectGatewayAssociation = Nothing
, _cdcgarsResponseStatus = pResponseStatus_
}
cdcgarsDirectConnectGatewayAssociation :: Lens' CreateDirectConnectGatewayAssociationResponse (Maybe DirectConnectGatewayAssociation)
cdcgarsDirectConnectGatewayAssociation = lens _cdcgarsDirectConnectGatewayAssociation (\ s a -> s{_cdcgarsDirectConnectGatewayAssociation = a})
cdcgarsResponseStatus :: Lens' CreateDirectConnectGatewayAssociationResponse Int
cdcgarsResponseStatus = lens _cdcgarsResponseStatus (\ s a -> s{_cdcgarsResponseStatus = a})
instance NFData
CreateDirectConnectGatewayAssociationResponse
where