{-# 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
, ccLocation
, ccBandwidth
, ccConnectionName
, connection
, Connection
, cVlan
, cLocation
, 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'
{ _ccLocation :: !Text
, _ccBandwidth :: !Text
, _ccConnectionName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createConnection
:: Text
-> Text
-> Text
-> CreateConnection
createConnection pLocation_ pBandwidth_ pConnectionName_ =
CreateConnection'
{ _ccLocation = pLocation_
, _ccBandwidth = pBandwidth_
, _ccConnectionName = pConnectionName_
}
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
instance NFData CreateConnection
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
[Just ("location" .= _ccLocation),
Just ("bandwidth" .= _ccBandwidth),
Just ("connectionName" .= _ccConnectionName)])
instance ToPath CreateConnection where
toPath = const "/"
instance ToQuery CreateConnection where
toQuery = const mempty