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