{-# 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.GetApiMapping
(
GetApiMapping (..),
newGetApiMapping,
getApiMapping_apiMappingId,
getApiMapping_domainName,
GetApiMappingResponse (..),
newGetApiMappingResponse,
getApiMappingResponse_stage,
getApiMappingResponse_apiId,
getApiMappingResponse_apiMappingKey,
getApiMappingResponse_apiMappingId,
getApiMappingResponse_httpStatus,
)
where
import Amazonka.ApiGatewayV2.Types
import qualified Amazonka.Core as Core
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 GetApiMapping = GetApiMapping'
{
GetApiMapping -> Text
apiMappingId :: Prelude.Text,
GetApiMapping -> Text
domainName :: Prelude.Text
}
deriving (GetApiMapping -> GetApiMapping -> Bool
(GetApiMapping -> GetApiMapping -> Bool)
-> (GetApiMapping -> GetApiMapping -> Bool) -> Eq GetApiMapping
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApiMapping -> GetApiMapping -> Bool
$c/= :: GetApiMapping -> GetApiMapping -> Bool
== :: GetApiMapping -> GetApiMapping -> Bool
$c== :: GetApiMapping -> GetApiMapping -> Bool
Prelude.Eq, ReadPrec [GetApiMapping]
ReadPrec GetApiMapping
Int -> ReadS GetApiMapping
ReadS [GetApiMapping]
(Int -> ReadS GetApiMapping)
-> ReadS [GetApiMapping]
-> ReadPrec GetApiMapping
-> ReadPrec [GetApiMapping]
-> Read GetApiMapping
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApiMapping]
$creadListPrec :: ReadPrec [GetApiMapping]
readPrec :: ReadPrec GetApiMapping
$creadPrec :: ReadPrec GetApiMapping
readList :: ReadS [GetApiMapping]
$creadList :: ReadS [GetApiMapping]
readsPrec :: Int -> ReadS GetApiMapping
$creadsPrec :: Int -> ReadS GetApiMapping
Prelude.Read, Int -> GetApiMapping -> ShowS
[GetApiMapping] -> ShowS
GetApiMapping -> String
(Int -> GetApiMapping -> ShowS)
-> (GetApiMapping -> String)
-> ([GetApiMapping] -> ShowS)
-> Show GetApiMapping
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApiMapping] -> ShowS
$cshowList :: [GetApiMapping] -> ShowS
show :: GetApiMapping -> String
$cshow :: GetApiMapping -> String
showsPrec :: Int -> GetApiMapping -> ShowS
$cshowsPrec :: Int -> GetApiMapping -> ShowS
Prelude.Show, (forall x. GetApiMapping -> Rep GetApiMapping x)
-> (forall x. Rep GetApiMapping x -> GetApiMapping)
-> Generic GetApiMapping
forall x. Rep GetApiMapping x -> GetApiMapping
forall x. GetApiMapping -> Rep GetApiMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetApiMapping x -> GetApiMapping
$cfrom :: forall x. GetApiMapping -> Rep GetApiMapping x
Prelude.Generic)
newGetApiMapping ::
Prelude.Text ->
Prelude.Text ->
GetApiMapping
newGetApiMapping :: Text -> Text -> GetApiMapping
newGetApiMapping Text
pApiMappingId_ Text
pDomainName_ =
GetApiMapping' :: Text -> Text -> GetApiMapping
GetApiMapping'
{ $sel:apiMappingId:GetApiMapping' :: Text
apiMappingId = Text
pApiMappingId_,
$sel:domainName:GetApiMapping' :: Text
domainName = Text
pDomainName_
}
getApiMapping_apiMappingId :: Lens.Lens' GetApiMapping Prelude.Text
getApiMapping_apiMappingId :: (Text -> f Text) -> GetApiMapping -> f GetApiMapping
getApiMapping_apiMappingId = (GetApiMapping -> Text)
-> (GetApiMapping -> Text -> GetApiMapping)
-> Lens GetApiMapping GetApiMapping Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApiMapping' {Text
apiMappingId :: Text
$sel:apiMappingId:GetApiMapping' :: GetApiMapping -> Text
apiMappingId} -> Text
apiMappingId) (\s :: GetApiMapping
s@GetApiMapping' {} Text
a -> GetApiMapping
s {$sel:apiMappingId:GetApiMapping' :: Text
apiMappingId = Text
a} :: GetApiMapping)
getApiMapping_domainName :: Lens.Lens' GetApiMapping Prelude.Text
getApiMapping_domainName :: (Text -> f Text) -> GetApiMapping -> f GetApiMapping
getApiMapping_domainName = (GetApiMapping -> Text)
-> (GetApiMapping -> Text -> GetApiMapping)
-> Lens GetApiMapping GetApiMapping Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApiMapping' {Text
domainName :: Text
$sel:domainName:GetApiMapping' :: GetApiMapping -> Text
domainName} -> Text
domainName) (\s :: GetApiMapping
s@GetApiMapping' {} Text
a -> GetApiMapping
s {$sel:domainName:GetApiMapping' :: Text
domainName = Text
a} :: GetApiMapping)
instance Core.AWSRequest GetApiMapping where
type
AWSResponse GetApiMapping =
GetApiMappingResponse
request :: GetApiMapping -> Request GetApiMapping
request = Service -> GetApiMapping -> Request GetApiMapping
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetApiMapping
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetApiMapping)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetApiMapping))
-> Logger
-> Service
-> Proxy GetApiMapping
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetApiMapping)))
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 Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> GetApiMappingResponse
GetApiMappingResponse'
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> GetApiMappingResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text
-> Maybe Text -> Maybe Text -> Int -> GetApiMappingResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"stage")
Either
String
(Maybe Text
-> Maybe Text -> Maybe Text -> Int -> GetApiMappingResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Maybe Text -> Int -> GetApiMappingResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"apiId")
Either
String (Maybe Text -> Maybe Text -> Int -> GetApiMappingResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> GetApiMappingResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"apiMappingKey")
Either String (Maybe Text -> Int -> GetApiMappingResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetApiMappingResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"apiMappingId")
Either String (Int -> GetApiMappingResponse)
-> Either String Int -> Either String GetApiMappingResponse
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 GetApiMapping
instance Prelude.NFData GetApiMapping
instance Core.ToHeaders GetApiMapping where
toHeaders :: GetApiMapping -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetApiMapping -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath GetApiMapping where
toPath :: GetApiMapping -> ByteString
toPath GetApiMapping' {Text
domainName :: Text
apiMappingId :: Text
$sel:domainName:GetApiMapping' :: GetApiMapping -> Text
$sel:apiMappingId:GetApiMapping' :: GetApiMapping -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v2/domainnames/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
domainName,
ByteString
"/apimappings/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
apiMappingId
]
instance Core.ToQuery GetApiMapping where
toQuery :: GetApiMapping -> QueryString
toQuery = QueryString -> GetApiMapping -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetApiMappingResponse = GetApiMappingResponse'
{
GetApiMappingResponse -> Maybe Text
stage :: Prelude.Maybe Prelude.Text,
GetApiMappingResponse -> Maybe Text
apiId :: Prelude.Maybe Prelude.Text,
GetApiMappingResponse -> Maybe Text
apiMappingKey :: Prelude.Maybe Prelude.Text,
GetApiMappingResponse -> Maybe Text
apiMappingId :: Prelude.Maybe Prelude.Text,
GetApiMappingResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetApiMappingResponse -> GetApiMappingResponse -> Bool
(GetApiMappingResponse -> GetApiMappingResponse -> Bool)
-> (GetApiMappingResponse -> GetApiMappingResponse -> Bool)
-> Eq GetApiMappingResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApiMappingResponse -> GetApiMappingResponse -> Bool
$c/= :: GetApiMappingResponse -> GetApiMappingResponse -> Bool
== :: GetApiMappingResponse -> GetApiMappingResponse -> Bool
$c== :: GetApiMappingResponse -> GetApiMappingResponse -> Bool
Prelude.Eq, ReadPrec [GetApiMappingResponse]
ReadPrec GetApiMappingResponse
Int -> ReadS GetApiMappingResponse
ReadS [GetApiMappingResponse]
(Int -> ReadS GetApiMappingResponse)
-> ReadS [GetApiMappingResponse]
-> ReadPrec GetApiMappingResponse
-> ReadPrec [GetApiMappingResponse]
-> Read GetApiMappingResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApiMappingResponse]
$creadListPrec :: ReadPrec [GetApiMappingResponse]
readPrec :: ReadPrec GetApiMappingResponse
$creadPrec :: ReadPrec GetApiMappingResponse
readList :: ReadS [GetApiMappingResponse]
$creadList :: ReadS [GetApiMappingResponse]
readsPrec :: Int -> ReadS GetApiMappingResponse
$creadsPrec :: Int -> ReadS GetApiMappingResponse
Prelude.Read, Int -> GetApiMappingResponse -> ShowS
[GetApiMappingResponse] -> ShowS
GetApiMappingResponse -> String
(Int -> GetApiMappingResponse -> ShowS)
-> (GetApiMappingResponse -> String)
-> ([GetApiMappingResponse] -> ShowS)
-> Show GetApiMappingResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApiMappingResponse] -> ShowS
$cshowList :: [GetApiMappingResponse] -> ShowS
show :: GetApiMappingResponse -> String
$cshow :: GetApiMappingResponse -> String
showsPrec :: Int -> GetApiMappingResponse -> ShowS
$cshowsPrec :: Int -> GetApiMappingResponse -> ShowS
Prelude.Show, (forall x. GetApiMappingResponse -> Rep GetApiMappingResponse x)
-> (forall x. Rep GetApiMappingResponse x -> GetApiMappingResponse)
-> Generic GetApiMappingResponse
forall x. Rep GetApiMappingResponse x -> GetApiMappingResponse
forall x. GetApiMappingResponse -> Rep GetApiMappingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetApiMappingResponse x -> GetApiMappingResponse
$cfrom :: forall x. GetApiMappingResponse -> Rep GetApiMappingResponse x
Prelude.Generic)
newGetApiMappingResponse ::
Prelude.Int ->
GetApiMappingResponse
newGetApiMappingResponse :: Int -> GetApiMappingResponse
newGetApiMappingResponse Int
pHttpStatus_ =
GetApiMappingResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> GetApiMappingResponse
GetApiMappingResponse'
{ $sel:stage:GetApiMappingResponse' :: Maybe Text
stage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:apiId:GetApiMappingResponse' :: Maybe Text
apiId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:apiMappingKey:GetApiMappingResponse' :: Maybe Text
apiMappingKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:apiMappingId:GetApiMappingResponse' :: Maybe Text
apiMappingId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetApiMappingResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getApiMappingResponse_stage :: Lens.Lens' GetApiMappingResponse (Prelude.Maybe Prelude.Text)
getApiMappingResponse_stage :: (Maybe Text -> f (Maybe Text))
-> GetApiMappingResponse -> f GetApiMappingResponse
getApiMappingResponse_stage = (GetApiMappingResponse -> Maybe Text)
-> (GetApiMappingResponse -> Maybe Text -> GetApiMappingResponse)
-> Lens
GetApiMappingResponse
GetApiMappingResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApiMappingResponse' {Maybe Text
stage :: Maybe Text
$sel:stage:GetApiMappingResponse' :: GetApiMappingResponse -> Maybe Text
stage} -> Maybe Text
stage) (\s :: GetApiMappingResponse
s@GetApiMappingResponse' {} Maybe Text
a -> GetApiMappingResponse
s {$sel:stage:GetApiMappingResponse' :: Maybe Text
stage = Maybe Text
a} :: GetApiMappingResponse)
getApiMappingResponse_apiId :: Lens.Lens' GetApiMappingResponse (Prelude.Maybe Prelude.Text)
getApiMappingResponse_apiId :: (Maybe Text -> f (Maybe Text))
-> GetApiMappingResponse -> f GetApiMappingResponse
getApiMappingResponse_apiId = (GetApiMappingResponse -> Maybe Text)
-> (GetApiMappingResponse -> Maybe Text -> GetApiMappingResponse)
-> Lens
GetApiMappingResponse
GetApiMappingResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApiMappingResponse' {Maybe Text
apiId :: Maybe Text
$sel:apiId:GetApiMappingResponse' :: GetApiMappingResponse -> Maybe Text
apiId} -> Maybe Text
apiId) (\s :: GetApiMappingResponse
s@GetApiMappingResponse' {} Maybe Text
a -> GetApiMappingResponse
s {$sel:apiId:GetApiMappingResponse' :: Maybe Text
apiId = Maybe Text
a} :: GetApiMappingResponse)
getApiMappingResponse_apiMappingKey :: Lens.Lens' GetApiMappingResponse (Prelude.Maybe Prelude.Text)
getApiMappingResponse_apiMappingKey :: (Maybe Text -> f (Maybe Text))
-> GetApiMappingResponse -> f GetApiMappingResponse
getApiMappingResponse_apiMappingKey = (GetApiMappingResponse -> Maybe Text)
-> (GetApiMappingResponse -> Maybe Text -> GetApiMappingResponse)
-> Lens
GetApiMappingResponse
GetApiMappingResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApiMappingResponse' {Maybe Text
apiMappingKey :: Maybe Text
$sel:apiMappingKey:GetApiMappingResponse' :: GetApiMappingResponse -> Maybe Text
apiMappingKey} -> Maybe Text
apiMappingKey) (\s :: GetApiMappingResponse
s@GetApiMappingResponse' {} Maybe Text
a -> GetApiMappingResponse
s {$sel:apiMappingKey:GetApiMappingResponse' :: Maybe Text
apiMappingKey = Maybe Text
a} :: GetApiMappingResponse)
getApiMappingResponse_apiMappingId :: Lens.Lens' GetApiMappingResponse (Prelude.Maybe Prelude.Text)
getApiMappingResponse_apiMappingId :: (Maybe Text -> f (Maybe Text))
-> GetApiMappingResponse -> f GetApiMappingResponse
getApiMappingResponse_apiMappingId = (GetApiMappingResponse -> Maybe Text)
-> (GetApiMappingResponse -> Maybe Text -> GetApiMappingResponse)
-> Lens
GetApiMappingResponse
GetApiMappingResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApiMappingResponse' {Maybe Text
apiMappingId :: Maybe Text
$sel:apiMappingId:GetApiMappingResponse' :: GetApiMappingResponse -> Maybe Text
apiMappingId} -> Maybe Text
apiMappingId) (\s :: GetApiMappingResponse
s@GetApiMappingResponse' {} Maybe Text
a -> GetApiMappingResponse
s {$sel:apiMappingId:GetApiMappingResponse' :: Maybe Text
apiMappingId = Maybe Text
a} :: GetApiMappingResponse)
getApiMappingResponse_httpStatus :: Lens.Lens' GetApiMappingResponse Prelude.Int
getApiMappingResponse_httpStatus :: (Int -> f Int) -> GetApiMappingResponse -> f GetApiMappingResponse
getApiMappingResponse_httpStatus = (GetApiMappingResponse -> Int)
-> (GetApiMappingResponse -> Int -> GetApiMappingResponse)
-> Lens GetApiMappingResponse GetApiMappingResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApiMappingResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetApiMappingResponse' :: GetApiMappingResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetApiMappingResponse
s@GetApiMappingResponse' {} Int
a -> GetApiMappingResponse
s {$sel:httpStatus:GetApiMappingResponse' :: Int
httpStatus = Int
a} :: GetApiMappingResponse)
instance Prelude.NFData GetApiMappingResponse