module Network.AWS.DirectConnect.CreateConnection
(
CreateConnection
, createConnection
, ccBandwidth
, ccConnectionName
, ccLocation
, CreateConnectionResponse
, createConnectionResponse
, ccrBandwidth
, ccrConnectionId
, ccrConnectionName
, ccrConnectionState
, ccrLocation
, ccrOwnerAccount
, ccrPartnerName
, ccrRegion
, ccrVlan
) where
import Network.AWS.Data (Object)
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.DirectConnect.Types
import qualified GHC.Exts
data CreateConnection = CreateConnection
{ _ccBandwidth :: Text
, _ccConnectionName :: Text
, _ccLocation :: Text
} deriving (Eq, Ord, Read, Show)
createConnection :: Text
-> Text
-> Text
-> CreateConnection
createConnection p1 p2 p3 = CreateConnection
{ _ccLocation = p1
, _ccBandwidth = p2
, _ccConnectionName = p3
}
ccBandwidth :: Lens' CreateConnection Text
ccBandwidth = lens _ccBandwidth (\s a -> s { _ccBandwidth = a })
ccConnectionName :: Lens' CreateConnection Text
ccConnectionName = lens _ccConnectionName (\s a -> s { _ccConnectionName = a })
ccLocation :: Lens' CreateConnection Text
ccLocation = lens _ccLocation (\s a -> s { _ccLocation = a })
data CreateConnectionResponse = CreateConnectionResponse
{ _ccrBandwidth :: Maybe Text
, _ccrConnectionId :: Maybe Text
, _ccrConnectionName :: Maybe Text
, _ccrConnectionState :: Maybe ConnectionState
, _ccrLocation :: Maybe Text
, _ccrOwnerAccount :: Maybe Text
, _ccrPartnerName :: Maybe Text
, _ccrRegion :: Maybe Text
, _ccrVlan :: Maybe Int
} deriving (Eq, Read, Show)
createConnectionResponse :: CreateConnectionResponse
createConnectionResponse = CreateConnectionResponse
{ _ccrOwnerAccount = Nothing
, _ccrConnectionId = Nothing
, _ccrConnectionName = Nothing
, _ccrConnectionState = Nothing
, _ccrRegion = Nothing
, _ccrLocation = Nothing
, _ccrBandwidth = Nothing
, _ccrVlan = Nothing
, _ccrPartnerName = Nothing
}
ccrBandwidth :: Lens' CreateConnectionResponse (Maybe Text)
ccrBandwidth = lens _ccrBandwidth (\s a -> s { _ccrBandwidth = a })
ccrConnectionId :: Lens' CreateConnectionResponse (Maybe Text)
ccrConnectionId = lens _ccrConnectionId (\s a -> s { _ccrConnectionId = a })
ccrConnectionName :: Lens' CreateConnectionResponse (Maybe Text)
ccrConnectionName =
lens _ccrConnectionName (\s a -> s { _ccrConnectionName = a })
ccrConnectionState :: Lens' CreateConnectionResponse (Maybe ConnectionState)
ccrConnectionState =
lens _ccrConnectionState (\s a -> s { _ccrConnectionState = a })
ccrLocation :: Lens' CreateConnectionResponse (Maybe Text)
ccrLocation = lens _ccrLocation (\s a -> s { _ccrLocation = a })
ccrOwnerAccount :: Lens' CreateConnectionResponse (Maybe Text)
ccrOwnerAccount = lens _ccrOwnerAccount (\s a -> s { _ccrOwnerAccount = a })
ccrPartnerName :: Lens' CreateConnectionResponse (Maybe Text)
ccrPartnerName = lens _ccrPartnerName (\s a -> s { _ccrPartnerName = a })
ccrRegion :: Lens' CreateConnectionResponse (Maybe Text)
ccrRegion = lens _ccrRegion (\s a -> s { _ccrRegion = a })
ccrVlan :: Lens' CreateConnectionResponse (Maybe Int)
ccrVlan = lens _ccrVlan (\s a -> s { _ccrVlan = a })
instance ToPath CreateConnection where
toPath = const "/"
instance ToQuery CreateConnection where
toQuery = const mempty
instance ToHeaders CreateConnection
instance ToJSON CreateConnection where
toJSON CreateConnection{..} = object
[ "location" .= _ccLocation
, "bandwidth" .= _ccBandwidth
, "connectionName" .= _ccConnectionName
]
instance AWSRequest CreateConnection where
type Sv CreateConnection = DirectConnect
type Rs CreateConnection = CreateConnectionResponse
request = post "CreateConnection"
response = jsonResponse
instance FromJSON CreateConnectionResponse where
parseJSON = withObject "CreateConnectionResponse" $ \o -> CreateConnectionResponse
<$> o .:? "bandwidth"
<*> o .:? "connectionId"
<*> o .:? "connectionName"
<*> o .:? "connectionState"
<*> o .:? "location"
<*> o .:? "ownerAccount"
<*> o .:? "partnerName"
<*> o .:? "region"
<*> o .:? "vlan"