{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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_treatMissingData,
    putAlarm_contactProtocols,
    putAlarm_datapointsToAlarm,
    putAlarm_notificationEnabled,
    putAlarm_notificationTriggers,
    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.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

-- | /See:/ 'newPutAlarm' smart constructor.
data PutAlarm = PutAlarm'
  { -- | 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 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 AWS 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 AWS 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],
    -- | 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
(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)

-- |
-- 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:
--
-- '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.
--
-- '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 AWS 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 AWS 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.
--
-- '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' :: 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_
      }

-- | 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 :: (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)

-- | 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 AWS 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 AWS Region.
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

-- | 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 :: (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)

-- | 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 :: (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)

-- | 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 :: (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

-- | 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 :: (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)

-- | 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 :: (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)

-- | 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 :: (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)

-- | 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 :: (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)

-- | The value against which the specified statistic is compared.
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)

-- | 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 :: (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

-- | /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
(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)

-- |
-- 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' :: 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_
    }

-- | 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 :: (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

-- | The response's http status code.
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