{-# 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.CreateDirectConnectGateway
(
CreateDirectConnectGateway (..),
newCreateDirectConnectGateway,
createDirectConnectGateway_amazonSideAsn,
createDirectConnectGateway_directConnectGatewayName,
CreateDirectConnectGatewayResponse (..),
newCreateDirectConnectGatewayResponse,
createDirectConnectGatewayResponse_directConnectGateway,
createDirectConnectGatewayResponse_httpStatus,
)
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 CreateDirectConnectGateway = CreateDirectConnectGateway'
{
CreateDirectConnectGateway -> Maybe Integer
amazonSideAsn :: Prelude.Maybe Prelude.Integer,
CreateDirectConnectGateway -> Text
directConnectGatewayName :: Prelude.Text
}
deriving (CreateDirectConnectGateway -> CreateDirectConnectGateway -> Bool
(CreateDirectConnectGateway -> CreateDirectConnectGateway -> Bool)
-> (CreateDirectConnectGateway
-> CreateDirectConnectGateway -> Bool)
-> Eq CreateDirectConnectGateway
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDirectConnectGateway -> CreateDirectConnectGateway -> Bool
$c/= :: CreateDirectConnectGateway -> CreateDirectConnectGateway -> Bool
== :: CreateDirectConnectGateway -> CreateDirectConnectGateway -> Bool
$c== :: CreateDirectConnectGateway -> CreateDirectConnectGateway -> Bool
Prelude.Eq, ReadPrec [CreateDirectConnectGateway]
ReadPrec CreateDirectConnectGateway
Int -> ReadS CreateDirectConnectGateway
ReadS [CreateDirectConnectGateway]
(Int -> ReadS CreateDirectConnectGateway)
-> ReadS [CreateDirectConnectGateway]
-> ReadPrec CreateDirectConnectGateway
-> ReadPrec [CreateDirectConnectGateway]
-> Read CreateDirectConnectGateway
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDirectConnectGateway]
$creadListPrec :: ReadPrec [CreateDirectConnectGateway]
readPrec :: ReadPrec CreateDirectConnectGateway
$creadPrec :: ReadPrec CreateDirectConnectGateway
readList :: ReadS [CreateDirectConnectGateway]
$creadList :: ReadS [CreateDirectConnectGateway]
readsPrec :: Int -> ReadS CreateDirectConnectGateway
$creadsPrec :: Int -> ReadS CreateDirectConnectGateway
Prelude.Read, Int -> CreateDirectConnectGateway -> ShowS
[CreateDirectConnectGateway] -> ShowS
CreateDirectConnectGateway -> String
(Int -> CreateDirectConnectGateway -> ShowS)
-> (CreateDirectConnectGateway -> String)
-> ([CreateDirectConnectGateway] -> ShowS)
-> Show CreateDirectConnectGateway
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDirectConnectGateway] -> ShowS
$cshowList :: [CreateDirectConnectGateway] -> ShowS
show :: CreateDirectConnectGateway -> String
$cshow :: CreateDirectConnectGateway -> String
showsPrec :: Int -> CreateDirectConnectGateway -> ShowS
$cshowsPrec :: Int -> CreateDirectConnectGateway -> ShowS
Prelude.Show, (forall x.
CreateDirectConnectGateway -> Rep CreateDirectConnectGateway x)
-> (forall x.
Rep CreateDirectConnectGateway x -> CreateDirectConnectGateway)
-> Generic CreateDirectConnectGateway
forall x.
Rep CreateDirectConnectGateway x -> CreateDirectConnectGateway
forall x.
CreateDirectConnectGateway -> Rep CreateDirectConnectGateway x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDirectConnectGateway x -> CreateDirectConnectGateway
$cfrom :: forall x.
CreateDirectConnectGateway -> Rep CreateDirectConnectGateway x
Prelude.Generic)
newCreateDirectConnectGateway ::
Prelude.Text ->
CreateDirectConnectGateway
newCreateDirectConnectGateway :: Text -> CreateDirectConnectGateway
newCreateDirectConnectGateway
Text
pDirectConnectGatewayName_ =
CreateDirectConnectGateway' :: Maybe Integer -> Text -> CreateDirectConnectGateway
CreateDirectConnectGateway'
{ $sel:amazonSideAsn:CreateDirectConnectGateway' :: Maybe Integer
amazonSideAsn =
Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:directConnectGatewayName:CreateDirectConnectGateway' :: Text
directConnectGatewayName =
Text
pDirectConnectGatewayName_
}
createDirectConnectGateway_amazonSideAsn :: Lens.Lens' CreateDirectConnectGateway (Prelude.Maybe Prelude.Integer)
createDirectConnectGateway_amazonSideAsn :: (Maybe Integer -> f (Maybe Integer))
-> CreateDirectConnectGateway -> f CreateDirectConnectGateway
createDirectConnectGateway_amazonSideAsn = (CreateDirectConnectGateway -> Maybe Integer)
-> (CreateDirectConnectGateway
-> Maybe Integer -> CreateDirectConnectGateway)
-> Lens
CreateDirectConnectGateway
CreateDirectConnectGateway
(Maybe Integer)
(Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDirectConnectGateway' {Maybe Integer
amazonSideAsn :: Maybe Integer
$sel:amazonSideAsn:CreateDirectConnectGateway' :: CreateDirectConnectGateway -> Maybe Integer
amazonSideAsn} -> Maybe Integer
amazonSideAsn) (\s :: CreateDirectConnectGateway
s@CreateDirectConnectGateway' {} Maybe Integer
a -> CreateDirectConnectGateway
s {$sel:amazonSideAsn:CreateDirectConnectGateway' :: Maybe Integer
amazonSideAsn = Maybe Integer
a} :: CreateDirectConnectGateway)
createDirectConnectGateway_directConnectGatewayName :: Lens.Lens' CreateDirectConnectGateway Prelude.Text
createDirectConnectGateway_directConnectGatewayName :: (Text -> f Text)
-> CreateDirectConnectGateway -> f CreateDirectConnectGateway
createDirectConnectGateway_directConnectGatewayName = (CreateDirectConnectGateway -> Text)
-> (CreateDirectConnectGateway
-> Text -> CreateDirectConnectGateway)
-> Lens
CreateDirectConnectGateway CreateDirectConnectGateway Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDirectConnectGateway' {Text
directConnectGatewayName :: Text
$sel:directConnectGatewayName:CreateDirectConnectGateway' :: CreateDirectConnectGateway -> Text
directConnectGatewayName} -> Text
directConnectGatewayName) (\s :: CreateDirectConnectGateway
s@CreateDirectConnectGateway' {} Text
a -> CreateDirectConnectGateway
s {$sel:directConnectGatewayName:CreateDirectConnectGateway' :: Text
directConnectGatewayName = Text
a} :: CreateDirectConnectGateway)
instance Core.AWSRequest CreateDirectConnectGateway where
type
AWSResponse CreateDirectConnectGateway =
CreateDirectConnectGatewayResponse
request :: CreateDirectConnectGateway -> Request CreateDirectConnectGateway
request = Service
-> CreateDirectConnectGateway -> Request CreateDirectConnectGateway
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateDirectConnectGateway
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDirectConnectGateway)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateDirectConnectGateway))
-> Logger
-> Service
-> Proxy CreateDirectConnectGateway
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDirectConnectGateway)))
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 ->
Maybe DirectConnectGateway
-> Int -> CreateDirectConnectGatewayResponse
CreateDirectConnectGatewayResponse'
(Maybe DirectConnectGateway
-> Int -> CreateDirectConnectGatewayResponse)
-> Either String (Maybe DirectConnectGateway)
-> Either String (Int -> CreateDirectConnectGatewayResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DirectConnectGateway)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"directConnectGateway")
Either String (Int -> CreateDirectConnectGatewayResponse)
-> Either String Int
-> Either String CreateDirectConnectGatewayResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateDirectConnectGateway
instance Prelude.NFData CreateDirectConnectGateway
instance Core.ToHeaders CreateDirectConnectGateway where
toHeaders :: CreateDirectConnectGateway -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateDirectConnectGateway -> 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.CreateDirectConnectGateway" ::
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 CreateDirectConnectGateway where
toJSON :: CreateDirectConnectGateway -> Value
toJSON CreateDirectConnectGateway' {Maybe Integer
Text
directConnectGatewayName :: Text
amazonSideAsn :: Maybe Integer
$sel:directConnectGatewayName:CreateDirectConnectGateway' :: CreateDirectConnectGateway -> Text
$sel:amazonSideAsn:CreateDirectConnectGateway' :: CreateDirectConnectGateway -> Maybe Integer
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"amazonSideAsn" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
amazonSideAsn,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"directConnectGatewayName"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directConnectGatewayName
)
]
)
instance Core.ToPath CreateDirectConnectGateway where
toPath :: CreateDirectConnectGateway -> ByteString
toPath = ByteString -> CreateDirectConnectGateway -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateDirectConnectGateway where
toQuery :: CreateDirectConnectGateway -> QueryString
toQuery = QueryString -> CreateDirectConnectGateway -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateDirectConnectGatewayResponse = CreateDirectConnectGatewayResponse'
{
CreateDirectConnectGatewayResponse -> Maybe DirectConnectGateway
directConnectGateway :: Prelude.Maybe DirectConnectGateway,
CreateDirectConnectGatewayResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateDirectConnectGatewayResponse
-> CreateDirectConnectGatewayResponse -> Bool
(CreateDirectConnectGatewayResponse
-> CreateDirectConnectGatewayResponse -> Bool)
-> (CreateDirectConnectGatewayResponse
-> CreateDirectConnectGatewayResponse -> Bool)
-> Eq CreateDirectConnectGatewayResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDirectConnectGatewayResponse
-> CreateDirectConnectGatewayResponse -> Bool
$c/= :: CreateDirectConnectGatewayResponse
-> CreateDirectConnectGatewayResponse -> Bool
== :: CreateDirectConnectGatewayResponse
-> CreateDirectConnectGatewayResponse -> Bool
$c== :: CreateDirectConnectGatewayResponse
-> CreateDirectConnectGatewayResponse -> Bool
Prelude.Eq, ReadPrec [CreateDirectConnectGatewayResponse]
ReadPrec CreateDirectConnectGatewayResponse
Int -> ReadS CreateDirectConnectGatewayResponse
ReadS [CreateDirectConnectGatewayResponse]
(Int -> ReadS CreateDirectConnectGatewayResponse)
-> ReadS [CreateDirectConnectGatewayResponse]
-> ReadPrec CreateDirectConnectGatewayResponse
-> ReadPrec [CreateDirectConnectGatewayResponse]
-> Read CreateDirectConnectGatewayResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDirectConnectGatewayResponse]
$creadListPrec :: ReadPrec [CreateDirectConnectGatewayResponse]
readPrec :: ReadPrec CreateDirectConnectGatewayResponse
$creadPrec :: ReadPrec CreateDirectConnectGatewayResponse
readList :: ReadS [CreateDirectConnectGatewayResponse]
$creadList :: ReadS [CreateDirectConnectGatewayResponse]
readsPrec :: Int -> ReadS CreateDirectConnectGatewayResponse
$creadsPrec :: Int -> ReadS CreateDirectConnectGatewayResponse
Prelude.Read, Int -> CreateDirectConnectGatewayResponse -> ShowS
[CreateDirectConnectGatewayResponse] -> ShowS
CreateDirectConnectGatewayResponse -> String
(Int -> CreateDirectConnectGatewayResponse -> ShowS)
-> (CreateDirectConnectGatewayResponse -> String)
-> ([CreateDirectConnectGatewayResponse] -> ShowS)
-> Show CreateDirectConnectGatewayResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDirectConnectGatewayResponse] -> ShowS
$cshowList :: [CreateDirectConnectGatewayResponse] -> ShowS
show :: CreateDirectConnectGatewayResponse -> String
$cshow :: CreateDirectConnectGatewayResponse -> String
showsPrec :: Int -> CreateDirectConnectGatewayResponse -> ShowS
$cshowsPrec :: Int -> CreateDirectConnectGatewayResponse -> ShowS
Prelude.Show, (forall x.
CreateDirectConnectGatewayResponse
-> Rep CreateDirectConnectGatewayResponse x)
-> (forall x.
Rep CreateDirectConnectGatewayResponse x
-> CreateDirectConnectGatewayResponse)
-> Generic CreateDirectConnectGatewayResponse
forall x.
Rep CreateDirectConnectGatewayResponse x
-> CreateDirectConnectGatewayResponse
forall x.
CreateDirectConnectGatewayResponse
-> Rep CreateDirectConnectGatewayResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDirectConnectGatewayResponse x
-> CreateDirectConnectGatewayResponse
$cfrom :: forall x.
CreateDirectConnectGatewayResponse
-> Rep CreateDirectConnectGatewayResponse x
Prelude.Generic)
newCreateDirectConnectGatewayResponse ::
Prelude.Int ->
CreateDirectConnectGatewayResponse
newCreateDirectConnectGatewayResponse :: Int -> CreateDirectConnectGatewayResponse
newCreateDirectConnectGatewayResponse Int
pHttpStatus_ =
CreateDirectConnectGatewayResponse' :: Maybe DirectConnectGateway
-> Int -> CreateDirectConnectGatewayResponse
CreateDirectConnectGatewayResponse'
{ $sel:directConnectGateway:CreateDirectConnectGatewayResponse' :: Maybe DirectConnectGateway
directConnectGateway =
Maybe DirectConnectGateway
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateDirectConnectGatewayResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createDirectConnectGatewayResponse_directConnectGateway :: Lens.Lens' CreateDirectConnectGatewayResponse (Prelude.Maybe DirectConnectGateway)
createDirectConnectGatewayResponse_directConnectGateway :: (Maybe DirectConnectGateway -> f (Maybe DirectConnectGateway))
-> CreateDirectConnectGatewayResponse
-> f CreateDirectConnectGatewayResponse
createDirectConnectGatewayResponse_directConnectGateway = (CreateDirectConnectGatewayResponse -> Maybe DirectConnectGateway)
-> (CreateDirectConnectGatewayResponse
-> Maybe DirectConnectGateway
-> CreateDirectConnectGatewayResponse)
-> Lens
CreateDirectConnectGatewayResponse
CreateDirectConnectGatewayResponse
(Maybe DirectConnectGateway)
(Maybe DirectConnectGateway)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDirectConnectGatewayResponse' {Maybe DirectConnectGateway
directConnectGateway :: Maybe DirectConnectGateway
$sel:directConnectGateway:CreateDirectConnectGatewayResponse' :: CreateDirectConnectGatewayResponse -> Maybe DirectConnectGateway
directConnectGateway} -> Maybe DirectConnectGateway
directConnectGateway) (\s :: CreateDirectConnectGatewayResponse
s@CreateDirectConnectGatewayResponse' {} Maybe DirectConnectGateway
a -> CreateDirectConnectGatewayResponse
s {$sel:directConnectGateway:CreateDirectConnectGatewayResponse' :: Maybe DirectConnectGateway
directConnectGateway = Maybe DirectConnectGateway
a} :: CreateDirectConnectGatewayResponse)
createDirectConnectGatewayResponse_httpStatus :: Lens.Lens' CreateDirectConnectGatewayResponse Prelude.Int
createDirectConnectGatewayResponse_httpStatus :: (Int -> f Int)
-> CreateDirectConnectGatewayResponse
-> f CreateDirectConnectGatewayResponse
createDirectConnectGatewayResponse_httpStatus = (CreateDirectConnectGatewayResponse -> Int)
-> (CreateDirectConnectGatewayResponse
-> Int -> CreateDirectConnectGatewayResponse)
-> Lens
CreateDirectConnectGatewayResponse
CreateDirectConnectGatewayResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDirectConnectGatewayResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDirectConnectGatewayResponse' :: CreateDirectConnectGatewayResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDirectConnectGatewayResponse
s@CreateDirectConnectGatewayResponse' {} Int
a -> CreateDirectConnectGatewayResponse
s {$sel:httpStatus:CreateDirectConnectGatewayResponse' :: Int
httpStatus = Int
a} :: CreateDirectConnectGatewayResponse)
instance
Prelude.NFData
CreateDirectConnectGatewayResponse