{-# 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.ApplicationAutoScaling.Types.PredefinedMetricSpecification where
import Amazonka.ApplicationAutoScaling.Types.MetricType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PredefinedMetricSpecification = PredefinedMetricSpecification'
{
PredefinedMetricSpecification -> Maybe Text
resourceLabel :: Prelude.Maybe Prelude.Text,
PredefinedMetricSpecification -> MetricType
predefinedMetricType :: MetricType
}
deriving (PredefinedMetricSpecification
-> PredefinedMetricSpecification -> Bool
(PredefinedMetricSpecification
-> PredefinedMetricSpecification -> Bool)
-> (PredefinedMetricSpecification
-> PredefinedMetricSpecification -> Bool)
-> Eq PredefinedMetricSpecification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PredefinedMetricSpecification
-> PredefinedMetricSpecification -> Bool
$c/= :: PredefinedMetricSpecification
-> PredefinedMetricSpecification -> Bool
== :: PredefinedMetricSpecification
-> PredefinedMetricSpecification -> Bool
$c== :: PredefinedMetricSpecification
-> PredefinedMetricSpecification -> Bool
Prelude.Eq, ReadPrec [PredefinedMetricSpecification]
ReadPrec PredefinedMetricSpecification
Int -> ReadS PredefinedMetricSpecification
ReadS [PredefinedMetricSpecification]
(Int -> ReadS PredefinedMetricSpecification)
-> ReadS [PredefinedMetricSpecification]
-> ReadPrec PredefinedMetricSpecification
-> ReadPrec [PredefinedMetricSpecification]
-> Read PredefinedMetricSpecification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PredefinedMetricSpecification]
$creadListPrec :: ReadPrec [PredefinedMetricSpecification]
readPrec :: ReadPrec PredefinedMetricSpecification
$creadPrec :: ReadPrec PredefinedMetricSpecification
readList :: ReadS [PredefinedMetricSpecification]
$creadList :: ReadS [PredefinedMetricSpecification]
readsPrec :: Int -> ReadS PredefinedMetricSpecification
$creadsPrec :: Int -> ReadS PredefinedMetricSpecification
Prelude.Read, Int -> PredefinedMetricSpecification -> ShowS
[PredefinedMetricSpecification] -> ShowS
PredefinedMetricSpecification -> String
(Int -> PredefinedMetricSpecification -> ShowS)
-> (PredefinedMetricSpecification -> String)
-> ([PredefinedMetricSpecification] -> ShowS)
-> Show PredefinedMetricSpecification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PredefinedMetricSpecification] -> ShowS
$cshowList :: [PredefinedMetricSpecification] -> ShowS
show :: PredefinedMetricSpecification -> String
$cshow :: PredefinedMetricSpecification -> String
showsPrec :: Int -> PredefinedMetricSpecification -> ShowS
$cshowsPrec :: Int -> PredefinedMetricSpecification -> ShowS
Prelude.Show, (forall x.
PredefinedMetricSpecification
-> Rep PredefinedMetricSpecification x)
-> (forall x.
Rep PredefinedMetricSpecification x
-> PredefinedMetricSpecification)
-> Generic PredefinedMetricSpecification
forall x.
Rep PredefinedMetricSpecification x
-> PredefinedMetricSpecification
forall x.
PredefinedMetricSpecification
-> Rep PredefinedMetricSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PredefinedMetricSpecification x
-> PredefinedMetricSpecification
$cfrom :: forall x.
PredefinedMetricSpecification
-> Rep PredefinedMetricSpecification x
Prelude.Generic)
newPredefinedMetricSpecification ::
MetricType ->
PredefinedMetricSpecification
newPredefinedMetricSpecification :: MetricType -> PredefinedMetricSpecification
newPredefinedMetricSpecification
MetricType
pPredefinedMetricType_ =
PredefinedMetricSpecification' :: Maybe Text -> MetricType -> PredefinedMetricSpecification
PredefinedMetricSpecification'
{ $sel:resourceLabel:PredefinedMetricSpecification' :: Maybe Text
resourceLabel =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:predefinedMetricType:PredefinedMetricSpecification' :: MetricType
predefinedMetricType =
MetricType
pPredefinedMetricType_
}
predefinedMetricSpecification_resourceLabel :: Lens.Lens' PredefinedMetricSpecification (Prelude.Maybe Prelude.Text)
predefinedMetricSpecification_resourceLabel :: (Maybe Text -> f (Maybe Text))
-> PredefinedMetricSpecification -> f PredefinedMetricSpecification
predefinedMetricSpecification_resourceLabel = (PredefinedMetricSpecification -> Maybe Text)
-> (PredefinedMetricSpecification
-> Maybe Text -> PredefinedMetricSpecification)
-> Lens
PredefinedMetricSpecification
PredefinedMetricSpecification
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredefinedMetricSpecification' {Maybe Text
resourceLabel :: Maybe Text
$sel:resourceLabel:PredefinedMetricSpecification' :: PredefinedMetricSpecification -> Maybe Text
resourceLabel} -> Maybe Text
resourceLabel) (\s :: PredefinedMetricSpecification
s@PredefinedMetricSpecification' {} Maybe Text
a -> PredefinedMetricSpecification
s {$sel:resourceLabel:PredefinedMetricSpecification' :: Maybe Text
resourceLabel = Maybe Text
a} :: PredefinedMetricSpecification)
predefinedMetricSpecification_predefinedMetricType :: Lens.Lens' PredefinedMetricSpecification MetricType
predefinedMetricSpecification_predefinedMetricType :: (MetricType -> f MetricType)
-> PredefinedMetricSpecification -> f PredefinedMetricSpecification
predefinedMetricSpecification_predefinedMetricType = (PredefinedMetricSpecification -> MetricType)
-> (PredefinedMetricSpecification
-> MetricType -> PredefinedMetricSpecification)
-> Lens
PredefinedMetricSpecification
PredefinedMetricSpecification
MetricType
MetricType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredefinedMetricSpecification' {MetricType
predefinedMetricType :: MetricType
$sel:predefinedMetricType:PredefinedMetricSpecification' :: PredefinedMetricSpecification -> MetricType
predefinedMetricType} -> MetricType
predefinedMetricType) (\s :: PredefinedMetricSpecification
s@PredefinedMetricSpecification' {} MetricType
a -> PredefinedMetricSpecification
s {$sel:predefinedMetricType:PredefinedMetricSpecification' :: MetricType
predefinedMetricType = MetricType
a} :: PredefinedMetricSpecification)
instance Core.FromJSON PredefinedMetricSpecification where
parseJSON :: Value -> Parser PredefinedMetricSpecification
parseJSON =
String
-> (Object -> Parser PredefinedMetricSpecification)
-> Value
-> Parser PredefinedMetricSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PredefinedMetricSpecification"
( \Object
x ->
Maybe Text -> MetricType -> PredefinedMetricSpecification
PredefinedMetricSpecification'
(Maybe Text -> MetricType -> PredefinedMetricSpecification)
-> Parser (Maybe Text)
-> Parser (MetricType -> PredefinedMetricSpecification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResourceLabel")
Parser (MetricType -> PredefinedMetricSpecification)
-> Parser MetricType -> Parser PredefinedMetricSpecification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser MetricType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"PredefinedMetricType")
)
instance
Prelude.Hashable
PredefinedMetricSpecification
instance Prelude.NFData PredefinedMetricSpecification
instance Core.ToJSON PredefinedMetricSpecification where
toJSON :: PredefinedMetricSpecification -> Value
toJSON PredefinedMetricSpecification' {Maybe Text
MetricType
predefinedMetricType :: MetricType
resourceLabel :: Maybe Text
$sel:predefinedMetricType:PredefinedMetricSpecification' :: PredefinedMetricSpecification -> MetricType
$sel:resourceLabel:PredefinedMetricSpecification' :: PredefinedMetricSpecification -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ResourceLabel" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
resourceLabel,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"PredefinedMetricType"
Text -> MetricType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= MetricType
predefinedMetricType
)
]
)