{-# 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.CreateInterconnect
(
CreateInterconnect (..),
newCreateInterconnect,
createInterconnect_lagId,
createInterconnect_providerName,
createInterconnect_tags,
createInterconnect_interconnectName,
createInterconnect_bandwidth,
createInterconnect_location,
Interconnect (..),
newInterconnect,
interconnect_lagId,
interconnect_interconnectId,
interconnect_location,
interconnect_interconnectName,
interconnect_awsDevice,
interconnect_hasLogicalRedundancy,
interconnect_awsLogicalDeviceId,
interconnect_loaIssueTime,
interconnect_bandwidth,
interconnect_jumboFrameCapable,
interconnect_interconnectState,
interconnect_region,
interconnect_providerName,
interconnect_awsDeviceV2,
interconnect_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 CreateInterconnect = CreateInterconnect'
{
CreateInterconnect -> Maybe Text
lagId :: Prelude.Maybe Prelude.Text,
CreateInterconnect -> Maybe Text
providerName :: Prelude.Maybe Prelude.Text,
CreateInterconnect -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
CreateInterconnect -> Text
interconnectName :: Prelude.Text,
CreateInterconnect -> Text
bandwidth :: Prelude.Text,
CreateInterconnect -> Text
location :: Prelude.Text
}
deriving (CreateInterconnect -> CreateInterconnect -> Bool
(CreateInterconnect -> CreateInterconnect -> Bool)
-> (CreateInterconnect -> CreateInterconnect -> Bool)
-> Eq CreateInterconnect
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateInterconnect -> CreateInterconnect -> Bool
$c/= :: CreateInterconnect -> CreateInterconnect -> Bool
== :: CreateInterconnect -> CreateInterconnect -> Bool
$c== :: CreateInterconnect -> CreateInterconnect -> Bool
Prelude.Eq, ReadPrec [CreateInterconnect]
ReadPrec CreateInterconnect
Int -> ReadS CreateInterconnect
ReadS [CreateInterconnect]
(Int -> ReadS CreateInterconnect)
-> ReadS [CreateInterconnect]
-> ReadPrec CreateInterconnect
-> ReadPrec [CreateInterconnect]
-> Read CreateInterconnect
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateInterconnect]
$creadListPrec :: ReadPrec [CreateInterconnect]
readPrec :: ReadPrec CreateInterconnect
$creadPrec :: ReadPrec CreateInterconnect
readList :: ReadS [CreateInterconnect]
$creadList :: ReadS [CreateInterconnect]
readsPrec :: Int -> ReadS CreateInterconnect
$creadsPrec :: Int -> ReadS CreateInterconnect
Prelude.Read, Int -> CreateInterconnect -> ShowS
[CreateInterconnect] -> ShowS
CreateInterconnect -> String
(Int -> CreateInterconnect -> ShowS)
-> (CreateInterconnect -> String)
-> ([CreateInterconnect] -> ShowS)
-> Show CreateInterconnect
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateInterconnect] -> ShowS
$cshowList :: [CreateInterconnect] -> ShowS
show :: CreateInterconnect -> String
$cshow :: CreateInterconnect -> String
showsPrec :: Int -> CreateInterconnect -> ShowS
$cshowsPrec :: Int -> CreateInterconnect -> ShowS
Prelude.Show, (forall x. CreateInterconnect -> Rep CreateInterconnect x)
-> (forall x. Rep CreateInterconnect x -> CreateInterconnect)
-> Generic CreateInterconnect
forall x. Rep CreateInterconnect x -> CreateInterconnect
forall x. CreateInterconnect -> Rep CreateInterconnect x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateInterconnect x -> CreateInterconnect
$cfrom :: forall x. CreateInterconnect -> Rep CreateInterconnect x
Prelude.Generic)
newCreateInterconnect ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreateInterconnect
newCreateInterconnect :: Text -> Text -> Text -> CreateInterconnect
newCreateInterconnect
Text
pInterconnectName_
Text
pBandwidth_
Text
pLocation_ =
CreateInterconnect' :: Maybe Text
-> Maybe Text
-> Maybe (NonEmpty Tag)
-> Text
-> Text
-> Text
-> CreateInterconnect
CreateInterconnect'
{ $sel:lagId:CreateInterconnect' :: Maybe Text
lagId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:providerName:CreateInterconnect' :: Maybe Text
providerName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateInterconnect' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
$sel:interconnectName:CreateInterconnect' :: Text
interconnectName = Text
pInterconnectName_,
$sel:bandwidth:CreateInterconnect' :: Text
bandwidth = Text
pBandwidth_,
$sel:location:CreateInterconnect' :: Text
location = Text
pLocation_
}
createInterconnect_lagId :: Lens.Lens' CreateInterconnect (Prelude.Maybe Prelude.Text)
createInterconnect_lagId :: (Maybe Text -> f (Maybe Text))
-> CreateInterconnect -> f CreateInterconnect
createInterconnect_lagId = (CreateInterconnect -> Maybe Text)
-> (CreateInterconnect -> Maybe Text -> CreateInterconnect)
-> Lens
CreateInterconnect CreateInterconnect (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInterconnect' {Maybe Text
lagId :: Maybe Text
$sel:lagId:CreateInterconnect' :: CreateInterconnect -> Maybe Text
lagId} -> Maybe Text
lagId) (\s :: CreateInterconnect
s@CreateInterconnect' {} Maybe Text
a -> CreateInterconnect
s {$sel:lagId:CreateInterconnect' :: Maybe Text
lagId = Maybe Text
a} :: CreateInterconnect)
createInterconnect_providerName :: Lens.Lens' CreateInterconnect (Prelude.Maybe Prelude.Text)
createInterconnect_providerName :: (Maybe Text -> f (Maybe Text))
-> CreateInterconnect -> f CreateInterconnect
createInterconnect_providerName = (CreateInterconnect -> Maybe Text)
-> (CreateInterconnect -> Maybe Text -> CreateInterconnect)
-> Lens
CreateInterconnect CreateInterconnect (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInterconnect' {Maybe Text
providerName :: Maybe Text
$sel:providerName:CreateInterconnect' :: CreateInterconnect -> Maybe Text
providerName} -> Maybe Text
providerName) (\s :: CreateInterconnect
s@CreateInterconnect' {} Maybe Text
a -> CreateInterconnect
s {$sel:providerName:CreateInterconnect' :: Maybe Text
providerName = Maybe Text
a} :: CreateInterconnect)
createInterconnect_tags :: Lens.Lens' CreateInterconnect (Prelude.Maybe (Prelude.NonEmpty Tag))
createInterconnect_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateInterconnect -> f CreateInterconnect
createInterconnect_tags = (CreateInterconnect -> Maybe (NonEmpty Tag))
-> (CreateInterconnect
-> Maybe (NonEmpty Tag) -> CreateInterconnect)
-> Lens
CreateInterconnect
CreateInterconnect
(Maybe (NonEmpty Tag))
(Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInterconnect' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateInterconnect' :: CreateInterconnect -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateInterconnect
s@CreateInterconnect' {} Maybe (NonEmpty Tag)
a -> CreateInterconnect
s {$sel:tags:CreateInterconnect' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateInterconnect) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateInterconnect -> f CreateInterconnect)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateInterconnect
-> f CreateInterconnect
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
createInterconnect_interconnectName :: Lens.Lens' CreateInterconnect Prelude.Text
createInterconnect_interconnectName :: (Text -> f Text) -> CreateInterconnect -> f CreateInterconnect
createInterconnect_interconnectName = (CreateInterconnect -> Text)
-> (CreateInterconnect -> Text -> CreateInterconnect)
-> Lens CreateInterconnect CreateInterconnect Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInterconnect' {Text
interconnectName :: Text
$sel:interconnectName:CreateInterconnect' :: CreateInterconnect -> Text
interconnectName} -> Text
interconnectName) (\s :: CreateInterconnect
s@CreateInterconnect' {} Text
a -> CreateInterconnect
s {$sel:interconnectName:CreateInterconnect' :: Text
interconnectName = Text
a} :: CreateInterconnect)
createInterconnect_bandwidth :: Lens.Lens' CreateInterconnect Prelude.Text
createInterconnect_bandwidth :: (Text -> f Text) -> CreateInterconnect -> f CreateInterconnect
createInterconnect_bandwidth = (CreateInterconnect -> Text)
-> (CreateInterconnect -> Text -> CreateInterconnect)
-> Lens CreateInterconnect CreateInterconnect Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInterconnect' {Text
bandwidth :: Text
$sel:bandwidth:CreateInterconnect' :: CreateInterconnect -> Text
bandwidth} -> Text
bandwidth) (\s :: CreateInterconnect
s@CreateInterconnect' {} Text
a -> CreateInterconnect
s {$sel:bandwidth:CreateInterconnect' :: Text
bandwidth = Text
a} :: CreateInterconnect)
createInterconnect_location :: Lens.Lens' CreateInterconnect Prelude.Text
createInterconnect_location :: (Text -> f Text) -> CreateInterconnect -> f CreateInterconnect
createInterconnect_location = (CreateInterconnect -> Text)
-> (CreateInterconnect -> Text -> CreateInterconnect)
-> Lens CreateInterconnect CreateInterconnect Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInterconnect' {Text
location :: Text
$sel:location:CreateInterconnect' :: CreateInterconnect -> Text
location} -> Text
location) (\s :: CreateInterconnect
s@CreateInterconnect' {} Text
a -> CreateInterconnect
s {$sel:location:CreateInterconnect' :: Text
location = Text
a} :: CreateInterconnect)
instance Core.AWSRequest CreateInterconnect where
type AWSResponse CreateInterconnect = Interconnect
request :: CreateInterconnect -> Request CreateInterconnect
request = Service -> CreateInterconnect -> Request CreateInterconnect
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateInterconnect
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateInterconnect)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateInterconnect))
-> Logger
-> Service
-> Proxy CreateInterconnect
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateInterconnect)))
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 Interconnect
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable CreateInterconnect
instance Prelude.NFData CreateInterconnect
instance Core.ToHeaders CreateInterconnect where
toHeaders :: CreateInterconnect -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateInterconnect -> 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.CreateInterconnect" ::
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 CreateInterconnect where
toJSON :: CreateInterconnect -> Value
toJSON CreateInterconnect' {Maybe (NonEmpty Tag)
Maybe Text
Text
location :: Text
bandwidth :: Text
interconnectName :: Text
tags :: Maybe (NonEmpty Tag)
providerName :: Maybe Text
lagId :: Maybe Text
$sel:location:CreateInterconnect' :: CreateInterconnect -> Text
$sel:bandwidth:CreateInterconnect' :: CreateInterconnect -> Text
$sel:interconnectName:CreateInterconnect' :: CreateInterconnect -> Text
$sel:tags:CreateInterconnect' :: CreateInterconnect -> Maybe (NonEmpty Tag)
$sel:providerName:CreateInterconnect' :: CreateInterconnect -> Maybe Text
$sel:lagId:CreateInterconnect' :: CreateInterconnect -> 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
"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
"interconnectName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
interconnectName),
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
"location" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
location)
]
)
instance Core.ToPath CreateInterconnect where
toPath :: CreateInterconnect -> ByteString
toPath = ByteString -> CreateInterconnect -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateInterconnect where
toQuery :: CreateInterconnect -> QueryString
toQuery = QueryString -> CreateInterconnect -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty