{-# 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.APIGateway.GetRestApis
(
GetRestApis (..),
newGetRestApis,
getRestApis_limit,
getRestApis_position,
GetRestApisResponse (..),
newGetRestApisResponse,
getRestApisResponse_items,
getRestApisResponse_position,
getRestApisResponse_httpStatus,
)
where
import Amazonka.APIGateway.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 GetRestApis = GetRestApis'
{
GetRestApis -> Maybe Int
limit :: Prelude.Maybe Prelude.Int,
GetRestApis -> Maybe Text
position :: Prelude.Maybe Prelude.Text
}
deriving (GetRestApis -> GetRestApis -> Bool
(GetRestApis -> GetRestApis -> Bool)
-> (GetRestApis -> GetRestApis -> Bool) -> Eq GetRestApis
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRestApis -> GetRestApis -> Bool
$c/= :: GetRestApis -> GetRestApis -> Bool
== :: GetRestApis -> GetRestApis -> Bool
$c== :: GetRestApis -> GetRestApis -> Bool
Prelude.Eq, ReadPrec [GetRestApis]
ReadPrec GetRestApis
Int -> ReadS GetRestApis
ReadS [GetRestApis]
(Int -> ReadS GetRestApis)
-> ReadS [GetRestApis]
-> ReadPrec GetRestApis
-> ReadPrec [GetRestApis]
-> Read GetRestApis
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRestApis]
$creadListPrec :: ReadPrec [GetRestApis]
readPrec :: ReadPrec GetRestApis
$creadPrec :: ReadPrec GetRestApis
readList :: ReadS [GetRestApis]
$creadList :: ReadS [GetRestApis]
readsPrec :: Int -> ReadS GetRestApis
$creadsPrec :: Int -> ReadS GetRestApis
Prelude.Read, Int -> GetRestApis -> ShowS
[GetRestApis] -> ShowS
GetRestApis -> String
(Int -> GetRestApis -> ShowS)
-> (GetRestApis -> String)
-> ([GetRestApis] -> ShowS)
-> Show GetRestApis
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRestApis] -> ShowS
$cshowList :: [GetRestApis] -> ShowS
show :: GetRestApis -> String
$cshow :: GetRestApis -> String
showsPrec :: Int -> GetRestApis -> ShowS
$cshowsPrec :: Int -> GetRestApis -> ShowS
Prelude.Show, (forall x. GetRestApis -> Rep GetRestApis x)
-> (forall x. Rep GetRestApis x -> GetRestApis)
-> Generic GetRestApis
forall x. Rep GetRestApis x -> GetRestApis
forall x. GetRestApis -> Rep GetRestApis x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRestApis x -> GetRestApis
$cfrom :: forall x. GetRestApis -> Rep GetRestApis x
Prelude.Generic)
newGetRestApis ::
GetRestApis
newGetRestApis :: GetRestApis
newGetRestApis =
GetRestApis' :: Maybe Int -> Maybe Text -> GetRestApis
GetRestApis'
{ $sel:limit:GetRestApis' :: Maybe Int
limit = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:position:GetRestApis' :: Maybe Text
position = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
getRestApis_limit :: Lens.Lens' GetRestApis (Prelude.Maybe Prelude.Int)
getRestApis_limit :: (Maybe Int -> f (Maybe Int)) -> GetRestApis -> f GetRestApis
getRestApis_limit = (GetRestApis -> Maybe Int)
-> (GetRestApis -> Maybe Int -> GetRestApis)
-> Lens GetRestApis GetRestApis (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRestApis' {Maybe Int
limit :: Maybe Int
$sel:limit:GetRestApis' :: GetRestApis -> Maybe Int
limit} -> Maybe Int
limit) (\s :: GetRestApis
s@GetRestApis' {} Maybe Int
a -> GetRestApis
s {$sel:limit:GetRestApis' :: Maybe Int
limit = Maybe Int
a} :: GetRestApis)
getRestApis_position :: Lens.Lens' GetRestApis (Prelude.Maybe Prelude.Text)
getRestApis_position :: (Maybe Text -> f (Maybe Text)) -> GetRestApis -> f GetRestApis
getRestApis_position = (GetRestApis -> Maybe Text)
-> (GetRestApis -> Maybe Text -> GetRestApis)
-> Lens GetRestApis GetRestApis (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRestApis' {Maybe Text
position :: Maybe Text
$sel:position:GetRestApis' :: GetRestApis -> Maybe Text
position} -> Maybe Text
position) (\s :: GetRestApis
s@GetRestApis' {} Maybe Text
a -> GetRestApis
s {$sel:position:GetRestApis' :: Maybe Text
position = Maybe Text
a} :: GetRestApis)
instance Core.AWSPager GetRestApis where
page :: GetRestApis -> AWSResponse GetRestApis -> Maybe GetRestApis
page GetRestApis
rq AWSResponse GetRestApis
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetRestApis
GetRestApisResponse
rs
GetRestApisResponse
-> Getting (First Text) GetRestApisResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetRestApisResponse -> Const (First Text) GetRestApisResponse
Lens' GetRestApisResponse (Maybe Text)
getRestApisResponse_position ((Maybe Text -> Const (First Text) (Maybe Text))
-> GetRestApisResponse -> Const (First Text) GetRestApisResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetRestApisResponse 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 GetRestApis
forall a. Maybe a
Prelude.Nothing
| Maybe [RestApi] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetRestApis
GetRestApisResponse
rs
GetRestApisResponse
-> Getting (First [RestApi]) GetRestApisResponse [RestApi]
-> Maybe [RestApi]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [RestApi] -> Const (First [RestApi]) (Maybe [RestApi]))
-> GetRestApisResponse
-> Const (First [RestApi]) GetRestApisResponse
Lens' GetRestApisResponse (Maybe [RestApi])
getRestApisResponse_items ((Maybe [RestApi] -> Const (First [RestApi]) (Maybe [RestApi]))
-> GetRestApisResponse
-> Const (First [RestApi]) GetRestApisResponse)
-> (([RestApi] -> Const (First [RestApi]) [RestApi])
-> Maybe [RestApi] -> Const (First [RestApi]) (Maybe [RestApi]))
-> Getting (First [RestApi]) GetRestApisResponse [RestApi]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RestApi] -> Const (First [RestApi]) [RestApi])
-> Maybe [RestApi] -> Const (First [RestApi]) (Maybe [RestApi])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe GetRestApis
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
GetRestApis -> Maybe GetRestApis
forall a. a -> Maybe a
Prelude.Just (GetRestApis -> Maybe GetRestApis)
-> GetRestApis -> Maybe GetRestApis
forall a b. (a -> b) -> a -> b
Prelude.$
GetRestApis
rq
GetRestApis -> (GetRestApis -> GetRestApis) -> GetRestApis
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetRestApis -> Identity GetRestApis
Lens GetRestApis GetRestApis (Maybe Text) (Maybe Text)
getRestApis_position
((Maybe Text -> Identity (Maybe Text))
-> GetRestApis -> Identity GetRestApis)
-> Maybe Text -> GetRestApis -> GetRestApis
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetRestApis
GetRestApisResponse
rs
GetRestApisResponse
-> Getting (First Text) GetRestApisResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetRestApisResponse -> Const (First Text) GetRestApisResponse
Lens' GetRestApisResponse (Maybe Text)
getRestApisResponse_position ((Maybe Text -> Const (First Text) (Maybe Text))
-> GetRestApisResponse -> Const (First Text) GetRestApisResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetRestApisResponse 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 GetRestApis where
type AWSResponse GetRestApis = GetRestApisResponse
request :: GetRestApis -> Request GetRestApis
request = Service -> GetRestApis -> Request GetRestApis
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetRestApis
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRestApis)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetRestApis))
-> Logger
-> Service
-> Proxy GetRestApis
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRestApis)))
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 [RestApi] -> Maybe Text -> Int -> GetRestApisResponse
GetRestApisResponse'
(Maybe [RestApi] -> Maybe Text -> Int -> GetRestApisResponse)
-> Either String (Maybe [RestApi])
-> Either String (Maybe Text -> Int -> GetRestApisResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [RestApi]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"item" Either String (Maybe (Maybe [RestApi]))
-> Maybe [RestApi] -> Either String (Maybe [RestApi])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [RestApi]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> GetRestApisResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetRestApisResponse)
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
"position")
Either String (Int -> GetRestApisResponse)
-> Either String Int -> Either String GetRestApisResponse
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 GetRestApis
instance Prelude.NFData GetRestApis
instance Core.ToHeaders GetRestApis where
toHeaders :: GetRestApis -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetRestApis -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Accept"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/json" :: Prelude.ByteString)
]
)
instance Core.ToPath GetRestApis where
toPath :: GetRestApis -> ByteString
toPath = ByteString -> GetRestApis -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/restapis"
instance Core.ToQuery GetRestApis where
toQuery :: GetRestApis -> QueryString
toQuery GetRestApis' {Maybe Int
Maybe Text
position :: Maybe Text
limit :: Maybe Int
$sel:position:GetRestApis' :: GetRestApis -> Maybe Text
$sel:limit:GetRestApis' :: GetRestApis -> Maybe Int
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"limit" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
limit, ByteString
"position" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
position]
data GetRestApisResponse = GetRestApisResponse'
{
GetRestApisResponse -> Maybe [RestApi]
items :: Prelude.Maybe [RestApi],
GetRestApisResponse -> Maybe Text
position :: Prelude.Maybe Prelude.Text,
GetRestApisResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetRestApisResponse -> GetRestApisResponse -> Bool
(GetRestApisResponse -> GetRestApisResponse -> Bool)
-> (GetRestApisResponse -> GetRestApisResponse -> Bool)
-> Eq GetRestApisResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRestApisResponse -> GetRestApisResponse -> Bool
$c/= :: GetRestApisResponse -> GetRestApisResponse -> Bool
== :: GetRestApisResponse -> GetRestApisResponse -> Bool
$c== :: GetRestApisResponse -> GetRestApisResponse -> Bool
Prelude.Eq, ReadPrec [GetRestApisResponse]
ReadPrec GetRestApisResponse
Int -> ReadS GetRestApisResponse
ReadS [GetRestApisResponse]
(Int -> ReadS GetRestApisResponse)
-> ReadS [GetRestApisResponse]
-> ReadPrec GetRestApisResponse
-> ReadPrec [GetRestApisResponse]
-> Read GetRestApisResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRestApisResponse]
$creadListPrec :: ReadPrec [GetRestApisResponse]
readPrec :: ReadPrec GetRestApisResponse
$creadPrec :: ReadPrec GetRestApisResponse
readList :: ReadS [GetRestApisResponse]
$creadList :: ReadS [GetRestApisResponse]
readsPrec :: Int -> ReadS GetRestApisResponse
$creadsPrec :: Int -> ReadS GetRestApisResponse
Prelude.Read, Int -> GetRestApisResponse -> ShowS
[GetRestApisResponse] -> ShowS
GetRestApisResponse -> String
(Int -> GetRestApisResponse -> ShowS)
-> (GetRestApisResponse -> String)
-> ([GetRestApisResponse] -> ShowS)
-> Show GetRestApisResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRestApisResponse] -> ShowS
$cshowList :: [GetRestApisResponse] -> ShowS
show :: GetRestApisResponse -> String
$cshow :: GetRestApisResponse -> String
showsPrec :: Int -> GetRestApisResponse -> ShowS
$cshowsPrec :: Int -> GetRestApisResponse -> ShowS
Prelude.Show, (forall x. GetRestApisResponse -> Rep GetRestApisResponse x)
-> (forall x. Rep GetRestApisResponse x -> GetRestApisResponse)
-> Generic GetRestApisResponse
forall x. Rep GetRestApisResponse x -> GetRestApisResponse
forall x. GetRestApisResponse -> Rep GetRestApisResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRestApisResponse x -> GetRestApisResponse
$cfrom :: forall x. GetRestApisResponse -> Rep GetRestApisResponse x
Prelude.Generic)
newGetRestApisResponse ::
Prelude.Int ->
GetRestApisResponse
newGetRestApisResponse :: Int -> GetRestApisResponse
newGetRestApisResponse Int
pHttpStatus_ =
GetRestApisResponse' :: Maybe [RestApi] -> Maybe Text -> Int -> GetRestApisResponse
GetRestApisResponse'
{ $sel:items:GetRestApisResponse' :: Maybe [RestApi]
items = Maybe [RestApi]
forall a. Maybe a
Prelude.Nothing,
$sel:position:GetRestApisResponse' :: Maybe Text
position = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetRestApisResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getRestApisResponse_items :: Lens.Lens' GetRestApisResponse (Prelude.Maybe [RestApi])
getRestApisResponse_items :: (Maybe [RestApi] -> f (Maybe [RestApi]))
-> GetRestApisResponse -> f GetRestApisResponse
getRestApisResponse_items = (GetRestApisResponse -> Maybe [RestApi])
-> (GetRestApisResponse -> Maybe [RestApi] -> GetRestApisResponse)
-> Lens' GetRestApisResponse (Maybe [RestApi])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRestApisResponse' {Maybe [RestApi]
items :: Maybe [RestApi]
$sel:items:GetRestApisResponse' :: GetRestApisResponse -> Maybe [RestApi]
items} -> Maybe [RestApi]
items) (\s :: GetRestApisResponse
s@GetRestApisResponse' {} Maybe [RestApi]
a -> GetRestApisResponse
s {$sel:items:GetRestApisResponse' :: Maybe [RestApi]
items = Maybe [RestApi]
a} :: GetRestApisResponse) ((Maybe [RestApi] -> f (Maybe [RestApi]))
-> GetRestApisResponse -> f GetRestApisResponse)
-> ((Maybe [RestApi] -> f (Maybe [RestApi]))
-> Maybe [RestApi] -> f (Maybe [RestApi]))
-> (Maybe [RestApi] -> f (Maybe [RestApi]))
-> GetRestApisResponse
-> f GetRestApisResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [RestApi] [RestApi] [RestApi] [RestApi]
-> Iso
(Maybe [RestApi])
(Maybe [RestApi])
(Maybe [RestApi])
(Maybe [RestApi])
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 [RestApi] [RestApi] [RestApi] [RestApi]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getRestApisResponse_position :: Lens.Lens' GetRestApisResponse (Prelude.Maybe Prelude.Text)
getRestApisResponse_position :: (Maybe Text -> f (Maybe Text))
-> GetRestApisResponse -> f GetRestApisResponse
getRestApisResponse_position = (GetRestApisResponse -> Maybe Text)
-> (GetRestApisResponse -> Maybe Text -> GetRestApisResponse)
-> Lens' GetRestApisResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRestApisResponse' {Maybe Text
position :: Maybe Text
$sel:position:GetRestApisResponse' :: GetRestApisResponse -> Maybe Text
position} -> Maybe Text
position) (\s :: GetRestApisResponse
s@GetRestApisResponse' {} Maybe Text
a -> GetRestApisResponse
s {$sel:position:GetRestApisResponse' :: Maybe Text
position = Maybe Text
a} :: GetRestApisResponse)
getRestApisResponse_httpStatus :: Lens.Lens' GetRestApisResponse Prelude.Int
getRestApisResponse_httpStatus :: (Int -> f Int) -> GetRestApisResponse -> f GetRestApisResponse
getRestApisResponse_httpStatus = (GetRestApisResponse -> Int)
-> (GetRestApisResponse -> Int -> GetRestApisResponse)
-> Lens GetRestApisResponse GetRestApisResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRestApisResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRestApisResponse' :: GetRestApisResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRestApisResponse
s@GetRestApisResponse' {} Int
a -> GetRestApisResponse
s {$sel:httpStatus:GetRestApisResponse' :: Int
httpStatus = Int
a} :: GetRestApisResponse)
instance Prelude.NFData GetRestApisResponse