{-# 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.CustomizedLoadMetricSpecification where
import Amazonka.AutoScalingPlans.Types.MetricDimension
import Amazonka.AutoScalingPlans.Types.MetricStatistic
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CustomizedLoadMetricSpecification = CustomizedLoadMetricSpecification'
{
CustomizedLoadMetricSpecification -> Maybe [MetricDimension]
dimensions :: Prelude.Maybe [MetricDimension],
CustomizedLoadMetricSpecification -> Maybe Text
unit :: Prelude.Maybe Prelude.Text,
CustomizedLoadMetricSpecification -> Text
metricName :: Prelude.Text,
CustomizedLoadMetricSpecification -> Text
namespace :: Prelude.Text,
CustomizedLoadMetricSpecification -> MetricStatistic
statistic :: MetricStatistic
}
deriving (CustomizedLoadMetricSpecification
-> CustomizedLoadMetricSpecification -> Bool
(CustomizedLoadMetricSpecification
-> CustomizedLoadMetricSpecification -> Bool)
-> (CustomizedLoadMetricSpecification
-> CustomizedLoadMetricSpecification -> Bool)
-> Eq CustomizedLoadMetricSpecification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomizedLoadMetricSpecification
-> CustomizedLoadMetricSpecification -> Bool
$c/= :: CustomizedLoadMetricSpecification
-> CustomizedLoadMetricSpecification -> Bool
== :: CustomizedLoadMetricSpecification
-> CustomizedLoadMetricSpecification -> Bool
$c== :: CustomizedLoadMetricSpecification
-> CustomizedLoadMetricSpecification -> Bool
Prelude.Eq, ReadPrec [CustomizedLoadMetricSpecification]
ReadPrec CustomizedLoadMetricSpecification
Int -> ReadS CustomizedLoadMetricSpecification
ReadS [CustomizedLoadMetricSpecification]
(Int -> ReadS CustomizedLoadMetricSpecification)
-> ReadS [CustomizedLoadMetricSpecification]
-> ReadPrec CustomizedLoadMetricSpecification
-> ReadPrec [CustomizedLoadMetricSpecification]
-> Read CustomizedLoadMetricSpecification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomizedLoadMetricSpecification]
$creadListPrec :: ReadPrec [CustomizedLoadMetricSpecification]
readPrec :: ReadPrec CustomizedLoadMetricSpecification
$creadPrec :: ReadPrec CustomizedLoadMetricSpecification
readList :: ReadS [CustomizedLoadMetricSpecification]
$creadList :: ReadS [CustomizedLoadMetricSpecification]
readsPrec :: Int -> ReadS CustomizedLoadMetricSpecification
$creadsPrec :: Int -> ReadS CustomizedLoadMetricSpecification
Prelude.Read, Int -> CustomizedLoadMetricSpecification -> ShowS
[CustomizedLoadMetricSpecification] -> ShowS
CustomizedLoadMetricSpecification -> String
(Int -> CustomizedLoadMetricSpecification -> ShowS)
-> (CustomizedLoadMetricSpecification -> String)
-> ([CustomizedLoadMetricSpecification] -> ShowS)
-> Show CustomizedLoadMetricSpecification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomizedLoadMetricSpecification] -> ShowS
$cshowList :: [CustomizedLoadMetricSpecification] -> ShowS
show :: CustomizedLoadMetricSpecification -> String
$cshow :: CustomizedLoadMetricSpecification -> String
showsPrec :: Int -> CustomizedLoadMetricSpecification -> ShowS
$cshowsPrec :: Int -> CustomizedLoadMetricSpecification -> ShowS
Prelude.Show, (forall x.
CustomizedLoadMetricSpecification
-> Rep CustomizedLoadMetricSpecification x)
-> (forall x.
Rep CustomizedLoadMetricSpecification x
-> CustomizedLoadMetricSpecification)
-> Generic CustomizedLoadMetricSpecification
forall x.
Rep CustomizedLoadMetricSpecification x
-> CustomizedLoadMetricSpecification
forall x.
CustomizedLoadMetricSpecification
-> Rep CustomizedLoadMetricSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomizedLoadMetricSpecification x
-> CustomizedLoadMetricSpecification
$cfrom :: forall x.
CustomizedLoadMetricSpecification
-> Rep CustomizedLoadMetricSpecification x
Prelude.Generic)
newCustomizedLoadMetricSpecification ::
Prelude.Text ->
Prelude.Text ->
MetricStatistic ->
CustomizedLoadMetricSpecification
newCustomizedLoadMetricSpecification :: Text
-> Text -> MetricStatistic -> CustomizedLoadMetricSpecification
newCustomizedLoadMetricSpecification
Text
pMetricName_
Text
pNamespace_
MetricStatistic
pStatistic_ =
CustomizedLoadMetricSpecification' :: Maybe [MetricDimension]
-> Maybe Text
-> Text
-> Text
-> MetricStatistic
-> CustomizedLoadMetricSpecification
CustomizedLoadMetricSpecification'
{ $sel:dimensions:CustomizedLoadMetricSpecification' :: Maybe [MetricDimension]
dimensions =
Maybe [MetricDimension]
forall a. Maybe a
Prelude.Nothing,
$sel:unit:CustomizedLoadMetricSpecification' :: Maybe Text
unit = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:metricName:CustomizedLoadMetricSpecification' :: Text
metricName = Text
pMetricName_,
$sel:namespace:CustomizedLoadMetricSpecification' :: Text
namespace = Text
pNamespace_,
$sel:statistic:CustomizedLoadMetricSpecification' :: MetricStatistic
statistic = MetricStatistic
pStatistic_
}
customizedLoadMetricSpecification_dimensions :: Lens.Lens' CustomizedLoadMetricSpecification (Prelude.Maybe [MetricDimension])
customizedLoadMetricSpecification_dimensions :: (Maybe [MetricDimension] -> f (Maybe [MetricDimension]))
-> CustomizedLoadMetricSpecification
-> f CustomizedLoadMetricSpecification
customizedLoadMetricSpecification_dimensions = (CustomizedLoadMetricSpecification -> Maybe [MetricDimension])
-> (CustomizedLoadMetricSpecification
-> Maybe [MetricDimension] -> CustomizedLoadMetricSpecification)
-> Lens
CustomizedLoadMetricSpecification
CustomizedLoadMetricSpecification
(Maybe [MetricDimension])
(Maybe [MetricDimension])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomizedLoadMetricSpecification' {Maybe [MetricDimension]
dimensions :: Maybe [MetricDimension]
$sel:dimensions:CustomizedLoadMetricSpecification' :: CustomizedLoadMetricSpecification -> Maybe [MetricDimension]
dimensions} -> Maybe [MetricDimension]
dimensions) (\s :: CustomizedLoadMetricSpecification
s@CustomizedLoadMetricSpecification' {} Maybe [MetricDimension]
a -> CustomizedLoadMetricSpecification
s {$sel:dimensions:CustomizedLoadMetricSpecification' :: Maybe [MetricDimension]
dimensions = Maybe [MetricDimension]
a} :: CustomizedLoadMetricSpecification) ((Maybe [MetricDimension] -> f (Maybe [MetricDimension]))
-> CustomizedLoadMetricSpecification
-> f CustomizedLoadMetricSpecification)
-> ((Maybe [MetricDimension] -> f (Maybe [MetricDimension]))
-> Maybe [MetricDimension] -> f (Maybe [MetricDimension]))
-> (Maybe [MetricDimension] -> f (Maybe [MetricDimension]))
-> CustomizedLoadMetricSpecification
-> f CustomizedLoadMetricSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[MetricDimension]
[MetricDimension]
[MetricDimension]
[MetricDimension]
-> Iso
(Maybe [MetricDimension])
(Maybe [MetricDimension])
(Maybe [MetricDimension])
(Maybe [MetricDimension])
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
[MetricDimension]
[MetricDimension]
[MetricDimension]
[MetricDimension]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
customizedLoadMetricSpecification_unit :: Lens.Lens' CustomizedLoadMetricSpecification (Prelude.Maybe Prelude.Text)
customizedLoadMetricSpecification_unit :: (Maybe Text -> f (Maybe Text))
-> CustomizedLoadMetricSpecification
-> f CustomizedLoadMetricSpecification
customizedLoadMetricSpecification_unit = (CustomizedLoadMetricSpecification -> Maybe Text)
-> (CustomizedLoadMetricSpecification
-> Maybe Text -> CustomizedLoadMetricSpecification)
-> Lens
CustomizedLoadMetricSpecification
CustomizedLoadMetricSpecification
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomizedLoadMetricSpecification' {Maybe Text
unit :: Maybe Text
$sel:unit:CustomizedLoadMetricSpecification' :: CustomizedLoadMetricSpecification -> Maybe Text
unit} -> Maybe Text
unit) (\s :: CustomizedLoadMetricSpecification
s@CustomizedLoadMetricSpecification' {} Maybe Text
a -> CustomizedLoadMetricSpecification
s {$sel:unit:CustomizedLoadMetricSpecification' :: Maybe Text
unit = Maybe Text
a} :: CustomizedLoadMetricSpecification)
customizedLoadMetricSpecification_metricName :: Lens.Lens' CustomizedLoadMetricSpecification Prelude.Text
customizedLoadMetricSpecification_metricName :: (Text -> f Text)
-> CustomizedLoadMetricSpecification
-> f CustomizedLoadMetricSpecification
customizedLoadMetricSpecification_metricName = (CustomizedLoadMetricSpecification -> Text)
-> (CustomizedLoadMetricSpecification
-> Text -> CustomizedLoadMetricSpecification)
-> Lens
CustomizedLoadMetricSpecification
CustomizedLoadMetricSpecification
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomizedLoadMetricSpecification' {Text
metricName :: Text
$sel:metricName:CustomizedLoadMetricSpecification' :: CustomizedLoadMetricSpecification -> Text
metricName} -> Text
metricName) (\s :: CustomizedLoadMetricSpecification
s@CustomizedLoadMetricSpecification' {} Text
a -> CustomizedLoadMetricSpecification
s {$sel:metricName:CustomizedLoadMetricSpecification' :: Text
metricName = Text
a} :: CustomizedLoadMetricSpecification)
customizedLoadMetricSpecification_namespace :: Lens.Lens' CustomizedLoadMetricSpecification Prelude.Text
customizedLoadMetricSpecification_namespace :: (Text -> f Text)
-> CustomizedLoadMetricSpecification
-> f CustomizedLoadMetricSpecification
customizedLoadMetricSpecification_namespace = (CustomizedLoadMetricSpecification -> Text)
-> (CustomizedLoadMetricSpecification
-> Text -> CustomizedLoadMetricSpecification)
-> Lens
CustomizedLoadMetricSpecification
CustomizedLoadMetricSpecification
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomizedLoadMetricSpecification' {Text
namespace :: Text
$sel:namespace:CustomizedLoadMetricSpecification' :: CustomizedLoadMetricSpecification -> Text
namespace} -> Text
namespace) (\s :: CustomizedLoadMetricSpecification
s@CustomizedLoadMetricSpecification' {} Text
a -> CustomizedLoadMetricSpecification
s {$sel:namespace:CustomizedLoadMetricSpecification' :: Text
namespace = Text
a} :: CustomizedLoadMetricSpecification)
customizedLoadMetricSpecification_statistic :: Lens.Lens' CustomizedLoadMetricSpecification MetricStatistic
customizedLoadMetricSpecification_statistic :: (MetricStatistic -> f MetricStatistic)
-> CustomizedLoadMetricSpecification
-> f CustomizedLoadMetricSpecification
customizedLoadMetricSpecification_statistic = (CustomizedLoadMetricSpecification -> MetricStatistic)
-> (CustomizedLoadMetricSpecification
-> MetricStatistic -> CustomizedLoadMetricSpecification)
-> Lens
CustomizedLoadMetricSpecification
CustomizedLoadMetricSpecification
MetricStatistic
MetricStatistic
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomizedLoadMetricSpecification' {MetricStatistic
statistic :: MetricStatistic
$sel:statistic:CustomizedLoadMetricSpecification' :: CustomizedLoadMetricSpecification -> MetricStatistic
statistic} -> MetricStatistic
statistic) (\s :: CustomizedLoadMetricSpecification
s@CustomizedLoadMetricSpecification' {} MetricStatistic
a -> CustomizedLoadMetricSpecification
s {$sel:statistic:CustomizedLoadMetricSpecification' :: MetricStatistic
statistic = MetricStatistic
a} :: CustomizedLoadMetricSpecification)
instance
Core.FromJSON
CustomizedLoadMetricSpecification
where
parseJSON :: Value -> Parser CustomizedLoadMetricSpecification
parseJSON =
String
-> (Object -> Parser CustomizedLoadMetricSpecification)
-> Value
-> Parser CustomizedLoadMetricSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CustomizedLoadMetricSpecification"
( \Object
x ->
Maybe [MetricDimension]
-> Maybe Text
-> Text
-> Text
-> MetricStatistic
-> CustomizedLoadMetricSpecification
CustomizedLoadMetricSpecification'
(Maybe [MetricDimension]
-> Maybe Text
-> Text
-> Text
-> MetricStatistic
-> CustomizedLoadMetricSpecification)
-> Parser (Maybe [MetricDimension])
-> Parser
(Maybe Text
-> Text
-> Text
-> MetricStatistic
-> CustomizedLoadMetricSpecification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [MetricDimension]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Dimensions" Parser (Maybe (Maybe [MetricDimension]))
-> Maybe [MetricDimension] -> Parser (Maybe [MetricDimension])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [MetricDimension]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Text
-> Text
-> Text
-> MetricStatistic
-> CustomizedLoadMetricSpecification)
-> Parser (Maybe Text)
-> Parser
(Text
-> Text -> MetricStatistic -> CustomizedLoadMetricSpecification)
forall (f :: * -> *) a b. Applicative f => 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
"Unit")
Parser
(Text
-> Text -> MetricStatistic -> CustomizedLoadMetricSpecification)
-> Parser Text
-> Parser
(Text -> MetricStatistic -> CustomizedLoadMetricSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MetricName")
Parser
(Text -> MetricStatistic -> CustomizedLoadMetricSpecification)
-> Parser Text
-> Parser (MetricStatistic -> CustomizedLoadMetricSpecification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Namespace")
Parser (MetricStatistic -> CustomizedLoadMetricSpecification)
-> Parser MetricStatistic
-> Parser CustomizedLoadMetricSpecification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser MetricStatistic
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Statistic")
)
instance
Prelude.Hashable
CustomizedLoadMetricSpecification
instance
Prelude.NFData
CustomizedLoadMetricSpecification
instance
Core.ToJSON
CustomizedLoadMetricSpecification
where
toJSON :: CustomizedLoadMetricSpecification -> Value
toJSON CustomizedLoadMetricSpecification' {Maybe [MetricDimension]
Maybe Text
Text
MetricStatistic
statistic :: MetricStatistic
namespace :: Text
metricName :: Text
unit :: Maybe Text
dimensions :: Maybe [MetricDimension]
$sel:statistic:CustomizedLoadMetricSpecification' :: CustomizedLoadMetricSpecification -> MetricStatistic
$sel:namespace:CustomizedLoadMetricSpecification' :: CustomizedLoadMetricSpecification -> Text
$sel:metricName:CustomizedLoadMetricSpecification' :: CustomizedLoadMetricSpecification -> Text
$sel:unit:CustomizedLoadMetricSpecification' :: CustomizedLoadMetricSpecification -> Maybe Text
$sel:dimensions:CustomizedLoadMetricSpecification' :: CustomizedLoadMetricSpecification -> Maybe [MetricDimension]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Dimensions" Text -> [MetricDimension] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([MetricDimension] -> Pair)
-> Maybe [MetricDimension] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [MetricDimension]
dimensions,
(Text
"Unit" 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
unit,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MetricName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
metricName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Namespace" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
namespace),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Statistic" Text -> MetricStatistic -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= MetricStatistic
statistic)
]
)