{-# 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.GetServiceQuota
(
GetServiceQuota (..),
newGetServiceQuota,
getServiceQuota_serviceCode,
getServiceQuota_quotaCode,
GetServiceQuotaResponse (..),
newGetServiceQuotaResponse,
getServiceQuotaResponse_quota,
getServiceQuotaResponse_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 GetServiceQuota = GetServiceQuota'
{
GetServiceQuota -> Text
serviceCode :: Prelude.Text,
GetServiceQuota -> Text
quotaCode :: Prelude.Text
}
deriving (GetServiceQuota -> GetServiceQuota -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetServiceQuota -> GetServiceQuota -> Bool
$c/= :: GetServiceQuota -> GetServiceQuota -> Bool
== :: GetServiceQuota -> GetServiceQuota -> Bool
$c== :: GetServiceQuota -> GetServiceQuota -> Bool
Prelude.Eq, ReadPrec [GetServiceQuota]
ReadPrec GetServiceQuota
Int -> ReadS GetServiceQuota
ReadS [GetServiceQuota]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetServiceQuota]
$creadListPrec :: ReadPrec [GetServiceQuota]
readPrec :: ReadPrec GetServiceQuota
$creadPrec :: ReadPrec GetServiceQuota
readList :: ReadS [GetServiceQuota]
$creadList :: ReadS [GetServiceQuota]
readsPrec :: Int -> ReadS GetServiceQuota
$creadsPrec :: Int -> ReadS GetServiceQuota
Prelude.Read, Int -> GetServiceQuota -> ShowS
[GetServiceQuota] -> ShowS
GetServiceQuota -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetServiceQuota] -> ShowS
$cshowList :: [GetServiceQuota] -> ShowS
show :: GetServiceQuota -> String
$cshow :: GetServiceQuota -> String
showsPrec :: Int -> GetServiceQuota -> ShowS
$cshowsPrec :: Int -> GetServiceQuota -> ShowS
Prelude.Show, forall x. Rep GetServiceQuota x -> GetServiceQuota
forall x. GetServiceQuota -> Rep GetServiceQuota x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetServiceQuota x -> GetServiceQuota
$cfrom :: forall x. GetServiceQuota -> Rep GetServiceQuota x
Prelude.Generic)
newGetServiceQuota ::
Prelude.Text ->
Prelude.Text ->
GetServiceQuota
newGetServiceQuota :: Text -> Text -> GetServiceQuota
newGetServiceQuota Text
pServiceCode_ Text
pQuotaCode_ =
GetServiceQuota'
{ $sel:serviceCode:GetServiceQuota' :: Text
serviceCode = Text
pServiceCode_,
$sel:quotaCode:GetServiceQuota' :: Text
quotaCode = Text
pQuotaCode_
}
getServiceQuota_serviceCode :: Lens.Lens' GetServiceQuota Prelude.Text
getServiceQuota_serviceCode :: Lens' GetServiceQuota Text
getServiceQuota_serviceCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceQuota' {Text
serviceCode :: Text
$sel:serviceCode:GetServiceQuota' :: GetServiceQuota -> Text
serviceCode} -> Text
serviceCode) (\s :: GetServiceQuota
s@GetServiceQuota' {} Text
a -> GetServiceQuota
s {$sel:serviceCode:GetServiceQuota' :: Text
serviceCode = Text
a} :: GetServiceQuota)
getServiceQuota_quotaCode :: Lens.Lens' GetServiceQuota Prelude.Text
getServiceQuota_quotaCode :: Lens' GetServiceQuota Text
getServiceQuota_quotaCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceQuota' {Text
quotaCode :: Text
$sel:quotaCode:GetServiceQuota' :: GetServiceQuota -> Text
quotaCode} -> Text
quotaCode) (\s :: GetServiceQuota
s@GetServiceQuota' {} Text
a -> GetServiceQuota
s {$sel:quotaCode:GetServiceQuota' :: Text
quotaCode = Text
a} :: GetServiceQuota)
instance Core.AWSRequest GetServiceQuota where
type
AWSResponse GetServiceQuota =
GetServiceQuotaResponse
request :: (Service -> Service) -> GetServiceQuota -> Request GetServiceQuota
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 GetServiceQuota
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetServiceQuota)))
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 ServiceQuota -> Int -> GetServiceQuotaResponse
GetServiceQuotaResponse'
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
"Quota")
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 GetServiceQuota where
hashWithSalt :: Int -> GetServiceQuota -> Int
hashWithSalt Int
_salt GetServiceQuota' {Text
quotaCode :: Text
serviceCode :: Text
$sel:quotaCode:GetServiceQuota' :: GetServiceQuota -> Text
$sel:serviceCode:GetServiceQuota' :: GetServiceQuota -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
serviceCode
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
quotaCode
instance Prelude.NFData GetServiceQuota where
rnf :: GetServiceQuota -> ()
rnf GetServiceQuota' {Text
quotaCode :: Text
serviceCode :: Text
$sel:quotaCode:GetServiceQuota' :: GetServiceQuota -> Text
$sel:serviceCode:GetServiceQuota' :: GetServiceQuota -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
serviceCode
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
quotaCode
instance Data.ToHeaders GetServiceQuota where
toHeaders :: GetServiceQuota -> 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.GetServiceQuota" ::
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 GetServiceQuota where
toJSON :: GetServiceQuota -> Value
toJSON GetServiceQuota' {Text
quotaCode :: Text
serviceCode :: Text
$sel:quotaCode:GetServiceQuota' :: GetServiceQuota -> Text
$sel:serviceCode:GetServiceQuota' :: GetServiceQuota -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"ServiceCode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
serviceCode),
forall a. a -> Maybe a
Prelude.Just (Key
"QuotaCode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
quotaCode)
]
)
instance Data.ToPath GetServiceQuota where
toPath :: GetServiceQuota -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetServiceQuota where
toQuery :: GetServiceQuota -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetServiceQuotaResponse = GetServiceQuotaResponse'
{
GetServiceQuotaResponse -> Maybe ServiceQuota
quota :: Prelude.Maybe ServiceQuota,
GetServiceQuotaResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetServiceQuotaResponse -> GetServiceQuotaResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetServiceQuotaResponse -> GetServiceQuotaResponse -> Bool
$c/= :: GetServiceQuotaResponse -> GetServiceQuotaResponse -> Bool
== :: GetServiceQuotaResponse -> GetServiceQuotaResponse -> Bool
$c== :: GetServiceQuotaResponse -> GetServiceQuotaResponse -> Bool
Prelude.Eq, ReadPrec [GetServiceQuotaResponse]
ReadPrec GetServiceQuotaResponse
Int -> ReadS GetServiceQuotaResponse
ReadS [GetServiceQuotaResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetServiceQuotaResponse]
$creadListPrec :: ReadPrec [GetServiceQuotaResponse]
readPrec :: ReadPrec GetServiceQuotaResponse
$creadPrec :: ReadPrec GetServiceQuotaResponse
readList :: ReadS [GetServiceQuotaResponse]
$creadList :: ReadS [GetServiceQuotaResponse]
readsPrec :: Int -> ReadS GetServiceQuotaResponse
$creadsPrec :: Int -> ReadS GetServiceQuotaResponse
Prelude.Read, Int -> GetServiceQuotaResponse -> ShowS
[GetServiceQuotaResponse] -> ShowS
GetServiceQuotaResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetServiceQuotaResponse] -> ShowS
$cshowList :: [GetServiceQuotaResponse] -> ShowS
show :: GetServiceQuotaResponse -> String
$cshow :: GetServiceQuotaResponse -> String
showsPrec :: Int -> GetServiceQuotaResponse -> ShowS
$cshowsPrec :: Int -> GetServiceQuotaResponse -> ShowS
Prelude.Show, forall x. Rep GetServiceQuotaResponse x -> GetServiceQuotaResponse
forall x. GetServiceQuotaResponse -> Rep GetServiceQuotaResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetServiceQuotaResponse x -> GetServiceQuotaResponse
$cfrom :: forall x. GetServiceQuotaResponse -> Rep GetServiceQuotaResponse x
Prelude.Generic)
newGetServiceQuotaResponse ::
Prelude.Int ->
GetServiceQuotaResponse
newGetServiceQuotaResponse :: Int -> GetServiceQuotaResponse
newGetServiceQuotaResponse Int
pHttpStatus_ =
GetServiceQuotaResponse'
{ $sel:quota:GetServiceQuotaResponse' :: Maybe ServiceQuota
quota = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetServiceQuotaResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getServiceQuotaResponse_quota :: Lens.Lens' GetServiceQuotaResponse (Prelude.Maybe ServiceQuota)
getServiceQuotaResponse_quota :: Lens' GetServiceQuotaResponse (Maybe ServiceQuota)
getServiceQuotaResponse_quota = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceQuotaResponse' {Maybe ServiceQuota
quota :: Maybe ServiceQuota
$sel:quota:GetServiceQuotaResponse' :: GetServiceQuotaResponse -> Maybe ServiceQuota
quota} -> Maybe ServiceQuota
quota) (\s :: GetServiceQuotaResponse
s@GetServiceQuotaResponse' {} Maybe ServiceQuota
a -> GetServiceQuotaResponse
s {$sel:quota:GetServiceQuotaResponse' :: Maybe ServiceQuota
quota = Maybe ServiceQuota
a} :: GetServiceQuotaResponse)
getServiceQuotaResponse_httpStatus :: Lens.Lens' GetServiceQuotaResponse Prelude.Int
getServiceQuotaResponse_httpStatus :: Lens' GetServiceQuotaResponse Int
getServiceQuotaResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceQuotaResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetServiceQuotaResponse' :: GetServiceQuotaResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetServiceQuotaResponse
s@GetServiceQuotaResponse' {} Int
a -> GetServiceQuotaResponse
s {$sel:httpStatus:GetServiceQuotaResponse' :: Int
httpStatus = Int
a} :: GetServiceQuotaResponse)
instance Prelude.NFData GetServiceQuotaResponse where
rnf :: GetServiceQuotaResponse -> ()
rnf GetServiceQuotaResponse' {Int
Maybe ServiceQuota
httpStatus :: Int
quota :: Maybe ServiceQuota
$sel:httpStatus:GetServiceQuotaResponse' :: GetServiceQuotaResponse -> Int
$sel:quota:GetServiceQuotaResponse' :: GetServiceQuotaResponse -> Maybe ServiceQuota
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe ServiceQuota
quota
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus