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