{-# 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.EMR.Types.AutoScalingPolicy where
import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.ScalingConstraints
import Amazonka.EMR.Types.ScalingRule
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AutoScalingPolicy = AutoScalingPolicy'
{
AutoScalingPolicy -> ScalingConstraints
constraints :: ScalingConstraints,
AutoScalingPolicy -> [ScalingRule]
rules :: [ScalingRule]
}
deriving (AutoScalingPolicy -> AutoScalingPolicy -> Bool
(AutoScalingPolicy -> AutoScalingPolicy -> Bool)
-> (AutoScalingPolicy -> AutoScalingPolicy -> Bool)
-> Eq AutoScalingPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoScalingPolicy -> AutoScalingPolicy -> Bool
$c/= :: AutoScalingPolicy -> AutoScalingPolicy -> Bool
== :: AutoScalingPolicy -> AutoScalingPolicy -> Bool
$c== :: AutoScalingPolicy -> AutoScalingPolicy -> Bool
Prelude.Eq, ReadPrec [AutoScalingPolicy]
ReadPrec AutoScalingPolicy
Int -> ReadS AutoScalingPolicy
ReadS [AutoScalingPolicy]
(Int -> ReadS AutoScalingPolicy)
-> ReadS [AutoScalingPolicy]
-> ReadPrec AutoScalingPolicy
-> ReadPrec [AutoScalingPolicy]
-> Read AutoScalingPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoScalingPolicy]
$creadListPrec :: ReadPrec [AutoScalingPolicy]
readPrec :: ReadPrec AutoScalingPolicy
$creadPrec :: ReadPrec AutoScalingPolicy
readList :: ReadS [AutoScalingPolicy]
$creadList :: ReadS [AutoScalingPolicy]
readsPrec :: Int -> ReadS AutoScalingPolicy
$creadsPrec :: Int -> ReadS AutoScalingPolicy
Prelude.Read, Int -> AutoScalingPolicy -> ShowS
[AutoScalingPolicy] -> ShowS
AutoScalingPolicy -> String
(Int -> AutoScalingPolicy -> ShowS)
-> (AutoScalingPolicy -> String)
-> ([AutoScalingPolicy] -> ShowS)
-> Show AutoScalingPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoScalingPolicy] -> ShowS
$cshowList :: [AutoScalingPolicy] -> ShowS
show :: AutoScalingPolicy -> String
$cshow :: AutoScalingPolicy -> String
showsPrec :: Int -> AutoScalingPolicy -> ShowS
$cshowsPrec :: Int -> AutoScalingPolicy -> ShowS
Prelude.Show, (forall x. AutoScalingPolicy -> Rep AutoScalingPolicy x)
-> (forall x. Rep AutoScalingPolicy x -> AutoScalingPolicy)
-> Generic AutoScalingPolicy
forall x. Rep AutoScalingPolicy x -> AutoScalingPolicy
forall x. AutoScalingPolicy -> Rep AutoScalingPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutoScalingPolicy x -> AutoScalingPolicy
$cfrom :: forall x. AutoScalingPolicy -> Rep AutoScalingPolicy x
Prelude.Generic)
newAutoScalingPolicy ::
ScalingConstraints ->
AutoScalingPolicy
newAutoScalingPolicy :: ScalingConstraints -> AutoScalingPolicy
newAutoScalingPolicy ScalingConstraints
pConstraints_ =
AutoScalingPolicy' :: ScalingConstraints -> [ScalingRule] -> AutoScalingPolicy
AutoScalingPolicy'
{ $sel:constraints:AutoScalingPolicy' :: ScalingConstraints
constraints = ScalingConstraints
pConstraints_,
$sel:rules:AutoScalingPolicy' :: [ScalingRule]
rules = [ScalingRule]
forall a. Monoid a => a
Prelude.mempty
}
autoScalingPolicy_constraints :: Lens.Lens' AutoScalingPolicy ScalingConstraints
autoScalingPolicy_constraints :: (ScalingConstraints -> f ScalingConstraints)
-> AutoScalingPolicy -> f AutoScalingPolicy
autoScalingPolicy_constraints = (AutoScalingPolicy -> ScalingConstraints)
-> (AutoScalingPolicy -> ScalingConstraints -> AutoScalingPolicy)
-> Lens
AutoScalingPolicy
AutoScalingPolicy
ScalingConstraints
ScalingConstraints
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingPolicy' {ScalingConstraints
constraints :: ScalingConstraints
$sel:constraints:AutoScalingPolicy' :: AutoScalingPolicy -> ScalingConstraints
constraints} -> ScalingConstraints
constraints) (\s :: AutoScalingPolicy
s@AutoScalingPolicy' {} ScalingConstraints
a -> AutoScalingPolicy
s {$sel:constraints:AutoScalingPolicy' :: ScalingConstraints
constraints = ScalingConstraints
a} :: AutoScalingPolicy)
autoScalingPolicy_rules :: Lens.Lens' AutoScalingPolicy [ScalingRule]
autoScalingPolicy_rules :: ([ScalingRule] -> f [ScalingRule])
-> AutoScalingPolicy -> f AutoScalingPolicy
autoScalingPolicy_rules = (AutoScalingPolicy -> [ScalingRule])
-> (AutoScalingPolicy -> [ScalingRule] -> AutoScalingPolicy)
-> Lens
AutoScalingPolicy AutoScalingPolicy [ScalingRule] [ScalingRule]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingPolicy' {[ScalingRule]
rules :: [ScalingRule]
$sel:rules:AutoScalingPolicy' :: AutoScalingPolicy -> [ScalingRule]
rules} -> [ScalingRule]
rules) (\s :: AutoScalingPolicy
s@AutoScalingPolicy' {} [ScalingRule]
a -> AutoScalingPolicy
s {$sel:rules:AutoScalingPolicy' :: [ScalingRule]
rules = [ScalingRule]
a} :: AutoScalingPolicy) (([ScalingRule] -> f [ScalingRule])
-> AutoScalingPolicy -> f AutoScalingPolicy)
-> (([ScalingRule] -> f [ScalingRule])
-> [ScalingRule] -> f [ScalingRule])
-> ([ScalingRule] -> f [ScalingRule])
-> AutoScalingPolicy
-> f AutoScalingPolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ScalingRule] -> f [ScalingRule])
-> [ScalingRule] -> f [ScalingRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.Hashable AutoScalingPolicy
instance Prelude.NFData AutoScalingPolicy
instance Core.ToJSON AutoScalingPolicy where
toJSON :: AutoScalingPolicy -> Value
toJSON AutoScalingPolicy' {[ScalingRule]
ScalingConstraints
rules :: [ScalingRule]
constraints :: ScalingConstraints
$sel:rules:AutoScalingPolicy' :: AutoScalingPolicy -> [ScalingRule]
$sel:constraints:AutoScalingPolicy' :: AutoScalingPolicy -> ScalingConstraints
..} =
[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
"Constraints" Text -> ScalingConstraints -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ScalingConstraints
constraints),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Rules" Text -> [ScalingRule] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [ScalingRule]
rules)
]
)