{-# 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.CreatePrivateVirtualInterface
(
CreatePrivateVirtualInterface (..),
newCreatePrivateVirtualInterface,
createPrivateVirtualInterface_connectionId,
createPrivateVirtualInterface_newPrivateVirtualInterface,
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 CreatePrivateVirtualInterface = CreatePrivateVirtualInterface'
{
CreatePrivateVirtualInterface -> Text
connectionId :: Prelude.Text,
CreatePrivateVirtualInterface -> NewPrivateVirtualInterface
newPrivateVirtualInterface' :: NewPrivateVirtualInterface
}
deriving (CreatePrivateVirtualInterface
-> CreatePrivateVirtualInterface -> Bool
(CreatePrivateVirtualInterface
-> CreatePrivateVirtualInterface -> Bool)
-> (CreatePrivateVirtualInterface
-> CreatePrivateVirtualInterface -> Bool)
-> Eq CreatePrivateVirtualInterface
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePrivateVirtualInterface
-> CreatePrivateVirtualInterface -> Bool
$c/= :: CreatePrivateVirtualInterface
-> CreatePrivateVirtualInterface -> Bool
== :: CreatePrivateVirtualInterface
-> CreatePrivateVirtualInterface -> Bool
$c== :: CreatePrivateVirtualInterface
-> CreatePrivateVirtualInterface -> Bool
Prelude.Eq, ReadPrec [CreatePrivateVirtualInterface]
ReadPrec CreatePrivateVirtualInterface
Int -> ReadS CreatePrivateVirtualInterface
ReadS [CreatePrivateVirtualInterface]
(Int -> ReadS CreatePrivateVirtualInterface)
-> ReadS [CreatePrivateVirtualInterface]
-> ReadPrec CreatePrivateVirtualInterface
-> ReadPrec [CreatePrivateVirtualInterface]
-> Read CreatePrivateVirtualInterface
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePrivateVirtualInterface]
$creadListPrec :: ReadPrec [CreatePrivateVirtualInterface]
readPrec :: ReadPrec CreatePrivateVirtualInterface
$creadPrec :: ReadPrec CreatePrivateVirtualInterface
readList :: ReadS [CreatePrivateVirtualInterface]
$creadList :: ReadS [CreatePrivateVirtualInterface]
readsPrec :: Int -> ReadS CreatePrivateVirtualInterface
$creadsPrec :: Int -> ReadS CreatePrivateVirtualInterface
Prelude.Read, Int -> CreatePrivateVirtualInterface -> ShowS
[CreatePrivateVirtualInterface] -> ShowS
CreatePrivateVirtualInterface -> String
(Int -> CreatePrivateVirtualInterface -> ShowS)
-> (CreatePrivateVirtualInterface -> String)
-> ([CreatePrivateVirtualInterface] -> ShowS)
-> Show CreatePrivateVirtualInterface
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePrivateVirtualInterface] -> ShowS
$cshowList :: [CreatePrivateVirtualInterface] -> ShowS
show :: CreatePrivateVirtualInterface -> String
$cshow :: CreatePrivateVirtualInterface -> String
showsPrec :: Int -> CreatePrivateVirtualInterface -> ShowS
$cshowsPrec :: Int -> CreatePrivateVirtualInterface -> ShowS
Prelude.Show, (forall x.
CreatePrivateVirtualInterface
-> Rep CreatePrivateVirtualInterface x)
-> (forall x.
Rep CreatePrivateVirtualInterface x
-> CreatePrivateVirtualInterface)
-> Generic CreatePrivateVirtualInterface
forall x.
Rep CreatePrivateVirtualInterface x
-> CreatePrivateVirtualInterface
forall x.
CreatePrivateVirtualInterface
-> Rep CreatePrivateVirtualInterface x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePrivateVirtualInterface x
-> CreatePrivateVirtualInterface
$cfrom :: forall x.
CreatePrivateVirtualInterface
-> Rep CreatePrivateVirtualInterface x
Prelude.Generic)
newCreatePrivateVirtualInterface ::
Prelude.Text ->
NewPrivateVirtualInterface ->
CreatePrivateVirtualInterface
newCreatePrivateVirtualInterface :: Text -> NewPrivateVirtualInterface -> CreatePrivateVirtualInterface
newCreatePrivateVirtualInterface
Text
pConnectionId_
NewPrivateVirtualInterface
pNewPrivateVirtualInterface_ =
CreatePrivateVirtualInterface' :: Text -> NewPrivateVirtualInterface -> CreatePrivateVirtualInterface
CreatePrivateVirtualInterface'
{ $sel:connectionId:CreatePrivateVirtualInterface' :: Text
connectionId =
Text
pConnectionId_,
$sel:newPrivateVirtualInterface':CreatePrivateVirtualInterface' :: NewPrivateVirtualInterface
newPrivateVirtualInterface' =
NewPrivateVirtualInterface
pNewPrivateVirtualInterface_
}
createPrivateVirtualInterface_connectionId :: Lens.Lens' CreatePrivateVirtualInterface Prelude.Text
createPrivateVirtualInterface_connectionId :: (Text -> f Text)
-> CreatePrivateVirtualInterface -> f CreatePrivateVirtualInterface
createPrivateVirtualInterface_connectionId = (CreatePrivateVirtualInterface -> Text)
-> (CreatePrivateVirtualInterface
-> Text -> CreatePrivateVirtualInterface)
-> Lens
CreatePrivateVirtualInterface
CreatePrivateVirtualInterface
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrivateVirtualInterface' {Text
connectionId :: Text
$sel:connectionId:CreatePrivateVirtualInterface' :: CreatePrivateVirtualInterface -> Text
connectionId} -> Text
connectionId) (\s :: CreatePrivateVirtualInterface
s@CreatePrivateVirtualInterface' {} Text
a -> CreatePrivateVirtualInterface
s {$sel:connectionId:CreatePrivateVirtualInterface' :: Text
connectionId = Text
a} :: CreatePrivateVirtualInterface)
createPrivateVirtualInterface_newPrivateVirtualInterface :: Lens.Lens' CreatePrivateVirtualInterface NewPrivateVirtualInterface
createPrivateVirtualInterface_newPrivateVirtualInterface :: (NewPrivateVirtualInterface -> f NewPrivateVirtualInterface)
-> CreatePrivateVirtualInterface -> f CreatePrivateVirtualInterface
createPrivateVirtualInterface_newPrivateVirtualInterface = (CreatePrivateVirtualInterface -> NewPrivateVirtualInterface)
-> (CreatePrivateVirtualInterface
-> NewPrivateVirtualInterface -> CreatePrivateVirtualInterface)
-> Lens
CreatePrivateVirtualInterface
CreatePrivateVirtualInterface
NewPrivateVirtualInterface
NewPrivateVirtualInterface
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrivateVirtualInterface' {NewPrivateVirtualInterface
newPrivateVirtualInterface' :: NewPrivateVirtualInterface
$sel:newPrivateVirtualInterface':CreatePrivateVirtualInterface' :: CreatePrivateVirtualInterface -> NewPrivateVirtualInterface
newPrivateVirtualInterface'} -> NewPrivateVirtualInterface
newPrivateVirtualInterface') (\s :: CreatePrivateVirtualInterface
s@CreatePrivateVirtualInterface' {} NewPrivateVirtualInterface
a -> CreatePrivateVirtualInterface
s {$sel:newPrivateVirtualInterface':CreatePrivateVirtualInterface' :: NewPrivateVirtualInterface
newPrivateVirtualInterface' = NewPrivateVirtualInterface
a} :: CreatePrivateVirtualInterface)
instance
Core.AWSRequest
CreatePrivateVirtualInterface
where
type
AWSResponse CreatePrivateVirtualInterface =
VirtualInterface
request :: CreatePrivateVirtualInterface
-> Request CreatePrivateVirtualInterface
request = Service
-> CreatePrivateVirtualInterface
-> Request CreatePrivateVirtualInterface
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreatePrivateVirtualInterface
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePrivateVirtualInterface)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreatePrivateVirtualInterface))
-> Logger
-> Service
-> Proxy CreatePrivateVirtualInterface
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePrivateVirtualInterface)))
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
CreatePrivateVirtualInterface
instance Prelude.NFData CreatePrivateVirtualInterface
instance Core.ToHeaders CreatePrivateVirtualInterface where
toHeaders :: CreatePrivateVirtualInterface -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreatePrivateVirtualInterface -> 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.CreatePrivateVirtualInterface" ::
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 CreatePrivateVirtualInterface where
toJSON :: CreatePrivateVirtualInterface -> Value
toJSON CreatePrivateVirtualInterface' {Text
NewPrivateVirtualInterface
newPrivateVirtualInterface' :: NewPrivateVirtualInterface
connectionId :: Text
$sel:newPrivateVirtualInterface':CreatePrivateVirtualInterface' :: CreatePrivateVirtualInterface -> NewPrivateVirtualInterface
$sel:connectionId:CreatePrivateVirtualInterface' :: CreatePrivateVirtualInterface -> 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
"newPrivateVirtualInterface"
Text -> NewPrivateVirtualInterface -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NewPrivateVirtualInterface
newPrivateVirtualInterface'
)
]
)
instance Core.ToPath CreatePrivateVirtualInterface where
toPath :: CreatePrivateVirtualInterface -> ByteString
toPath = ByteString -> CreatePrivateVirtualInterface -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreatePrivateVirtualInterface where
toQuery :: CreatePrivateVirtualInterface -> QueryString
toQuery = QueryString -> CreatePrivateVirtualInterface -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty