{-# 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.UpdateConnection
(
UpdateConnection (..),
newUpdateConnection,
updateConnection_connectionName,
updateConnection_encryptionMode,
updateConnection_connectionId,
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 UpdateConnection = UpdateConnection'
{
UpdateConnection -> Maybe Text
connectionName :: Prelude.Maybe Prelude.Text,
UpdateConnection -> Maybe Text
encryptionMode :: Prelude.Maybe Prelude.Text,
UpdateConnection -> Text
connectionId :: Prelude.Text
}
deriving (UpdateConnection -> UpdateConnection -> Bool
(UpdateConnection -> UpdateConnection -> Bool)
-> (UpdateConnection -> UpdateConnection -> Bool)
-> Eq UpdateConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateConnection -> UpdateConnection -> Bool
$c/= :: UpdateConnection -> UpdateConnection -> Bool
== :: UpdateConnection -> UpdateConnection -> Bool
$c== :: UpdateConnection -> UpdateConnection -> Bool
Prelude.Eq, ReadPrec [UpdateConnection]
ReadPrec UpdateConnection
Int -> ReadS UpdateConnection
ReadS [UpdateConnection]
(Int -> ReadS UpdateConnection)
-> ReadS [UpdateConnection]
-> ReadPrec UpdateConnection
-> ReadPrec [UpdateConnection]
-> Read UpdateConnection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateConnection]
$creadListPrec :: ReadPrec [UpdateConnection]
readPrec :: ReadPrec UpdateConnection
$creadPrec :: ReadPrec UpdateConnection
readList :: ReadS [UpdateConnection]
$creadList :: ReadS [UpdateConnection]
readsPrec :: Int -> ReadS UpdateConnection
$creadsPrec :: Int -> ReadS UpdateConnection
Prelude.Read, Int -> UpdateConnection -> ShowS
[UpdateConnection] -> ShowS
UpdateConnection -> String
(Int -> UpdateConnection -> ShowS)
-> (UpdateConnection -> String)
-> ([UpdateConnection] -> ShowS)
-> Show UpdateConnection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateConnection] -> ShowS
$cshowList :: [UpdateConnection] -> ShowS
show :: UpdateConnection -> String
$cshow :: UpdateConnection -> String
showsPrec :: Int -> UpdateConnection -> ShowS
$cshowsPrec :: Int -> UpdateConnection -> ShowS
Prelude.Show, (forall x. UpdateConnection -> Rep UpdateConnection x)
-> (forall x. Rep UpdateConnection x -> UpdateConnection)
-> Generic UpdateConnection
forall x. Rep UpdateConnection x -> UpdateConnection
forall x. UpdateConnection -> Rep UpdateConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateConnection x -> UpdateConnection
$cfrom :: forall x. UpdateConnection -> Rep UpdateConnection x
Prelude.Generic)
newUpdateConnection ::
Prelude.Text ->
UpdateConnection
newUpdateConnection :: Text -> UpdateConnection
newUpdateConnection Text
pConnectionId_ =
UpdateConnection' :: Maybe Text -> Maybe Text -> Text -> UpdateConnection
UpdateConnection'
{ $sel:connectionName:UpdateConnection' :: Maybe Text
connectionName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:encryptionMode:UpdateConnection' :: Maybe Text
encryptionMode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:connectionId:UpdateConnection' :: Text
connectionId = Text
pConnectionId_
}
updateConnection_connectionName :: Lens.Lens' UpdateConnection (Prelude.Maybe Prelude.Text)
updateConnection_connectionName :: (Maybe Text -> f (Maybe Text))
-> UpdateConnection -> f UpdateConnection
updateConnection_connectionName = (UpdateConnection -> Maybe Text)
-> (UpdateConnection -> Maybe Text -> UpdateConnection)
-> Lens UpdateConnection UpdateConnection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnection' {Maybe Text
connectionName :: Maybe Text
$sel:connectionName:UpdateConnection' :: UpdateConnection -> Maybe Text
connectionName} -> Maybe Text
connectionName) (\s :: UpdateConnection
s@UpdateConnection' {} Maybe Text
a -> UpdateConnection
s {$sel:connectionName:UpdateConnection' :: Maybe Text
connectionName = Maybe Text
a} :: UpdateConnection)
updateConnection_encryptionMode :: Lens.Lens' UpdateConnection (Prelude.Maybe Prelude.Text)
updateConnection_encryptionMode :: (Maybe Text -> f (Maybe Text))
-> UpdateConnection -> f UpdateConnection
updateConnection_encryptionMode = (UpdateConnection -> Maybe Text)
-> (UpdateConnection -> Maybe Text -> UpdateConnection)
-> Lens UpdateConnection UpdateConnection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnection' {Maybe Text
encryptionMode :: Maybe Text
$sel:encryptionMode:UpdateConnection' :: UpdateConnection -> Maybe Text
encryptionMode} -> Maybe Text
encryptionMode) (\s :: UpdateConnection
s@UpdateConnection' {} Maybe Text
a -> UpdateConnection
s {$sel:encryptionMode:UpdateConnection' :: Maybe Text
encryptionMode = Maybe Text
a} :: UpdateConnection)
updateConnection_connectionId :: Lens.Lens' UpdateConnection Prelude.Text
updateConnection_connectionId :: (Text -> f Text) -> UpdateConnection -> f UpdateConnection
updateConnection_connectionId = (UpdateConnection -> Text)
-> (UpdateConnection -> Text -> UpdateConnection)
-> Lens UpdateConnection UpdateConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnection' {Text
connectionId :: Text
$sel:connectionId:UpdateConnection' :: UpdateConnection -> Text
connectionId} -> Text
connectionId) (\s :: UpdateConnection
s@UpdateConnection' {} Text
a -> UpdateConnection
s {$sel:connectionId:UpdateConnection' :: Text
connectionId = Text
a} :: UpdateConnection)
instance Core.AWSRequest UpdateConnection where
type AWSResponse UpdateConnection = Connection
request :: UpdateConnection -> Request UpdateConnection
request = Service -> UpdateConnection -> Request UpdateConnection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateConnection)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateConnection))
-> Logger
-> Service
-> Proxy UpdateConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateConnection)))
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 UpdateConnection
instance Prelude.NFData UpdateConnection
instance Core.ToHeaders UpdateConnection where
toHeaders :: UpdateConnection -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateConnection -> 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.UpdateConnection" ::
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 UpdateConnection where
toJSON :: UpdateConnection -> Value
toJSON UpdateConnection' {Maybe Text
Text
connectionId :: Text
encryptionMode :: Maybe Text
connectionName :: Maybe Text
$sel:connectionId:UpdateConnection' :: UpdateConnection -> Text
$sel:encryptionMode:UpdateConnection' :: UpdateConnection -> Maybe Text
$sel:connectionName:UpdateConnection' :: UpdateConnection -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"connectionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
connectionName,
(Text
"encryptionMode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
encryptionMode,
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)
]
)
instance Core.ToPath UpdateConnection where
toPath :: UpdateConnection -> ByteString
toPath = ByteString -> UpdateConnection -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateConnection where
toQuery :: UpdateConnection -> QueryString
toQuery = QueryString -> UpdateConnection -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty