{-# 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.CreatePublicVirtualInterface
(
CreatePublicVirtualInterface (..),
newCreatePublicVirtualInterface,
createPublicVirtualInterface_connectionId,
createPublicVirtualInterface_newPublicVirtualInterface,
VirtualInterface (..),
newVirtualInterface,
virtualInterface_bgpPeers,
virtualInterface_virtualGatewayId,
virtualInterface_mtu,
virtualInterface_routeFilterPrefixes,
virtualInterface_customerAddress,
virtualInterface_vlan,
virtualInterface_location,
virtualInterface_amazonAddress,
virtualInterface_addressFamily,
virtualInterface_virtualInterfaceState,
virtualInterface_connectionId,
virtualInterface_awsLogicalDeviceId,
virtualInterface_directConnectGatewayId,
virtualInterface_amazonSideAsn,
virtualInterface_virtualInterfaceType,
virtualInterface_asn,
virtualInterface_authKey,
virtualInterface_jumboFrameCapable,
virtualInterface_customerRouterConfig,
virtualInterface_ownerAccount,
virtualInterface_region,
virtualInterface_virtualInterfaceName,
virtualInterface_awsDeviceV2,
virtualInterface_virtualInterfaceId,
virtualInterface_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 CreatePublicVirtualInterface = CreatePublicVirtualInterface'
{
CreatePublicVirtualInterface -> Text
connectionId :: Prelude.Text,
CreatePublicVirtualInterface -> NewPublicVirtualInterface
newPublicVirtualInterface' :: NewPublicVirtualInterface
}
deriving (CreatePublicVirtualInterface
-> CreatePublicVirtualInterface -> Bool
(CreatePublicVirtualInterface
-> CreatePublicVirtualInterface -> Bool)
-> (CreatePublicVirtualInterface
-> CreatePublicVirtualInterface -> Bool)
-> Eq CreatePublicVirtualInterface
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePublicVirtualInterface
-> CreatePublicVirtualInterface -> Bool
$c/= :: CreatePublicVirtualInterface
-> CreatePublicVirtualInterface -> Bool
== :: CreatePublicVirtualInterface
-> CreatePublicVirtualInterface -> Bool
$c== :: CreatePublicVirtualInterface
-> CreatePublicVirtualInterface -> Bool
Prelude.Eq, ReadPrec [CreatePublicVirtualInterface]
ReadPrec CreatePublicVirtualInterface
Int -> ReadS CreatePublicVirtualInterface
ReadS [CreatePublicVirtualInterface]
(Int -> ReadS CreatePublicVirtualInterface)
-> ReadS [CreatePublicVirtualInterface]
-> ReadPrec CreatePublicVirtualInterface
-> ReadPrec [CreatePublicVirtualInterface]
-> Read CreatePublicVirtualInterface
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePublicVirtualInterface]
$creadListPrec :: ReadPrec [CreatePublicVirtualInterface]
readPrec :: ReadPrec CreatePublicVirtualInterface
$creadPrec :: ReadPrec CreatePublicVirtualInterface
readList :: ReadS [CreatePublicVirtualInterface]
$creadList :: ReadS [CreatePublicVirtualInterface]
readsPrec :: Int -> ReadS CreatePublicVirtualInterface
$creadsPrec :: Int -> ReadS CreatePublicVirtualInterface
Prelude.Read, Int -> CreatePublicVirtualInterface -> ShowS
[CreatePublicVirtualInterface] -> ShowS
CreatePublicVirtualInterface -> String
(Int -> CreatePublicVirtualInterface -> ShowS)
-> (CreatePublicVirtualInterface -> String)
-> ([CreatePublicVirtualInterface] -> ShowS)
-> Show CreatePublicVirtualInterface
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePublicVirtualInterface] -> ShowS
$cshowList :: [CreatePublicVirtualInterface] -> ShowS
show :: CreatePublicVirtualInterface -> String
$cshow :: CreatePublicVirtualInterface -> String
showsPrec :: Int -> CreatePublicVirtualInterface -> ShowS
$cshowsPrec :: Int -> CreatePublicVirtualInterface -> ShowS
Prelude.Show, (forall x.
CreatePublicVirtualInterface -> Rep CreatePublicVirtualInterface x)
-> (forall x.
Rep CreatePublicVirtualInterface x -> CreatePublicVirtualInterface)
-> Generic CreatePublicVirtualInterface
forall x.
Rep CreatePublicVirtualInterface x -> CreatePublicVirtualInterface
forall x.
CreatePublicVirtualInterface -> Rep CreatePublicVirtualInterface x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePublicVirtualInterface x -> CreatePublicVirtualInterface
$cfrom :: forall x.
CreatePublicVirtualInterface -> Rep CreatePublicVirtualInterface x
Prelude.Generic)
newCreatePublicVirtualInterface ::
Prelude.Text ->
NewPublicVirtualInterface ->
CreatePublicVirtualInterface
newCreatePublicVirtualInterface :: Text -> NewPublicVirtualInterface -> CreatePublicVirtualInterface
newCreatePublicVirtualInterface
Text
pConnectionId_
NewPublicVirtualInterface
pNewPublicVirtualInterface_ =
CreatePublicVirtualInterface' :: Text -> NewPublicVirtualInterface -> CreatePublicVirtualInterface
CreatePublicVirtualInterface'
{ $sel:connectionId:CreatePublicVirtualInterface' :: Text
connectionId =
Text
pConnectionId_,
$sel:newPublicVirtualInterface':CreatePublicVirtualInterface' :: NewPublicVirtualInterface
newPublicVirtualInterface' =
NewPublicVirtualInterface
pNewPublicVirtualInterface_
}
createPublicVirtualInterface_connectionId :: Lens.Lens' CreatePublicVirtualInterface Prelude.Text
createPublicVirtualInterface_connectionId :: (Text -> f Text)
-> CreatePublicVirtualInterface -> f CreatePublicVirtualInterface
createPublicVirtualInterface_connectionId = (CreatePublicVirtualInterface -> Text)
-> (CreatePublicVirtualInterface
-> Text -> CreatePublicVirtualInterface)
-> Lens
CreatePublicVirtualInterface CreatePublicVirtualInterface Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePublicVirtualInterface' {Text
connectionId :: Text
$sel:connectionId:CreatePublicVirtualInterface' :: CreatePublicVirtualInterface -> Text
connectionId} -> Text
connectionId) (\s :: CreatePublicVirtualInterface
s@CreatePublicVirtualInterface' {} Text
a -> CreatePublicVirtualInterface
s {$sel:connectionId:CreatePublicVirtualInterface' :: Text
connectionId = Text
a} :: CreatePublicVirtualInterface)
createPublicVirtualInterface_newPublicVirtualInterface :: Lens.Lens' CreatePublicVirtualInterface NewPublicVirtualInterface
createPublicVirtualInterface_newPublicVirtualInterface :: (NewPublicVirtualInterface -> f NewPublicVirtualInterface)
-> CreatePublicVirtualInterface -> f CreatePublicVirtualInterface
createPublicVirtualInterface_newPublicVirtualInterface = (CreatePublicVirtualInterface -> NewPublicVirtualInterface)
-> (CreatePublicVirtualInterface
-> NewPublicVirtualInterface -> CreatePublicVirtualInterface)
-> Lens
CreatePublicVirtualInterface
CreatePublicVirtualInterface
NewPublicVirtualInterface
NewPublicVirtualInterface
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePublicVirtualInterface' {NewPublicVirtualInterface
newPublicVirtualInterface' :: NewPublicVirtualInterface
$sel:newPublicVirtualInterface':CreatePublicVirtualInterface' :: CreatePublicVirtualInterface -> NewPublicVirtualInterface
newPublicVirtualInterface'} -> NewPublicVirtualInterface
newPublicVirtualInterface') (\s :: CreatePublicVirtualInterface
s@CreatePublicVirtualInterface' {} NewPublicVirtualInterface
a -> CreatePublicVirtualInterface
s {$sel:newPublicVirtualInterface':CreatePublicVirtualInterface' :: NewPublicVirtualInterface
newPublicVirtualInterface' = NewPublicVirtualInterface
a} :: CreatePublicVirtualInterface)
instance Core.AWSRequest CreatePublicVirtualInterface where
type
AWSResponse CreatePublicVirtualInterface =
VirtualInterface
request :: CreatePublicVirtualInterface
-> Request CreatePublicVirtualInterface
request = Service
-> CreatePublicVirtualInterface
-> Request CreatePublicVirtualInterface
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreatePublicVirtualInterface
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePublicVirtualInterface)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreatePublicVirtualInterface))
-> Logger
-> Service
-> Proxy CreatePublicVirtualInterface
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePublicVirtualInterface)))
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 VirtualInterface
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance
Prelude.Hashable
CreatePublicVirtualInterface
instance Prelude.NFData CreatePublicVirtualInterface
instance Core.ToHeaders CreatePublicVirtualInterface where
toHeaders :: CreatePublicVirtualInterface -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreatePublicVirtualInterface -> 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.CreatePublicVirtualInterface" ::
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 CreatePublicVirtualInterface where
toJSON :: CreatePublicVirtualInterface -> Value
toJSON CreatePublicVirtualInterface' {Text
NewPublicVirtualInterface
newPublicVirtualInterface' :: NewPublicVirtualInterface
connectionId :: Text
$sel:newPublicVirtualInterface':CreatePublicVirtualInterface' :: CreatePublicVirtualInterface -> NewPublicVirtualInterface
$sel:connectionId:CreatePublicVirtualInterface' :: CreatePublicVirtualInterface -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ 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
"newPublicVirtualInterface"
Text -> NewPublicVirtualInterface -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NewPublicVirtualInterface
newPublicVirtualInterface'
)
]
)
instance Core.ToPath CreatePublicVirtualInterface where
toPath :: CreatePublicVirtualInterface -> ByteString
toPath = ByteString -> CreatePublicVirtualInterface -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreatePublicVirtualInterface where
toQuery :: CreatePublicVirtualInterface -> QueryString
toQuery = QueryString -> CreatePublicVirtualInterface -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty