{-# 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.CreateLag
(
CreateLag (..),
newCreateLag,
createLag_childConnectionTags,
createLag_connectionId,
createLag_requestMACSec,
createLag_providerName,
createLag_tags,
createLag_numberOfConnections,
createLag_location,
createLag_connectionsBandwidth,
createLag_lagName,
Lag (..),
newLag,
lag_lagId,
lag_macSecCapable,
lag_connectionsBandwidth,
lag_minimumLinks,
lag_lagName,
lag_location,
lag_connections,
lag_awsDevice,
lag_hasLogicalRedundancy,
lag_awsLogicalDeviceId,
lag_allowsHostedConnections,
lag_encryptionMode,
lag_numberOfConnections,
lag_jumboFrameCapable,
lag_lagState,
lag_ownerAccount,
lag_region,
lag_macSecKeys,
lag_providerName,
lag_awsDeviceV2,
lag_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 CreateLag = CreateLag'
{
CreateLag -> Maybe (NonEmpty Tag)
childConnectionTags :: Prelude.Maybe (Prelude.NonEmpty Tag),
CreateLag -> Maybe Text
connectionId :: Prelude.Maybe Prelude.Text,
CreateLag -> Maybe Bool
requestMACSec :: Prelude.Maybe Prelude.Bool,
CreateLag -> Maybe Text
providerName :: Prelude.Maybe Prelude.Text,
CreateLag -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
CreateLag -> Int
numberOfConnections :: Prelude.Int,
CreateLag -> Text
location :: Prelude.Text,
CreateLag -> Text
connectionsBandwidth :: Prelude.Text,
CreateLag -> Text
lagName :: Prelude.Text
}
deriving (CreateLag -> CreateLag -> Bool
(CreateLag -> CreateLag -> Bool)
-> (CreateLag -> CreateLag -> Bool) -> Eq CreateLag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLag -> CreateLag -> Bool
$c/= :: CreateLag -> CreateLag -> Bool
== :: CreateLag -> CreateLag -> Bool
$c== :: CreateLag -> CreateLag -> Bool
Prelude.Eq, ReadPrec [CreateLag]
ReadPrec CreateLag
Int -> ReadS CreateLag
ReadS [CreateLag]
(Int -> ReadS CreateLag)
-> ReadS [CreateLag]
-> ReadPrec CreateLag
-> ReadPrec [CreateLag]
-> Read CreateLag
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLag]
$creadListPrec :: ReadPrec [CreateLag]
readPrec :: ReadPrec CreateLag
$creadPrec :: ReadPrec CreateLag
readList :: ReadS [CreateLag]
$creadList :: ReadS [CreateLag]
readsPrec :: Int -> ReadS CreateLag
$creadsPrec :: Int -> ReadS CreateLag
Prelude.Read, Int -> CreateLag -> ShowS
[CreateLag] -> ShowS
CreateLag -> String
(Int -> CreateLag -> ShowS)
-> (CreateLag -> String)
-> ([CreateLag] -> ShowS)
-> Show CreateLag
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLag] -> ShowS
$cshowList :: [CreateLag] -> ShowS
show :: CreateLag -> String
$cshow :: CreateLag -> String
showsPrec :: Int -> CreateLag -> ShowS
$cshowsPrec :: Int -> CreateLag -> ShowS
Prelude.Show, (forall x. CreateLag -> Rep CreateLag x)
-> (forall x. Rep CreateLag x -> CreateLag) -> Generic CreateLag
forall x. Rep CreateLag x -> CreateLag
forall x. CreateLag -> Rep CreateLag x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLag x -> CreateLag
$cfrom :: forall x. CreateLag -> Rep CreateLag x
Prelude.Generic)
newCreateLag ::
Prelude.Int ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreateLag
newCreateLag :: Int -> Text -> Text -> Text -> CreateLag
newCreateLag
Int
pNumberOfConnections_
Text
pLocation_
Text
pConnectionsBandwidth_
Text
pLagName_ =
CreateLag' :: Maybe (NonEmpty Tag)
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe (NonEmpty Tag)
-> Int
-> Text
-> Text
-> Text
-> CreateLag
CreateLag'
{ $sel:childConnectionTags:CreateLag' :: Maybe (NonEmpty Tag)
childConnectionTags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
$sel:connectionId:CreateLag' :: Maybe Text
connectionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:requestMACSec:CreateLag' :: Maybe Bool
requestMACSec = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:providerName:CreateLag' :: Maybe Text
providerName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateLag' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
$sel:numberOfConnections:CreateLag' :: Int
numberOfConnections = Int
pNumberOfConnections_,
$sel:location:CreateLag' :: Text
location = Text
pLocation_,
$sel:connectionsBandwidth:CreateLag' :: Text
connectionsBandwidth = Text
pConnectionsBandwidth_,
$sel:lagName:CreateLag' :: Text
lagName = Text
pLagName_
}
createLag_childConnectionTags :: Lens.Lens' CreateLag (Prelude.Maybe (Prelude.NonEmpty Tag))
createLag_childConnectionTags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateLag -> f CreateLag
createLag_childConnectionTags = (CreateLag -> Maybe (NonEmpty Tag))
-> (CreateLag -> Maybe (NonEmpty Tag) -> CreateLag)
-> Lens
CreateLag CreateLag (Maybe (NonEmpty Tag)) (Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLag' {Maybe (NonEmpty Tag)
childConnectionTags :: Maybe (NonEmpty Tag)
$sel:childConnectionTags:CreateLag' :: CreateLag -> Maybe (NonEmpty Tag)
childConnectionTags} -> Maybe (NonEmpty Tag)
childConnectionTags) (\s :: CreateLag
s@CreateLag' {} Maybe (NonEmpty Tag)
a -> CreateLag
s {$sel:childConnectionTags:CreateLag' :: Maybe (NonEmpty Tag)
childConnectionTags = Maybe (NonEmpty Tag)
a} :: CreateLag) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateLag -> f CreateLag)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateLag
-> f CreateLag
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
createLag_connectionId :: Lens.Lens' CreateLag (Prelude.Maybe Prelude.Text)
createLag_connectionId :: (Maybe Text -> f (Maybe Text)) -> CreateLag -> f CreateLag
createLag_connectionId = (CreateLag -> Maybe Text)
-> (CreateLag -> Maybe Text -> CreateLag)
-> Lens CreateLag CreateLag (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLag' {Maybe Text
connectionId :: Maybe Text
$sel:connectionId:CreateLag' :: CreateLag -> Maybe Text
connectionId} -> Maybe Text
connectionId) (\s :: CreateLag
s@CreateLag' {} Maybe Text
a -> CreateLag
s {$sel:connectionId:CreateLag' :: Maybe Text
connectionId = Maybe Text
a} :: CreateLag)
createLag_requestMACSec :: Lens.Lens' CreateLag (Prelude.Maybe Prelude.Bool)
createLag_requestMACSec :: (Maybe Bool -> f (Maybe Bool)) -> CreateLag -> f CreateLag
createLag_requestMACSec = (CreateLag -> Maybe Bool)
-> (CreateLag -> Maybe Bool -> CreateLag)
-> Lens CreateLag CreateLag (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLag' {Maybe Bool
requestMACSec :: Maybe Bool
$sel:requestMACSec:CreateLag' :: CreateLag -> Maybe Bool
requestMACSec} -> Maybe Bool
requestMACSec) (\s :: CreateLag
s@CreateLag' {} Maybe Bool
a -> CreateLag
s {$sel:requestMACSec:CreateLag' :: Maybe Bool
requestMACSec = Maybe Bool
a} :: CreateLag)
createLag_providerName :: Lens.Lens' CreateLag (Prelude.Maybe Prelude.Text)
createLag_providerName :: (Maybe Text -> f (Maybe Text)) -> CreateLag -> f CreateLag
createLag_providerName = (CreateLag -> Maybe Text)
-> (CreateLag -> Maybe Text -> CreateLag)
-> Lens CreateLag CreateLag (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLag' {Maybe Text
providerName :: Maybe Text
$sel:providerName:CreateLag' :: CreateLag -> Maybe Text
providerName} -> Maybe Text
providerName) (\s :: CreateLag
s@CreateLag' {} Maybe Text
a -> CreateLag
s {$sel:providerName:CreateLag' :: Maybe Text
providerName = Maybe Text
a} :: CreateLag)
createLag_tags :: Lens.Lens' CreateLag (Prelude.Maybe (Prelude.NonEmpty Tag))
createLag_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateLag -> f CreateLag
createLag_tags = (CreateLag -> Maybe (NonEmpty Tag))
-> (CreateLag -> Maybe (NonEmpty Tag) -> CreateLag)
-> Lens
CreateLag CreateLag (Maybe (NonEmpty Tag)) (Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLag' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateLag' :: CreateLag -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateLag
s@CreateLag' {} Maybe (NonEmpty Tag)
a -> CreateLag
s {$sel:tags:CreateLag' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateLag) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateLag -> f CreateLag)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateLag
-> f CreateLag
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
createLag_numberOfConnections :: Lens.Lens' CreateLag Prelude.Int
createLag_numberOfConnections :: (Int -> f Int) -> CreateLag -> f CreateLag
createLag_numberOfConnections = (CreateLag -> Int)
-> (CreateLag -> Int -> CreateLag)
-> Lens CreateLag CreateLag Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLag' {Int
numberOfConnections :: Int
$sel:numberOfConnections:CreateLag' :: CreateLag -> Int
numberOfConnections} -> Int
numberOfConnections) (\s :: CreateLag
s@CreateLag' {} Int
a -> CreateLag
s {$sel:numberOfConnections:CreateLag' :: Int
numberOfConnections = Int
a} :: CreateLag)
createLag_location :: Lens.Lens' CreateLag Prelude.Text
createLag_location :: (Text -> f Text) -> CreateLag -> f CreateLag
createLag_location = (CreateLag -> Text)
-> (CreateLag -> Text -> CreateLag)
-> Lens CreateLag CreateLag Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLag' {Text
location :: Text
$sel:location:CreateLag' :: CreateLag -> Text
location} -> Text
location) (\s :: CreateLag
s@CreateLag' {} Text
a -> CreateLag
s {$sel:location:CreateLag' :: Text
location = Text
a} :: CreateLag)
createLag_connectionsBandwidth :: Lens.Lens' CreateLag Prelude.Text
createLag_connectionsBandwidth :: (Text -> f Text) -> CreateLag -> f CreateLag
createLag_connectionsBandwidth = (CreateLag -> Text)
-> (CreateLag -> Text -> CreateLag)
-> Lens CreateLag CreateLag Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLag' {Text
connectionsBandwidth :: Text
$sel:connectionsBandwidth:CreateLag' :: CreateLag -> Text
connectionsBandwidth} -> Text
connectionsBandwidth) (\s :: CreateLag
s@CreateLag' {} Text
a -> CreateLag
s {$sel:connectionsBandwidth:CreateLag' :: Text
connectionsBandwidth = Text
a} :: CreateLag)
createLag_lagName :: Lens.Lens' CreateLag Prelude.Text
createLag_lagName :: (Text -> f Text) -> CreateLag -> f CreateLag
createLag_lagName = (CreateLag -> Text)
-> (CreateLag -> Text -> CreateLag)
-> Lens CreateLag CreateLag Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLag' {Text
lagName :: Text
$sel:lagName:CreateLag' :: CreateLag -> Text
lagName} -> Text
lagName) (\s :: CreateLag
s@CreateLag' {} Text
a -> CreateLag
s {$sel:lagName:CreateLag' :: Text
lagName = Text
a} :: CreateLag)
instance Core.AWSRequest CreateLag where
type AWSResponse CreateLag = Lag
request :: CreateLag -> Request CreateLag
request = Service -> CreateLag -> Request CreateLag
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateLag
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLag)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateLag))
-> Logger
-> Service
-> Proxy CreateLag
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLag)))
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 Lag
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable CreateLag
instance Prelude.NFData CreateLag
instance Core.ToHeaders CreateLag where
toHeaders :: CreateLag -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateLag -> 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.CreateLag" :: 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 CreateLag where
toJSON :: CreateLag -> Value
toJSON CreateLag' {Int
Maybe Bool
Maybe (NonEmpty Tag)
Maybe Text
Text
lagName :: Text
connectionsBandwidth :: Text
location :: Text
numberOfConnections :: Int
tags :: Maybe (NonEmpty Tag)
providerName :: Maybe Text
requestMACSec :: Maybe Bool
connectionId :: Maybe Text
childConnectionTags :: Maybe (NonEmpty Tag)
$sel:lagName:CreateLag' :: CreateLag -> Text
$sel:connectionsBandwidth:CreateLag' :: CreateLag -> Text
$sel:location:CreateLag' :: CreateLag -> Text
$sel:numberOfConnections:CreateLag' :: CreateLag -> Int
$sel:tags:CreateLag' :: CreateLag -> Maybe (NonEmpty Tag)
$sel:providerName:CreateLag' :: CreateLag -> Maybe Text
$sel:requestMACSec:CreateLag' :: CreateLag -> Maybe Bool
$sel:connectionId:CreateLag' :: CreateLag -> Maybe Text
$sel:childConnectionTags:CreateLag' :: CreateLag -> Maybe (NonEmpty Tag)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"childConnectionTags" 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)
childConnectionTags,
(Text
"connectionId" 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
connectionId,
(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
"numberOfConnections" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
numberOfConnections),
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
"connectionsBandwidth"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
connectionsBandwidth
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"lagName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
lagName)
]
)
instance Core.ToPath CreateLag where
toPath :: CreateLag -> ByteString
toPath = ByteString -> CreateLag -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateLag where
toQuery :: CreateLag -> QueryString
toQuery = QueryString -> CreateLag -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty