{-# 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.CreateConnection
(
CreateConnection (..),
newCreateConnection,
createConnection_lagId,
createConnection_requestMACSec,
createConnection_providerName,
createConnection_tags,
createConnection_location,
createConnection_bandwidth,
createConnection_connectionName,
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 CreateConnection = CreateConnection'
{
CreateConnection -> Maybe Text
lagId :: Prelude.Maybe Prelude.Text,
CreateConnection -> Maybe Bool
requestMACSec :: Prelude.Maybe Prelude.Bool,
CreateConnection -> Maybe Text
providerName :: Prelude.Maybe Prelude.Text,
CreateConnection -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
CreateConnection -> Text
location :: Prelude.Text,
CreateConnection -> Text
bandwidth :: Prelude.Text,
CreateConnection -> Text
connectionName :: Prelude.Text
}
deriving (CreateConnection -> CreateConnection -> Bool
(CreateConnection -> CreateConnection -> Bool)
-> (CreateConnection -> CreateConnection -> Bool)
-> Eq CreateConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConnection -> CreateConnection -> Bool
$c/= :: CreateConnection -> CreateConnection -> Bool
== :: CreateConnection -> CreateConnection -> Bool
$c== :: CreateConnection -> CreateConnection -> Bool
Prelude.Eq, ReadPrec [CreateConnection]
ReadPrec CreateConnection
Int -> ReadS CreateConnection
ReadS [CreateConnection]
(Int -> ReadS CreateConnection)
-> ReadS [CreateConnection]
-> ReadPrec CreateConnection
-> ReadPrec [CreateConnection]
-> Read CreateConnection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateConnection]
$creadListPrec :: ReadPrec [CreateConnection]
readPrec :: ReadPrec CreateConnection
$creadPrec :: ReadPrec CreateConnection
readList :: ReadS [CreateConnection]
$creadList :: ReadS [CreateConnection]
readsPrec :: Int -> ReadS CreateConnection
$creadsPrec :: Int -> ReadS CreateConnection
Prelude.Read, Int -> CreateConnection -> ShowS
[CreateConnection] -> ShowS
CreateConnection -> String
(Int -> CreateConnection -> ShowS)
-> (CreateConnection -> String)
-> ([CreateConnection] -> ShowS)
-> Show CreateConnection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateConnection] -> ShowS
$cshowList :: [CreateConnection] -> ShowS
show :: CreateConnection -> String
$cshow :: CreateConnection -> String
showsPrec :: Int -> CreateConnection -> ShowS
$cshowsPrec :: Int -> CreateConnection -> ShowS
Prelude.Show, (forall x. CreateConnection -> Rep CreateConnection x)
-> (forall x. Rep CreateConnection x -> CreateConnection)
-> Generic CreateConnection
forall x. Rep CreateConnection x -> CreateConnection
forall x. CreateConnection -> Rep CreateConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateConnection x -> CreateConnection
$cfrom :: forall x. CreateConnection -> Rep CreateConnection x
Prelude.Generic)
newCreateConnection ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreateConnection
newCreateConnection :: Text -> Text -> Text -> CreateConnection
newCreateConnection
Text
pLocation_
Text
pBandwidth_
Text
pConnectionName_ =
CreateConnection' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe (NonEmpty Tag)
-> Text
-> Text
-> Text
-> CreateConnection
CreateConnection'
{ $sel:lagId:CreateConnection' :: Maybe Text
lagId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:requestMACSec:CreateConnection' :: Maybe Bool
requestMACSec = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:providerName:CreateConnection' :: Maybe Text
providerName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateConnection' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
$sel:location:CreateConnection' :: Text
location = Text
pLocation_,
$sel:bandwidth:CreateConnection' :: Text
bandwidth = Text
pBandwidth_,
$sel:connectionName:CreateConnection' :: Text
connectionName = Text
pConnectionName_
}
createConnection_lagId :: Lens.Lens' CreateConnection (Prelude.Maybe Prelude.Text)
createConnection_lagId :: (Maybe Text -> f (Maybe Text))
-> CreateConnection -> f CreateConnection
createConnection_lagId = (CreateConnection -> Maybe Text)
-> (CreateConnection -> Maybe Text -> CreateConnection)
-> Lens CreateConnection CreateConnection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnection' {Maybe Text
lagId :: Maybe Text
$sel:lagId:CreateConnection' :: CreateConnection -> Maybe Text
lagId} -> Maybe Text
lagId) (\s :: CreateConnection
s@CreateConnection' {} Maybe Text
a -> CreateConnection
s {$sel:lagId:CreateConnection' :: Maybe Text
lagId = Maybe Text
a} :: CreateConnection)
createConnection_requestMACSec :: Lens.Lens' CreateConnection (Prelude.Maybe Prelude.Bool)
createConnection_requestMACSec :: (Maybe Bool -> f (Maybe Bool))
-> CreateConnection -> f CreateConnection
createConnection_requestMACSec = (CreateConnection -> Maybe Bool)
-> (CreateConnection -> Maybe Bool -> CreateConnection)
-> Lens CreateConnection CreateConnection (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnection' {Maybe Bool
requestMACSec :: Maybe Bool
$sel:requestMACSec:CreateConnection' :: CreateConnection -> Maybe Bool
requestMACSec} -> Maybe Bool
requestMACSec) (\s :: CreateConnection
s@CreateConnection' {} Maybe Bool
a -> CreateConnection
s {$sel:requestMACSec:CreateConnection' :: Maybe Bool
requestMACSec = Maybe Bool
a} :: CreateConnection)
createConnection_providerName :: Lens.Lens' CreateConnection (Prelude.Maybe Prelude.Text)
createConnection_providerName :: (Maybe Text -> f (Maybe Text))
-> CreateConnection -> f CreateConnection
createConnection_providerName = (CreateConnection -> Maybe Text)
-> (CreateConnection -> Maybe Text -> CreateConnection)
-> Lens CreateConnection CreateConnection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnection' {Maybe Text
providerName :: Maybe Text
$sel:providerName:CreateConnection' :: CreateConnection -> Maybe Text
providerName} -> Maybe Text
providerName) (\s :: CreateConnection
s@CreateConnection' {} Maybe Text
a -> CreateConnection
s {$sel:providerName:CreateConnection' :: Maybe Text
providerName = Maybe Text
a} :: CreateConnection)
createConnection_tags :: Lens.Lens' CreateConnection (Prelude.Maybe (Prelude.NonEmpty Tag))
createConnection_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateConnection -> f CreateConnection
createConnection_tags = (CreateConnection -> Maybe (NonEmpty Tag))
-> (CreateConnection -> Maybe (NonEmpty Tag) -> CreateConnection)
-> Lens
CreateConnection
CreateConnection
(Maybe (NonEmpty Tag))
(Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnection' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateConnection' :: CreateConnection -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateConnection
s@CreateConnection' {} Maybe (NonEmpty Tag)
a -> CreateConnection
s {$sel:tags:CreateConnection' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateConnection) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateConnection -> f CreateConnection)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateConnection
-> f CreateConnection
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
-> Iso
(Maybe (NonEmpty Tag))
(Maybe (NonEmpty Tag))
(Maybe (NonEmpty Tag))
(Maybe (NonEmpty Tag))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createConnection_location :: Lens.Lens' CreateConnection Prelude.Text
createConnection_location :: (Text -> f Text) -> CreateConnection -> f CreateConnection
createConnection_location = (CreateConnection -> Text)
-> (CreateConnection -> Text -> CreateConnection)
-> Lens CreateConnection CreateConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnection' {Text
location :: Text
$sel:location:CreateConnection' :: CreateConnection -> Text
location} -> Text
location) (\s :: CreateConnection
s@CreateConnection' {} Text
a -> CreateConnection
s {$sel:location:CreateConnection' :: Text
location = Text
a} :: CreateConnection)
createConnection_bandwidth :: Lens.Lens' CreateConnection Prelude.Text
createConnection_bandwidth :: (Text -> f Text) -> CreateConnection -> f CreateConnection
createConnection_bandwidth = (CreateConnection -> Text)
-> (CreateConnection -> Text -> CreateConnection)
-> Lens CreateConnection CreateConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnection' {Text
bandwidth :: Text
$sel:bandwidth:CreateConnection' :: CreateConnection -> Text
bandwidth} -> Text
bandwidth) (\s :: CreateConnection
s@CreateConnection' {} Text
a -> CreateConnection
s {$sel:bandwidth:CreateConnection' :: Text
bandwidth = Text
a} :: CreateConnection)
createConnection_connectionName :: Lens.Lens' CreateConnection Prelude.Text
createConnection_connectionName :: (Text -> f Text) -> CreateConnection -> f CreateConnection
createConnection_connectionName = (CreateConnection -> Text)
-> (CreateConnection -> Text -> CreateConnection)
-> Lens CreateConnection CreateConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnection' {Text
connectionName :: Text
$sel:connectionName:CreateConnection' :: CreateConnection -> Text
connectionName} -> Text
connectionName) (\s :: CreateConnection
s@CreateConnection' {} Text
a -> CreateConnection
s {$sel:connectionName:CreateConnection' :: Text
connectionName = Text
a} :: CreateConnection)
instance Core.AWSRequest CreateConnection where
type AWSResponse CreateConnection = Connection
request :: CreateConnection -> Request CreateConnection
request = Service -> CreateConnection -> Request CreateConnection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateConnection)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateConnection))
-> Logger
-> Service
-> Proxy CreateConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateConnection)))
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 CreateConnection
instance Prelude.NFData CreateConnection
instance Core.ToHeaders CreateConnection where
toHeaders :: CreateConnection -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateConnection -> 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.CreateConnection" ::
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 CreateConnection where
toJSON :: CreateConnection -> Value
toJSON CreateConnection' {Maybe Bool
Maybe (NonEmpty Tag)
Maybe Text
Text
connectionName :: Text
bandwidth :: Text
location :: Text
tags :: Maybe (NonEmpty Tag)
providerName :: Maybe Text
requestMACSec :: Maybe Bool
lagId :: Maybe Text
$sel:connectionName:CreateConnection' :: CreateConnection -> Text
$sel:bandwidth:CreateConnection' :: CreateConnection -> Text
$sel:location:CreateConnection' :: CreateConnection -> Text
$sel:tags:CreateConnection' :: CreateConnection -> Maybe (NonEmpty Tag)
$sel:providerName:CreateConnection' :: CreateConnection -> Maybe Text
$sel:requestMACSec:CreateConnection' :: CreateConnection -> Maybe Bool
$sel:lagId:CreateConnection' :: CreateConnection -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"lagId" 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
lagId,
(Text
"requestMACSec" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
requestMACSec,
(Text
"providerName" 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
providerName,
(Text
"tags" Text -> NonEmpty Tag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Tag -> Pair) -> Maybe (NonEmpty Tag) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"location" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
location),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"bandwidth" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bandwidth),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"connectionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
connectionName)
]
)
instance Core.ToPath CreateConnection where
toPath :: CreateConnection -> ByteString
toPath = ByteString -> CreateConnection -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateConnection where
toQuery :: CreateConnection -> QueryString
toQuery = QueryString -> CreateConnection -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty