{-# 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.AutoScalingPlans.Types.PredefinedScalingMetricSpecification where
import Amazonka.AutoScalingPlans.Types.ScalingMetricType
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 PredefinedScalingMetricSpecification = PredefinedScalingMetricSpecification'
{
PredefinedScalingMetricSpecification -> Maybe Text
resourceLabel :: Prelude.Maybe Prelude.Text,
PredefinedScalingMetricSpecification -> ScalingMetricType
predefinedScalingMetricType :: ScalingMetricType
}
deriving (PredefinedScalingMetricSpecification
-> PredefinedScalingMetricSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PredefinedScalingMetricSpecification
-> PredefinedScalingMetricSpecification -> Bool
$c/= :: PredefinedScalingMetricSpecification
-> PredefinedScalingMetricSpecification -> Bool
== :: PredefinedScalingMetricSpecification
-> PredefinedScalingMetricSpecification -> Bool
$c== :: PredefinedScalingMetricSpecification
-> PredefinedScalingMetricSpecification -> Bool
Prelude.Eq, ReadPrec [PredefinedScalingMetricSpecification]
ReadPrec PredefinedScalingMetricSpecification
Int -> ReadS PredefinedScalingMetricSpecification
ReadS [PredefinedScalingMetricSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PredefinedScalingMetricSpecification]
$creadListPrec :: ReadPrec [PredefinedScalingMetricSpecification]
readPrec :: ReadPrec PredefinedScalingMetricSpecification
$creadPrec :: ReadPrec PredefinedScalingMetricSpecification
readList :: ReadS [PredefinedScalingMetricSpecification]
$creadList :: ReadS [PredefinedScalingMetricSpecification]
readsPrec :: Int -> ReadS PredefinedScalingMetricSpecification
$creadsPrec :: Int -> ReadS PredefinedScalingMetricSpecification
Prelude.Read, Int -> PredefinedScalingMetricSpecification -> ShowS
[PredefinedScalingMetricSpecification] -> ShowS
PredefinedScalingMetricSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PredefinedScalingMetricSpecification] -> ShowS
$cshowList :: [PredefinedScalingMetricSpecification] -> ShowS
show :: PredefinedScalingMetricSpecification -> String
$cshow :: PredefinedScalingMetricSpecification -> String
showsPrec :: Int -> PredefinedScalingMetricSpecification -> ShowS
$cshowsPrec :: Int -> PredefinedScalingMetricSpecification -> ShowS
Prelude.Show, forall x.
Rep PredefinedScalingMetricSpecification x
-> PredefinedScalingMetricSpecification
forall x.
PredefinedScalingMetricSpecification
-> Rep PredefinedScalingMetricSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PredefinedScalingMetricSpecification x
-> PredefinedScalingMetricSpecification
$cfrom :: forall x.
PredefinedScalingMetricSpecification
-> Rep PredefinedScalingMetricSpecification x
Prelude.Generic)
newPredefinedScalingMetricSpecification ::
ScalingMetricType ->
PredefinedScalingMetricSpecification
newPredefinedScalingMetricSpecification :: ScalingMetricType -> PredefinedScalingMetricSpecification
newPredefinedScalingMetricSpecification
ScalingMetricType
pPredefinedScalingMetricType_ =
PredefinedScalingMetricSpecification'
{ $sel:resourceLabel:PredefinedScalingMetricSpecification' :: Maybe Text
resourceLabel =
forall a. Maybe a
Prelude.Nothing,
$sel:predefinedScalingMetricType:PredefinedScalingMetricSpecification' :: ScalingMetricType
predefinedScalingMetricType =
ScalingMetricType
pPredefinedScalingMetricType_
}
predefinedScalingMetricSpecification_resourceLabel :: Lens.Lens' PredefinedScalingMetricSpecification (Prelude.Maybe Prelude.Text)
predefinedScalingMetricSpecification_resourceLabel :: Lens' PredefinedScalingMetricSpecification (Maybe Text)
predefinedScalingMetricSpecification_resourceLabel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredefinedScalingMetricSpecification' {Maybe Text
resourceLabel :: Maybe Text
$sel:resourceLabel:PredefinedScalingMetricSpecification' :: PredefinedScalingMetricSpecification -> Maybe Text
resourceLabel} -> Maybe Text
resourceLabel) (\s :: PredefinedScalingMetricSpecification
s@PredefinedScalingMetricSpecification' {} Maybe Text
a -> PredefinedScalingMetricSpecification
s {$sel:resourceLabel:PredefinedScalingMetricSpecification' :: Maybe Text
resourceLabel = Maybe Text
a} :: PredefinedScalingMetricSpecification)
predefinedScalingMetricSpecification_predefinedScalingMetricType :: Lens.Lens' PredefinedScalingMetricSpecification ScalingMetricType
predefinedScalingMetricSpecification_predefinedScalingMetricType :: Lens' PredefinedScalingMetricSpecification ScalingMetricType
predefinedScalingMetricSpecification_predefinedScalingMetricType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredefinedScalingMetricSpecification' {ScalingMetricType
predefinedScalingMetricType :: ScalingMetricType
$sel:predefinedScalingMetricType:PredefinedScalingMetricSpecification' :: PredefinedScalingMetricSpecification -> ScalingMetricType
predefinedScalingMetricType} -> ScalingMetricType
predefinedScalingMetricType) (\s :: PredefinedScalingMetricSpecification
s@PredefinedScalingMetricSpecification' {} ScalingMetricType
a -> PredefinedScalingMetricSpecification
s {$sel:predefinedScalingMetricType:PredefinedScalingMetricSpecification' :: ScalingMetricType
predefinedScalingMetricType = ScalingMetricType
a} :: PredefinedScalingMetricSpecification)
instance
Data.FromJSON
PredefinedScalingMetricSpecification
where
parseJSON :: Value -> Parser PredefinedScalingMetricSpecification
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PredefinedScalingMetricSpecification"
( \Object
x ->
Maybe Text
-> ScalingMetricType -> PredefinedScalingMetricSpecification
PredefinedScalingMetricSpecification'
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
"ResourceLabel")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"PredefinedScalingMetricType")
)
instance
Prelude.Hashable
PredefinedScalingMetricSpecification
where
hashWithSalt :: Int -> PredefinedScalingMetricSpecification -> Int
hashWithSalt
Int
_salt
PredefinedScalingMetricSpecification' {Maybe Text
ScalingMetricType
predefinedScalingMetricType :: ScalingMetricType
resourceLabel :: Maybe Text
$sel:predefinedScalingMetricType:PredefinedScalingMetricSpecification' :: PredefinedScalingMetricSpecification -> ScalingMetricType
$sel:resourceLabel:PredefinedScalingMetricSpecification' :: PredefinedScalingMetricSpecification -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceLabel
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ScalingMetricType
predefinedScalingMetricType
instance
Prelude.NFData
PredefinedScalingMetricSpecification
where
rnf :: PredefinedScalingMetricSpecification -> ()
rnf PredefinedScalingMetricSpecification' {Maybe Text
ScalingMetricType
predefinedScalingMetricType :: ScalingMetricType
resourceLabel :: Maybe Text
$sel:predefinedScalingMetricType:PredefinedScalingMetricSpecification' :: PredefinedScalingMetricSpecification -> ScalingMetricType
$sel:resourceLabel:PredefinedScalingMetricSpecification' :: PredefinedScalingMetricSpecification -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceLabel
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ScalingMetricType
predefinedScalingMetricType
instance
Data.ToJSON
PredefinedScalingMetricSpecification
where
toJSON :: PredefinedScalingMetricSpecification -> Value
toJSON PredefinedScalingMetricSpecification' {Maybe Text
ScalingMetricType
predefinedScalingMetricType :: ScalingMetricType
resourceLabel :: Maybe Text
$sel:predefinedScalingMetricType:PredefinedScalingMetricSpecification' :: PredefinedScalingMetricSpecification -> ScalingMetricType
$sel:resourceLabel:PredefinedScalingMetricSpecification' :: PredefinedScalingMetricSpecification -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"ResourceLabel" 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 Text
resourceLabel,
forall a. a -> Maybe a
Prelude.Just
( Key
"PredefinedScalingMetricType"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ScalingMetricType
predefinedScalingMetricType
)
]
)