{-# 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.IoT.Types.RateIncreaseCriteria where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data RateIncreaseCriteria = RateIncreaseCriteria'
{
RateIncreaseCriteria -> Maybe Natural
numberOfNotifiedThings :: Prelude.Maybe Prelude.Natural,
RateIncreaseCriteria -> Maybe Natural
numberOfSucceededThings :: Prelude.Maybe Prelude.Natural
}
deriving (RateIncreaseCriteria -> RateIncreaseCriteria -> Bool
(RateIncreaseCriteria -> RateIncreaseCriteria -> Bool)
-> (RateIncreaseCriteria -> RateIncreaseCriteria -> Bool)
-> Eq RateIncreaseCriteria
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RateIncreaseCriteria -> RateIncreaseCriteria -> Bool
$c/= :: RateIncreaseCriteria -> RateIncreaseCriteria -> Bool
== :: RateIncreaseCriteria -> RateIncreaseCriteria -> Bool
$c== :: RateIncreaseCriteria -> RateIncreaseCriteria -> Bool
Prelude.Eq, ReadPrec [RateIncreaseCriteria]
ReadPrec RateIncreaseCriteria
Int -> ReadS RateIncreaseCriteria
ReadS [RateIncreaseCriteria]
(Int -> ReadS RateIncreaseCriteria)
-> ReadS [RateIncreaseCriteria]
-> ReadPrec RateIncreaseCriteria
-> ReadPrec [RateIncreaseCriteria]
-> Read RateIncreaseCriteria
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RateIncreaseCriteria]
$creadListPrec :: ReadPrec [RateIncreaseCriteria]
readPrec :: ReadPrec RateIncreaseCriteria
$creadPrec :: ReadPrec RateIncreaseCriteria
readList :: ReadS [RateIncreaseCriteria]
$creadList :: ReadS [RateIncreaseCriteria]
readsPrec :: Int -> ReadS RateIncreaseCriteria
$creadsPrec :: Int -> ReadS RateIncreaseCriteria
Prelude.Read, Int -> RateIncreaseCriteria -> ShowS
[RateIncreaseCriteria] -> ShowS
RateIncreaseCriteria -> String
(Int -> RateIncreaseCriteria -> ShowS)
-> (RateIncreaseCriteria -> String)
-> ([RateIncreaseCriteria] -> ShowS)
-> Show RateIncreaseCriteria
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RateIncreaseCriteria] -> ShowS
$cshowList :: [RateIncreaseCriteria] -> ShowS
show :: RateIncreaseCriteria -> String
$cshow :: RateIncreaseCriteria -> String
showsPrec :: Int -> RateIncreaseCriteria -> ShowS
$cshowsPrec :: Int -> RateIncreaseCriteria -> ShowS
Prelude.Show, (forall x. RateIncreaseCriteria -> Rep RateIncreaseCriteria x)
-> (forall x. Rep RateIncreaseCriteria x -> RateIncreaseCriteria)
-> Generic RateIncreaseCriteria
forall x. Rep RateIncreaseCriteria x -> RateIncreaseCriteria
forall x. RateIncreaseCriteria -> Rep RateIncreaseCriteria x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RateIncreaseCriteria x -> RateIncreaseCriteria
$cfrom :: forall x. RateIncreaseCriteria -> Rep RateIncreaseCriteria x
Prelude.Generic)
newRateIncreaseCriteria ::
RateIncreaseCriteria
newRateIncreaseCriteria :: RateIncreaseCriteria
newRateIncreaseCriteria =
RateIncreaseCriteria' :: Maybe Natural -> Maybe Natural -> RateIncreaseCriteria
RateIncreaseCriteria'
{ $sel:numberOfNotifiedThings:RateIncreaseCriteria' :: Maybe Natural
numberOfNotifiedThings =
Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:numberOfSucceededThings:RateIncreaseCriteria' :: Maybe Natural
numberOfSucceededThings = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
rateIncreaseCriteria_numberOfNotifiedThings :: Lens.Lens' RateIncreaseCriteria (Prelude.Maybe Prelude.Natural)
rateIncreaseCriteria_numberOfNotifiedThings :: (Maybe Natural -> f (Maybe Natural))
-> RateIncreaseCriteria -> f RateIncreaseCriteria
rateIncreaseCriteria_numberOfNotifiedThings = (RateIncreaseCriteria -> Maybe Natural)
-> (RateIncreaseCriteria -> Maybe Natural -> RateIncreaseCriteria)
-> Lens
RateIncreaseCriteria
RateIncreaseCriteria
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RateIncreaseCriteria' {Maybe Natural
numberOfNotifiedThings :: Maybe Natural
$sel:numberOfNotifiedThings:RateIncreaseCriteria' :: RateIncreaseCriteria -> Maybe Natural
numberOfNotifiedThings} -> Maybe Natural
numberOfNotifiedThings) (\s :: RateIncreaseCriteria
s@RateIncreaseCriteria' {} Maybe Natural
a -> RateIncreaseCriteria
s {$sel:numberOfNotifiedThings:RateIncreaseCriteria' :: Maybe Natural
numberOfNotifiedThings = Maybe Natural
a} :: RateIncreaseCriteria)
rateIncreaseCriteria_numberOfSucceededThings :: Lens.Lens' RateIncreaseCriteria (Prelude.Maybe Prelude.Natural)
rateIncreaseCriteria_numberOfSucceededThings :: (Maybe Natural -> f (Maybe Natural))
-> RateIncreaseCriteria -> f RateIncreaseCriteria
rateIncreaseCriteria_numberOfSucceededThings = (RateIncreaseCriteria -> Maybe Natural)
-> (RateIncreaseCriteria -> Maybe Natural -> RateIncreaseCriteria)
-> Lens
RateIncreaseCriteria
RateIncreaseCriteria
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RateIncreaseCriteria' {Maybe Natural
numberOfSucceededThings :: Maybe Natural
$sel:numberOfSucceededThings:RateIncreaseCriteria' :: RateIncreaseCriteria -> Maybe Natural
numberOfSucceededThings} -> Maybe Natural
numberOfSucceededThings) (\s :: RateIncreaseCriteria
s@RateIncreaseCriteria' {} Maybe Natural
a -> RateIncreaseCriteria
s {$sel:numberOfSucceededThings:RateIncreaseCriteria' :: Maybe Natural
numberOfSucceededThings = Maybe Natural
a} :: RateIncreaseCriteria)
instance Core.FromJSON RateIncreaseCriteria where
parseJSON :: Value -> Parser RateIncreaseCriteria
parseJSON =
String
-> (Object -> Parser RateIncreaseCriteria)
-> Value
-> Parser RateIncreaseCriteria
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RateIncreaseCriteria"
( \Object
x ->
Maybe Natural -> Maybe Natural -> RateIncreaseCriteria
RateIncreaseCriteria'
(Maybe Natural -> Maybe Natural -> RateIncreaseCriteria)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> RateIncreaseCriteria)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"numberOfNotifiedThings")
Parser (Maybe Natural -> RateIncreaseCriteria)
-> Parser (Maybe Natural) -> Parser RateIncreaseCriteria
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"numberOfSucceededThings")
)
instance Prelude.Hashable RateIncreaseCriteria
instance Prelude.NFData RateIncreaseCriteria
instance Core.ToJSON RateIncreaseCriteria where
toJSON :: RateIncreaseCriteria -> Value
toJSON RateIncreaseCriteria' {Maybe Natural
numberOfSucceededThings :: Maybe Natural
numberOfNotifiedThings :: Maybe Natural
$sel:numberOfSucceededThings:RateIncreaseCriteria' :: RateIncreaseCriteria -> Maybe Natural
$sel:numberOfNotifiedThings:RateIncreaseCriteria' :: RateIncreaseCriteria -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"numberOfNotifiedThings" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
numberOfNotifiedThings,
(Text
"numberOfSucceededThings" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
numberOfSucceededThings
]
)