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