{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.APIGateway.Types.QuotaSettings where
import Amazonka.APIGateway.Types.QuotaPeriodType
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
data QuotaSettings = QuotaSettings'
{
QuotaSettings -> Maybe Int
limit :: Prelude.Maybe Prelude.Int,
QuotaSettings -> Maybe Int
offset :: Prelude.Maybe Prelude.Int,
QuotaSettings -> Maybe QuotaPeriodType
period :: Prelude.Maybe QuotaPeriodType
}
deriving (QuotaSettings -> QuotaSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QuotaSettings -> QuotaSettings -> Bool
$c/= :: QuotaSettings -> QuotaSettings -> Bool
== :: QuotaSettings -> QuotaSettings -> Bool
$c== :: QuotaSettings -> QuotaSettings -> Bool
Prelude.Eq, ReadPrec [QuotaSettings]
ReadPrec QuotaSettings
Int -> ReadS QuotaSettings
ReadS [QuotaSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QuotaSettings]
$creadListPrec :: ReadPrec [QuotaSettings]
readPrec :: ReadPrec QuotaSettings
$creadPrec :: ReadPrec QuotaSettings
readList :: ReadS [QuotaSettings]
$creadList :: ReadS [QuotaSettings]
readsPrec :: Int -> ReadS QuotaSettings
$creadsPrec :: Int -> ReadS QuotaSettings
Prelude.Read, Int -> QuotaSettings -> ShowS
[QuotaSettings] -> ShowS
QuotaSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QuotaSettings] -> ShowS
$cshowList :: [QuotaSettings] -> ShowS
show :: QuotaSettings -> String
$cshow :: QuotaSettings -> String
showsPrec :: Int -> QuotaSettings -> ShowS
$cshowsPrec :: Int -> QuotaSettings -> ShowS
Prelude.Show, forall x. Rep QuotaSettings x -> QuotaSettings
forall x. QuotaSettings -> Rep QuotaSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QuotaSettings x -> QuotaSettings
$cfrom :: forall x. QuotaSettings -> Rep QuotaSettings x
Prelude.Generic)
newQuotaSettings ::
QuotaSettings
newQuotaSettings :: QuotaSettings
newQuotaSettings =
QuotaSettings'
{ $sel:limit:QuotaSettings' :: Maybe Int
limit = forall a. Maybe a
Prelude.Nothing,
$sel:offset:QuotaSettings' :: Maybe Int
offset = forall a. Maybe a
Prelude.Nothing,
$sel:period:QuotaSettings' :: Maybe QuotaPeriodType
period = forall a. Maybe a
Prelude.Nothing
}
quotaSettings_limit :: Lens.Lens' QuotaSettings (Prelude.Maybe Prelude.Int)
quotaSettings_limit :: Lens' QuotaSettings (Maybe Int)
quotaSettings_limit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QuotaSettings' {Maybe Int
limit :: Maybe Int
$sel:limit:QuotaSettings' :: QuotaSettings -> Maybe Int
limit} -> Maybe Int
limit) (\s :: QuotaSettings
s@QuotaSettings' {} Maybe Int
a -> QuotaSettings
s {$sel:limit:QuotaSettings' :: Maybe Int
limit = Maybe Int
a} :: QuotaSettings)
quotaSettings_offset :: Lens.Lens' QuotaSettings (Prelude.Maybe Prelude.Int)
quotaSettings_offset :: Lens' QuotaSettings (Maybe Int)
quotaSettings_offset = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QuotaSettings' {Maybe Int
offset :: Maybe Int
$sel:offset:QuotaSettings' :: QuotaSettings -> Maybe Int
offset} -> Maybe Int
offset) (\s :: QuotaSettings
s@QuotaSettings' {} Maybe Int
a -> QuotaSettings
s {$sel:offset:QuotaSettings' :: Maybe Int
offset = Maybe Int
a} :: QuotaSettings)
quotaSettings_period :: Lens.Lens' QuotaSettings (Prelude.Maybe QuotaPeriodType)
quotaSettings_period :: Lens' QuotaSettings (Maybe QuotaPeriodType)
quotaSettings_period = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QuotaSettings' {Maybe QuotaPeriodType
period :: Maybe QuotaPeriodType
$sel:period:QuotaSettings' :: QuotaSettings -> Maybe QuotaPeriodType
period} -> Maybe QuotaPeriodType
period) (\s :: QuotaSettings
s@QuotaSettings' {} Maybe QuotaPeriodType
a -> QuotaSettings
s {$sel:period:QuotaSettings' :: Maybe QuotaPeriodType
period = Maybe QuotaPeriodType
a} :: QuotaSettings)
instance Data.FromJSON QuotaSettings where
parseJSON :: Value -> Parser QuotaSettings
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"QuotaSettings"
( \Object
x ->
Maybe Int -> Maybe Int -> Maybe QuotaPeriodType -> QuotaSettings
QuotaSettings'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"limit")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"offset")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"period")
)
instance Prelude.Hashable QuotaSettings where
hashWithSalt :: Int -> QuotaSettings -> Int
hashWithSalt Int
_salt QuotaSettings' {Maybe Int
Maybe QuotaPeriodType
period :: Maybe QuotaPeriodType
offset :: Maybe Int
limit :: Maybe Int
$sel:period:QuotaSettings' :: QuotaSettings -> Maybe QuotaPeriodType
$sel:offset:QuotaSettings' :: QuotaSettings -> Maybe Int
$sel:limit:QuotaSettings' :: QuotaSettings -> Maybe Int
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
limit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
offset
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe QuotaPeriodType
period
instance Prelude.NFData QuotaSettings where
rnf :: QuotaSettings -> ()
rnf QuotaSettings' {Maybe Int
Maybe QuotaPeriodType
period :: Maybe QuotaPeriodType
offset :: Maybe Int
limit :: Maybe Int
$sel:period:QuotaSettings' :: QuotaSettings -> Maybe QuotaPeriodType
$sel:offset:QuotaSettings' :: QuotaSettings -> Maybe Int
$sel:limit:QuotaSettings' :: QuotaSettings -> Maybe Int
..} =
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 Int
offset
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe QuotaPeriodType
period
instance Data.ToJSON QuotaSettings where
toJSON :: QuotaSettings -> Value
toJSON QuotaSettings' {Maybe Int
Maybe QuotaPeriodType
period :: Maybe QuotaPeriodType
offset :: Maybe Int
limit :: Maybe Int
$sel:period:QuotaSettings' :: QuotaSettings -> Maybe QuotaPeriodType
$sel:offset:QuotaSettings' :: QuotaSettings -> Maybe Int
$sel:limit:QuotaSettings' :: QuotaSettings -> Maybe Int
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"limit" 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 Int
limit,
(Key
"offset" 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 Int
offset,
(Key
"period" 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 QuotaPeriodType
period
]
)