{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
{ $sel:dimensions:CustomizedScalingMetricSpecification' :: Maybe [MetricDimension]
dimensions =
forall a. Maybe a
Prelude.Nothing,
$sel:unit:CustomizedScalingMetricSpecification' :: Maybe Text
unit = 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 :: Lens'
CustomizedScalingMetricSpecification (Maybe [MetricDimension])
customizedScalingMetricSpecification_dimensions = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' CustomizedScalingMetricSpecification (Maybe Text)
customizedScalingMetricSpecification_unit = 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 :: Lens' CustomizedScalingMetricSpecification Text
customizedScalingMetricSpecification_metricName = 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 :: Lens' CustomizedScalingMetricSpecification Text
customizedScalingMetricSpecification_namespace = 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 :: Lens' CustomizedScalingMetricSpecification MetricStatistic
customizedScalingMetricSpecification_statistic = 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
Data.FromJSON
CustomizedScalingMetricSpecification
where
parseJSON :: Value -> Parser CustomizedScalingMetricSpecification
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CustomizedScalingMetricSpecification"
( \Object
x ->
Maybe [MetricDimension]
-> Maybe Text
-> Text
-> Text
-> MetricStatistic
-> CustomizedScalingMetricSpecification
CustomizedScalingMetricSpecification'
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
"Dimensions" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Unit")
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
"MetricName")
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
"Namespace")
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
"Statistic")
)
instance
Prelude.Hashable
CustomizedScalingMetricSpecification
where
hashWithSalt :: Int -> CustomizedScalingMetricSpecification -> Int
hashWithSalt
Int
_salt
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]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [MetricDimension]
dimensions
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
unit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
metricName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
namespace
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` MetricStatistic
statistic
instance
Prelude.NFData
CustomizedScalingMetricSpecification
where
rnf :: CustomizedScalingMetricSpecification -> ()
rnf 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]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [MetricDimension]
dimensions
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
unit
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
metricName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
namespace
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf MetricStatistic
statistic
instance
Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Dimensions" 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 [MetricDimension]
dimensions,
(Key
"Unit" 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
unit,
forall a. a -> Maybe a
Prelude.Just (Key
"MetricName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
metricName),
forall a. a -> Maybe a
Prelude.Just (Key
"Namespace" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
namespace),
forall a. a -> Maybe a
Prelude.Just (Key
"Statistic" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= MetricStatistic
statistic)
]
)