{-# 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.GetUsagePlans
(
GetUsagePlans (..),
newGetUsagePlans,
getUsagePlans_keyId,
getUsagePlans_limit,
getUsagePlans_position,
GetUsagePlansResponse (..),
newGetUsagePlansResponse,
getUsagePlansResponse_items,
getUsagePlansResponse_position,
getUsagePlansResponse_httpStatus,
)
where
import Amazonka.APIGateway.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 GetUsagePlans = GetUsagePlans'
{
GetUsagePlans -> Maybe Text
keyId :: Prelude.Maybe Prelude.Text,
GetUsagePlans -> Maybe Int
limit :: Prelude.Maybe Prelude.Int,
GetUsagePlans -> Maybe Text
position :: Prelude.Maybe Prelude.Text
}
deriving (GetUsagePlans -> GetUsagePlans -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUsagePlans -> GetUsagePlans -> Bool
$c/= :: GetUsagePlans -> GetUsagePlans -> Bool
== :: GetUsagePlans -> GetUsagePlans -> Bool
$c== :: GetUsagePlans -> GetUsagePlans -> Bool
Prelude.Eq, ReadPrec [GetUsagePlans]
ReadPrec GetUsagePlans
Int -> ReadS GetUsagePlans
ReadS [GetUsagePlans]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetUsagePlans]
$creadListPrec :: ReadPrec [GetUsagePlans]
readPrec :: ReadPrec GetUsagePlans
$creadPrec :: ReadPrec GetUsagePlans
readList :: ReadS [GetUsagePlans]
$creadList :: ReadS [GetUsagePlans]
readsPrec :: Int -> ReadS GetUsagePlans
$creadsPrec :: Int -> ReadS GetUsagePlans
Prelude.Read, Int -> GetUsagePlans -> ShowS
[GetUsagePlans] -> ShowS
GetUsagePlans -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUsagePlans] -> ShowS
$cshowList :: [GetUsagePlans] -> ShowS
show :: GetUsagePlans -> String
$cshow :: GetUsagePlans -> String
showsPrec :: Int -> GetUsagePlans -> ShowS
$cshowsPrec :: Int -> GetUsagePlans -> ShowS
Prelude.Show, forall x. Rep GetUsagePlans x -> GetUsagePlans
forall x. GetUsagePlans -> Rep GetUsagePlans x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetUsagePlans x -> GetUsagePlans
$cfrom :: forall x. GetUsagePlans -> Rep GetUsagePlans x
Prelude.Generic)
newGetUsagePlans ::
GetUsagePlans
newGetUsagePlans :: GetUsagePlans
newGetUsagePlans =
GetUsagePlans'
{ $sel:keyId:GetUsagePlans' :: Maybe Text
keyId = forall a. Maybe a
Prelude.Nothing,
$sel:limit:GetUsagePlans' :: Maybe Int
limit = forall a. Maybe a
Prelude.Nothing,
$sel:position:GetUsagePlans' :: Maybe Text
position = forall a. Maybe a
Prelude.Nothing
}
getUsagePlans_keyId :: Lens.Lens' GetUsagePlans (Prelude.Maybe Prelude.Text)
getUsagePlans_keyId :: Lens' GetUsagePlans (Maybe Text)
getUsagePlans_keyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUsagePlans' {Maybe Text
keyId :: Maybe Text
$sel:keyId:GetUsagePlans' :: GetUsagePlans -> Maybe Text
keyId} -> Maybe Text
keyId) (\s :: GetUsagePlans
s@GetUsagePlans' {} Maybe Text
a -> GetUsagePlans
s {$sel:keyId:GetUsagePlans' :: Maybe Text
keyId = Maybe Text
a} :: GetUsagePlans)
getUsagePlans_limit :: Lens.Lens' GetUsagePlans (Prelude.Maybe Prelude.Int)
getUsagePlans_limit :: Lens' GetUsagePlans (Maybe Int)
getUsagePlans_limit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUsagePlans' {Maybe Int
limit :: Maybe Int
$sel:limit:GetUsagePlans' :: GetUsagePlans -> Maybe Int
limit} -> Maybe Int
limit) (\s :: GetUsagePlans
s@GetUsagePlans' {} Maybe Int
a -> GetUsagePlans
s {$sel:limit:GetUsagePlans' :: Maybe Int
limit = Maybe Int
a} :: GetUsagePlans)
getUsagePlans_position :: Lens.Lens' GetUsagePlans (Prelude.Maybe Prelude.Text)
getUsagePlans_position :: Lens' GetUsagePlans (Maybe Text)
getUsagePlans_position = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUsagePlans' {Maybe Text
position :: Maybe Text
$sel:position:GetUsagePlans' :: GetUsagePlans -> Maybe Text
position} -> Maybe Text
position) (\s :: GetUsagePlans
s@GetUsagePlans' {} Maybe Text
a -> GetUsagePlans
s {$sel:position:GetUsagePlans' :: Maybe Text
position = Maybe Text
a} :: GetUsagePlans)
instance Core.AWSPager GetUsagePlans where
page :: GetUsagePlans -> AWSResponse GetUsagePlans -> Maybe GetUsagePlans
page GetUsagePlans
rq AWSResponse GetUsagePlans
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetUsagePlans
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetUsagePlansResponse (Maybe Text)
getUsagePlansResponse_position
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetUsagePlans
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetUsagePlansResponse (Maybe [UsagePlan])
getUsagePlansResponse_items
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ GetUsagePlans
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetUsagePlans (Maybe Text)
getUsagePlans_position
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetUsagePlans
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetUsagePlansResponse (Maybe Text)
getUsagePlansResponse_position
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest GetUsagePlans where
type
AWSResponse GetUsagePlans =
GetUsagePlansResponse
request :: (Service -> Service) -> GetUsagePlans -> Request GetUsagePlans
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetUsagePlans
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetUsagePlans)))
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 [UsagePlan] -> Maybe Text -> Int -> GetUsagePlansResponse
GetUsagePlansResponse'
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
"item" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
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
"position")
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 GetUsagePlans where
hashWithSalt :: Int -> GetUsagePlans -> Int
hashWithSalt Int
_salt GetUsagePlans' {Maybe Int
Maybe Text
position :: Maybe Text
limit :: Maybe Int
keyId :: Maybe Text
$sel:position:GetUsagePlans' :: GetUsagePlans -> Maybe Text
$sel:limit:GetUsagePlans' :: GetUsagePlans -> Maybe Int
$sel:keyId:GetUsagePlans' :: GetUsagePlans -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
keyId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
limit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
position
instance Prelude.NFData GetUsagePlans where
rnf :: GetUsagePlans -> ()
rnf GetUsagePlans' {Maybe Int
Maybe Text
position :: Maybe Text
limit :: Maybe Int
keyId :: Maybe Text
$sel:position:GetUsagePlans' :: GetUsagePlans -> Maybe Text
$sel:limit:GetUsagePlans' :: GetUsagePlans -> Maybe Int
$sel:keyId:GetUsagePlans' :: GetUsagePlans -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
keyId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
limit
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
position
instance Data.ToHeaders GetUsagePlans where
toHeaders :: GetUsagePlans -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Accept"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"application/json" :: Prelude.ByteString)
]
)
instance Data.ToPath GetUsagePlans where
toPath :: GetUsagePlans -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/usageplans"
instance Data.ToQuery GetUsagePlans where
toQuery :: GetUsagePlans -> QueryString
toQuery GetUsagePlans' {Maybe Int
Maybe Text
position :: Maybe Text
limit :: Maybe Int
keyId :: Maybe Text
$sel:position:GetUsagePlans' :: GetUsagePlans -> Maybe Text
$sel:limit:GetUsagePlans' :: GetUsagePlans -> Maybe Int
$sel:keyId:GetUsagePlans' :: GetUsagePlans -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"keyId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
keyId,
ByteString
"limit" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
limit,
ByteString
"position" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
position
]
data GetUsagePlansResponse = GetUsagePlansResponse'
{
GetUsagePlansResponse -> Maybe [UsagePlan]
items :: Prelude.Maybe [UsagePlan],
GetUsagePlansResponse -> Maybe Text
position :: Prelude.Maybe Prelude.Text,
GetUsagePlansResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetUsagePlansResponse -> GetUsagePlansResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUsagePlansResponse -> GetUsagePlansResponse -> Bool
$c/= :: GetUsagePlansResponse -> GetUsagePlansResponse -> Bool
== :: GetUsagePlansResponse -> GetUsagePlansResponse -> Bool
$c== :: GetUsagePlansResponse -> GetUsagePlansResponse -> Bool
Prelude.Eq, ReadPrec [GetUsagePlansResponse]
ReadPrec GetUsagePlansResponse
Int -> ReadS GetUsagePlansResponse
ReadS [GetUsagePlansResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetUsagePlansResponse]
$creadListPrec :: ReadPrec [GetUsagePlansResponse]
readPrec :: ReadPrec GetUsagePlansResponse
$creadPrec :: ReadPrec GetUsagePlansResponse
readList :: ReadS [GetUsagePlansResponse]
$creadList :: ReadS [GetUsagePlansResponse]
readsPrec :: Int -> ReadS GetUsagePlansResponse
$creadsPrec :: Int -> ReadS GetUsagePlansResponse
Prelude.Read, Int -> GetUsagePlansResponse -> ShowS
[GetUsagePlansResponse] -> ShowS
GetUsagePlansResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUsagePlansResponse] -> ShowS
$cshowList :: [GetUsagePlansResponse] -> ShowS
show :: GetUsagePlansResponse -> String
$cshow :: GetUsagePlansResponse -> String
showsPrec :: Int -> GetUsagePlansResponse -> ShowS
$cshowsPrec :: Int -> GetUsagePlansResponse -> ShowS
Prelude.Show, forall x. Rep GetUsagePlansResponse x -> GetUsagePlansResponse
forall x. GetUsagePlansResponse -> Rep GetUsagePlansResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetUsagePlansResponse x -> GetUsagePlansResponse
$cfrom :: forall x. GetUsagePlansResponse -> Rep GetUsagePlansResponse x
Prelude.Generic)
newGetUsagePlansResponse ::
Prelude.Int ->
GetUsagePlansResponse
newGetUsagePlansResponse :: Int -> GetUsagePlansResponse
newGetUsagePlansResponse Int
pHttpStatus_ =
GetUsagePlansResponse'
{ $sel:items:GetUsagePlansResponse' :: Maybe [UsagePlan]
items = forall a. Maybe a
Prelude.Nothing,
$sel:position:GetUsagePlansResponse' :: Maybe Text
position = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetUsagePlansResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getUsagePlansResponse_items :: Lens.Lens' GetUsagePlansResponse (Prelude.Maybe [UsagePlan])
getUsagePlansResponse_items :: Lens' GetUsagePlansResponse (Maybe [UsagePlan])
getUsagePlansResponse_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUsagePlansResponse' {Maybe [UsagePlan]
items :: Maybe [UsagePlan]
$sel:items:GetUsagePlansResponse' :: GetUsagePlansResponse -> Maybe [UsagePlan]
items} -> Maybe [UsagePlan]
items) (\s :: GetUsagePlansResponse
s@GetUsagePlansResponse' {} Maybe [UsagePlan]
a -> GetUsagePlansResponse
s {$sel:items:GetUsagePlansResponse' :: Maybe [UsagePlan]
items = Maybe [UsagePlan]
a} :: GetUsagePlansResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getUsagePlansResponse_position :: Lens.Lens' GetUsagePlansResponse (Prelude.Maybe Prelude.Text)
getUsagePlansResponse_position :: Lens' GetUsagePlansResponse (Maybe Text)
getUsagePlansResponse_position = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUsagePlansResponse' {Maybe Text
position :: Maybe Text
$sel:position:GetUsagePlansResponse' :: GetUsagePlansResponse -> Maybe Text
position} -> Maybe Text
position) (\s :: GetUsagePlansResponse
s@GetUsagePlansResponse' {} Maybe Text
a -> GetUsagePlansResponse
s {$sel:position:GetUsagePlansResponse' :: Maybe Text
position = Maybe Text
a} :: GetUsagePlansResponse)
getUsagePlansResponse_httpStatus :: Lens.Lens' GetUsagePlansResponse Prelude.Int
getUsagePlansResponse_httpStatus :: Lens' GetUsagePlansResponse Int
getUsagePlansResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUsagePlansResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetUsagePlansResponse' :: GetUsagePlansResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetUsagePlansResponse
s@GetUsagePlansResponse' {} Int
a -> GetUsagePlansResponse
s {$sel:httpStatus:GetUsagePlansResponse' :: Int
httpStatus = Int
a} :: GetUsagePlansResponse)
instance Prelude.NFData GetUsagePlansResponse where
rnf :: GetUsagePlansResponse -> ()
rnf GetUsagePlansResponse' {Int
Maybe [UsagePlan]
Maybe Text
httpStatus :: Int
position :: Maybe Text
items :: Maybe [UsagePlan]
$sel:httpStatus:GetUsagePlansResponse' :: GetUsagePlansResponse -> Int
$sel:position:GetUsagePlansResponse' :: GetUsagePlansResponse -> Maybe Text
$sel:items:GetUsagePlansResponse' :: GetUsagePlansResponse -> Maybe [UsagePlan]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [UsagePlan]
items
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
position
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus