{-# 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.IoT.Types.CloudwatchMetricAction where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CloudwatchMetricAction = CloudwatchMetricAction'
{
CloudwatchMetricAction -> Maybe Text
metricTimestamp :: Prelude.Maybe Prelude.Text,
CloudwatchMetricAction -> Text
roleArn :: Prelude.Text,
CloudwatchMetricAction -> Text
metricNamespace :: Prelude.Text,
CloudwatchMetricAction -> Text
metricName :: Prelude.Text,
CloudwatchMetricAction -> Text
metricValue :: Prelude.Text,
CloudwatchMetricAction -> Text
metricUnit :: Prelude.Text
}
deriving (CloudwatchMetricAction -> CloudwatchMetricAction -> Bool
(CloudwatchMetricAction -> CloudwatchMetricAction -> Bool)
-> (CloudwatchMetricAction -> CloudwatchMetricAction -> Bool)
-> Eq CloudwatchMetricAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudwatchMetricAction -> CloudwatchMetricAction -> Bool
$c/= :: CloudwatchMetricAction -> CloudwatchMetricAction -> Bool
== :: CloudwatchMetricAction -> CloudwatchMetricAction -> Bool
$c== :: CloudwatchMetricAction -> CloudwatchMetricAction -> Bool
Prelude.Eq, ReadPrec [CloudwatchMetricAction]
ReadPrec CloudwatchMetricAction
Int -> ReadS CloudwatchMetricAction
ReadS [CloudwatchMetricAction]
(Int -> ReadS CloudwatchMetricAction)
-> ReadS [CloudwatchMetricAction]
-> ReadPrec CloudwatchMetricAction
-> ReadPrec [CloudwatchMetricAction]
-> Read CloudwatchMetricAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudwatchMetricAction]
$creadListPrec :: ReadPrec [CloudwatchMetricAction]
readPrec :: ReadPrec CloudwatchMetricAction
$creadPrec :: ReadPrec CloudwatchMetricAction
readList :: ReadS [CloudwatchMetricAction]
$creadList :: ReadS [CloudwatchMetricAction]
readsPrec :: Int -> ReadS CloudwatchMetricAction
$creadsPrec :: Int -> ReadS CloudwatchMetricAction
Prelude.Read, Int -> CloudwatchMetricAction -> ShowS
[CloudwatchMetricAction] -> ShowS
CloudwatchMetricAction -> String
(Int -> CloudwatchMetricAction -> ShowS)
-> (CloudwatchMetricAction -> String)
-> ([CloudwatchMetricAction] -> ShowS)
-> Show CloudwatchMetricAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudwatchMetricAction] -> ShowS
$cshowList :: [CloudwatchMetricAction] -> ShowS
show :: CloudwatchMetricAction -> String
$cshow :: CloudwatchMetricAction -> String
showsPrec :: Int -> CloudwatchMetricAction -> ShowS
$cshowsPrec :: Int -> CloudwatchMetricAction -> ShowS
Prelude.Show, (forall x. CloudwatchMetricAction -> Rep CloudwatchMetricAction x)
-> (forall x.
Rep CloudwatchMetricAction x -> CloudwatchMetricAction)
-> Generic CloudwatchMetricAction
forall x. Rep CloudwatchMetricAction x -> CloudwatchMetricAction
forall x. CloudwatchMetricAction -> Rep CloudwatchMetricAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CloudwatchMetricAction x -> CloudwatchMetricAction
$cfrom :: forall x. CloudwatchMetricAction -> Rep CloudwatchMetricAction x
Prelude.Generic)
newCloudwatchMetricAction ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CloudwatchMetricAction
newCloudwatchMetricAction :: Text -> Text -> Text -> Text -> Text -> CloudwatchMetricAction
newCloudwatchMetricAction
Text
pRoleArn_
Text
pMetricNamespace_
Text
pMetricName_
Text
pMetricValue_
Text
pMetricUnit_ =
CloudwatchMetricAction' :: Maybe Text
-> Text -> Text -> Text -> Text -> Text -> CloudwatchMetricAction
CloudwatchMetricAction'
{ $sel:metricTimestamp:CloudwatchMetricAction' :: Maybe Text
metricTimestamp =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:CloudwatchMetricAction' :: Text
roleArn = Text
pRoleArn_,
$sel:metricNamespace:CloudwatchMetricAction' :: Text
metricNamespace = Text
pMetricNamespace_,
$sel:metricName:CloudwatchMetricAction' :: Text
metricName = Text
pMetricName_,
$sel:metricValue:CloudwatchMetricAction' :: Text
metricValue = Text
pMetricValue_,
$sel:metricUnit:CloudwatchMetricAction' :: Text
metricUnit = Text
pMetricUnit_
}
cloudwatchMetricAction_metricTimestamp :: Lens.Lens' CloudwatchMetricAction (Prelude.Maybe Prelude.Text)
cloudwatchMetricAction_metricTimestamp :: (Maybe Text -> f (Maybe Text))
-> CloudwatchMetricAction -> f CloudwatchMetricAction
cloudwatchMetricAction_metricTimestamp = (CloudwatchMetricAction -> Maybe Text)
-> (CloudwatchMetricAction -> Maybe Text -> CloudwatchMetricAction)
-> Lens
CloudwatchMetricAction
CloudwatchMetricAction
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudwatchMetricAction' {Maybe Text
metricTimestamp :: Maybe Text
$sel:metricTimestamp:CloudwatchMetricAction' :: CloudwatchMetricAction -> Maybe Text
metricTimestamp} -> Maybe Text
metricTimestamp) (\s :: CloudwatchMetricAction
s@CloudwatchMetricAction' {} Maybe Text
a -> CloudwatchMetricAction
s {$sel:metricTimestamp:CloudwatchMetricAction' :: Maybe Text
metricTimestamp = Maybe Text
a} :: CloudwatchMetricAction)
cloudwatchMetricAction_roleArn :: Lens.Lens' CloudwatchMetricAction Prelude.Text
cloudwatchMetricAction_roleArn :: (Text -> f Text)
-> CloudwatchMetricAction -> f CloudwatchMetricAction
cloudwatchMetricAction_roleArn = (CloudwatchMetricAction -> Text)
-> (CloudwatchMetricAction -> Text -> CloudwatchMetricAction)
-> Lens CloudwatchMetricAction CloudwatchMetricAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudwatchMetricAction' {Text
roleArn :: Text
$sel:roleArn:CloudwatchMetricAction' :: CloudwatchMetricAction -> Text
roleArn} -> Text
roleArn) (\s :: CloudwatchMetricAction
s@CloudwatchMetricAction' {} Text
a -> CloudwatchMetricAction
s {$sel:roleArn:CloudwatchMetricAction' :: Text
roleArn = Text
a} :: CloudwatchMetricAction)
cloudwatchMetricAction_metricNamespace :: Lens.Lens' CloudwatchMetricAction Prelude.Text
cloudwatchMetricAction_metricNamespace :: (Text -> f Text)
-> CloudwatchMetricAction -> f CloudwatchMetricAction
cloudwatchMetricAction_metricNamespace = (CloudwatchMetricAction -> Text)
-> (CloudwatchMetricAction -> Text -> CloudwatchMetricAction)
-> Lens CloudwatchMetricAction CloudwatchMetricAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudwatchMetricAction' {Text
metricNamespace :: Text
$sel:metricNamespace:CloudwatchMetricAction' :: CloudwatchMetricAction -> Text
metricNamespace} -> Text
metricNamespace) (\s :: CloudwatchMetricAction
s@CloudwatchMetricAction' {} Text
a -> CloudwatchMetricAction
s {$sel:metricNamespace:CloudwatchMetricAction' :: Text
metricNamespace = Text
a} :: CloudwatchMetricAction)
cloudwatchMetricAction_metricName :: Lens.Lens' CloudwatchMetricAction Prelude.Text
cloudwatchMetricAction_metricName :: (Text -> f Text)
-> CloudwatchMetricAction -> f CloudwatchMetricAction
cloudwatchMetricAction_metricName = (CloudwatchMetricAction -> Text)
-> (CloudwatchMetricAction -> Text -> CloudwatchMetricAction)
-> Lens CloudwatchMetricAction CloudwatchMetricAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudwatchMetricAction' {Text
metricName :: Text
$sel:metricName:CloudwatchMetricAction' :: CloudwatchMetricAction -> Text
metricName} -> Text
metricName) (\s :: CloudwatchMetricAction
s@CloudwatchMetricAction' {} Text
a -> CloudwatchMetricAction
s {$sel:metricName:CloudwatchMetricAction' :: Text
metricName = Text
a} :: CloudwatchMetricAction)
cloudwatchMetricAction_metricValue :: Lens.Lens' CloudwatchMetricAction Prelude.Text
cloudwatchMetricAction_metricValue :: (Text -> f Text)
-> CloudwatchMetricAction -> f CloudwatchMetricAction
cloudwatchMetricAction_metricValue = (CloudwatchMetricAction -> Text)
-> (CloudwatchMetricAction -> Text -> CloudwatchMetricAction)
-> Lens CloudwatchMetricAction CloudwatchMetricAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudwatchMetricAction' {Text
metricValue :: Text
$sel:metricValue:CloudwatchMetricAction' :: CloudwatchMetricAction -> Text
metricValue} -> Text
metricValue) (\s :: CloudwatchMetricAction
s@CloudwatchMetricAction' {} Text
a -> CloudwatchMetricAction
s {$sel:metricValue:CloudwatchMetricAction' :: Text
metricValue = Text
a} :: CloudwatchMetricAction)
cloudwatchMetricAction_metricUnit :: Lens.Lens' CloudwatchMetricAction Prelude.Text
cloudwatchMetricAction_metricUnit :: (Text -> f Text)
-> CloudwatchMetricAction -> f CloudwatchMetricAction
cloudwatchMetricAction_metricUnit = (CloudwatchMetricAction -> Text)
-> (CloudwatchMetricAction -> Text -> CloudwatchMetricAction)
-> Lens CloudwatchMetricAction CloudwatchMetricAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudwatchMetricAction' {Text
metricUnit :: Text
$sel:metricUnit:CloudwatchMetricAction' :: CloudwatchMetricAction -> Text
metricUnit} -> Text
metricUnit) (\s :: CloudwatchMetricAction
s@CloudwatchMetricAction' {} Text
a -> CloudwatchMetricAction
s {$sel:metricUnit:CloudwatchMetricAction' :: Text
metricUnit = Text
a} :: CloudwatchMetricAction)
instance Core.FromJSON CloudwatchMetricAction where
parseJSON :: Value -> Parser CloudwatchMetricAction
parseJSON =
String
-> (Object -> Parser CloudwatchMetricAction)
-> Value
-> Parser CloudwatchMetricAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CloudwatchMetricAction"
( \Object
x ->
Maybe Text
-> Text -> Text -> Text -> Text -> Text -> CloudwatchMetricAction
CloudwatchMetricAction'
(Maybe Text
-> Text -> Text -> Text -> Text -> Text -> CloudwatchMetricAction)
-> Parser (Maybe Text)
-> Parser
(Text -> Text -> Text -> Text -> Text -> CloudwatchMetricAction)
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
"metricTimestamp")
Parser
(Text -> Text -> Text -> Text -> Text -> CloudwatchMetricAction)
-> Parser Text
-> Parser (Text -> Text -> Text -> Text -> CloudwatchMetricAction)
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
"roleArn")
Parser (Text -> Text -> Text -> Text -> CloudwatchMetricAction)
-> Parser Text
-> Parser (Text -> Text -> Text -> CloudwatchMetricAction)
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
"metricNamespace")
Parser (Text -> Text -> Text -> CloudwatchMetricAction)
-> Parser Text -> Parser (Text -> Text -> CloudwatchMetricAction)
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 -> Text -> CloudwatchMetricAction)
-> Parser Text -> Parser (Text -> CloudwatchMetricAction)
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
"metricValue")
Parser (Text -> CloudwatchMetricAction)
-> Parser Text -> Parser CloudwatchMetricAction
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
"metricUnit")
)
instance Prelude.Hashable CloudwatchMetricAction
instance Prelude.NFData CloudwatchMetricAction
instance Core.ToJSON CloudwatchMetricAction where
toJSON :: CloudwatchMetricAction -> Value
toJSON CloudwatchMetricAction' {Maybe Text
Text
metricUnit :: Text
metricValue :: Text
metricName :: Text
metricNamespace :: Text
roleArn :: Text
metricTimestamp :: Maybe Text
$sel:metricUnit:CloudwatchMetricAction' :: CloudwatchMetricAction -> Text
$sel:metricValue:CloudwatchMetricAction' :: CloudwatchMetricAction -> Text
$sel:metricName:CloudwatchMetricAction' :: CloudwatchMetricAction -> Text
$sel:metricNamespace:CloudwatchMetricAction' :: CloudwatchMetricAction -> Text
$sel:roleArn:CloudwatchMetricAction' :: CloudwatchMetricAction -> Text
$sel:metricTimestamp:CloudwatchMetricAction' :: CloudwatchMetricAction -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"metricTimestamp" 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
metricTimestamp,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"metricNamespace" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
metricNamespace),
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
"metricValue" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
metricValue),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"metricUnit" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
metricUnit)
]
)