{-# 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.GetStages
(
GetStages (..),
newGetStages,
getStages_nextToken,
getStages_maxResults,
getStages_apiId,
GetStagesResponse (..),
newGetStagesResponse,
getStagesResponse_items,
getStagesResponse_nextToken,
getStagesResponse_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 GetStages = GetStages'
{
GetStages -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetStages -> Maybe Text
maxResults :: Prelude.Maybe Prelude.Text,
GetStages -> Text
apiId :: Prelude.Text
}
deriving (GetStages -> GetStages -> Bool
(GetStages -> GetStages -> Bool)
-> (GetStages -> GetStages -> Bool) -> Eq GetStages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStages -> GetStages -> Bool
$c/= :: GetStages -> GetStages -> Bool
== :: GetStages -> GetStages -> Bool
$c== :: GetStages -> GetStages -> Bool
Prelude.Eq, ReadPrec [GetStages]
ReadPrec GetStages
Int -> ReadS GetStages
ReadS [GetStages]
(Int -> ReadS GetStages)
-> ReadS [GetStages]
-> ReadPrec GetStages
-> ReadPrec [GetStages]
-> Read GetStages
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStages]
$creadListPrec :: ReadPrec [GetStages]
readPrec :: ReadPrec GetStages
$creadPrec :: ReadPrec GetStages
readList :: ReadS [GetStages]
$creadList :: ReadS [GetStages]
readsPrec :: Int -> ReadS GetStages
$creadsPrec :: Int -> ReadS GetStages
Prelude.Read, Int -> GetStages -> ShowS
[GetStages] -> ShowS
GetStages -> String
(Int -> GetStages -> ShowS)
-> (GetStages -> String)
-> ([GetStages] -> ShowS)
-> Show GetStages
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStages] -> ShowS
$cshowList :: [GetStages] -> ShowS
show :: GetStages -> String
$cshow :: GetStages -> String
showsPrec :: Int -> GetStages -> ShowS
$cshowsPrec :: Int -> GetStages -> ShowS
Prelude.Show, (forall x. GetStages -> Rep GetStages x)
-> (forall x. Rep GetStages x -> GetStages) -> Generic GetStages
forall x. Rep GetStages x -> GetStages
forall x. GetStages -> Rep GetStages x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStages x -> GetStages
$cfrom :: forall x. GetStages -> Rep GetStages x
Prelude.Generic)
newGetStages ::
Prelude.Text ->
GetStages
newGetStages :: Text -> GetStages
newGetStages Text
pApiId_ =
GetStages' :: Maybe Text -> Maybe Text -> Text -> GetStages
GetStages'
{ $sel:nextToken:GetStages' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:GetStages' :: Maybe Text
maxResults = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:apiId:GetStages' :: Text
apiId = Text
pApiId_
}
getStages_nextToken :: Lens.Lens' GetStages (Prelude.Maybe Prelude.Text)
getStages_nextToken :: (Maybe Text -> f (Maybe Text)) -> GetStages -> f GetStages
getStages_nextToken = (GetStages -> Maybe Text)
-> (GetStages -> Maybe Text -> GetStages)
-> Lens GetStages GetStages (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStages' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetStages' :: GetStages -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetStages
s@GetStages' {} Maybe Text
a -> GetStages
s {$sel:nextToken:GetStages' :: Maybe Text
nextToken = Maybe Text
a} :: GetStages)
getStages_maxResults :: Lens.Lens' GetStages (Prelude.Maybe Prelude.Text)
getStages_maxResults :: (Maybe Text -> f (Maybe Text)) -> GetStages -> f GetStages
getStages_maxResults = (GetStages -> Maybe Text)
-> (GetStages -> Maybe Text -> GetStages)
-> Lens GetStages GetStages (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStages' {Maybe Text
maxResults :: Maybe Text
$sel:maxResults:GetStages' :: GetStages -> Maybe Text
maxResults} -> Maybe Text
maxResults) (\s :: GetStages
s@GetStages' {} Maybe Text
a -> GetStages
s {$sel:maxResults:GetStages' :: Maybe Text
maxResults = Maybe Text
a} :: GetStages)
getStages_apiId :: Lens.Lens' GetStages Prelude.Text
getStages_apiId :: (Text -> f Text) -> GetStages -> f GetStages
getStages_apiId = (GetStages -> Text)
-> (GetStages -> Text -> GetStages)
-> Lens GetStages GetStages Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStages' {Text
apiId :: Text
$sel:apiId:GetStages' :: GetStages -> Text
apiId} -> Text
apiId) (\s :: GetStages
s@GetStages' {} Text
a -> GetStages
s {$sel:apiId:GetStages' :: Text
apiId = Text
a} :: GetStages)
instance Core.AWSPager GetStages where
page :: GetStages -> AWSResponse GetStages -> Maybe GetStages
page GetStages
rq AWSResponse GetStages
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetStages
GetStagesResponse
rs
GetStagesResponse
-> Getting (First Text) GetStagesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetStagesResponse -> Const (First Text) GetStagesResponse
Lens' GetStagesResponse (Maybe Text)
getStagesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> GetStagesResponse -> Const (First Text) GetStagesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetStagesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe GetStages
forall a. Maybe a
Prelude.Nothing
| Maybe [Stage] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetStages
GetStagesResponse
rs
GetStagesResponse
-> Getting (First [Stage]) GetStagesResponse [Stage]
-> Maybe [Stage]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Stage] -> Const (First [Stage]) (Maybe [Stage]))
-> GetStagesResponse -> Const (First [Stage]) GetStagesResponse
Lens' GetStagesResponse (Maybe [Stage])
getStagesResponse_items ((Maybe [Stage] -> Const (First [Stage]) (Maybe [Stage]))
-> GetStagesResponse -> Const (First [Stage]) GetStagesResponse)
-> (([Stage] -> Const (First [Stage]) [Stage])
-> Maybe [Stage] -> Const (First [Stage]) (Maybe [Stage]))
-> Getting (First [Stage]) GetStagesResponse [Stage]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Stage] -> Const (First [Stage]) [Stage])
-> Maybe [Stage] -> Const (First [Stage]) (Maybe [Stage])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe GetStages
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
GetStages -> Maybe GetStages
forall a. a -> Maybe a
Prelude.Just (GetStages -> Maybe GetStages) -> GetStages -> Maybe GetStages
forall a b. (a -> b) -> a -> b
Prelude.$
GetStages
rq
GetStages -> (GetStages -> GetStages) -> GetStages
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetStages -> Identity GetStages
Lens GetStages GetStages (Maybe Text) (Maybe Text)
getStages_nextToken
((Maybe Text -> Identity (Maybe Text))
-> GetStages -> Identity GetStages)
-> Maybe Text -> GetStages -> GetStages
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetStages
GetStagesResponse
rs
GetStagesResponse
-> Getting (First Text) GetStagesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetStagesResponse -> Const (First Text) GetStagesResponse
Lens' GetStagesResponse (Maybe Text)
getStagesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> GetStagesResponse -> Const (First Text) GetStagesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetStagesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest GetStages where
type AWSResponse GetStages = GetStagesResponse
request :: GetStages -> Request GetStages
request = Service -> GetStages -> Request GetStages
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetStages
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStages)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetStages))
-> Logger
-> Service
-> Proxy GetStages
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStages)))
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 [Stage] -> Maybe Text -> Int -> GetStagesResponse
GetStagesResponse'
(Maybe [Stage] -> Maybe Text -> Int -> GetStagesResponse)
-> Either String (Maybe [Stage])
-> Either String (Maybe Text -> Int -> GetStagesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Stage]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"items" Either String (Maybe (Maybe [Stage]))
-> Maybe [Stage] -> Either String (Maybe [Stage])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Stage]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> GetStagesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetStagesResponse)
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 -> GetStagesResponse)
-> Either String Int -> Either String GetStagesResponse
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 GetStages
instance Prelude.NFData GetStages
instance Core.ToHeaders GetStages where
toHeaders :: GetStages -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetStages -> 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 GetStages where
toPath :: GetStages -> ByteString
toPath GetStages' {Maybe Text
Text
apiId :: Text
maxResults :: Maybe Text
nextToken :: Maybe Text
$sel:apiId:GetStages' :: GetStages -> Text
$sel:maxResults:GetStages' :: GetStages -> Maybe Text
$sel:nextToken:GetStages' :: GetStages -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v2/apis/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
apiId, ByteString
"/stages"]
instance Core.ToQuery GetStages where
toQuery :: GetStages -> QueryString
toQuery GetStages' {Maybe Text
Text
apiId :: Text
maxResults :: Maybe Text
nextToken :: Maybe Text
$sel:apiId:GetStages' :: GetStages -> Text
$sel:maxResults:GetStages' :: GetStages -> Maybe Text
$sel:nextToken:GetStages' :: GetStages -> 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 GetStagesResponse = GetStagesResponse'
{
GetStagesResponse -> Maybe [Stage]
items :: Prelude.Maybe [Stage],
GetStagesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetStagesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetStagesResponse -> GetStagesResponse -> Bool
(GetStagesResponse -> GetStagesResponse -> Bool)
-> (GetStagesResponse -> GetStagesResponse -> Bool)
-> Eq GetStagesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStagesResponse -> GetStagesResponse -> Bool
$c/= :: GetStagesResponse -> GetStagesResponse -> Bool
== :: GetStagesResponse -> GetStagesResponse -> Bool
$c== :: GetStagesResponse -> GetStagesResponse -> Bool
Prelude.Eq, ReadPrec [GetStagesResponse]
ReadPrec GetStagesResponse
Int -> ReadS GetStagesResponse
ReadS [GetStagesResponse]
(Int -> ReadS GetStagesResponse)
-> ReadS [GetStagesResponse]
-> ReadPrec GetStagesResponse
-> ReadPrec [GetStagesResponse]
-> Read GetStagesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStagesResponse]
$creadListPrec :: ReadPrec [GetStagesResponse]
readPrec :: ReadPrec GetStagesResponse
$creadPrec :: ReadPrec GetStagesResponse
readList :: ReadS [GetStagesResponse]
$creadList :: ReadS [GetStagesResponse]
readsPrec :: Int -> ReadS GetStagesResponse
$creadsPrec :: Int -> ReadS GetStagesResponse
Prelude.Read, Int -> GetStagesResponse -> ShowS
[GetStagesResponse] -> ShowS
GetStagesResponse -> String
(Int -> GetStagesResponse -> ShowS)
-> (GetStagesResponse -> String)
-> ([GetStagesResponse] -> ShowS)
-> Show GetStagesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStagesResponse] -> ShowS
$cshowList :: [GetStagesResponse] -> ShowS
show :: GetStagesResponse -> String
$cshow :: GetStagesResponse -> String
showsPrec :: Int -> GetStagesResponse -> ShowS
$cshowsPrec :: Int -> GetStagesResponse -> ShowS
Prelude.Show, (forall x. GetStagesResponse -> Rep GetStagesResponse x)
-> (forall x. Rep GetStagesResponse x -> GetStagesResponse)
-> Generic GetStagesResponse
forall x. Rep GetStagesResponse x -> GetStagesResponse
forall x. GetStagesResponse -> Rep GetStagesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStagesResponse x -> GetStagesResponse
$cfrom :: forall x. GetStagesResponse -> Rep GetStagesResponse x
Prelude.Generic)
newGetStagesResponse ::
Prelude.Int ->
GetStagesResponse
newGetStagesResponse :: Int -> GetStagesResponse
newGetStagesResponse Int
pHttpStatus_ =
GetStagesResponse' :: Maybe [Stage] -> Maybe Text -> Int -> GetStagesResponse
GetStagesResponse'
{ $sel:items:GetStagesResponse' :: Maybe [Stage]
items = Maybe [Stage]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetStagesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetStagesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getStagesResponse_items :: Lens.Lens' GetStagesResponse (Prelude.Maybe [Stage])
getStagesResponse_items :: (Maybe [Stage] -> f (Maybe [Stage]))
-> GetStagesResponse -> f GetStagesResponse
getStagesResponse_items = (GetStagesResponse -> Maybe [Stage])
-> (GetStagesResponse -> Maybe [Stage] -> GetStagesResponse)
-> Lens' GetStagesResponse (Maybe [Stage])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStagesResponse' {Maybe [Stage]
items :: Maybe [Stage]
$sel:items:GetStagesResponse' :: GetStagesResponse -> Maybe [Stage]
items} -> Maybe [Stage]
items) (\s :: GetStagesResponse
s@GetStagesResponse' {} Maybe [Stage]
a -> GetStagesResponse
s {$sel:items:GetStagesResponse' :: Maybe [Stage]
items = Maybe [Stage]
a} :: GetStagesResponse) ((Maybe [Stage] -> f (Maybe [Stage]))
-> GetStagesResponse -> f GetStagesResponse)
-> ((Maybe [Stage] -> f (Maybe [Stage]))
-> Maybe [Stage] -> f (Maybe [Stage]))
-> (Maybe [Stage] -> f (Maybe [Stage]))
-> GetStagesResponse
-> f GetStagesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Stage] [Stage] [Stage] [Stage]
-> Iso
(Maybe [Stage]) (Maybe [Stage]) (Maybe [Stage]) (Maybe [Stage])
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 [Stage] [Stage] [Stage] [Stage]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getStagesResponse_nextToken :: Lens.Lens' GetStagesResponse (Prelude.Maybe Prelude.Text)
getStagesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetStagesResponse -> f GetStagesResponse
getStagesResponse_nextToken = (GetStagesResponse -> Maybe Text)
-> (GetStagesResponse -> Maybe Text -> GetStagesResponse)
-> Lens' GetStagesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStagesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetStagesResponse' :: GetStagesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetStagesResponse
s@GetStagesResponse' {} Maybe Text
a -> GetStagesResponse
s {$sel:nextToken:GetStagesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetStagesResponse)
getStagesResponse_httpStatus :: Lens.Lens' GetStagesResponse Prelude.Int
getStagesResponse_httpStatus :: (Int -> f Int) -> GetStagesResponse -> f GetStagesResponse
getStagesResponse_httpStatus = (GetStagesResponse -> Int)
-> (GetStagesResponse -> Int -> GetStagesResponse)
-> Lens GetStagesResponse GetStagesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStagesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetStagesResponse' :: GetStagesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetStagesResponse
s@GetStagesResponse' {} Int
a -> GetStagesResponse
s {$sel:httpStatus:GetStagesResponse' :: Int
httpStatus = Int
a} :: GetStagesResponse)
instance Prelude.NFData GetStagesResponse