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