{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.DirectConnect.AssociateHostedConnection
(
AssociateHostedConnection (..),
newAssociateHostedConnection,
associateHostedConnection_connectionId,
associateHostedConnection_parentConnectionId,
Connection (..),
newConnection,
connection_lagId,
connection_macSecCapable,
connection_portEncryptionStatus,
connection_vlan,
connection_location,
connection_awsDevice,
connection_hasLogicalRedundancy,
connection_connectionId,
connection_awsLogicalDeviceId,
connection_loaIssueTime,
connection_partnerName,
connection_connectionName,
connection_encryptionMode,
connection_bandwidth,
connection_jumboFrameCapable,
connection_ownerAccount,
connection_region,
connection_macSecKeys,
connection_providerName,
connection_awsDeviceV2,
connection_connectionState,
connection_tags,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DirectConnect.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AssociateHostedConnection = AssociateHostedConnection'
{
AssociateHostedConnection -> Text
connectionId :: Prelude.Text,
AssociateHostedConnection -> Text
parentConnectionId :: Prelude.Text
}
deriving (AssociateHostedConnection -> AssociateHostedConnection -> Bool
(AssociateHostedConnection -> AssociateHostedConnection -> Bool)
-> (AssociateHostedConnection -> AssociateHostedConnection -> Bool)
-> Eq AssociateHostedConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateHostedConnection -> AssociateHostedConnection -> Bool
$c/= :: AssociateHostedConnection -> AssociateHostedConnection -> Bool
== :: AssociateHostedConnection -> AssociateHostedConnection -> Bool
$c== :: AssociateHostedConnection -> AssociateHostedConnection -> Bool
Prelude.Eq, ReadPrec [AssociateHostedConnection]
ReadPrec AssociateHostedConnection
Int -> ReadS AssociateHostedConnection
ReadS [AssociateHostedConnection]
(Int -> ReadS AssociateHostedConnection)
-> ReadS [AssociateHostedConnection]
-> ReadPrec AssociateHostedConnection
-> ReadPrec [AssociateHostedConnection]
-> Read AssociateHostedConnection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateHostedConnection]
$creadListPrec :: ReadPrec [AssociateHostedConnection]
readPrec :: ReadPrec AssociateHostedConnection
$creadPrec :: ReadPrec AssociateHostedConnection
readList :: ReadS [AssociateHostedConnection]
$creadList :: ReadS [AssociateHostedConnection]
readsPrec :: Int -> ReadS AssociateHostedConnection
$creadsPrec :: Int -> ReadS AssociateHostedConnection
Prelude.Read, Int -> AssociateHostedConnection -> ShowS
[AssociateHostedConnection] -> ShowS
AssociateHostedConnection -> String
(Int -> AssociateHostedConnection -> ShowS)
-> (AssociateHostedConnection -> String)
-> ([AssociateHostedConnection] -> ShowS)
-> Show AssociateHostedConnection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateHostedConnection] -> ShowS
$cshowList :: [AssociateHostedConnection] -> ShowS
show :: AssociateHostedConnection -> String
$cshow :: AssociateHostedConnection -> String
showsPrec :: Int -> AssociateHostedConnection -> ShowS
$cshowsPrec :: Int -> AssociateHostedConnection -> ShowS
Prelude.Show, (forall x.
AssociateHostedConnection -> Rep AssociateHostedConnection x)
-> (forall x.
Rep AssociateHostedConnection x -> AssociateHostedConnection)
-> Generic AssociateHostedConnection
forall x.
Rep AssociateHostedConnection x -> AssociateHostedConnection
forall x.
AssociateHostedConnection -> Rep AssociateHostedConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateHostedConnection x -> AssociateHostedConnection
$cfrom :: forall x.
AssociateHostedConnection -> Rep AssociateHostedConnection x
Prelude.Generic)
newAssociateHostedConnection ::
Prelude.Text ->
Prelude.Text ->
AssociateHostedConnection
newAssociateHostedConnection :: Text -> Text -> AssociateHostedConnection
newAssociateHostedConnection
Text
pConnectionId_
Text
pParentConnectionId_ =
AssociateHostedConnection' :: Text -> Text -> AssociateHostedConnection
AssociateHostedConnection'
{ $sel:connectionId:AssociateHostedConnection' :: Text
connectionId =
Text
pConnectionId_,
$sel:parentConnectionId:AssociateHostedConnection' :: Text
parentConnectionId = Text
pParentConnectionId_
}
associateHostedConnection_connectionId :: Lens.Lens' AssociateHostedConnection Prelude.Text
associateHostedConnection_connectionId :: (Text -> f Text)
-> AssociateHostedConnection -> f AssociateHostedConnection
associateHostedConnection_connectionId = (AssociateHostedConnection -> Text)
-> (AssociateHostedConnection -> Text -> AssociateHostedConnection)
-> Lens
AssociateHostedConnection AssociateHostedConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateHostedConnection' {Text
connectionId :: Text
$sel:connectionId:AssociateHostedConnection' :: AssociateHostedConnection -> Text
connectionId} -> Text
connectionId) (\s :: AssociateHostedConnection
s@AssociateHostedConnection' {} Text
a -> AssociateHostedConnection
s {$sel:connectionId:AssociateHostedConnection' :: Text
connectionId = Text
a} :: AssociateHostedConnection)
associateHostedConnection_parentConnectionId :: Lens.Lens' AssociateHostedConnection Prelude.Text
associateHostedConnection_parentConnectionId :: (Text -> f Text)
-> AssociateHostedConnection -> f AssociateHostedConnection
associateHostedConnection_parentConnectionId = (AssociateHostedConnection -> Text)
-> (AssociateHostedConnection -> Text -> AssociateHostedConnection)
-> Lens
AssociateHostedConnection AssociateHostedConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateHostedConnection' {Text
parentConnectionId :: Text
$sel:parentConnectionId:AssociateHostedConnection' :: AssociateHostedConnection -> Text
parentConnectionId} -> Text
parentConnectionId) (\s :: AssociateHostedConnection
s@AssociateHostedConnection' {} Text
a -> AssociateHostedConnection
s {$sel:parentConnectionId:AssociateHostedConnection' :: Text
parentConnectionId = Text
a} :: AssociateHostedConnection)
instance Core.AWSRequest AssociateHostedConnection where
type
AWSResponse AssociateHostedConnection =
Connection
request :: AssociateHostedConnection -> Request AssociateHostedConnection
request = Service
-> AssociateHostedConnection -> Request AssociateHostedConnection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateHostedConnection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateHostedConnection)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AssociateHostedConnection))
-> Logger
-> Service
-> Proxy AssociateHostedConnection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateHostedConnection)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
(\Int
s ResponseHeaders
h Object
x -> Object -> Either String Connection
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable AssociateHostedConnection
instance Prelude.NFData AssociateHostedConnection
instance Core.ToHeaders AssociateHostedConnection where
toHeaders :: AssociateHostedConnection -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateHostedConnection -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"OvertureService.AssociateHostedConnection" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON AssociateHostedConnection where
toJSON :: AssociateHostedConnection -> Value
toJSON AssociateHostedConnection' {Text
parentConnectionId :: Text
connectionId :: Text
$sel:parentConnectionId:AssociateHostedConnection' :: AssociateHostedConnection -> Text
$sel:connectionId:AssociateHostedConnection' :: AssociateHostedConnection -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"connectionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
connectionId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"parentConnectionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
parentConnectionId)
]
)
instance Core.ToPath AssociateHostedConnection where
toPath :: AssociateHostedConnection -> ByteString
toPath = ByteString -> AssociateHostedConnection -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AssociateHostedConnection where
toQuery :: AssociateHostedConnection -> QueryString
toQuery = QueryString -> AssociateHostedConnection -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty