{-# 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.AutoScalingPolicyDescription where
import qualified Amazonka.Core as Core
import Amazonka.EMR.Types.AutoScalingPolicyStatus
import Amazonka.EMR.Types.ScalingConstraints
import Amazonka.EMR.Types.ScalingRule
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AutoScalingPolicyDescription = AutoScalingPolicyDescription'
{
AutoScalingPolicyDescription -> Maybe AutoScalingPolicyStatus
status :: Prelude.Maybe AutoScalingPolicyStatus,
AutoScalingPolicyDescription -> Maybe [ScalingRule]
rules :: Prelude.Maybe [ScalingRule],
AutoScalingPolicyDescription -> Maybe ScalingConstraints
constraints :: Prelude.Maybe ScalingConstraints
}
deriving (AutoScalingPolicyDescription
-> AutoScalingPolicyDescription -> Bool
(AutoScalingPolicyDescription
-> AutoScalingPolicyDescription -> Bool)
-> (AutoScalingPolicyDescription
-> AutoScalingPolicyDescription -> Bool)
-> Eq AutoScalingPolicyDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoScalingPolicyDescription
-> AutoScalingPolicyDescription -> Bool
$c/= :: AutoScalingPolicyDescription
-> AutoScalingPolicyDescription -> Bool
== :: AutoScalingPolicyDescription
-> AutoScalingPolicyDescription -> Bool
$c== :: AutoScalingPolicyDescription
-> AutoScalingPolicyDescription -> Bool
Prelude.Eq, ReadPrec [AutoScalingPolicyDescription]
ReadPrec AutoScalingPolicyDescription
Int -> ReadS AutoScalingPolicyDescription
ReadS [AutoScalingPolicyDescription]
(Int -> ReadS AutoScalingPolicyDescription)
-> ReadS [AutoScalingPolicyDescription]
-> ReadPrec AutoScalingPolicyDescription
-> ReadPrec [AutoScalingPolicyDescription]
-> Read AutoScalingPolicyDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoScalingPolicyDescription]
$creadListPrec :: ReadPrec [AutoScalingPolicyDescription]
readPrec :: ReadPrec AutoScalingPolicyDescription
$creadPrec :: ReadPrec AutoScalingPolicyDescription
readList :: ReadS [AutoScalingPolicyDescription]
$creadList :: ReadS [AutoScalingPolicyDescription]
readsPrec :: Int -> ReadS AutoScalingPolicyDescription
$creadsPrec :: Int -> ReadS AutoScalingPolicyDescription
Prelude.Read, Int -> AutoScalingPolicyDescription -> ShowS
[AutoScalingPolicyDescription] -> ShowS
AutoScalingPolicyDescription -> String
(Int -> AutoScalingPolicyDescription -> ShowS)
-> (AutoScalingPolicyDescription -> String)
-> ([AutoScalingPolicyDescription] -> ShowS)
-> Show AutoScalingPolicyDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoScalingPolicyDescription] -> ShowS
$cshowList :: [AutoScalingPolicyDescription] -> ShowS
show :: AutoScalingPolicyDescription -> String
$cshow :: AutoScalingPolicyDescription -> String
showsPrec :: Int -> AutoScalingPolicyDescription -> ShowS
$cshowsPrec :: Int -> AutoScalingPolicyDescription -> ShowS
Prelude.Show, (forall x.
AutoScalingPolicyDescription -> Rep AutoScalingPolicyDescription x)
-> (forall x.
Rep AutoScalingPolicyDescription x -> AutoScalingPolicyDescription)
-> Generic AutoScalingPolicyDescription
forall x.
Rep AutoScalingPolicyDescription x -> AutoScalingPolicyDescription
forall x.
AutoScalingPolicyDescription -> Rep AutoScalingPolicyDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AutoScalingPolicyDescription x -> AutoScalingPolicyDescription
$cfrom :: forall x.
AutoScalingPolicyDescription -> Rep AutoScalingPolicyDescription x
Prelude.Generic)
newAutoScalingPolicyDescription ::
AutoScalingPolicyDescription
newAutoScalingPolicyDescription :: AutoScalingPolicyDescription
newAutoScalingPolicyDescription =
AutoScalingPolicyDescription' :: Maybe AutoScalingPolicyStatus
-> Maybe [ScalingRule]
-> Maybe ScalingConstraints
-> AutoScalingPolicyDescription
AutoScalingPolicyDescription'
{ $sel:status:AutoScalingPolicyDescription' :: Maybe AutoScalingPolicyStatus
status =
Maybe AutoScalingPolicyStatus
forall a. Maybe a
Prelude.Nothing,
$sel:rules:AutoScalingPolicyDescription' :: Maybe [ScalingRule]
rules = Maybe [ScalingRule]
forall a. Maybe a
Prelude.Nothing,
$sel:constraints:AutoScalingPolicyDescription' :: Maybe ScalingConstraints
constraints = Maybe ScalingConstraints
forall a. Maybe a
Prelude.Nothing
}
autoScalingPolicyDescription_status :: Lens.Lens' AutoScalingPolicyDescription (Prelude.Maybe AutoScalingPolicyStatus)
autoScalingPolicyDescription_status :: (Maybe AutoScalingPolicyStatus
-> f (Maybe AutoScalingPolicyStatus))
-> AutoScalingPolicyDescription -> f AutoScalingPolicyDescription
autoScalingPolicyDescription_status = (AutoScalingPolicyDescription -> Maybe AutoScalingPolicyStatus)
-> (AutoScalingPolicyDescription
-> Maybe AutoScalingPolicyStatus -> AutoScalingPolicyDescription)
-> Lens
AutoScalingPolicyDescription
AutoScalingPolicyDescription
(Maybe AutoScalingPolicyStatus)
(Maybe AutoScalingPolicyStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingPolicyDescription' {Maybe AutoScalingPolicyStatus
status :: Maybe AutoScalingPolicyStatus
$sel:status:AutoScalingPolicyDescription' :: AutoScalingPolicyDescription -> Maybe AutoScalingPolicyStatus
status} -> Maybe AutoScalingPolicyStatus
status) (\s :: AutoScalingPolicyDescription
s@AutoScalingPolicyDescription' {} Maybe AutoScalingPolicyStatus
a -> AutoScalingPolicyDescription
s {$sel:status:AutoScalingPolicyDescription' :: Maybe AutoScalingPolicyStatus
status = Maybe AutoScalingPolicyStatus
a} :: AutoScalingPolicyDescription)
autoScalingPolicyDescription_rules :: Lens.Lens' AutoScalingPolicyDescription (Prelude.Maybe [ScalingRule])
autoScalingPolicyDescription_rules :: (Maybe [ScalingRule] -> f (Maybe [ScalingRule]))
-> AutoScalingPolicyDescription -> f AutoScalingPolicyDescription
autoScalingPolicyDescription_rules = (AutoScalingPolicyDescription -> Maybe [ScalingRule])
-> (AutoScalingPolicyDescription
-> Maybe [ScalingRule] -> AutoScalingPolicyDescription)
-> Lens
AutoScalingPolicyDescription
AutoScalingPolicyDescription
(Maybe [ScalingRule])
(Maybe [ScalingRule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingPolicyDescription' {Maybe [ScalingRule]
rules :: Maybe [ScalingRule]
$sel:rules:AutoScalingPolicyDescription' :: AutoScalingPolicyDescription -> Maybe [ScalingRule]
rules} -> Maybe [ScalingRule]
rules) (\s :: AutoScalingPolicyDescription
s@AutoScalingPolicyDescription' {} Maybe [ScalingRule]
a -> AutoScalingPolicyDescription
s {$sel:rules:AutoScalingPolicyDescription' :: Maybe [ScalingRule]
rules = Maybe [ScalingRule]
a} :: AutoScalingPolicyDescription) ((Maybe [ScalingRule] -> f (Maybe [ScalingRule]))
-> AutoScalingPolicyDescription -> f AutoScalingPolicyDescription)
-> ((Maybe [ScalingRule] -> f (Maybe [ScalingRule]))
-> Maybe [ScalingRule] -> f (Maybe [ScalingRule]))
-> (Maybe [ScalingRule] -> f (Maybe [ScalingRule]))
-> AutoScalingPolicyDescription
-> f AutoScalingPolicyDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ScalingRule] [ScalingRule] [ScalingRule] [ScalingRule]
-> Iso
(Maybe [ScalingRule])
(Maybe [ScalingRule])
(Maybe [ScalingRule])
(Maybe [ScalingRule])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [ScalingRule] [ScalingRule] [ScalingRule] [ScalingRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
autoScalingPolicyDescription_constraints :: Lens.Lens' AutoScalingPolicyDescription (Prelude.Maybe ScalingConstraints)
autoScalingPolicyDescription_constraints :: (Maybe ScalingConstraints -> f (Maybe ScalingConstraints))
-> AutoScalingPolicyDescription -> f AutoScalingPolicyDescription
autoScalingPolicyDescription_constraints = (AutoScalingPolicyDescription -> Maybe ScalingConstraints)
-> (AutoScalingPolicyDescription
-> Maybe ScalingConstraints -> AutoScalingPolicyDescription)
-> Lens
AutoScalingPolicyDescription
AutoScalingPolicyDescription
(Maybe ScalingConstraints)
(Maybe ScalingConstraints)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingPolicyDescription' {Maybe ScalingConstraints
constraints :: Maybe ScalingConstraints
$sel:constraints:AutoScalingPolicyDescription' :: AutoScalingPolicyDescription -> Maybe ScalingConstraints
constraints} -> Maybe ScalingConstraints
constraints) (\s :: AutoScalingPolicyDescription
s@AutoScalingPolicyDescription' {} Maybe ScalingConstraints
a -> AutoScalingPolicyDescription
s {$sel:constraints:AutoScalingPolicyDescription' :: Maybe ScalingConstraints
constraints = Maybe ScalingConstraints
a} :: AutoScalingPolicyDescription)
instance Core.FromJSON AutoScalingPolicyDescription where
parseJSON :: Value -> Parser AutoScalingPolicyDescription
parseJSON =
String
-> (Object -> Parser AutoScalingPolicyDescription)
-> Value
-> Parser AutoScalingPolicyDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AutoScalingPolicyDescription"
( \Object
x ->
Maybe AutoScalingPolicyStatus
-> Maybe [ScalingRule]
-> Maybe ScalingConstraints
-> AutoScalingPolicyDescription
AutoScalingPolicyDescription'
(Maybe AutoScalingPolicyStatus
-> Maybe [ScalingRule]
-> Maybe ScalingConstraints
-> AutoScalingPolicyDescription)
-> Parser (Maybe AutoScalingPolicyStatus)
-> Parser
(Maybe [ScalingRule]
-> Maybe ScalingConstraints -> AutoScalingPolicyDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AutoScalingPolicyStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
Parser
(Maybe [ScalingRule]
-> Maybe ScalingConstraints -> AutoScalingPolicyDescription)
-> Parser (Maybe [ScalingRule])
-> Parser
(Maybe ScalingConstraints -> AutoScalingPolicyDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [ScalingRule]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Rules" Parser (Maybe (Maybe [ScalingRule]))
-> Maybe [ScalingRule] -> Parser (Maybe [ScalingRule])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ScalingRule]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe ScalingConstraints -> AutoScalingPolicyDescription)
-> Parser (Maybe ScalingConstraints)
-> Parser AutoScalingPolicyDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ScalingConstraints)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Constraints")
)
instance
Prelude.Hashable
AutoScalingPolicyDescription
instance Prelude.NFData AutoScalingPolicyDescription