{-# 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.CreateConnection
(
createConnection
, CreateConnection
, ccLagId
, ccLocation
, ccBandwidth
, ccConnectionName
, connection
, Connection
, cLagId
, cVlan
, cLocation
, cAwsDevice
, cConnectionId
, cLoaIssueTime
, cPartnerName
, cConnectionName
, cBandwidth
, cOwnerAccount
, cRegion
, cConnectionState
) 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 CreateConnection = CreateConnection'
{ _ccLagId :: !(Maybe Text)
, _ccLocation :: !Text
, _ccBandwidth :: !Text
, _ccConnectionName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createConnection
:: Text
-> Text
-> Text
-> CreateConnection
createConnection pLocation_ pBandwidth_ pConnectionName_ =
CreateConnection'
{ _ccLagId = Nothing
, _ccLocation = pLocation_
, _ccBandwidth = pBandwidth_
, _ccConnectionName = pConnectionName_
}
ccLagId :: Lens' CreateConnection (Maybe Text)
ccLagId = lens _ccLagId (\ s a -> s{_ccLagId = a})
ccLocation :: Lens' CreateConnection Text
ccLocation = lens _ccLocation (\ s a -> s{_ccLocation = a})
ccBandwidth :: Lens' CreateConnection Text
ccBandwidth = lens _ccBandwidth (\ s a -> s{_ccBandwidth = a})
ccConnectionName :: Lens' CreateConnection Text
ccConnectionName = lens _ccConnectionName (\ s a -> s{_ccConnectionName = a})
instance AWSRequest CreateConnection where
type Rs CreateConnection = Connection
request = postJSON directConnect
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable CreateConnection where
instance NFData CreateConnection where
instance ToHeaders CreateConnection where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("OvertureService.CreateConnection" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateConnection where
toJSON CreateConnection'{..}
= object
(catMaybes
[("lagId" .=) <$> _ccLagId,
Just ("location" .= _ccLocation),
Just ("bandwidth" .= _ccBandwidth),
Just ("connectionName" .= _ccConnectionName)])
instance ToPath CreateConnection where
toPath = const "/"
instance ToQuery CreateConnection where
toQuery = const mempty