{-# 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.ApiGatewayV2.CreateApiMapping
(
CreateApiMapping (..),
newCreateApiMapping,
createApiMapping_apiMappingKey,
createApiMapping_domainName,
createApiMapping_stage,
createApiMapping_apiId,
CreateApiMappingResponse (..),
newCreateApiMappingResponse,
createApiMappingResponse_apiId,
createApiMappingResponse_apiMappingId,
createApiMappingResponse_apiMappingKey,
createApiMappingResponse_stage,
createApiMappingResponse_httpStatus,
)
where
import Amazonka.ApiGatewayV2.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateApiMapping = CreateApiMapping'
{
CreateApiMapping -> Maybe Text
apiMappingKey :: Prelude.Maybe Prelude.Text,
CreateApiMapping -> Text
domainName :: Prelude.Text,
CreateApiMapping -> Text
stage :: Prelude.Text,
CreateApiMapping -> Text
apiId :: Prelude.Text
}
deriving (CreateApiMapping -> CreateApiMapping -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateApiMapping -> CreateApiMapping -> Bool
$c/= :: CreateApiMapping -> CreateApiMapping -> Bool
== :: CreateApiMapping -> CreateApiMapping -> Bool
$c== :: CreateApiMapping -> CreateApiMapping -> Bool
Prelude.Eq, ReadPrec [CreateApiMapping]
ReadPrec CreateApiMapping
Int -> ReadS CreateApiMapping
ReadS [CreateApiMapping]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateApiMapping]
$creadListPrec :: ReadPrec [CreateApiMapping]
readPrec :: ReadPrec CreateApiMapping
$creadPrec :: ReadPrec CreateApiMapping
readList :: ReadS [CreateApiMapping]
$creadList :: ReadS [CreateApiMapping]
readsPrec :: Int -> ReadS CreateApiMapping
$creadsPrec :: Int -> ReadS CreateApiMapping
Prelude.Read, Int -> CreateApiMapping -> ShowS
[CreateApiMapping] -> ShowS
CreateApiMapping -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateApiMapping] -> ShowS
$cshowList :: [CreateApiMapping] -> ShowS
show :: CreateApiMapping -> String
$cshow :: CreateApiMapping -> String
showsPrec :: Int -> CreateApiMapping -> ShowS
$cshowsPrec :: Int -> CreateApiMapping -> ShowS
Prelude.Show, forall x. Rep CreateApiMapping x -> CreateApiMapping
forall x. CreateApiMapping -> Rep CreateApiMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateApiMapping x -> CreateApiMapping
$cfrom :: forall x. CreateApiMapping -> Rep CreateApiMapping x
Prelude.Generic)
newCreateApiMapping ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreateApiMapping
newCreateApiMapping :: Text -> Text -> Text -> CreateApiMapping
newCreateApiMapping Text
pDomainName_ Text
pStage_ Text
pApiId_ =
CreateApiMapping'
{ $sel:apiMappingKey:CreateApiMapping' :: Maybe Text
apiMappingKey = forall a. Maybe a
Prelude.Nothing,
$sel:domainName:CreateApiMapping' :: Text
domainName = Text
pDomainName_,
$sel:stage:CreateApiMapping' :: Text
stage = Text
pStage_,
$sel:apiId:CreateApiMapping' :: Text
apiId = Text
pApiId_
}
createApiMapping_apiMappingKey :: Lens.Lens' CreateApiMapping (Prelude.Maybe Prelude.Text)
createApiMapping_apiMappingKey :: Lens' CreateApiMapping (Maybe Text)
createApiMapping_apiMappingKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiMapping' {Maybe Text
apiMappingKey :: Maybe Text
$sel:apiMappingKey:CreateApiMapping' :: CreateApiMapping -> Maybe Text
apiMappingKey} -> Maybe Text
apiMappingKey) (\s :: CreateApiMapping
s@CreateApiMapping' {} Maybe Text
a -> CreateApiMapping
s {$sel:apiMappingKey:CreateApiMapping' :: Maybe Text
apiMappingKey = Maybe Text
a} :: CreateApiMapping)
createApiMapping_domainName :: Lens.Lens' CreateApiMapping Prelude.Text
createApiMapping_domainName :: Lens' CreateApiMapping Text
createApiMapping_domainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiMapping' {Text
domainName :: Text
$sel:domainName:CreateApiMapping' :: CreateApiMapping -> Text
domainName} -> Text
domainName) (\s :: CreateApiMapping
s@CreateApiMapping' {} Text
a -> CreateApiMapping
s {$sel:domainName:CreateApiMapping' :: Text
domainName = Text
a} :: CreateApiMapping)
createApiMapping_stage :: Lens.Lens' CreateApiMapping Prelude.Text
createApiMapping_stage :: Lens' CreateApiMapping Text
createApiMapping_stage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiMapping' {Text
stage :: Text
$sel:stage:CreateApiMapping' :: CreateApiMapping -> Text
stage} -> Text
stage) (\s :: CreateApiMapping
s@CreateApiMapping' {} Text
a -> CreateApiMapping
s {$sel:stage:CreateApiMapping' :: Text
stage = Text
a} :: CreateApiMapping)
createApiMapping_apiId :: Lens.Lens' CreateApiMapping Prelude.Text
createApiMapping_apiId :: Lens' CreateApiMapping Text
createApiMapping_apiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiMapping' {Text
apiId :: Text
$sel:apiId:CreateApiMapping' :: CreateApiMapping -> Text
apiId} -> Text
apiId) (\s :: CreateApiMapping
s@CreateApiMapping' {} Text
a -> CreateApiMapping
s {$sel:apiId:CreateApiMapping' :: Text
apiId = Text
a} :: CreateApiMapping)
instance Core.AWSRequest CreateApiMapping where
type
AWSResponse CreateApiMapping =
CreateApiMappingResponse
request :: (Service -> Service)
-> CreateApiMapping -> Request CreateApiMapping
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 CreateApiMapping
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateApiMapping)))
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 ->
Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateApiMappingResponse
CreateApiMappingResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"apiId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"apiMappingId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"apiMappingKey")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"stage")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateApiMapping where
hashWithSalt :: Int -> CreateApiMapping -> Int
hashWithSalt Int
_salt CreateApiMapping' {Maybe Text
Text
apiId :: Text
stage :: Text
domainName :: Text
apiMappingKey :: Maybe Text
$sel:apiId:CreateApiMapping' :: CreateApiMapping -> Text
$sel:stage:CreateApiMapping' :: CreateApiMapping -> Text
$sel:domainName:CreateApiMapping' :: CreateApiMapping -> Text
$sel:apiMappingKey:CreateApiMapping' :: CreateApiMapping -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
apiMappingKey
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
stage
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
apiId
instance Prelude.NFData CreateApiMapping where
rnf :: CreateApiMapping -> ()
rnf CreateApiMapping' {Maybe Text
Text
apiId :: Text
stage :: Text
domainName :: Text
apiMappingKey :: Maybe Text
$sel:apiId:CreateApiMapping' :: CreateApiMapping -> Text
$sel:stage:CreateApiMapping' :: CreateApiMapping -> Text
$sel:domainName:CreateApiMapping' :: CreateApiMapping -> Text
$sel:apiMappingKey:CreateApiMapping' :: CreateApiMapping -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
apiMappingKey
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
domainName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stage
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
apiId
instance Data.ToHeaders CreateApiMapping where
toHeaders :: CreateApiMapping -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateApiMapping where
toJSON :: CreateApiMapping -> Value
toJSON CreateApiMapping' {Maybe Text
Text
apiId :: Text
stage :: Text
domainName :: Text
apiMappingKey :: Maybe Text
$sel:apiId:CreateApiMapping' :: CreateApiMapping -> Text
$sel:stage:CreateApiMapping' :: CreateApiMapping -> Text
$sel:domainName:CreateApiMapping' :: CreateApiMapping -> Text
$sel:apiMappingKey:CreateApiMapping' :: CreateApiMapping -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"apiMappingKey" 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 Text
apiMappingKey,
forall a. a -> Maybe a
Prelude.Just (Key
"stage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
stage),
forall a. a -> Maybe a
Prelude.Just (Key
"apiId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
apiId)
]
)
instance Data.ToPath CreateApiMapping where
toPath :: CreateApiMapping -> ByteString
toPath CreateApiMapping' {Maybe Text
Text
apiId :: Text
stage :: Text
domainName :: Text
apiMappingKey :: Maybe Text
$sel:apiId:CreateApiMapping' :: CreateApiMapping -> Text
$sel:stage:CreateApiMapping' :: CreateApiMapping -> Text
$sel:domainName:CreateApiMapping' :: CreateApiMapping -> Text
$sel:apiMappingKey:CreateApiMapping' :: CreateApiMapping -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v2/domainnames/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
domainName,
ByteString
"/apimappings"
]
instance Data.ToQuery CreateApiMapping where
toQuery :: CreateApiMapping -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateApiMappingResponse = CreateApiMappingResponse'
{
CreateApiMappingResponse -> Maybe Text
apiId :: Prelude.Maybe Prelude.Text,
CreateApiMappingResponse -> Maybe Text
apiMappingId :: Prelude.Maybe Prelude.Text,
CreateApiMappingResponse -> Maybe Text
apiMappingKey :: Prelude.Maybe Prelude.Text,
CreateApiMappingResponse -> Maybe Text
stage :: Prelude.Maybe Prelude.Text,
CreateApiMappingResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateApiMappingResponse -> CreateApiMappingResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateApiMappingResponse -> CreateApiMappingResponse -> Bool
$c/= :: CreateApiMappingResponse -> CreateApiMappingResponse -> Bool
== :: CreateApiMappingResponse -> CreateApiMappingResponse -> Bool
$c== :: CreateApiMappingResponse -> CreateApiMappingResponse -> Bool
Prelude.Eq, ReadPrec [CreateApiMappingResponse]
ReadPrec CreateApiMappingResponse
Int -> ReadS CreateApiMappingResponse
ReadS [CreateApiMappingResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateApiMappingResponse]
$creadListPrec :: ReadPrec [CreateApiMappingResponse]
readPrec :: ReadPrec CreateApiMappingResponse
$creadPrec :: ReadPrec CreateApiMappingResponse
readList :: ReadS [CreateApiMappingResponse]
$creadList :: ReadS [CreateApiMappingResponse]
readsPrec :: Int -> ReadS CreateApiMappingResponse
$creadsPrec :: Int -> ReadS CreateApiMappingResponse
Prelude.Read, Int -> CreateApiMappingResponse -> ShowS
[CreateApiMappingResponse] -> ShowS
CreateApiMappingResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateApiMappingResponse] -> ShowS
$cshowList :: [CreateApiMappingResponse] -> ShowS
show :: CreateApiMappingResponse -> String
$cshow :: CreateApiMappingResponse -> String
showsPrec :: Int -> CreateApiMappingResponse -> ShowS
$cshowsPrec :: Int -> CreateApiMappingResponse -> ShowS
Prelude.Show, forall x.
Rep CreateApiMappingResponse x -> CreateApiMappingResponse
forall x.
CreateApiMappingResponse -> Rep CreateApiMappingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateApiMappingResponse x -> CreateApiMappingResponse
$cfrom :: forall x.
CreateApiMappingResponse -> Rep CreateApiMappingResponse x
Prelude.Generic)
newCreateApiMappingResponse ::
Prelude.Int ->
CreateApiMappingResponse
newCreateApiMappingResponse :: Int -> CreateApiMappingResponse
newCreateApiMappingResponse Int
pHttpStatus_ =
CreateApiMappingResponse'
{ $sel:apiId:CreateApiMappingResponse' :: Maybe Text
apiId = forall a. Maybe a
Prelude.Nothing,
$sel:apiMappingId:CreateApiMappingResponse' :: Maybe Text
apiMappingId = forall a. Maybe a
Prelude.Nothing,
$sel:apiMappingKey:CreateApiMappingResponse' :: Maybe Text
apiMappingKey = forall a. Maybe a
Prelude.Nothing,
$sel:stage:CreateApiMappingResponse' :: Maybe Text
stage = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateApiMappingResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createApiMappingResponse_apiId :: Lens.Lens' CreateApiMappingResponse (Prelude.Maybe Prelude.Text)
createApiMappingResponse_apiId :: Lens' CreateApiMappingResponse (Maybe Text)
createApiMappingResponse_apiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiMappingResponse' {Maybe Text
apiId :: Maybe Text
$sel:apiId:CreateApiMappingResponse' :: CreateApiMappingResponse -> Maybe Text
apiId} -> Maybe Text
apiId) (\s :: CreateApiMappingResponse
s@CreateApiMappingResponse' {} Maybe Text
a -> CreateApiMappingResponse
s {$sel:apiId:CreateApiMappingResponse' :: Maybe Text
apiId = Maybe Text
a} :: CreateApiMappingResponse)
createApiMappingResponse_apiMappingId :: Lens.Lens' CreateApiMappingResponse (Prelude.Maybe Prelude.Text)
createApiMappingResponse_apiMappingId :: Lens' CreateApiMappingResponse (Maybe Text)
createApiMappingResponse_apiMappingId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiMappingResponse' {Maybe Text
apiMappingId :: Maybe Text
$sel:apiMappingId:CreateApiMappingResponse' :: CreateApiMappingResponse -> Maybe Text
apiMappingId} -> Maybe Text
apiMappingId) (\s :: CreateApiMappingResponse
s@CreateApiMappingResponse' {} Maybe Text
a -> CreateApiMappingResponse
s {$sel:apiMappingId:CreateApiMappingResponse' :: Maybe Text
apiMappingId = Maybe Text
a} :: CreateApiMappingResponse)
createApiMappingResponse_apiMappingKey :: Lens.Lens' CreateApiMappingResponse (Prelude.Maybe Prelude.Text)
createApiMappingResponse_apiMappingKey :: Lens' CreateApiMappingResponse (Maybe Text)
createApiMappingResponse_apiMappingKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiMappingResponse' {Maybe Text
apiMappingKey :: Maybe Text
$sel:apiMappingKey:CreateApiMappingResponse' :: CreateApiMappingResponse -> Maybe Text
apiMappingKey} -> Maybe Text
apiMappingKey) (\s :: CreateApiMappingResponse
s@CreateApiMappingResponse' {} Maybe Text
a -> CreateApiMappingResponse
s {$sel:apiMappingKey:CreateApiMappingResponse' :: Maybe Text
apiMappingKey = Maybe Text
a} :: CreateApiMappingResponse)
createApiMappingResponse_stage :: Lens.Lens' CreateApiMappingResponse (Prelude.Maybe Prelude.Text)
createApiMappingResponse_stage :: Lens' CreateApiMappingResponse (Maybe Text)
createApiMappingResponse_stage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiMappingResponse' {Maybe Text
stage :: Maybe Text
$sel:stage:CreateApiMappingResponse' :: CreateApiMappingResponse -> Maybe Text
stage} -> Maybe Text
stage) (\s :: CreateApiMappingResponse
s@CreateApiMappingResponse' {} Maybe Text
a -> CreateApiMappingResponse
s {$sel:stage:CreateApiMappingResponse' :: Maybe Text
stage = Maybe Text
a} :: CreateApiMappingResponse)
createApiMappingResponse_httpStatus :: Lens.Lens' CreateApiMappingResponse Prelude.Int
createApiMappingResponse_httpStatus :: Lens' CreateApiMappingResponse Int
createApiMappingResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiMappingResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateApiMappingResponse' :: CreateApiMappingResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateApiMappingResponse
s@CreateApiMappingResponse' {} Int
a -> CreateApiMappingResponse
s {$sel:httpStatus:CreateApiMappingResponse' :: Int
httpStatus = Int
a} :: CreateApiMappingResponse)
instance Prelude.NFData CreateApiMappingResponse where
rnf :: CreateApiMappingResponse -> ()
rnf CreateApiMappingResponse' {Int
Maybe Text
httpStatus :: Int
stage :: Maybe Text
apiMappingKey :: Maybe Text
apiMappingId :: Maybe Text
apiId :: Maybe Text
$sel:httpStatus:CreateApiMappingResponse' :: CreateApiMappingResponse -> Int
$sel:stage:CreateApiMappingResponse' :: CreateApiMappingResponse -> Maybe Text
$sel:apiMappingKey:CreateApiMappingResponse' :: CreateApiMappingResponse -> Maybe Text
$sel:apiMappingId:CreateApiMappingResponse' :: CreateApiMappingResponse -> Maybe Text
$sel:apiId:CreateApiMappingResponse' :: CreateApiMappingResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
apiId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
apiMappingId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
apiMappingKey
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stage
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus