{-# 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_awsDevice,
connection_awsDeviceV2,
connection_awsLogicalDeviceId,
connection_bandwidth,
connection_connectionId,
connection_connectionName,
connection_connectionState,
connection_encryptionMode,
connection_hasLogicalRedundancy,
connection_jumboFrameCapable,
connection_lagId,
connection_loaIssueTime,
connection_location,
connection_macSecCapable,
connection_macSecKeys,
connection_ownerAccount,
connection_partnerName,
connection_portEncryptionStatus,
connection_providerName,
connection_region,
connection_tags,
connection_vlan,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DirectConnect.Types
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
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]
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
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.
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'
{ $sel:tags:AllocateHostedConnection' :: Maybe (NonEmpty Tag)
tags = 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 :: Lens' AllocateHostedConnection (Maybe (NonEmpty Tag))
allocateHostedConnection_tags = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' AllocateHostedConnection Text
allocateHostedConnection_connectionId = 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 :: Lens' AllocateHostedConnection Text
allocateHostedConnection_ownerAccount = 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 :: Lens' AllocateHostedConnection Text
allocateHostedConnection_bandwidth = 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 :: Lens' AllocateHostedConnection Text
allocateHostedConnection_connectionName = 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 :: Lens' AllocateHostedConnection Int
allocateHostedConnection_vlan = 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 :: (Service -> Service)
-> AllocateHostedConnection -> Request AllocateHostedConnection
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AllocateHostedConnection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AllocateHostedConnection)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
(\Int
s ResponseHeaders
h Object
x -> forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
instance Prelude.Hashable AllocateHostedConnection where
hashWithSalt :: Int -> AllocateHostedConnection -> Int
hashWithSalt Int
_salt 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)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Tag)
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
connectionId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ownerAccount
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bandwidth
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
connectionName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
vlan
instance Prelude.NFData AllocateHostedConnection where
rnf :: AllocateHostedConnection -> ()
rnf 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)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Tag)
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
connectionId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
ownerAccount
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
bandwidth
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
connectionName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
vlan
instance Data.ToHeaders AllocateHostedConnection where
toHeaders :: AllocateHostedConnection -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"OvertureService.AllocateHostedConnection" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"connectionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
connectionId),
forall a. a -> Maybe a
Prelude.Just (Key
"ownerAccount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
ownerAccount),
forall a. a -> Maybe a
Prelude.Just (Key
"bandwidth" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
bandwidth),
forall a. a -> Maybe a
Prelude.Just
(Key
"connectionName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
connectionName),
forall a. a -> Maybe a
Prelude.Just (Key
"vlan" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Int
vlan)
]
)
instance Data.ToPath AllocateHostedConnection where
toPath :: AllocateHostedConnection -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery AllocateHostedConnection where
toQuery :: AllocateHostedConnection -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty