{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Lightsail.PutAlarm
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates or updates an alarm, and associates it with the specified
-- metric.
--
-- An alarm is used to monitor a single metric for one of your resources.
-- When a metric condition is met, the alarm can notify you by email, SMS
-- text message, and a banner displayed on the Amazon Lightsail console.
-- For more information, see
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-alarms Alarms in Amazon Lightsail>.
--
-- When this action creates an alarm, the alarm state is immediately set to
-- @INSUFFICIENT_DATA@. The alarm is then evaluated and its state is set
-- appropriately. Any actions associated with the new state are then
-- executed.
--
-- When you update an existing alarm, its state is left unchanged, but the
-- update completely overwrites the previous configuration of the alarm.
-- The alarm is then evaluated with the updated configuration.
module Amazonka.Lightsail.PutAlarm
  ( -- * Creating a Request
    PutAlarm (..),
    newPutAlarm,

    -- * Request Lenses
    putAlarm_contactProtocols,
    putAlarm_datapointsToAlarm,
    putAlarm_notificationEnabled,
    putAlarm_notificationTriggers,
    putAlarm_treatMissingData,
    putAlarm_alarmName,
    putAlarm_metricName,
    putAlarm_monitoredResourceName,
    putAlarm_comparisonOperator,
    putAlarm_threshold,
    putAlarm_evaluationPeriods,

    -- * Destructuring the Response
    PutAlarmResponse (..),
    newPutAlarmResponse,

    -- * Response Lenses
    putAlarmResponse_operations,
    putAlarmResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newPutAlarm' smart constructor.
data PutAlarm = PutAlarm'
  { -- | The contact protocols to use for the alarm, such as @Email@, @SMS@ (text
    -- messaging), or both.
    --
    -- A notification is sent via the specified contact protocol if
    -- notifications are enabled for the alarm, and when the alarm is
    -- triggered.
    --
    -- A notification is not sent if a contact protocol is not specified, if
    -- the specified contact protocol is not configured in the Amazon Web
    -- Services Region, or if notifications are not enabled for the alarm using
    -- the @notificationEnabled@ paramater.
    --
    -- Use the @CreateContactMethod@ action to configure a contact protocol in
    -- an Amazon Web Services Region.
    PutAlarm -> Maybe [ContactProtocol]
contactProtocols :: Prelude.Maybe [ContactProtocol],
    -- | The number of data points that must be not within the specified
    -- threshold to trigger the alarm. If you are setting an \"M out of N\"
    -- alarm, this value (@datapointsToAlarm@) is the M.
    PutAlarm -> Maybe Int
datapointsToAlarm :: Prelude.Maybe Prelude.Int,
    -- | Indicates whether the alarm is enabled.
    --
    -- Notifications are enabled by default if you don\'t specify this
    -- parameter.
    PutAlarm -> Maybe Bool
notificationEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The alarm states that trigger a notification.
    --
    -- An alarm has the following possible states:
    --
    -- -   @ALARM@ - The metric is outside of the defined threshold.
    --
    -- -   @INSUFFICIENT_DATA@ - The alarm has just started, the metric is not
    --     available, or not enough data is available for the metric to
    --     determine the alarm state.
    --
    -- -   @OK@ - The metric is within the defined threshold.
    --
    -- When you specify a notification trigger, the @ALARM@ state must be
    -- specified. The @INSUFFICIENT_DATA@ and @OK@ states can be specified in
    -- addition to the @ALARM@ state.
    --
    -- -   If you specify @OK@ as an alarm trigger, a notification is sent when
    --     the alarm switches from an @ALARM@ or @INSUFFICIENT_DATA@ alarm
    --     state to an @OK@ state. This can be thought of as an /all clear/
    --     alarm notification.
    --
    -- -   If you specify @INSUFFICIENT_DATA@ as the alarm trigger, a
    --     notification is sent when the alarm switches from an @OK@ or @ALARM@
    --     alarm state to an @INSUFFICIENT_DATA@ state.
    --
    -- The notification trigger defaults to @ALARM@ if you don\'t specify this
    -- parameter.
    PutAlarm -> Maybe [AlarmState]
notificationTriggers :: Prelude.Maybe [AlarmState],
    -- | Sets how this alarm will handle missing data points.
    --
    -- An alarm can treat missing data in the following ways:
    --
    -- -   @breaching@ - Assume the missing data is not within the threshold.
    --     Missing data counts towards the number of times the metric is not
    --     within the threshold.
    --
    -- -   @notBreaching@ - Assume the missing data is within the threshold.
    --     Missing data does not count towards the number of times the metric
    --     is not within the threshold.
    --
    -- -   @ignore@ - Ignore the missing data. Maintains the current alarm
    --     state.
    --
    -- -   @missing@ - Missing data is treated as missing.
    --
    -- If @treatMissingData@ is not specified, the default behavior of
    -- @missing@ is used.
    PutAlarm -> Maybe TreatMissingData
treatMissingData :: Prelude.Maybe TreatMissingData,
    -- | The name for the alarm. Specify the name of an existing alarm to update,
    -- and overwrite the previous configuration of the alarm.
    PutAlarm -> Text
alarmName :: Prelude.Text,
    -- | The name of the metric to associate with the alarm.
    --
    -- You can configure up to two alarms per metric.
    --
    -- The following metrics are available for each resource type:
    --
    -- -   __Instances__: @BurstCapacityPercentage@, @BurstCapacityTime@,
    --     @CPUUtilization@, @NetworkIn@, @NetworkOut@, @StatusCheckFailed@,
    --     @StatusCheckFailed_Instance@, and @StatusCheckFailed_System@.
    --
    -- -   __Load balancers__: @ClientTLSNegotiationErrorCount@,
    --     @HealthyHostCount@, @UnhealthyHostCount@, @HTTPCode_LB_4XX_Count@,
    --     @HTTPCode_LB_5XX_Count@, @HTTPCode_Instance_2XX_Count@,
    --     @HTTPCode_Instance_3XX_Count@, @HTTPCode_Instance_4XX_Count@,
    --     @HTTPCode_Instance_5XX_Count@, @InstanceResponseTime@,
    --     @RejectedConnectionCount@, and @RequestCount@.
    --
    -- -   __Relational databases__: @CPUUtilization@, @DatabaseConnections@,
    --     @DiskQueueDepth@, @FreeStorageSpace@, @NetworkReceiveThroughput@,
    --     and @NetworkTransmitThroughput@.
    --
    -- For more information about these metrics, see
    -- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-resource-health-metrics#available-metrics Metrics available in Lightsail>.
    PutAlarm -> MetricName
metricName :: MetricName,
    -- | The name of the Lightsail resource that will be monitored.
    --
    -- Instances, load balancers, and relational databases are the only
    -- Lightsail resources that can currently be monitored by alarms.
    PutAlarm -> Text
monitoredResourceName :: Prelude.Text,
    -- | The arithmetic operation to use when comparing the specified statistic
    -- to the threshold. The specified statistic value is used as the first
    -- operand.
    PutAlarm -> ComparisonOperator
comparisonOperator :: ComparisonOperator,
    -- | The value against which the specified statistic is compared.
    PutAlarm -> Double
threshold :: Prelude.Double,
    -- | The number of most recent periods over which data is compared to the
    -- specified threshold. If you are setting an \"M out of N\" alarm, this
    -- value (@evaluationPeriods@) is the N.
    --
    -- If you are setting an alarm that requires that a number of consecutive
    -- data points be breaching to trigger the alarm, this value specifies the
    -- rolling period of time in which data points are evaluated.
    --
    -- Each evaluation period is five minutes long. For example, specify an
    -- evaluation period of 24 to evaluate a metric over a rolling period of
    -- two hours.
    --
    -- You can specify a minimum valuation period of 1 (5 minutes), and a
    -- maximum evaluation period of 288 (24 hours).
    PutAlarm -> Int
evaluationPeriods :: Prelude.Int
  }
  deriving (PutAlarm -> PutAlarm -> Bool
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]
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
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. 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)

-- |
-- Create a value of 'PutAlarm' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'contactProtocols', 'putAlarm_contactProtocols' - The contact protocols to use for the alarm, such as @Email@, @SMS@ (text
-- messaging), or both.
--
-- A notification is sent via the specified contact protocol if
-- notifications are enabled for the alarm, and when the alarm is
-- triggered.
--
-- A notification is not sent if a contact protocol is not specified, if
-- the specified contact protocol is not configured in the Amazon Web
-- Services Region, or if notifications are not enabled for the alarm using
-- the @notificationEnabled@ paramater.
--
-- Use the @CreateContactMethod@ action to configure a contact protocol in
-- an Amazon Web Services Region.
--
-- 'datapointsToAlarm', 'putAlarm_datapointsToAlarm' - The number of data points that must be not within the specified
-- threshold to trigger the alarm. If you are setting an \"M out of N\"
-- alarm, this value (@datapointsToAlarm@) is the M.
--
-- 'notificationEnabled', 'putAlarm_notificationEnabled' - Indicates whether the alarm is enabled.
--
-- Notifications are enabled by default if you don\'t specify this
-- parameter.
--
-- 'notificationTriggers', 'putAlarm_notificationTriggers' - The alarm states that trigger a notification.
--
-- An alarm has the following possible states:
--
-- -   @ALARM@ - The metric is outside of the defined threshold.
--
-- -   @INSUFFICIENT_DATA@ - The alarm has just started, the metric is not
--     available, or not enough data is available for the metric to
--     determine the alarm state.
--
-- -   @OK@ - The metric is within the defined threshold.
--
-- When you specify a notification trigger, the @ALARM@ state must be
-- specified. The @INSUFFICIENT_DATA@ and @OK@ states can be specified in
-- addition to the @ALARM@ state.
--
-- -   If you specify @OK@ as an alarm trigger, a notification is sent when
--     the alarm switches from an @ALARM@ or @INSUFFICIENT_DATA@ alarm
--     state to an @OK@ state. This can be thought of as an /all clear/
--     alarm notification.
--
-- -   If you specify @INSUFFICIENT_DATA@ as the alarm trigger, a
--     notification is sent when the alarm switches from an @OK@ or @ALARM@
--     alarm state to an @INSUFFICIENT_DATA@ state.
--
-- The notification trigger defaults to @ALARM@ if you don\'t specify this
-- parameter.
--
-- 'treatMissingData', 'putAlarm_treatMissingData' - Sets how this alarm will handle missing data points.
--
-- An alarm can treat missing data in the following ways:
--
-- -   @breaching@ - Assume the missing data is not within the threshold.
--     Missing data counts towards the number of times the metric is not
--     within the threshold.
--
-- -   @notBreaching@ - Assume the missing data is within the threshold.
--     Missing data does not count towards the number of times the metric
--     is not within the threshold.
--
-- -   @ignore@ - Ignore the missing data. Maintains the current alarm
--     state.
--
-- -   @missing@ - Missing data is treated as missing.
--
-- If @treatMissingData@ is not specified, the default behavior of
-- @missing@ is used.
--
-- 'alarmName', 'putAlarm_alarmName' - The name for the alarm. Specify the name of an existing alarm to update,
-- and overwrite the previous configuration of the alarm.
--
-- 'metricName', 'putAlarm_metricName' - The name of the metric to associate with the alarm.
--
-- You can configure up to two alarms per metric.
--
-- The following metrics are available for each resource type:
--
-- -   __Instances__: @BurstCapacityPercentage@, @BurstCapacityTime@,
--     @CPUUtilization@, @NetworkIn@, @NetworkOut@, @StatusCheckFailed@,
--     @StatusCheckFailed_Instance@, and @StatusCheckFailed_System@.
--
-- -   __Load balancers__: @ClientTLSNegotiationErrorCount@,
--     @HealthyHostCount@, @UnhealthyHostCount@, @HTTPCode_LB_4XX_Count@,
--     @HTTPCode_LB_5XX_Count@, @HTTPCode_Instance_2XX_Count@,
--     @HTTPCode_Instance_3XX_Count@, @HTTPCode_Instance_4XX_Count@,
--     @HTTPCode_Instance_5XX_Count@, @InstanceResponseTime@,
--     @RejectedConnectionCount@, and @RequestCount@.
--
-- -   __Relational databases__: @CPUUtilization@, @DatabaseConnections@,
--     @DiskQueueDepth@, @FreeStorageSpace@, @NetworkReceiveThroughput@,
--     and @NetworkTransmitThroughput@.
--
-- For more information about these metrics, see
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-resource-health-metrics#available-metrics Metrics available in Lightsail>.
--
-- 'monitoredResourceName', 'putAlarm_monitoredResourceName' - The name of the Lightsail resource that will be monitored.
--
-- Instances, load balancers, and relational databases are the only
-- Lightsail resources that can currently be monitored by alarms.
--
-- 'comparisonOperator', 'putAlarm_comparisonOperator' - The arithmetic operation to use when comparing the specified statistic
-- to the threshold. The specified statistic value is used as the first
-- operand.
--
-- 'threshold', 'putAlarm_threshold' - The value against which the specified statistic is compared.
--
-- 'evaluationPeriods', 'putAlarm_evaluationPeriods' - The number of most recent periods over which data is compared to the
-- specified threshold. If you are setting an \"M out of N\" alarm, this
-- value (@evaluationPeriods@) is the N.
--
-- If you are setting an alarm that requires that a number of consecutive
-- data points be breaching to trigger the alarm, this value specifies the
-- rolling period of time in which data points are evaluated.
--
-- Each evaluation period is five minutes long. For example, specify an
-- evaluation period of 24 to evaluate a metric over a rolling period of
-- two hours.
--
-- You can specify a minimum valuation period of 1 (5 minutes), and a
-- maximum evaluation period of 288 (24 hours).
newPutAlarm ::
  -- | 'alarmName'
  Prelude.Text ->
  -- | 'metricName'
  MetricName ->
  -- | 'monitoredResourceName'
  Prelude.Text ->
  -- | 'comparisonOperator'
  ComparisonOperator ->
  -- | 'threshold'
  Prelude.Double ->
  -- | 'evaluationPeriods'
  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'
      { $sel:contactProtocols:PutAlarm' :: Maybe [ContactProtocol]
contactProtocols = forall a. Maybe a
Prelude.Nothing,
        $sel:datapointsToAlarm:PutAlarm' :: Maybe Int
datapointsToAlarm = forall a. Maybe a
Prelude.Nothing,
        $sel:notificationEnabled:PutAlarm' :: Maybe Bool
notificationEnabled = forall a. Maybe a
Prelude.Nothing,
        $sel:notificationTriggers:PutAlarm' :: Maybe [AlarmState]
notificationTriggers = forall a. Maybe a
Prelude.Nothing,
        $sel:treatMissingData:PutAlarm' :: Maybe TreatMissingData
treatMissingData = 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_
      }

-- | The contact protocols to use for the alarm, such as @Email@, @SMS@ (text
-- messaging), or both.
--
-- A notification is sent via the specified contact protocol if
-- notifications are enabled for the alarm, and when the alarm is
-- triggered.
--
-- A notification is not sent if a contact protocol is not specified, if
-- the specified contact protocol is not configured in the Amazon Web
-- Services Region, or if notifications are not enabled for the alarm using
-- the @notificationEnabled@ paramater.
--
-- Use the @CreateContactMethod@ action to configure a contact protocol in
-- an Amazon Web Services Region.
putAlarm_contactProtocols :: Lens.Lens' PutAlarm (Prelude.Maybe [ContactProtocol])
putAlarm_contactProtocols :: Lens' PutAlarm (Maybe [ContactProtocol])
putAlarm_contactProtocols = 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) 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

-- | The number of data points that must be not within the specified
-- threshold to trigger the alarm. If you are setting an \"M out of N\"
-- alarm, this value (@datapointsToAlarm@) is the M.
putAlarm_datapointsToAlarm :: Lens.Lens' PutAlarm (Prelude.Maybe Prelude.Int)
putAlarm_datapointsToAlarm :: Lens' PutAlarm (Maybe Int)
putAlarm_datapointsToAlarm = 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)

-- | Indicates whether the alarm is enabled.
--
-- Notifications are enabled by default if you don\'t specify this
-- parameter.
putAlarm_notificationEnabled :: Lens.Lens' PutAlarm (Prelude.Maybe Prelude.Bool)
putAlarm_notificationEnabled :: Lens' PutAlarm (Maybe Bool)
putAlarm_notificationEnabled = 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)

-- | The alarm states that trigger a notification.
--
-- An alarm has the following possible states:
--
-- -   @ALARM@ - The metric is outside of the defined threshold.
--
-- -   @INSUFFICIENT_DATA@ - The alarm has just started, the metric is not
--     available, or not enough data is available for the metric to
--     determine the alarm state.
--
-- -   @OK@ - The metric is within the defined threshold.
--
-- When you specify a notification trigger, the @ALARM@ state must be
-- specified. The @INSUFFICIENT_DATA@ and @OK@ states can be specified in
-- addition to the @ALARM@ state.
--
-- -   If you specify @OK@ as an alarm trigger, a notification is sent when
--     the alarm switches from an @ALARM@ or @INSUFFICIENT_DATA@ alarm
--     state to an @OK@ state. This can be thought of as an /all clear/
--     alarm notification.
--
-- -   If you specify @INSUFFICIENT_DATA@ as the alarm trigger, a
--     notification is sent when the alarm switches from an @OK@ or @ALARM@
--     alarm state to an @INSUFFICIENT_DATA@ state.
--
-- The notification trigger defaults to @ALARM@ if you don\'t specify this
-- parameter.
putAlarm_notificationTriggers :: Lens.Lens' PutAlarm (Prelude.Maybe [AlarmState])
putAlarm_notificationTriggers :: Lens' PutAlarm (Maybe [AlarmState])
putAlarm_notificationTriggers = 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) 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

-- | Sets how this alarm will handle missing data points.
--
-- An alarm can treat missing data in the following ways:
--
-- -   @breaching@ - Assume the missing data is not within the threshold.
--     Missing data counts towards the number of times the metric is not
--     within the threshold.
--
-- -   @notBreaching@ - Assume the missing data is within the threshold.
--     Missing data does not count towards the number of times the metric
--     is not within the threshold.
--
-- -   @ignore@ - Ignore the missing data. Maintains the current alarm
--     state.
--
-- -   @missing@ - Missing data is treated as missing.
--
-- If @treatMissingData@ is not specified, the default behavior of
-- @missing@ is used.
putAlarm_treatMissingData :: Lens.Lens' PutAlarm (Prelude.Maybe TreatMissingData)
putAlarm_treatMissingData :: Lens' PutAlarm (Maybe TreatMissingData)
putAlarm_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)

-- | The name for the alarm. Specify the name of an existing alarm to update,
-- and overwrite the previous configuration of the alarm.
putAlarm_alarmName :: Lens.Lens' PutAlarm Prelude.Text
putAlarm_alarmName :: Lens' PutAlarm Text
putAlarm_alarmName = 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)

-- | The name of the metric to associate with the alarm.
--
-- You can configure up to two alarms per metric.
--
-- The following metrics are available for each resource type:
--
-- -   __Instances__: @BurstCapacityPercentage@, @BurstCapacityTime@,
--     @CPUUtilization@, @NetworkIn@, @NetworkOut@, @StatusCheckFailed@,
--     @StatusCheckFailed_Instance@, and @StatusCheckFailed_System@.
--
-- -   __Load balancers__: @ClientTLSNegotiationErrorCount@,
--     @HealthyHostCount@, @UnhealthyHostCount@, @HTTPCode_LB_4XX_Count@,
--     @HTTPCode_LB_5XX_Count@, @HTTPCode_Instance_2XX_Count@,
--     @HTTPCode_Instance_3XX_Count@, @HTTPCode_Instance_4XX_Count@,
--     @HTTPCode_Instance_5XX_Count@, @InstanceResponseTime@,
--     @RejectedConnectionCount@, and @RequestCount@.
--
-- -   __Relational databases__: @CPUUtilization@, @DatabaseConnections@,
--     @DiskQueueDepth@, @FreeStorageSpace@, @NetworkReceiveThroughput@,
--     and @NetworkTransmitThroughput@.
--
-- For more information about these metrics, see
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-resource-health-metrics#available-metrics Metrics available in Lightsail>.
putAlarm_metricName :: Lens.Lens' PutAlarm MetricName
putAlarm_metricName :: Lens' PutAlarm MetricName
putAlarm_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)

-- | The name of the Lightsail resource that will be monitored.
--
-- Instances, load balancers, and relational databases are the only
-- Lightsail resources that can currently be monitored by alarms.
putAlarm_monitoredResourceName :: Lens.Lens' PutAlarm Prelude.Text
putAlarm_monitoredResourceName :: Lens' PutAlarm Text
putAlarm_monitoredResourceName = 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)

-- | The arithmetic operation to use when comparing the specified statistic
-- to the threshold. The specified statistic value is used as the first
-- operand.
putAlarm_comparisonOperator :: Lens.Lens' PutAlarm ComparisonOperator
putAlarm_comparisonOperator :: Lens' PutAlarm ComparisonOperator
putAlarm_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)

-- | The value against which the specified statistic is compared.
putAlarm_threshold :: Lens.Lens' PutAlarm Prelude.Double
putAlarm_threshold :: Lens' PutAlarm Double
putAlarm_threshold = 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)

-- | The number of most recent periods over which data is compared to the
-- specified threshold. If you are setting an \"M out of N\" alarm, this
-- value (@evaluationPeriods@) is the N.
--
-- If you are setting an alarm that requires that a number of consecutive
-- data points be breaching to trigger the alarm, this value specifies the
-- rolling period of time in which data points are evaluated.
--
-- Each evaluation period is five minutes long. For example, specify an
-- evaluation period of 24 to evaluate a metric over a rolling period of
-- two hours.
--
-- You can specify a minimum valuation period of 1 (5 minutes), and a
-- maximum evaluation period of 288 (24 hours).
putAlarm_evaluationPeriods :: Lens.Lens' PutAlarm Prelude.Int
putAlarm_evaluationPeriods :: Lens' PutAlarm Int
putAlarm_evaluationPeriods = 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 :: (Service -> Service) -> PutAlarm -> Request PutAlarm
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutAlarm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutAlarm)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [Operation] -> Int -> PutAlarmResponse
PutAlarmResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"operations" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable PutAlarm where
  hashWithSalt :: Int -> PutAlarm -> Int
hashWithSalt Int
_salt 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
treatMissingData :: Maybe TreatMissingData
notificationTriggers :: Maybe [AlarmState]
notificationEnabled :: Maybe Bool
datapointsToAlarm :: Maybe Int
contactProtocols :: Maybe [ContactProtocol]
$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:treatMissingData:PutAlarm' :: PutAlarm -> Maybe TreatMissingData
$sel:notificationTriggers:PutAlarm' :: PutAlarm -> Maybe [AlarmState]
$sel:notificationEnabled:PutAlarm' :: PutAlarm -> Maybe Bool
$sel:datapointsToAlarm:PutAlarm' :: PutAlarm -> Maybe Int
$sel:contactProtocols:PutAlarm' :: PutAlarm -> Maybe [ContactProtocol]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ContactProtocol]
contactProtocols
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
datapointsToAlarm
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
notificationEnabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AlarmState]
notificationTriggers
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TreatMissingData
treatMissingData
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
alarmName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` MetricName
metricName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
monitoredResourceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ComparisonOperator
comparisonOperator
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
threshold
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
evaluationPeriods

instance Prelude.NFData PutAlarm where
  rnf :: PutAlarm -> ()
rnf 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
treatMissingData :: Maybe TreatMissingData
notificationTriggers :: Maybe [AlarmState]
notificationEnabled :: Maybe Bool
datapointsToAlarm :: Maybe Int
contactProtocols :: Maybe [ContactProtocol]
$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:treatMissingData:PutAlarm' :: PutAlarm -> Maybe TreatMissingData
$sel:notificationTriggers:PutAlarm' :: PutAlarm -> Maybe [AlarmState]
$sel:notificationEnabled:PutAlarm' :: PutAlarm -> Maybe Bool
$sel:datapointsToAlarm:PutAlarm' :: PutAlarm -> Maybe Int
$sel:contactProtocols:PutAlarm' :: PutAlarm -> Maybe [ContactProtocol]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ContactProtocol]
contactProtocols
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
datapointsToAlarm
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
notificationEnabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [AlarmState]
notificationTriggers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TreatMissingData
treatMissingData
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
alarmName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf MetricName
metricName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
monitoredResourceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ComparisonOperator
comparisonOperator
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
threshold
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
evaluationPeriods

instance Data.ToHeaders PutAlarm where
  toHeaders :: PutAlarm -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Lightsail_20161128.PutAlarm" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.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
treatMissingData :: Maybe TreatMissingData
notificationTriggers :: Maybe [AlarmState]
notificationEnabled :: Maybe Bool
datapointsToAlarm :: Maybe Int
contactProtocols :: Maybe [ContactProtocol]
$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:treatMissingData:PutAlarm' :: PutAlarm -> Maybe TreatMissingData
$sel:notificationTriggers:PutAlarm' :: PutAlarm -> Maybe [AlarmState]
$sel:notificationEnabled:PutAlarm' :: PutAlarm -> Maybe Bool
$sel:datapointsToAlarm:PutAlarm' :: PutAlarm -> Maybe Int
$sel:contactProtocols:PutAlarm' :: PutAlarm -> Maybe [ContactProtocol]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"contactProtocols" 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 [ContactProtocol]
contactProtocols,
            (Key
"datapointsToAlarm" 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 Int
datapointsToAlarm,
            (Key
"notificationEnabled" 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 Bool
notificationEnabled,
            (Key
"notificationTriggers" 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 [AlarmState]
notificationTriggers,
            (Key
"treatMissingData" 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 TreatMissingData
treatMissingData,
            forall a. a -> Maybe a
Prelude.Just (Key
"alarmName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
alarmName),
            forall a. a -> Maybe a
Prelude.Just (Key
"metricName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= MetricName
metricName),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"monitoredResourceName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
monitoredResourceName
              ),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"comparisonOperator" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ComparisonOperator
comparisonOperator),
            forall a. a -> Maybe a
Prelude.Just (Key
"threshold" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
threshold),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"evaluationPeriods" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Int
evaluationPeriods)
          ]
      )

instance Data.ToPath PutAlarm where
  toPath :: PutAlarm -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery PutAlarm where
  toQuery :: PutAlarm -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newPutAlarmResponse' smart constructor.
data PutAlarmResponse = PutAlarmResponse'
  { -- | An array of objects that describe the result of the action, such as the
    -- status of the request, the timestamp of the request, and the resources
    -- affected by the request.
    PutAlarmResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
    -- | The response's http status code.
    PutAlarmResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PutAlarmResponse -> PutAlarmResponse -> Bool
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]
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
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. 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)

-- |
-- Create a value of 'PutAlarmResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'operations', 'putAlarmResponse_operations' - An array of objects that describe the result of the action, such as the
-- status of the request, the timestamp of the request, and the resources
-- affected by the request.
--
-- 'httpStatus', 'putAlarmResponse_httpStatus' - The response's http status code.
newPutAlarmResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutAlarmResponse
newPutAlarmResponse :: Int -> PutAlarmResponse
newPutAlarmResponse Int
pHttpStatus_ =
  PutAlarmResponse'
    { $sel:operations:PutAlarmResponse' :: Maybe [Operation]
operations = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:PutAlarmResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of objects that describe the result of the action, such as the
-- status of the request, the timestamp of the request, and the resources
-- affected by the request.
putAlarmResponse_operations :: Lens.Lens' PutAlarmResponse (Prelude.Maybe [Operation])
putAlarmResponse_operations :: Lens' PutAlarmResponse (Maybe [Operation])
putAlarmResponse_operations = 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) 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

-- | The response's http status code.
putAlarmResponse_httpStatus :: Lens.Lens' PutAlarmResponse Prelude.Int
putAlarmResponse_httpStatus :: Lens' PutAlarmResponse Int
putAlarmResponse_httpStatus = 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 where
  rnf :: PutAlarmResponse -> ()
rnf PutAlarmResponse' {Int
Maybe [Operation]
httpStatus :: Int
operations :: Maybe [Operation]
$sel:httpStatus:PutAlarmResponse' :: PutAlarmResponse -> Int
$sel:operations:PutAlarmResponse' :: PutAlarmResponse -> Maybe [Operation]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Operation]
operations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus