{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Lightsail.PutAlarm
(
PutAlarm (..),
newPutAlarm,
putAlarm_treatMissingData,
putAlarm_contactProtocols,
putAlarm_datapointsToAlarm,
putAlarm_notificationEnabled,
putAlarm_notificationTriggers,
putAlarm_alarmName,
putAlarm_metricName,
putAlarm_monitoredResourceName,
putAlarm_comparisonOperator,
putAlarm_threshold,
putAlarm_evaluationPeriods,
PutAlarmResponse (..),
newPutAlarmResponse,
putAlarmResponse_operations,
putAlarmResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutAlarm = PutAlarm'
{
PutAlarm -> Maybe TreatMissingData
treatMissingData :: Prelude.Maybe TreatMissingData,
PutAlarm -> Maybe [ContactProtocol]
contactProtocols :: Prelude.Maybe [ContactProtocol],
PutAlarm -> Maybe Int
datapointsToAlarm :: Prelude.Maybe Prelude.Int,
PutAlarm -> Maybe Bool
notificationEnabled :: Prelude.Maybe Prelude.Bool,
PutAlarm -> Maybe [AlarmState]
notificationTriggers :: Prelude.Maybe [AlarmState],
PutAlarm -> Text
alarmName :: Prelude.Text,
PutAlarm -> MetricName
metricName :: MetricName,
PutAlarm -> Text
monitoredResourceName :: Prelude.Text,
PutAlarm -> ComparisonOperator
comparisonOperator :: ComparisonOperator,
PutAlarm -> Double
threshold :: Prelude.Double,
PutAlarm -> Int
evaluationPeriods :: Prelude.Int
}
deriving (PutAlarm -> PutAlarm -> Bool
(PutAlarm -> PutAlarm -> Bool)
-> (PutAlarm -> PutAlarm -> Bool) -> Eq PutAlarm
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAlarm -> PutAlarm -> Bool
$c/= :: PutAlarm -> PutAlarm -> Bool
== :: PutAlarm -> PutAlarm -> Bool
$c== :: PutAlarm -> PutAlarm -> Bool
Prelude.Eq, ReadPrec [PutAlarm]
ReadPrec PutAlarm
Int -> ReadS PutAlarm
ReadS [PutAlarm]
(Int -> ReadS PutAlarm)
-> ReadS [PutAlarm]
-> ReadPrec PutAlarm
-> ReadPrec [PutAlarm]
-> Read PutAlarm
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAlarm]
$creadListPrec :: ReadPrec [PutAlarm]
readPrec :: ReadPrec PutAlarm
$creadPrec :: ReadPrec PutAlarm
readList :: ReadS [PutAlarm]
$creadList :: ReadS [PutAlarm]
readsPrec :: Int -> ReadS PutAlarm
$creadsPrec :: Int -> ReadS PutAlarm
Prelude.Read, Int -> PutAlarm -> ShowS
[PutAlarm] -> ShowS
PutAlarm -> String
(Int -> PutAlarm -> ShowS)
-> (PutAlarm -> String) -> ([PutAlarm] -> ShowS) -> Show PutAlarm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAlarm] -> ShowS
$cshowList :: [PutAlarm] -> ShowS
show :: PutAlarm -> String
$cshow :: PutAlarm -> String
showsPrec :: Int -> PutAlarm -> ShowS
$cshowsPrec :: Int -> PutAlarm -> ShowS
Prelude.Show, (forall x. PutAlarm -> Rep PutAlarm x)
-> (forall x. Rep PutAlarm x -> PutAlarm) -> Generic PutAlarm
forall x. Rep PutAlarm x -> PutAlarm
forall x. PutAlarm -> Rep PutAlarm x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutAlarm x -> PutAlarm
$cfrom :: forall x. PutAlarm -> Rep PutAlarm x
Prelude.Generic)
newPutAlarm ::
Prelude.Text ->
MetricName ->
Prelude.Text ->
ComparisonOperator ->
Prelude.Double ->
Prelude.Int ->
PutAlarm
newPutAlarm :: Text
-> MetricName
-> Text
-> ComparisonOperator
-> Double
-> Int
-> PutAlarm
newPutAlarm
Text
pAlarmName_
MetricName
pMetricName_
Text
pMonitoredResourceName_
ComparisonOperator
pComparisonOperator_
Double
pThreshold_
Int
pEvaluationPeriods_ =
PutAlarm' :: Maybe TreatMissingData
-> Maybe [ContactProtocol]
-> Maybe Int
-> Maybe Bool
-> Maybe [AlarmState]
-> Text
-> MetricName
-> Text
-> ComparisonOperator
-> Double
-> Int
-> PutAlarm
PutAlarm'
{ $sel:treatMissingData:PutAlarm' :: Maybe TreatMissingData
treatMissingData = Maybe TreatMissingData
forall a. Maybe a
Prelude.Nothing,
$sel:contactProtocols:PutAlarm' :: Maybe [ContactProtocol]
contactProtocols = Maybe [ContactProtocol]
forall a. Maybe a
Prelude.Nothing,
$sel:datapointsToAlarm:PutAlarm' :: Maybe Int
datapointsToAlarm = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:notificationEnabled:PutAlarm' :: Maybe Bool
notificationEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:notificationTriggers:PutAlarm' :: Maybe [AlarmState]
notificationTriggers = Maybe [AlarmState]
forall a. Maybe a
Prelude.Nothing,
$sel:alarmName:PutAlarm' :: Text
alarmName = Text
pAlarmName_,
$sel:metricName:PutAlarm' :: MetricName
metricName = MetricName
pMetricName_,
$sel:monitoredResourceName:PutAlarm' :: Text
monitoredResourceName = Text
pMonitoredResourceName_,
$sel:comparisonOperator:PutAlarm' :: ComparisonOperator
comparisonOperator = ComparisonOperator
pComparisonOperator_,
$sel:threshold:PutAlarm' :: Double
threshold = Double
pThreshold_,
$sel:evaluationPeriods:PutAlarm' :: Int
evaluationPeriods = Int
pEvaluationPeriods_
}
putAlarm_treatMissingData :: Lens.Lens' PutAlarm (Prelude.Maybe TreatMissingData)
putAlarm_treatMissingData :: (Maybe TreatMissingData -> f (Maybe TreatMissingData))
-> PutAlarm -> f PutAlarm
putAlarm_treatMissingData = (PutAlarm -> Maybe TreatMissingData)
-> (PutAlarm -> Maybe TreatMissingData -> PutAlarm)
-> Lens
PutAlarm PutAlarm (Maybe TreatMissingData) (Maybe TreatMissingData)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlarm' {Maybe TreatMissingData
treatMissingData :: Maybe TreatMissingData
$sel:treatMissingData:PutAlarm' :: PutAlarm -> Maybe TreatMissingData
treatMissingData} -> Maybe TreatMissingData
treatMissingData) (\s :: PutAlarm
s@PutAlarm' {} Maybe TreatMissingData
a -> PutAlarm
s {$sel:treatMissingData:PutAlarm' :: Maybe TreatMissingData
treatMissingData = Maybe TreatMissingData
a} :: PutAlarm)
putAlarm_contactProtocols :: Lens.Lens' PutAlarm (Prelude.Maybe [ContactProtocol])
putAlarm_contactProtocols :: (Maybe [ContactProtocol] -> f (Maybe [ContactProtocol]))
-> PutAlarm -> f PutAlarm
putAlarm_contactProtocols = (PutAlarm -> Maybe [ContactProtocol])
-> (PutAlarm -> Maybe [ContactProtocol] -> PutAlarm)
-> Lens
PutAlarm
PutAlarm
(Maybe [ContactProtocol])
(Maybe [ContactProtocol])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlarm' {Maybe [ContactProtocol]
contactProtocols :: Maybe [ContactProtocol]
$sel:contactProtocols:PutAlarm' :: PutAlarm -> Maybe [ContactProtocol]
contactProtocols} -> Maybe [ContactProtocol]
contactProtocols) (\s :: PutAlarm
s@PutAlarm' {} Maybe [ContactProtocol]
a -> PutAlarm
s {$sel:contactProtocols:PutAlarm' :: Maybe [ContactProtocol]
contactProtocols = Maybe [ContactProtocol]
a} :: PutAlarm) ((Maybe [ContactProtocol] -> f (Maybe [ContactProtocol]))
-> PutAlarm -> f PutAlarm)
-> ((Maybe [ContactProtocol] -> f (Maybe [ContactProtocol]))
-> Maybe [ContactProtocol] -> f (Maybe [ContactProtocol]))
-> (Maybe [ContactProtocol] -> f (Maybe [ContactProtocol]))
-> PutAlarm
-> f PutAlarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[ContactProtocol]
[ContactProtocol]
[ContactProtocol]
[ContactProtocol]
-> Iso
(Maybe [ContactProtocol])
(Maybe [ContactProtocol])
(Maybe [ContactProtocol])
(Maybe [ContactProtocol])
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
[ContactProtocol]
[ContactProtocol]
[ContactProtocol]
[ContactProtocol]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putAlarm_datapointsToAlarm :: Lens.Lens' PutAlarm (Prelude.Maybe Prelude.Int)
putAlarm_datapointsToAlarm :: (Maybe Int -> f (Maybe Int)) -> PutAlarm -> f PutAlarm
putAlarm_datapointsToAlarm = (PutAlarm -> Maybe Int)
-> (PutAlarm -> Maybe Int -> PutAlarm)
-> Lens PutAlarm PutAlarm (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlarm' {Maybe Int
datapointsToAlarm :: Maybe Int
$sel:datapointsToAlarm:PutAlarm' :: PutAlarm -> Maybe Int
datapointsToAlarm} -> Maybe Int
datapointsToAlarm) (\s :: PutAlarm
s@PutAlarm' {} Maybe Int
a -> PutAlarm
s {$sel:datapointsToAlarm:PutAlarm' :: Maybe Int
datapointsToAlarm = Maybe Int
a} :: PutAlarm)
putAlarm_notificationEnabled :: Lens.Lens' PutAlarm (Prelude.Maybe Prelude.Bool)
putAlarm_notificationEnabled :: (Maybe Bool -> f (Maybe Bool)) -> PutAlarm -> f PutAlarm
putAlarm_notificationEnabled = (PutAlarm -> Maybe Bool)
-> (PutAlarm -> Maybe Bool -> PutAlarm)
-> Lens PutAlarm PutAlarm (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlarm' {Maybe Bool
notificationEnabled :: Maybe Bool
$sel:notificationEnabled:PutAlarm' :: PutAlarm -> Maybe Bool
notificationEnabled} -> Maybe Bool
notificationEnabled) (\s :: PutAlarm
s@PutAlarm' {} Maybe Bool
a -> PutAlarm
s {$sel:notificationEnabled:PutAlarm' :: Maybe Bool
notificationEnabled = Maybe Bool
a} :: PutAlarm)
putAlarm_notificationTriggers :: Lens.Lens' PutAlarm (Prelude.Maybe [AlarmState])
putAlarm_notificationTriggers :: (Maybe [AlarmState] -> f (Maybe [AlarmState]))
-> PutAlarm -> f PutAlarm
putAlarm_notificationTriggers = (PutAlarm -> Maybe [AlarmState])
-> (PutAlarm -> Maybe [AlarmState] -> PutAlarm)
-> Lens PutAlarm PutAlarm (Maybe [AlarmState]) (Maybe [AlarmState])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlarm' {Maybe [AlarmState]
notificationTriggers :: Maybe [AlarmState]
$sel:notificationTriggers:PutAlarm' :: PutAlarm -> Maybe [AlarmState]
notificationTriggers} -> Maybe [AlarmState]
notificationTriggers) (\s :: PutAlarm
s@PutAlarm' {} Maybe [AlarmState]
a -> PutAlarm
s {$sel:notificationTriggers:PutAlarm' :: Maybe [AlarmState]
notificationTriggers = Maybe [AlarmState]
a} :: PutAlarm) ((Maybe [AlarmState] -> f (Maybe [AlarmState]))
-> PutAlarm -> f PutAlarm)
-> ((Maybe [AlarmState] -> f (Maybe [AlarmState]))
-> Maybe [AlarmState] -> f (Maybe [AlarmState]))
-> (Maybe [AlarmState] -> f (Maybe [AlarmState]))
-> PutAlarm
-> f PutAlarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [AlarmState] [AlarmState] [AlarmState] [AlarmState]
-> Iso
(Maybe [AlarmState])
(Maybe [AlarmState])
(Maybe [AlarmState])
(Maybe [AlarmState])
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 [AlarmState] [AlarmState] [AlarmState] [AlarmState]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putAlarm_alarmName :: Lens.Lens' PutAlarm Prelude.Text
putAlarm_alarmName :: (Text -> f Text) -> PutAlarm -> f PutAlarm
putAlarm_alarmName = (PutAlarm -> Text)
-> (PutAlarm -> Text -> PutAlarm)
-> Lens PutAlarm PutAlarm Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlarm' {Text
alarmName :: Text
$sel:alarmName:PutAlarm' :: PutAlarm -> Text
alarmName} -> Text
alarmName) (\s :: PutAlarm
s@PutAlarm' {} Text
a -> PutAlarm
s {$sel:alarmName:PutAlarm' :: Text
alarmName = Text
a} :: PutAlarm)
putAlarm_metricName :: Lens.Lens' PutAlarm MetricName
putAlarm_metricName :: (MetricName -> f MetricName) -> PutAlarm -> f PutAlarm
putAlarm_metricName = (PutAlarm -> MetricName)
-> (PutAlarm -> MetricName -> PutAlarm)
-> Lens PutAlarm PutAlarm MetricName MetricName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlarm' {MetricName
metricName :: MetricName
$sel:metricName:PutAlarm' :: PutAlarm -> MetricName
metricName} -> MetricName
metricName) (\s :: PutAlarm
s@PutAlarm' {} MetricName
a -> PutAlarm
s {$sel:metricName:PutAlarm' :: MetricName
metricName = MetricName
a} :: PutAlarm)
putAlarm_monitoredResourceName :: Lens.Lens' PutAlarm Prelude.Text
putAlarm_monitoredResourceName :: (Text -> f Text) -> PutAlarm -> f PutAlarm
putAlarm_monitoredResourceName = (PutAlarm -> Text)
-> (PutAlarm -> Text -> PutAlarm)
-> Lens PutAlarm PutAlarm Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlarm' {Text
monitoredResourceName :: Text
$sel:monitoredResourceName:PutAlarm' :: PutAlarm -> Text
monitoredResourceName} -> Text
monitoredResourceName) (\s :: PutAlarm
s@PutAlarm' {} Text
a -> PutAlarm
s {$sel:monitoredResourceName:PutAlarm' :: Text
monitoredResourceName = Text
a} :: PutAlarm)
putAlarm_comparisonOperator :: Lens.Lens' PutAlarm ComparisonOperator
putAlarm_comparisonOperator :: (ComparisonOperator -> f ComparisonOperator)
-> PutAlarm -> f PutAlarm
putAlarm_comparisonOperator = (PutAlarm -> ComparisonOperator)
-> (PutAlarm -> ComparisonOperator -> PutAlarm)
-> Lens PutAlarm PutAlarm ComparisonOperator ComparisonOperator
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlarm' {ComparisonOperator
comparisonOperator :: ComparisonOperator
$sel:comparisonOperator:PutAlarm' :: PutAlarm -> ComparisonOperator
comparisonOperator} -> ComparisonOperator
comparisonOperator) (\s :: PutAlarm
s@PutAlarm' {} ComparisonOperator
a -> PutAlarm
s {$sel:comparisonOperator:PutAlarm' :: ComparisonOperator
comparisonOperator = ComparisonOperator
a} :: PutAlarm)
putAlarm_threshold :: Lens.Lens' PutAlarm Prelude.Double
putAlarm_threshold :: (Double -> f Double) -> PutAlarm -> f PutAlarm
putAlarm_threshold = (PutAlarm -> Double)
-> (PutAlarm -> Double -> PutAlarm)
-> Lens PutAlarm PutAlarm Double Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlarm' {Double
threshold :: Double
$sel:threshold:PutAlarm' :: PutAlarm -> Double
threshold} -> Double
threshold) (\s :: PutAlarm
s@PutAlarm' {} Double
a -> PutAlarm
s {$sel:threshold:PutAlarm' :: Double
threshold = Double
a} :: PutAlarm)
putAlarm_evaluationPeriods :: Lens.Lens' PutAlarm Prelude.Int
putAlarm_evaluationPeriods :: (Int -> f Int) -> PutAlarm -> f PutAlarm
putAlarm_evaluationPeriods = (PutAlarm -> Int)
-> (PutAlarm -> Int -> PutAlarm) -> Lens PutAlarm PutAlarm Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlarm' {Int
evaluationPeriods :: Int
$sel:evaluationPeriods:PutAlarm' :: PutAlarm -> Int
evaluationPeriods} -> Int
evaluationPeriods) (\s :: PutAlarm
s@PutAlarm' {} Int
a -> PutAlarm
s {$sel:evaluationPeriods:PutAlarm' :: Int
evaluationPeriods = Int
a} :: PutAlarm)
instance Core.AWSRequest PutAlarm where
type AWSResponse PutAlarm = PutAlarmResponse
request :: PutAlarm -> Request PutAlarm
request = Service -> PutAlarm -> Request PutAlarm
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutAlarm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutAlarm)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutAlarm))
-> Logger
-> Service
-> Proxy PutAlarm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutAlarm)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [Operation] -> Int -> PutAlarmResponse
PutAlarmResponse'
(Maybe [Operation] -> Int -> PutAlarmResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> PutAlarmResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Operation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operations" Either String (Maybe (Maybe [Operation]))
-> Maybe [Operation] -> Either String (Maybe [Operation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Operation]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> PutAlarmResponse)
-> Either String Int -> Either String PutAlarmResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable PutAlarm
instance Prelude.NFData PutAlarm
instance Core.ToHeaders PutAlarm where
toHeaders :: PutAlarm -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutAlarm -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Lightsail_20161128.PutAlarm" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON PutAlarm where
toJSON :: PutAlarm -> Value
toJSON PutAlarm' {Double
Int
Maybe Bool
Maybe Int
Maybe [AlarmState]
Maybe [ContactProtocol]
Maybe TreatMissingData
Text
ComparisonOperator
MetricName
evaluationPeriods :: Int
threshold :: Double
comparisonOperator :: ComparisonOperator
monitoredResourceName :: Text
metricName :: MetricName
alarmName :: Text
notificationTriggers :: Maybe [AlarmState]
notificationEnabled :: Maybe Bool
datapointsToAlarm :: Maybe Int
contactProtocols :: Maybe [ContactProtocol]
treatMissingData :: Maybe TreatMissingData
$sel:evaluationPeriods:PutAlarm' :: PutAlarm -> Int
$sel:threshold:PutAlarm' :: PutAlarm -> Double
$sel:comparisonOperator:PutAlarm' :: PutAlarm -> ComparisonOperator
$sel:monitoredResourceName:PutAlarm' :: PutAlarm -> Text
$sel:metricName:PutAlarm' :: PutAlarm -> MetricName
$sel:alarmName:PutAlarm' :: PutAlarm -> Text
$sel:notificationTriggers:PutAlarm' :: PutAlarm -> Maybe [AlarmState]
$sel:notificationEnabled:PutAlarm' :: PutAlarm -> Maybe Bool
$sel:datapointsToAlarm:PutAlarm' :: PutAlarm -> Maybe Int
$sel:contactProtocols:PutAlarm' :: PutAlarm -> Maybe [ContactProtocol]
$sel:treatMissingData:PutAlarm' :: PutAlarm -> Maybe TreatMissingData
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"treatMissingData" Text -> TreatMissingData -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(TreatMissingData -> Pair) -> Maybe TreatMissingData -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TreatMissingData
treatMissingData,
(Text
"contactProtocols" Text -> [ContactProtocol] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([ContactProtocol] -> Pair)
-> Maybe [ContactProtocol] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ContactProtocol]
contactProtocols,
(Text
"datapointsToAlarm" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
datapointsToAlarm,
(Text
"notificationEnabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
notificationEnabled,
(Text
"notificationTriggers" Text -> [AlarmState] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([AlarmState] -> Pair) -> Maybe [AlarmState] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AlarmState]
notificationTriggers,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"alarmName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
alarmName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"metricName" Text -> MetricName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= MetricName
metricName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"monitoredResourceName"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
monitoredResourceName
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"comparisonOperator" Text -> ComparisonOperator -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ComparisonOperator
comparisonOperator),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"threshold" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Double
threshold),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"evaluationPeriods" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
evaluationPeriods)
]
)
instance Core.ToPath PutAlarm where
toPath :: PutAlarm -> ByteString
toPath = ByteString -> PutAlarm -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutAlarm where
toQuery :: PutAlarm -> QueryString
toQuery = QueryString -> PutAlarm -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutAlarmResponse = PutAlarmResponse'
{
PutAlarmResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
PutAlarmResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutAlarmResponse -> PutAlarmResponse -> Bool
(PutAlarmResponse -> PutAlarmResponse -> Bool)
-> (PutAlarmResponse -> PutAlarmResponse -> Bool)
-> Eq PutAlarmResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAlarmResponse -> PutAlarmResponse -> Bool
$c/= :: PutAlarmResponse -> PutAlarmResponse -> Bool
== :: PutAlarmResponse -> PutAlarmResponse -> Bool
$c== :: PutAlarmResponse -> PutAlarmResponse -> Bool
Prelude.Eq, ReadPrec [PutAlarmResponse]
ReadPrec PutAlarmResponse
Int -> ReadS PutAlarmResponse
ReadS [PutAlarmResponse]
(Int -> ReadS PutAlarmResponse)
-> ReadS [PutAlarmResponse]
-> ReadPrec PutAlarmResponse
-> ReadPrec [PutAlarmResponse]
-> Read PutAlarmResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAlarmResponse]
$creadListPrec :: ReadPrec [PutAlarmResponse]
readPrec :: ReadPrec PutAlarmResponse
$creadPrec :: ReadPrec PutAlarmResponse
readList :: ReadS [PutAlarmResponse]
$creadList :: ReadS [PutAlarmResponse]
readsPrec :: Int -> ReadS PutAlarmResponse
$creadsPrec :: Int -> ReadS PutAlarmResponse
Prelude.Read, Int -> PutAlarmResponse -> ShowS
[PutAlarmResponse] -> ShowS
PutAlarmResponse -> String
(Int -> PutAlarmResponse -> ShowS)
-> (PutAlarmResponse -> String)
-> ([PutAlarmResponse] -> ShowS)
-> Show PutAlarmResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAlarmResponse] -> ShowS
$cshowList :: [PutAlarmResponse] -> ShowS
show :: PutAlarmResponse -> String
$cshow :: PutAlarmResponse -> String
showsPrec :: Int -> PutAlarmResponse -> ShowS
$cshowsPrec :: Int -> PutAlarmResponse -> ShowS
Prelude.Show, (forall x. PutAlarmResponse -> Rep PutAlarmResponse x)
-> (forall x. Rep PutAlarmResponse x -> PutAlarmResponse)
-> Generic PutAlarmResponse
forall x. Rep PutAlarmResponse x -> PutAlarmResponse
forall x. PutAlarmResponse -> Rep PutAlarmResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutAlarmResponse x -> PutAlarmResponse
$cfrom :: forall x. PutAlarmResponse -> Rep PutAlarmResponse x
Prelude.Generic)
newPutAlarmResponse ::
Prelude.Int ->
PutAlarmResponse
newPutAlarmResponse :: Int -> PutAlarmResponse
newPutAlarmResponse Int
pHttpStatus_ =
PutAlarmResponse' :: Maybe [Operation] -> Int -> PutAlarmResponse
PutAlarmResponse'
{ $sel:operations:PutAlarmResponse' :: Maybe [Operation]
operations = Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutAlarmResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putAlarmResponse_operations :: Lens.Lens' PutAlarmResponse (Prelude.Maybe [Operation])
putAlarmResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> PutAlarmResponse -> f PutAlarmResponse
putAlarmResponse_operations = (PutAlarmResponse -> Maybe [Operation])
-> (PutAlarmResponse -> Maybe [Operation] -> PutAlarmResponse)
-> Lens
PutAlarmResponse
PutAlarmResponse
(Maybe [Operation])
(Maybe [Operation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlarmResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:PutAlarmResponse' :: PutAlarmResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: PutAlarmResponse
s@PutAlarmResponse' {} Maybe [Operation]
a -> PutAlarmResponse
s {$sel:operations:PutAlarmResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: PutAlarmResponse) ((Maybe [Operation] -> f (Maybe [Operation]))
-> PutAlarmResponse -> f PutAlarmResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
-> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> PutAlarmResponse
-> f PutAlarmResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Operation] [Operation] [Operation] [Operation]
-> Iso
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
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 [Operation] [Operation] [Operation] [Operation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putAlarmResponse_httpStatus :: Lens.Lens' PutAlarmResponse Prelude.Int
putAlarmResponse_httpStatus :: (Int -> f Int) -> PutAlarmResponse -> f PutAlarmResponse
putAlarmResponse_httpStatus = (PutAlarmResponse -> Int)
-> (PutAlarmResponse -> Int -> PutAlarmResponse)
-> Lens PutAlarmResponse PutAlarmResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAlarmResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutAlarmResponse' :: PutAlarmResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutAlarmResponse
s@PutAlarmResponse' {} Int
a -> PutAlarmResponse
s {$sel:httpStatus:PutAlarmResponse' :: Int
httpStatus = Int
a} :: PutAlarmResponse)
instance Prelude.NFData PutAlarmResponse