{-# 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.CustomizedScalingMetricSpecification 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 CustomizedScalingMetricSpecification = CustomizedScalingMetricSpecification'
{
CustomizedScalingMetricSpecification -> Maybe [MetricDimension]
dimensions :: Prelude.Maybe [MetricDimension],
CustomizedScalingMetricSpecification -> Maybe Text
unit :: Prelude.Maybe Prelude.Text,
CustomizedScalingMetricSpecification -> Text
metricName :: Prelude.Text,
CustomizedScalingMetricSpecification -> Text
namespace :: Prelude.Text,
CustomizedScalingMetricSpecification -> MetricStatistic
statistic :: MetricStatistic
}
deriving (CustomizedScalingMetricSpecification
-> CustomizedScalingMetricSpecification -> Bool
(CustomizedScalingMetricSpecification
-> CustomizedScalingMetricSpecification -> Bool)
-> (CustomizedScalingMetricSpecification
-> CustomizedScalingMetricSpecification -> Bool)
-> Eq CustomizedScalingMetricSpecification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomizedScalingMetricSpecification
-> CustomizedScalingMetricSpecification -> Bool
$c/= :: CustomizedScalingMetricSpecification
-> CustomizedScalingMetricSpecification -> Bool
== :: CustomizedScalingMetricSpecification
-> CustomizedScalingMetricSpecification -> Bool
$c== :: CustomizedScalingMetricSpecification
-> CustomizedScalingMetricSpecification -> Bool
Prelude.Eq, ReadPrec [CustomizedScalingMetricSpecification]
ReadPrec CustomizedScalingMetricSpecification
Int -> ReadS CustomizedScalingMetricSpecification
ReadS [CustomizedScalingMetricSpecification]
(Int -> ReadS CustomizedScalingMetricSpecification)
-> ReadS [CustomizedScalingMetricSpecification]
-> ReadPrec CustomizedScalingMetricSpecification
-> ReadPrec [CustomizedScalingMetricSpecification]
-> Read CustomizedScalingMetricSpecification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomizedScalingMetricSpecification]
$creadListPrec :: ReadPrec [CustomizedScalingMetricSpecification]
readPrec :: ReadPrec CustomizedScalingMetricSpecification
$creadPrec :: ReadPrec CustomizedScalingMetricSpecification
readList :: ReadS [CustomizedScalingMetricSpecification]
$creadList :: ReadS [CustomizedScalingMetricSpecification]
readsPrec :: Int -> ReadS CustomizedScalingMetricSpecification
$creadsPrec :: Int -> ReadS CustomizedScalingMetricSpecification
Prelude.Read, Int -> CustomizedScalingMetricSpecification -> ShowS
[CustomizedScalingMetricSpecification] -> ShowS
CustomizedScalingMetricSpecification -> String
(Int -> CustomizedScalingMetricSpecification -> ShowS)
-> (CustomizedScalingMetricSpecification -> String)
-> ([CustomizedScalingMetricSpecification] -> ShowS)
-> Show CustomizedScalingMetricSpecification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomizedScalingMetricSpecification] -> ShowS
$cshowList :: [CustomizedScalingMetricSpecification] -> ShowS
show :: CustomizedScalingMetricSpecification -> String
$cshow :: CustomizedScalingMetricSpecification -> String
showsPrec :: Int -> CustomizedScalingMetricSpecification -> ShowS
$cshowsPrec :: Int -> CustomizedScalingMetricSpecification -> ShowS
Prelude.Show, (forall x.
CustomizedScalingMetricSpecification
-> Rep CustomizedScalingMetricSpecification x)
-> (forall x.
Rep CustomizedScalingMetricSpecification x
-> CustomizedScalingMetricSpecification)
-> Generic CustomizedScalingMetricSpecification
forall x.
Rep CustomizedScalingMetricSpecification x
-> CustomizedScalingMetricSpecification
forall x.
CustomizedScalingMetricSpecification
-> Rep CustomizedScalingMetricSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomizedScalingMetricSpecification x
-> CustomizedScalingMetricSpecification
$cfrom :: forall x.
CustomizedScalingMetricSpecification
-> Rep CustomizedScalingMetricSpecification x
Prelude.Generic)
newCustomizedScalingMetricSpecification ::
Prelude.Text ->
Prelude.Text ->
MetricStatistic ->
CustomizedScalingMetricSpecification
newCustomizedScalingMetricSpecification :: Text
-> Text -> MetricStatistic -> CustomizedScalingMetricSpecification
newCustomizedScalingMetricSpecification
Text
pMetricName_
Text
pNamespace_
MetricStatistic
pStatistic_ =
CustomizedScalingMetricSpecification' :: Maybe [MetricDimension]
-> Maybe Text
-> Text
-> Text
-> MetricStatistic
-> CustomizedScalingMetricSpecification
CustomizedScalingMetricSpecification'
{ $sel:dimensions:CustomizedScalingMetricSpecification' :: Maybe [MetricDimension]
dimensions =
Maybe [MetricDimension]
forall a. Maybe a
Prelude.Nothing,
$sel:unit:CustomizedScalingMetricSpecification' :: Maybe Text
unit = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:metricName:CustomizedScalingMetricSpecification' :: Text
metricName = Text
pMetricName_,
$sel:namespace:CustomizedScalingMetricSpecification' :: Text
namespace = Text
pNamespace_,
$sel:statistic:CustomizedScalingMetricSpecification' :: MetricStatistic
statistic = MetricStatistic
pStatistic_
}
customizedScalingMetricSpecification_dimensions :: Lens.Lens' CustomizedScalingMetricSpecification (Prelude.Maybe [MetricDimension])
customizedScalingMetricSpecification_dimensions :: (Maybe [MetricDimension] -> f (Maybe [MetricDimension]))
-> CustomizedScalingMetricSpecification
-> f CustomizedScalingMetricSpecification
customizedScalingMetricSpecification_dimensions = (CustomizedScalingMetricSpecification -> Maybe [MetricDimension])
-> (CustomizedScalingMetricSpecification
-> Maybe [MetricDimension] -> CustomizedScalingMetricSpecification)
-> Lens
CustomizedScalingMetricSpecification
CustomizedScalingMetricSpecification
(Maybe [MetricDimension])
(Maybe [MetricDimension])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomizedScalingMetricSpecification' {Maybe [MetricDimension]
dimensions :: Maybe [MetricDimension]
$sel:dimensions:CustomizedScalingMetricSpecification' :: CustomizedScalingMetricSpecification -> Maybe [MetricDimension]
dimensions} -> Maybe [MetricDimension]
dimensions) (\s :: CustomizedScalingMetricSpecification
s@CustomizedScalingMetricSpecification' {} Maybe [MetricDimension]
a -> CustomizedScalingMetricSpecification
s {$sel:dimensions:CustomizedScalingMetricSpecification' :: Maybe [MetricDimension]
dimensions = Maybe [MetricDimension]
a} :: CustomizedScalingMetricSpecification) ((Maybe [MetricDimension] -> f (Maybe [MetricDimension]))
-> CustomizedScalingMetricSpecification
-> f CustomizedScalingMetricSpecification)
-> ((Maybe [MetricDimension] -> f (Maybe [MetricDimension]))
-> Maybe [MetricDimension] -> f (Maybe [MetricDimension]))
-> (Maybe [MetricDimension] -> f (Maybe [MetricDimension]))
-> CustomizedScalingMetricSpecification
-> f CustomizedScalingMetricSpecification
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
customizedScalingMetricSpecification_unit :: Lens.Lens' CustomizedScalingMetricSpecification (Prelude.Maybe Prelude.Text)
customizedScalingMetricSpecification_unit :: (Maybe Text -> f (Maybe Text))
-> CustomizedScalingMetricSpecification
-> f CustomizedScalingMetricSpecification
customizedScalingMetricSpecification_unit = (CustomizedScalingMetricSpecification -> Maybe Text)
-> (CustomizedScalingMetricSpecification
-> Maybe Text -> CustomizedScalingMetricSpecification)
-> Lens
CustomizedScalingMetricSpecification
CustomizedScalingMetricSpecification
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomizedScalingMetricSpecification' {Maybe Text
unit :: Maybe Text
$sel:unit:CustomizedScalingMetricSpecification' :: CustomizedScalingMetricSpecification -> Maybe Text
unit} -> Maybe Text
unit) (\s :: CustomizedScalingMetricSpecification
s@CustomizedScalingMetricSpecification' {} Maybe Text
a -> CustomizedScalingMetricSpecification
s {$sel:unit:CustomizedScalingMetricSpecification' :: Maybe Text
unit = Maybe Text
a} :: CustomizedScalingMetricSpecification)
customizedScalingMetricSpecification_metricName :: Lens.Lens' CustomizedScalingMetricSpecification Prelude.Text
customizedScalingMetricSpecification_metricName :: (Text -> f Text)
-> CustomizedScalingMetricSpecification
-> f CustomizedScalingMetricSpecification
customizedScalingMetricSpecification_metricName = (CustomizedScalingMetricSpecification -> Text)
-> (CustomizedScalingMetricSpecification
-> Text -> CustomizedScalingMetricSpecification)
-> Lens
CustomizedScalingMetricSpecification
CustomizedScalingMetricSpecification
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomizedScalingMetricSpecification' {Text
metricName :: Text
$sel:metricName:CustomizedScalingMetricSpecification' :: CustomizedScalingMetricSpecification -> Text
metricName} -> Text
metricName) (\s :: CustomizedScalingMetricSpecification
s@CustomizedScalingMetricSpecification' {} Text
a -> CustomizedScalingMetricSpecification
s {$sel:metricName:CustomizedScalingMetricSpecification' :: Text
metricName = Text
a} :: CustomizedScalingMetricSpecification)
customizedScalingMetricSpecification_namespace :: Lens.Lens' CustomizedScalingMetricSpecification Prelude.Text
customizedScalingMetricSpecification_namespace :: (Text -> f Text)
-> CustomizedScalingMetricSpecification
-> f CustomizedScalingMetricSpecification
customizedScalingMetricSpecification_namespace = (CustomizedScalingMetricSpecification -> Text)
-> (CustomizedScalingMetricSpecification
-> Text -> CustomizedScalingMetricSpecification)
-> Lens
CustomizedScalingMetricSpecification
CustomizedScalingMetricSpecification
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomizedScalingMetricSpecification' {Text
namespace :: Text
$sel:namespace:CustomizedScalingMetricSpecification' :: CustomizedScalingMetricSpecification -> Text
namespace} -> Text
namespace) (\s :: CustomizedScalingMetricSpecification
s@CustomizedScalingMetricSpecification' {} Text
a -> CustomizedScalingMetricSpecification
s {$sel:namespace:CustomizedScalingMetricSpecification' :: Text
namespace = Text
a} :: CustomizedScalingMetricSpecification)
customizedScalingMetricSpecification_statistic :: Lens.Lens' CustomizedScalingMetricSpecification MetricStatistic
customizedScalingMetricSpecification_statistic :: (MetricStatistic -> f MetricStatistic)
-> CustomizedScalingMetricSpecification
-> f CustomizedScalingMetricSpecification
customizedScalingMetricSpecification_statistic = (CustomizedScalingMetricSpecification -> MetricStatistic)
-> (CustomizedScalingMetricSpecification
-> MetricStatistic -> CustomizedScalingMetricSpecification)
-> Lens
CustomizedScalingMetricSpecification
CustomizedScalingMetricSpecification
MetricStatistic
MetricStatistic
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomizedScalingMetricSpecification' {MetricStatistic
statistic :: MetricStatistic
$sel:statistic:CustomizedScalingMetricSpecification' :: CustomizedScalingMetricSpecification -> MetricStatistic
statistic} -> MetricStatistic
statistic) (\s :: CustomizedScalingMetricSpecification
s@CustomizedScalingMetricSpecification' {} MetricStatistic
a -> CustomizedScalingMetricSpecification
s {$sel:statistic:CustomizedScalingMetricSpecification' :: MetricStatistic
statistic = MetricStatistic
a} :: CustomizedScalingMetricSpecification)
instance
Core.FromJSON
CustomizedScalingMetricSpecification
where
parseJSON :: Value -> Parser CustomizedScalingMetricSpecification
parseJSON =
String
-> (Object -> Parser CustomizedScalingMetricSpecification)
-> Value
-> Parser CustomizedScalingMetricSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CustomizedScalingMetricSpecification"
( \Object
x ->
Maybe [MetricDimension]
-> Maybe Text
-> Text
-> Text
-> MetricStatistic
-> CustomizedScalingMetricSpecification
CustomizedScalingMetricSpecification'
(Maybe [MetricDimension]
-> Maybe Text
-> Text
-> Text
-> MetricStatistic
-> CustomizedScalingMetricSpecification)
-> Parser (Maybe [MetricDimension])
-> Parser
(Maybe Text
-> Text
-> Text
-> MetricStatistic
-> CustomizedScalingMetricSpecification)
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
-> CustomizedScalingMetricSpecification)
-> Parser (Maybe Text)
-> Parser
(Text
-> Text -> MetricStatistic -> CustomizedScalingMetricSpecification)
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 -> CustomizedScalingMetricSpecification)
-> Parser Text
-> Parser
(Text -> MetricStatistic -> CustomizedScalingMetricSpecification)
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 -> CustomizedScalingMetricSpecification)
-> Parser Text
-> Parser (MetricStatistic -> CustomizedScalingMetricSpecification)
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 -> CustomizedScalingMetricSpecification)
-> Parser MetricStatistic
-> Parser CustomizedScalingMetricSpecification
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
CustomizedScalingMetricSpecification
instance
Prelude.NFData
CustomizedScalingMetricSpecification
instance
Core.ToJSON
CustomizedScalingMetricSpecification
where
toJSON :: CustomizedScalingMetricSpecification -> Value
toJSON CustomizedScalingMetricSpecification' {Maybe [MetricDimension]
Maybe Text
Text
MetricStatistic
statistic :: MetricStatistic
namespace :: Text
metricName :: Text
unit :: Maybe Text
dimensions :: Maybe [MetricDimension]
$sel:statistic:CustomizedScalingMetricSpecification' :: CustomizedScalingMetricSpecification -> MetricStatistic
$sel:namespace:CustomizedScalingMetricSpecification' :: CustomizedScalingMetricSpecification -> Text
$sel:metricName:CustomizedScalingMetricSpecification' :: CustomizedScalingMetricSpecification -> Text
$sel:unit:CustomizedScalingMetricSpecification' :: CustomizedScalingMetricSpecification -> Maybe Text
$sel:dimensions:CustomizedScalingMetricSpecification' :: CustomizedScalingMetricSpecification -> 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)
]
)