{-# 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.ServiceQuotas.ListServiceQuotas
(
ListServiceQuotas (..),
newListServiceQuotas,
listServiceQuotas_maxResults,
listServiceQuotas_nextToken,
listServiceQuotas_serviceCode,
ListServiceQuotasResponse (..),
newListServiceQuotasResponse,
listServiceQuotasResponse_nextToken,
listServiceQuotasResponse_quotas,
listServiceQuotasResponse_httpStatus,
)
where
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
import Amazonka.ServiceQuotas.Types
data ListServiceQuotas = ListServiceQuotas'
{
ListServiceQuotas -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListServiceQuotas -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListServiceQuotas -> Text
serviceCode :: Prelude.Text
}
deriving (ListServiceQuotas -> ListServiceQuotas -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListServiceQuotas -> ListServiceQuotas -> Bool
$c/= :: ListServiceQuotas -> ListServiceQuotas -> Bool
== :: ListServiceQuotas -> ListServiceQuotas -> Bool
$c== :: ListServiceQuotas -> ListServiceQuotas -> Bool
Prelude.Eq, ReadPrec [ListServiceQuotas]
ReadPrec ListServiceQuotas
Int -> ReadS ListServiceQuotas
ReadS [ListServiceQuotas]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListServiceQuotas]
$creadListPrec :: ReadPrec [ListServiceQuotas]
readPrec :: ReadPrec ListServiceQuotas
$creadPrec :: ReadPrec ListServiceQuotas
readList :: ReadS [ListServiceQuotas]
$creadList :: ReadS [ListServiceQuotas]
readsPrec :: Int -> ReadS ListServiceQuotas
$creadsPrec :: Int -> ReadS ListServiceQuotas
Prelude.Read, Int -> ListServiceQuotas -> ShowS
[ListServiceQuotas] -> ShowS
ListServiceQuotas -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListServiceQuotas] -> ShowS
$cshowList :: [ListServiceQuotas] -> ShowS
show :: ListServiceQuotas -> String
$cshow :: ListServiceQuotas -> String
showsPrec :: Int -> ListServiceQuotas -> ShowS
$cshowsPrec :: Int -> ListServiceQuotas -> ShowS
Prelude.Show, forall x. Rep ListServiceQuotas x -> ListServiceQuotas
forall x. ListServiceQuotas -> Rep ListServiceQuotas x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListServiceQuotas x -> ListServiceQuotas
$cfrom :: forall x. ListServiceQuotas -> Rep ListServiceQuotas x
Prelude.Generic)
newListServiceQuotas ::
Prelude.Text ->
ListServiceQuotas
newListServiceQuotas :: Text -> ListServiceQuotas
newListServiceQuotas Text
pServiceCode_ =
ListServiceQuotas'
{ $sel:maxResults:ListServiceQuotas' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListServiceQuotas' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:serviceCode:ListServiceQuotas' :: Text
serviceCode = Text
pServiceCode_
}
listServiceQuotas_maxResults :: Lens.Lens' ListServiceQuotas (Prelude.Maybe Prelude.Natural)
listServiceQuotas_maxResults :: Lens' ListServiceQuotas (Maybe Natural)
listServiceQuotas_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServiceQuotas' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListServiceQuotas' :: ListServiceQuotas -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListServiceQuotas
s@ListServiceQuotas' {} Maybe Natural
a -> ListServiceQuotas
s {$sel:maxResults:ListServiceQuotas' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListServiceQuotas)
listServiceQuotas_nextToken :: Lens.Lens' ListServiceQuotas (Prelude.Maybe Prelude.Text)
listServiceQuotas_nextToken :: Lens' ListServiceQuotas (Maybe Text)
listServiceQuotas_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServiceQuotas' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListServiceQuotas' :: ListServiceQuotas -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListServiceQuotas
s@ListServiceQuotas' {} Maybe Text
a -> ListServiceQuotas
s {$sel:nextToken:ListServiceQuotas' :: Maybe Text
nextToken = Maybe Text
a} :: ListServiceQuotas)
listServiceQuotas_serviceCode :: Lens.Lens' ListServiceQuotas Prelude.Text
listServiceQuotas_serviceCode :: Lens' ListServiceQuotas Text
listServiceQuotas_serviceCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServiceQuotas' {Text
serviceCode :: Text
$sel:serviceCode:ListServiceQuotas' :: ListServiceQuotas -> Text
serviceCode} -> Text
serviceCode) (\s :: ListServiceQuotas
s@ListServiceQuotas' {} Text
a -> ListServiceQuotas
s {$sel:serviceCode:ListServiceQuotas' :: Text
serviceCode = Text
a} :: ListServiceQuotas)
instance Core.AWSPager ListServiceQuotas where
page :: ListServiceQuotas
-> AWSResponse ListServiceQuotas -> Maybe ListServiceQuotas
page ListServiceQuotas
rq AWSResponse ListServiceQuotas
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListServiceQuotas
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListServiceQuotasResponse (Maybe Text)
listServiceQuotasResponse_nextToken
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 ListServiceQuotas
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListServiceQuotasResponse (Maybe [ServiceQuota])
listServiceQuotasResponse_quotas
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.$ ListServiceQuotas
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListServiceQuotas (Maybe Text)
listServiceQuotas_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListServiceQuotas
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListServiceQuotasResponse (Maybe Text)
listServiceQuotasResponse_nextToken
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 ListServiceQuotas where
type
AWSResponse ListServiceQuotas =
ListServiceQuotasResponse
request :: (Service -> Service)
-> ListServiceQuotas -> Request ListServiceQuotas
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListServiceQuotas
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListServiceQuotas)))
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 Text
-> Maybe [ServiceQuota] -> Int -> ListServiceQuotasResponse
ListServiceQuotasResponse'
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
"NextToken")
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
"Quotas" 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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListServiceQuotas where
hashWithSalt :: Int -> ListServiceQuotas -> Int
hashWithSalt Int
_salt ListServiceQuotas' {Maybe Natural
Maybe Text
Text
serviceCode :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:serviceCode:ListServiceQuotas' :: ListServiceQuotas -> Text
$sel:nextToken:ListServiceQuotas' :: ListServiceQuotas -> Maybe Text
$sel:maxResults:ListServiceQuotas' :: ListServiceQuotas -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
serviceCode
instance Prelude.NFData ListServiceQuotas where
rnf :: ListServiceQuotas -> ()
rnf ListServiceQuotas' {Maybe Natural
Maybe Text
Text
serviceCode :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:serviceCode:ListServiceQuotas' :: ListServiceQuotas -> Text
$sel:nextToken:ListServiceQuotas' :: ListServiceQuotas -> Maybe Text
$sel:maxResults:ListServiceQuotas' :: ListServiceQuotas -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
serviceCode
instance Data.ToHeaders ListServiceQuotas where
toHeaders :: ListServiceQuotas -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"ServiceQuotasV20190624.ListServiceQuotas" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListServiceQuotas where
toJSON :: ListServiceQuotas -> Value
toJSON ListServiceQuotas' {Maybe Natural
Maybe Text
Text
serviceCode :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:serviceCode:ListServiceQuotas' :: ListServiceQuotas -> Text
$sel:nextToken:ListServiceQuotas' :: ListServiceQuotas -> Maybe Text
$sel:maxResults:ListServiceQuotas' :: ListServiceQuotas -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
(Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
forall a. a -> Maybe a
Prelude.Just (Key
"ServiceCode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
serviceCode)
]
)
instance Data.ToPath ListServiceQuotas where
toPath :: ListServiceQuotas -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListServiceQuotas where
toQuery :: ListServiceQuotas -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListServiceQuotasResponse = ListServiceQuotasResponse'
{
ListServiceQuotasResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListServiceQuotasResponse -> Maybe [ServiceQuota]
quotas :: Prelude.Maybe [ServiceQuota],
ListServiceQuotasResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListServiceQuotasResponse -> ListServiceQuotasResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListServiceQuotasResponse -> ListServiceQuotasResponse -> Bool
$c/= :: ListServiceQuotasResponse -> ListServiceQuotasResponse -> Bool
== :: ListServiceQuotasResponse -> ListServiceQuotasResponse -> Bool
$c== :: ListServiceQuotasResponse -> ListServiceQuotasResponse -> Bool
Prelude.Eq, ReadPrec [ListServiceQuotasResponse]
ReadPrec ListServiceQuotasResponse
Int -> ReadS ListServiceQuotasResponse
ReadS [ListServiceQuotasResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListServiceQuotasResponse]
$creadListPrec :: ReadPrec [ListServiceQuotasResponse]
readPrec :: ReadPrec ListServiceQuotasResponse
$creadPrec :: ReadPrec ListServiceQuotasResponse
readList :: ReadS [ListServiceQuotasResponse]
$creadList :: ReadS [ListServiceQuotasResponse]
readsPrec :: Int -> ReadS ListServiceQuotasResponse
$creadsPrec :: Int -> ReadS ListServiceQuotasResponse
Prelude.Read, Int -> ListServiceQuotasResponse -> ShowS
[ListServiceQuotasResponse] -> ShowS
ListServiceQuotasResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListServiceQuotasResponse] -> ShowS
$cshowList :: [ListServiceQuotasResponse] -> ShowS
show :: ListServiceQuotasResponse -> String
$cshow :: ListServiceQuotasResponse -> String
showsPrec :: Int -> ListServiceQuotasResponse -> ShowS
$cshowsPrec :: Int -> ListServiceQuotasResponse -> ShowS
Prelude.Show, forall x.
Rep ListServiceQuotasResponse x -> ListServiceQuotasResponse
forall x.
ListServiceQuotasResponse -> Rep ListServiceQuotasResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListServiceQuotasResponse x -> ListServiceQuotasResponse
$cfrom :: forall x.
ListServiceQuotasResponse -> Rep ListServiceQuotasResponse x
Prelude.Generic)
newListServiceQuotasResponse ::
Prelude.Int ->
ListServiceQuotasResponse
newListServiceQuotasResponse :: Int -> ListServiceQuotasResponse
newListServiceQuotasResponse Int
pHttpStatus_ =
ListServiceQuotasResponse'
{ $sel:nextToken:ListServiceQuotasResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:quotas:ListServiceQuotasResponse' :: Maybe [ServiceQuota]
quotas = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListServiceQuotasResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listServiceQuotasResponse_nextToken :: Lens.Lens' ListServiceQuotasResponse (Prelude.Maybe Prelude.Text)
listServiceQuotasResponse_nextToken :: Lens' ListServiceQuotasResponse (Maybe Text)
listServiceQuotasResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServiceQuotasResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListServiceQuotasResponse' :: ListServiceQuotasResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListServiceQuotasResponse
s@ListServiceQuotasResponse' {} Maybe Text
a -> ListServiceQuotasResponse
s {$sel:nextToken:ListServiceQuotasResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListServiceQuotasResponse)
listServiceQuotasResponse_quotas :: Lens.Lens' ListServiceQuotasResponse (Prelude.Maybe [ServiceQuota])
listServiceQuotasResponse_quotas :: Lens' ListServiceQuotasResponse (Maybe [ServiceQuota])
listServiceQuotasResponse_quotas = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServiceQuotasResponse' {Maybe [ServiceQuota]
quotas :: Maybe [ServiceQuota]
$sel:quotas:ListServiceQuotasResponse' :: ListServiceQuotasResponse -> Maybe [ServiceQuota]
quotas} -> Maybe [ServiceQuota]
quotas) (\s :: ListServiceQuotasResponse
s@ListServiceQuotasResponse' {} Maybe [ServiceQuota]
a -> ListServiceQuotasResponse
s {$sel:quotas:ListServiceQuotasResponse' :: Maybe [ServiceQuota]
quotas = Maybe [ServiceQuota]
a} :: ListServiceQuotasResponse) 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
listServiceQuotasResponse_httpStatus :: Lens.Lens' ListServiceQuotasResponse Prelude.Int
listServiceQuotasResponse_httpStatus :: Lens' ListServiceQuotasResponse Int
listServiceQuotasResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServiceQuotasResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListServiceQuotasResponse' :: ListServiceQuotasResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListServiceQuotasResponse
s@ListServiceQuotasResponse' {} Int
a -> ListServiceQuotasResponse
s {$sel:httpStatus:ListServiceQuotasResponse' :: Int
httpStatus = Int
a} :: ListServiceQuotasResponse)
instance Prelude.NFData ListServiceQuotasResponse where
rnf :: ListServiceQuotasResponse -> ()
rnf ListServiceQuotasResponse' {Int
Maybe [ServiceQuota]
Maybe Text
httpStatus :: Int
quotas :: Maybe [ServiceQuota]
nextToken :: Maybe Text
$sel:httpStatus:ListServiceQuotasResponse' :: ListServiceQuotasResponse -> Int
$sel:quotas:ListServiceQuotasResponse' :: ListServiceQuotasResponse -> Maybe [ServiceQuota]
$sel:nextToken:ListServiceQuotasResponse' :: ListServiceQuotasResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ServiceQuota]
quotas
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus