{-# 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.GetApiMappings
(
GetApiMappings (..),
newGetApiMappings,
getApiMappings_nextToken,
getApiMappings_maxResults,
getApiMappings_domainName,
GetApiMappingsResponse (..),
newGetApiMappingsResponse,
getApiMappingsResponse_items,
getApiMappingsResponse_nextToken,
getApiMappingsResponse_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 GetApiMappings = GetApiMappings'
{
GetApiMappings -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetApiMappings -> Maybe Text
maxResults :: Prelude.Maybe Prelude.Text,
GetApiMappings -> Text
domainName :: Prelude.Text
}
deriving (GetApiMappings -> GetApiMappings -> Bool
(GetApiMappings -> GetApiMappings -> Bool)
-> (GetApiMappings -> GetApiMappings -> Bool) -> Eq GetApiMappings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApiMappings -> GetApiMappings -> Bool
$c/= :: GetApiMappings -> GetApiMappings -> Bool
== :: GetApiMappings -> GetApiMappings -> Bool
$c== :: GetApiMappings -> GetApiMappings -> Bool
Prelude.Eq, ReadPrec [GetApiMappings]
ReadPrec GetApiMappings
Int -> ReadS GetApiMappings
ReadS [GetApiMappings]
(Int -> ReadS GetApiMappings)
-> ReadS [GetApiMappings]
-> ReadPrec GetApiMappings
-> ReadPrec [GetApiMappings]
-> Read GetApiMappings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApiMappings]
$creadListPrec :: ReadPrec [GetApiMappings]
readPrec :: ReadPrec GetApiMappings
$creadPrec :: ReadPrec GetApiMappings
readList :: ReadS [GetApiMappings]
$creadList :: ReadS [GetApiMappings]
readsPrec :: Int -> ReadS GetApiMappings
$creadsPrec :: Int -> ReadS GetApiMappings
Prelude.Read, Int -> GetApiMappings -> ShowS
[GetApiMappings] -> ShowS
GetApiMappings -> String
(Int -> GetApiMappings -> ShowS)
-> (GetApiMappings -> String)
-> ([GetApiMappings] -> ShowS)
-> Show GetApiMappings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApiMappings] -> ShowS
$cshowList :: [GetApiMappings] -> ShowS
show :: GetApiMappings -> String
$cshow :: GetApiMappings -> String
showsPrec :: Int -> GetApiMappings -> ShowS
$cshowsPrec :: Int -> GetApiMappings -> ShowS
Prelude.Show, (forall x. GetApiMappings -> Rep GetApiMappings x)
-> (forall x. Rep GetApiMappings x -> GetApiMappings)
-> Generic GetApiMappings
forall x. Rep GetApiMappings x -> GetApiMappings
forall x. GetApiMappings -> Rep GetApiMappings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetApiMappings x -> GetApiMappings
$cfrom :: forall x. GetApiMappings -> Rep GetApiMappings x
Prelude.Generic)
newGetApiMappings ::
Prelude.Text ->
GetApiMappings
newGetApiMappings :: Text -> GetApiMappings
newGetApiMappings Text
pDomainName_ =
GetApiMappings' :: Maybe Text -> Maybe Text -> Text -> GetApiMappings
GetApiMappings'
{ $sel:nextToken:GetApiMappings' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:GetApiMappings' :: Maybe Text
maxResults = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:domainName:GetApiMappings' :: Text
domainName = Text
pDomainName_
}
getApiMappings_nextToken :: Lens.Lens' GetApiMappings (Prelude.Maybe Prelude.Text)
getApiMappings_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetApiMappings -> f GetApiMappings
getApiMappings_nextToken = (GetApiMappings -> Maybe Text)
-> (GetApiMappings -> Maybe Text -> GetApiMappings)
-> Lens GetApiMappings GetApiMappings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApiMappings' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetApiMappings' :: GetApiMappings -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetApiMappings
s@GetApiMappings' {} Maybe Text
a -> GetApiMappings
s {$sel:nextToken:GetApiMappings' :: Maybe Text
nextToken = Maybe Text
a} :: GetApiMappings)
getApiMappings_maxResults :: Lens.Lens' GetApiMappings (Prelude.Maybe Prelude.Text)
getApiMappings_maxResults :: (Maybe Text -> f (Maybe Text))
-> GetApiMappings -> f GetApiMappings
getApiMappings_maxResults = (GetApiMappings -> Maybe Text)
-> (GetApiMappings -> Maybe Text -> GetApiMappings)
-> Lens GetApiMappings GetApiMappings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApiMappings' {Maybe Text
maxResults :: Maybe Text
$sel:maxResults:GetApiMappings' :: GetApiMappings -> Maybe Text
maxResults} -> Maybe Text
maxResults) (\s :: GetApiMappings
s@GetApiMappings' {} Maybe Text
a -> GetApiMappings
s {$sel:maxResults:GetApiMappings' :: Maybe Text
maxResults = Maybe Text
a} :: GetApiMappings)
getApiMappings_domainName :: Lens.Lens' GetApiMappings Prelude.Text
getApiMappings_domainName :: (Text -> f Text) -> GetApiMappings -> f GetApiMappings
getApiMappings_domainName = (GetApiMappings -> Text)
-> (GetApiMappings -> Text -> GetApiMappings)
-> Lens GetApiMappings GetApiMappings Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApiMappings' {Text
domainName :: Text
$sel:domainName:GetApiMappings' :: GetApiMappings -> Text
domainName} -> Text
domainName) (\s :: GetApiMappings
s@GetApiMappings' {} Text
a -> GetApiMappings
s {$sel:domainName:GetApiMappings' :: Text
domainName = Text
a} :: GetApiMappings)
instance Core.AWSRequest GetApiMappings where
type
AWSResponse GetApiMappings =
GetApiMappingsResponse
request :: GetApiMappings -> Request GetApiMappings
request = Service -> GetApiMappings -> Request GetApiMappings
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetApiMappings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetApiMappings)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetApiMappings))
-> Logger
-> Service
-> Proxy GetApiMappings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetApiMappings)))
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 [ApiMapping] -> Maybe Text -> Int -> GetApiMappingsResponse
GetApiMappingsResponse'
(Maybe [ApiMapping] -> Maybe Text -> Int -> GetApiMappingsResponse)
-> Either String (Maybe [ApiMapping])
-> Either String (Maybe Text -> Int -> GetApiMappingsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [ApiMapping]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"items" Either String (Maybe (Maybe [ApiMapping]))
-> Maybe [ApiMapping] -> Either String (Maybe [ApiMapping])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ApiMapping]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> GetApiMappingsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetApiMappingsResponse)
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
"nextToken")
Either String (Int -> GetApiMappingsResponse)
-> Either String Int -> Either String GetApiMappingsResponse
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 GetApiMappings
instance Prelude.NFData GetApiMappings
instance Core.ToHeaders GetApiMappings where
toHeaders :: GetApiMappings -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetApiMappings -> 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 GetApiMappings where
toPath :: GetApiMappings -> ByteString
toPath GetApiMappings' {Maybe Text
Text
domainName :: Text
maxResults :: Maybe Text
nextToken :: Maybe Text
$sel:domainName:GetApiMappings' :: GetApiMappings -> Text
$sel:maxResults:GetApiMappings' :: GetApiMappings -> Maybe Text
$sel:nextToken:GetApiMappings' :: GetApiMappings -> Maybe 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"
]
instance Core.ToQuery GetApiMappings where
toQuery :: GetApiMappings -> QueryString
toQuery GetApiMappings' {Maybe Text
Text
domainName :: Text
maxResults :: Maybe Text
nextToken :: Maybe Text
$sel:domainName:GetApiMappings' :: GetApiMappings -> Text
$sel:maxResults:GetApiMappings' :: GetApiMappings -> Maybe Text
$sel:nextToken:GetApiMappings' :: GetApiMappings -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"maxResults" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
maxResults
]
data GetApiMappingsResponse = GetApiMappingsResponse'
{
GetApiMappingsResponse -> Maybe [ApiMapping]
items :: Prelude.Maybe [ApiMapping],
GetApiMappingsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetApiMappingsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetApiMappingsResponse -> GetApiMappingsResponse -> Bool
(GetApiMappingsResponse -> GetApiMappingsResponse -> Bool)
-> (GetApiMappingsResponse -> GetApiMappingsResponse -> Bool)
-> Eq GetApiMappingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApiMappingsResponse -> GetApiMappingsResponse -> Bool
$c/= :: GetApiMappingsResponse -> GetApiMappingsResponse -> Bool
== :: GetApiMappingsResponse -> GetApiMappingsResponse -> Bool
$c== :: GetApiMappingsResponse -> GetApiMappingsResponse -> Bool
Prelude.Eq, ReadPrec [GetApiMappingsResponse]
ReadPrec GetApiMappingsResponse
Int -> ReadS GetApiMappingsResponse
ReadS [GetApiMappingsResponse]
(Int -> ReadS GetApiMappingsResponse)
-> ReadS [GetApiMappingsResponse]
-> ReadPrec GetApiMappingsResponse
-> ReadPrec [GetApiMappingsResponse]
-> Read GetApiMappingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApiMappingsResponse]
$creadListPrec :: ReadPrec [GetApiMappingsResponse]
readPrec :: ReadPrec GetApiMappingsResponse
$creadPrec :: ReadPrec GetApiMappingsResponse
readList :: ReadS [GetApiMappingsResponse]
$creadList :: ReadS [GetApiMappingsResponse]
readsPrec :: Int -> ReadS GetApiMappingsResponse
$creadsPrec :: Int -> ReadS GetApiMappingsResponse
Prelude.Read, Int -> GetApiMappingsResponse -> ShowS
[GetApiMappingsResponse] -> ShowS
GetApiMappingsResponse -> String
(Int -> GetApiMappingsResponse -> ShowS)
-> (GetApiMappingsResponse -> String)
-> ([GetApiMappingsResponse] -> ShowS)
-> Show GetApiMappingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApiMappingsResponse] -> ShowS
$cshowList :: [GetApiMappingsResponse] -> ShowS
show :: GetApiMappingsResponse -> String
$cshow :: GetApiMappingsResponse -> String
showsPrec :: Int -> GetApiMappingsResponse -> ShowS
$cshowsPrec :: Int -> GetApiMappingsResponse -> ShowS
Prelude.Show, (forall x. GetApiMappingsResponse -> Rep GetApiMappingsResponse x)
-> (forall x.
Rep GetApiMappingsResponse x -> GetApiMappingsResponse)
-> Generic GetApiMappingsResponse
forall x. Rep GetApiMappingsResponse x -> GetApiMappingsResponse
forall x. GetApiMappingsResponse -> Rep GetApiMappingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetApiMappingsResponse x -> GetApiMappingsResponse
$cfrom :: forall x. GetApiMappingsResponse -> Rep GetApiMappingsResponse x
Prelude.Generic)
newGetApiMappingsResponse ::
Prelude.Int ->
GetApiMappingsResponse
newGetApiMappingsResponse :: Int -> GetApiMappingsResponse
newGetApiMappingsResponse Int
pHttpStatus_ =
GetApiMappingsResponse' :: Maybe [ApiMapping] -> Maybe Text -> Int -> GetApiMappingsResponse
GetApiMappingsResponse'
{ $sel:items:GetApiMappingsResponse' :: Maybe [ApiMapping]
items = Maybe [ApiMapping]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetApiMappingsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetApiMappingsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getApiMappingsResponse_items :: Lens.Lens' GetApiMappingsResponse (Prelude.Maybe [ApiMapping])
getApiMappingsResponse_items :: (Maybe [ApiMapping] -> f (Maybe [ApiMapping]))
-> GetApiMappingsResponse -> f GetApiMappingsResponse
getApiMappingsResponse_items = (GetApiMappingsResponse -> Maybe [ApiMapping])
-> (GetApiMappingsResponse
-> Maybe [ApiMapping] -> GetApiMappingsResponse)
-> Lens
GetApiMappingsResponse
GetApiMappingsResponse
(Maybe [ApiMapping])
(Maybe [ApiMapping])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApiMappingsResponse' {Maybe [ApiMapping]
items :: Maybe [ApiMapping]
$sel:items:GetApiMappingsResponse' :: GetApiMappingsResponse -> Maybe [ApiMapping]
items} -> Maybe [ApiMapping]
items) (\s :: GetApiMappingsResponse
s@GetApiMappingsResponse' {} Maybe [ApiMapping]
a -> GetApiMappingsResponse
s {$sel:items:GetApiMappingsResponse' :: Maybe [ApiMapping]
items = Maybe [ApiMapping]
a} :: GetApiMappingsResponse) ((Maybe [ApiMapping] -> f (Maybe [ApiMapping]))
-> GetApiMappingsResponse -> f GetApiMappingsResponse)
-> ((Maybe [ApiMapping] -> f (Maybe [ApiMapping]))
-> Maybe [ApiMapping] -> f (Maybe [ApiMapping]))
-> (Maybe [ApiMapping] -> f (Maybe [ApiMapping]))
-> GetApiMappingsResponse
-> f GetApiMappingsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ApiMapping] [ApiMapping] [ApiMapping] [ApiMapping]
-> Iso
(Maybe [ApiMapping])
(Maybe [ApiMapping])
(Maybe [ApiMapping])
(Maybe [ApiMapping])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [ApiMapping] [ApiMapping] [ApiMapping] [ApiMapping]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getApiMappingsResponse_nextToken :: Lens.Lens' GetApiMappingsResponse (Prelude.Maybe Prelude.Text)
getApiMappingsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetApiMappingsResponse -> f GetApiMappingsResponse
getApiMappingsResponse_nextToken = (GetApiMappingsResponse -> Maybe Text)
-> (GetApiMappingsResponse -> Maybe Text -> GetApiMappingsResponse)
-> Lens
GetApiMappingsResponse
GetApiMappingsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApiMappingsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetApiMappingsResponse' :: GetApiMappingsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetApiMappingsResponse
s@GetApiMappingsResponse' {} Maybe Text
a -> GetApiMappingsResponse
s {$sel:nextToken:GetApiMappingsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetApiMappingsResponse)
getApiMappingsResponse_httpStatus :: Lens.Lens' GetApiMappingsResponse Prelude.Int
getApiMappingsResponse_httpStatus :: (Int -> f Int)
-> GetApiMappingsResponse -> f GetApiMappingsResponse
getApiMappingsResponse_httpStatus = (GetApiMappingsResponse -> Int)
-> (GetApiMappingsResponse -> Int -> GetApiMappingsResponse)
-> Lens GetApiMappingsResponse GetApiMappingsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApiMappingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetApiMappingsResponse' :: GetApiMappingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetApiMappingsResponse
s@GetApiMappingsResponse' {} Int
a -> GetApiMappingsResponse
s {$sel:httpStatus:GetApiMappingsResponse' :: Int
httpStatus = Int
a} :: GetApiMappingsResponse)
instance Prelude.NFData GetApiMappingsResponse