{-# 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.PredefinedLoadMetricSpecification where
import Amazonka.AutoScalingPlans.Types.LoadMetricType
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 PredefinedLoadMetricSpecification = PredefinedLoadMetricSpecification'
{
PredefinedLoadMetricSpecification -> Maybe Text
resourceLabel :: Prelude.Maybe Prelude.Text,
PredefinedLoadMetricSpecification -> LoadMetricType
predefinedLoadMetricType :: LoadMetricType
}
deriving (PredefinedLoadMetricSpecification
-> PredefinedLoadMetricSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PredefinedLoadMetricSpecification
-> PredefinedLoadMetricSpecification -> Bool
$c/= :: PredefinedLoadMetricSpecification
-> PredefinedLoadMetricSpecification -> Bool
== :: PredefinedLoadMetricSpecification
-> PredefinedLoadMetricSpecification -> Bool
$c== :: PredefinedLoadMetricSpecification
-> PredefinedLoadMetricSpecification -> Bool
Prelude.Eq, ReadPrec [PredefinedLoadMetricSpecification]
ReadPrec PredefinedLoadMetricSpecification
Int -> ReadS PredefinedLoadMetricSpecification
ReadS [PredefinedLoadMetricSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PredefinedLoadMetricSpecification]
$creadListPrec :: ReadPrec [PredefinedLoadMetricSpecification]
readPrec :: ReadPrec PredefinedLoadMetricSpecification
$creadPrec :: ReadPrec PredefinedLoadMetricSpecification
readList :: ReadS [PredefinedLoadMetricSpecification]
$creadList :: ReadS [PredefinedLoadMetricSpecification]
readsPrec :: Int -> ReadS PredefinedLoadMetricSpecification
$creadsPrec :: Int -> ReadS PredefinedLoadMetricSpecification
Prelude.Read, Int -> PredefinedLoadMetricSpecification -> ShowS
[PredefinedLoadMetricSpecification] -> ShowS
PredefinedLoadMetricSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PredefinedLoadMetricSpecification] -> ShowS
$cshowList :: [PredefinedLoadMetricSpecification] -> ShowS
show :: PredefinedLoadMetricSpecification -> String
$cshow :: PredefinedLoadMetricSpecification -> String
showsPrec :: Int -> PredefinedLoadMetricSpecification -> ShowS
$cshowsPrec :: Int -> PredefinedLoadMetricSpecification -> ShowS
Prelude.Show, forall x.
Rep PredefinedLoadMetricSpecification x
-> PredefinedLoadMetricSpecification
forall x.
PredefinedLoadMetricSpecification
-> Rep PredefinedLoadMetricSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PredefinedLoadMetricSpecification x
-> PredefinedLoadMetricSpecification
$cfrom :: forall x.
PredefinedLoadMetricSpecification
-> Rep PredefinedLoadMetricSpecification x
Prelude.Generic)
newPredefinedLoadMetricSpecification ::
LoadMetricType ->
PredefinedLoadMetricSpecification
newPredefinedLoadMetricSpecification :: LoadMetricType -> PredefinedLoadMetricSpecification
newPredefinedLoadMetricSpecification
LoadMetricType
pPredefinedLoadMetricType_ =
PredefinedLoadMetricSpecification'
{ $sel:resourceLabel:PredefinedLoadMetricSpecification' :: Maybe Text
resourceLabel =
forall a. Maybe a
Prelude.Nothing,
$sel:predefinedLoadMetricType:PredefinedLoadMetricSpecification' :: LoadMetricType
predefinedLoadMetricType =
LoadMetricType
pPredefinedLoadMetricType_
}
predefinedLoadMetricSpecification_resourceLabel :: Lens.Lens' PredefinedLoadMetricSpecification (Prelude.Maybe Prelude.Text)
predefinedLoadMetricSpecification_resourceLabel :: Lens' PredefinedLoadMetricSpecification (Maybe Text)
predefinedLoadMetricSpecification_resourceLabel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredefinedLoadMetricSpecification' {Maybe Text
resourceLabel :: Maybe Text
$sel:resourceLabel:PredefinedLoadMetricSpecification' :: PredefinedLoadMetricSpecification -> Maybe Text
resourceLabel} -> Maybe Text
resourceLabel) (\s :: PredefinedLoadMetricSpecification
s@PredefinedLoadMetricSpecification' {} Maybe Text
a -> PredefinedLoadMetricSpecification
s {$sel:resourceLabel:PredefinedLoadMetricSpecification' :: Maybe Text
resourceLabel = Maybe Text
a} :: PredefinedLoadMetricSpecification)
predefinedLoadMetricSpecification_predefinedLoadMetricType :: Lens.Lens' PredefinedLoadMetricSpecification LoadMetricType
predefinedLoadMetricSpecification_predefinedLoadMetricType :: Lens' PredefinedLoadMetricSpecification LoadMetricType
predefinedLoadMetricSpecification_predefinedLoadMetricType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredefinedLoadMetricSpecification' {LoadMetricType
predefinedLoadMetricType :: LoadMetricType
$sel:predefinedLoadMetricType:PredefinedLoadMetricSpecification' :: PredefinedLoadMetricSpecification -> LoadMetricType
predefinedLoadMetricType} -> LoadMetricType
predefinedLoadMetricType) (\s :: PredefinedLoadMetricSpecification
s@PredefinedLoadMetricSpecification' {} LoadMetricType
a -> PredefinedLoadMetricSpecification
s {$sel:predefinedLoadMetricType:PredefinedLoadMetricSpecification' :: LoadMetricType
predefinedLoadMetricType = LoadMetricType
a} :: PredefinedLoadMetricSpecification)
instance
Data.FromJSON
PredefinedLoadMetricSpecification
where
parseJSON :: Value -> Parser PredefinedLoadMetricSpecification
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PredefinedLoadMetricSpecification"
( \Object
x ->
Maybe Text -> LoadMetricType -> PredefinedLoadMetricSpecification
PredefinedLoadMetricSpecification'
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
"PredefinedLoadMetricType")
)
instance
Prelude.Hashable
PredefinedLoadMetricSpecification
where
hashWithSalt :: Int -> PredefinedLoadMetricSpecification -> Int
hashWithSalt
Int
_salt
PredefinedLoadMetricSpecification' {Maybe Text
LoadMetricType
predefinedLoadMetricType :: LoadMetricType
resourceLabel :: Maybe Text
$sel:predefinedLoadMetricType:PredefinedLoadMetricSpecification' :: PredefinedLoadMetricSpecification -> LoadMetricType
$sel:resourceLabel:PredefinedLoadMetricSpecification' :: PredefinedLoadMetricSpecification -> 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` LoadMetricType
predefinedLoadMetricType
instance
Prelude.NFData
PredefinedLoadMetricSpecification
where
rnf :: PredefinedLoadMetricSpecification -> ()
rnf PredefinedLoadMetricSpecification' {Maybe Text
LoadMetricType
predefinedLoadMetricType :: LoadMetricType
resourceLabel :: Maybe Text
$sel:predefinedLoadMetricType:PredefinedLoadMetricSpecification' :: PredefinedLoadMetricSpecification -> LoadMetricType
$sel:resourceLabel:PredefinedLoadMetricSpecification' :: PredefinedLoadMetricSpecification -> 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 LoadMetricType
predefinedLoadMetricType
instance
Data.ToJSON
PredefinedLoadMetricSpecification
where
toJSON :: PredefinedLoadMetricSpecification -> Value
toJSON PredefinedLoadMetricSpecification' {Maybe Text
LoadMetricType
predefinedLoadMetricType :: LoadMetricType
resourceLabel :: Maybe Text
$sel:predefinedLoadMetricType:PredefinedLoadMetricSpecification' :: PredefinedLoadMetricSpecification -> LoadMetricType
$sel:resourceLabel:PredefinedLoadMetricSpecification' :: PredefinedLoadMetricSpecification -> 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
"PredefinedLoadMetricType"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= LoadMetricType
predefinedLoadMetricType
)
]
)