{-# 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.CloudWatch.PutMetricAlarm
-- 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,
-- metric math expression, or anomaly detection model.
--
-- Alarms based on anomaly detection models cannot have Auto Scaling
-- actions.
--
-- When this operation 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.
--
-- If you are an IAM user, you must have Amazon EC2 permissions for some
-- alarm operations:
--
-- -   The @iam:CreateServiceLinkedRole@ for all alarms with EC2 actions
--
-- -   The @iam:CreateServiceLinkedRole@ to create an alarm with Systems
--     Manager OpsItem actions.
--
-- The first time you create an alarm in the Management Console, the CLI,
-- or by using the PutMetricAlarm API, CloudWatch creates the necessary
-- service-linked role for you. The service-linked roles are called
-- @AWSServiceRoleForCloudWatchEvents@ and
-- @AWSServiceRoleForCloudWatchAlarms_ActionSSM@. For more information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-linked-role Amazon Web Services service-linked role>.
--
-- __Cross-account alarms__
--
-- You can set an alarm on metrics in the current account, or in another
-- account. To create a cross-account alarm that watches a metric in a
-- different account, you must have completed the following pre-requisites:
--
-- -   The account where the metrics are located (the /sharing account/)
--     must already have a sharing role named
--     __CloudWatch-CrossAccountSharingRole__. If it does not already have
--     this role, you must create it using the instructions in __Set up a
--     sharing account__ in
--     <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Cross-Account-Cross-Region.html#enable-cross-account-cross-Region Cross-account cross-Region CloudWatch console>.
--     The policy for that role must grant access to the ID of the account
--     where you are creating the alarm.
--
-- -   The account where you are creating the alarm (the /monitoring
--     account/) must already have a service-linked role named
--     __AWSServiceRoleForCloudWatchCrossAccount__ to allow CloudWatch to
--     assume the sharing role in the sharing account. If it does not, you
--     must create it following the directions in __Set up a monitoring
--     account__ in
--     <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Cross-Account-Cross-Region.html#enable-cross-account-cross-Region Cross-account cross-Region CloudWatch console>.
module Amazonka.CloudWatch.PutMetricAlarm
  ( -- * Creating a Request
    PutMetricAlarm (..),
    newPutMetricAlarm,

    -- * Request Lenses
    putMetricAlarm_metrics,
    putMetricAlarm_treatMissingData,
    putMetricAlarm_period,
    putMetricAlarm_alarmDescription,
    putMetricAlarm_metricName,
    putMetricAlarm_namespace,
    putMetricAlarm_thresholdMetricId,
    putMetricAlarm_oKActions,
    putMetricAlarm_evaluateLowSampleCountPercentile,
    putMetricAlarm_datapointsToAlarm,
    putMetricAlarm_threshold,
    putMetricAlarm_actionsEnabled,
    putMetricAlarm_insufficientDataActions,
    putMetricAlarm_dimensions,
    putMetricAlarm_alarmActions,
    putMetricAlarm_unit,
    putMetricAlarm_statistic,
    putMetricAlarm_tags,
    putMetricAlarm_extendedStatistic,
    putMetricAlarm_alarmName,
    putMetricAlarm_evaluationPeriods,
    putMetricAlarm_comparisonOperator,

    -- * Destructuring the Response
    PutMetricAlarmResponse (..),
    newPutMetricAlarmResponse,
  )
where

import Amazonka.CloudWatch.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newPutMetricAlarm' smart constructor.
data PutMetricAlarm = PutMetricAlarm'
  { -- | An array of @MetricDataQuery@ structures that enable you to create an
    -- alarm based on the result of a metric math expression. For each
    -- @PutMetricAlarm@ operation, you must specify either @MetricName@ or a
    -- @Metrics@ array.
    --
    -- Each item in the @Metrics@ array either retrieves a metric or performs a
    -- math expression.
    --
    -- One item in the @Metrics@ array is the expression that the alarm
    -- watches. You designate this expression by setting @ReturnData@ to true
    -- for this object in the array. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDataQuery.html MetricDataQuery>.
    --
    -- If you use the @Metrics@ parameter, you cannot include the @MetricName@,
    -- @Dimensions@, @Period@, @Namespace@, @Statistic@, or @ExtendedStatistic@
    -- parameters of @PutMetricAlarm@ in the same operation. Instead, you
    -- retrieve the metrics you are using in your math expression as part of
    -- the @Metrics@ array.
    PutMetricAlarm -> Maybe [MetricDataQuery]
metrics :: Prelude.Maybe [MetricDataQuery],
    -- | Sets how this alarm is to handle missing data points. If
    -- @TreatMissingData@ is omitted, the default behavior of @missing@ is
    -- used. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-missing-data Configuring How CloudWatch Alarms Treats Missing Data>.
    --
    -- Valid Values: @breaching | notBreaching | ignore | missing@
    PutMetricAlarm -> Maybe Text
treatMissingData :: Prelude.Maybe Prelude.Text,
    -- | The length, in seconds, used each time the metric specified in
    -- @MetricName@ is evaluated. Valid values are 10, 30, and any multiple of
    -- 60.
    --
    -- @Period@ is required for alarms based on static thresholds. If you are
    -- creating an alarm based on a metric math expression, you specify the
    -- period for each metric within the objects in the @Metrics@ array.
    --
    -- Be sure to specify 10 or 30 only for metrics that are stored by a
    -- @PutMetricData@ call with a @StorageResolution@ of 1. If you specify a
    -- period of 10 or 30 for a metric that does not have sub-minute
    -- resolution, the alarm still attempts to gather data at the period rate
    -- that you specify. In this case, it does not receive data for the
    -- attempts that do not correspond to a one-minute data resolution, and the
    -- alarm might often lapse into INSUFFICENT_DATA status. Specifying 10 or
    -- 30 also sets this alarm as a high-resolution alarm, which has a higher
    -- charge than other alarms. For more information about pricing, see
    -- <https://aws.amazon.com/cloudwatch/pricing/ Amazon CloudWatch Pricing>.
    --
    -- An alarm\'s total current evaluation period can be no longer than one
    -- day, so @Period@ multiplied by @EvaluationPeriods@ cannot be more than
    -- 86,400 seconds.
    PutMetricAlarm -> Maybe Natural
period :: Prelude.Maybe Prelude.Natural,
    -- | The description for the alarm.
    PutMetricAlarm -> Maybe Text
alarmDescription :: Prelude.Maybe Prelude.Text,
    -- | The name for the metric associated with the alarm. For each
    -- @PutMetricAlarm@ operation, you must specify either @MetricName@ or a
    -- @Metrics@ array.
    --
    -- If you are creating an alarm based on a math expression, you cannot
    -- specify this parameter, or any of the @Dimensions@, @Period@,
    -- @Namespace@, @Statistic@, or @ExtendedStatistic@ parameters. Instead,
    -- you specify all this information in the @Metrics@ array.
    PutMetricAlarm -> Maybe Text
metricName :: Prelude.Maybe Prelude.Text,
    -- | The namespace for the metric associated specified in @MetricName@.
    PutMetricAlarm -> Maybe Text
namespace :: Prelude.Maybe Prelude.Text,
    -- | If this is an alarm based on an anomaly detection model, make this value
    -- match the ID of the @ANOMALY_DETECTION_BAND@ function.
    --
    -- For an example of how to use this parameter, see the __Anomaly Detection
    -- Model Alarm__ example on this page.
    --
    -- If your alarm uses this parameter, it cannot have Auto Scaling actions.
    PutMetricAlarm -> Maybe Text
thresholdMetricId :: Prelude.Maybe Prelude.Text,
    -- | The actions to execute when this alarm transitions to an @OK@ state from
    -- any other state. Each action is specified as an Amazon Resource Name
    -- (ARN).
    --
    -- Valid Values: @arn:aws:automate:region:ec2:stop@ |
    -- @arn:aws:automate:region:ec2:terminate@ |
    -- @arn:aws:automate:region:ec2:recover@ |
    -- @arn:aws:automate:region:ec2:reboot@ |
    -- @arn:aws:sns:region:account-id:sns-topic-name @ |
    -- @arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id:autoScalingGroupName\/group-friendly-name:policyName\/policy-friendly-name @
    --
    -- Valid Values (for use with IAM roles):
    -- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Stop\/1.0@
    -- |
    -- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Terminate\/1.0@
    -- |
    -- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Reboot\/1.0@
    -- |
    -- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Recover\/1.0@
    PutMetricAlarm -> Maybe [Text]
oKActions :: Prelude.Maybe [Prelude.Text],
    -- | Used only for alarms based on percentiles. If you specify @ignore@, the
    -- alarm state does not change during periods with too few data points to
    -- be statistically significant. If you specify @evaluate@ or omit this
    -- parameter, the alarm is always evaluated and possibly changes state no
    -- matter how many data points are available. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#percentiles-with-low-samples Percentile-Based CloudWatch Alarms and Low Data Samples>.
    --
    -- Valid Values: @evaluate | ignore@
    PutMetricAlarm -> Maybe Text
evaluateLowSampleCountPercentile :: Prelude.Maybe Prelude.Text,
    -- | The number of data points that must be breaching to trigger the alarm.
    -- This is used only if you are setting an \"M out of N\" alarm. In that
    -- case, this value is the M. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarm-evaluation Evaluating an Alarm>
    -- in the /Amazon CloudWatch User Guide/.
    PutMetricAlarm -> Maybe Natural
datapointsToAlarm :: Prelude.Maybe Prelude.Natural,
    -- | The value against which the specified statistic is compared.
    --
    -- This parameter is required for alarms based on static thresholds, but
    -- should not be used for alarms based on anomaly detection models.
    PutMetricAlarm -> Maybe Double
threshold :: Prelude.Maybe Prelude.Double,
    -- | Indicates whether actions should be executed during any changes to the
    -- alarm state. The default is @TRUE@.
    PutMetricAlarm -> Maybe Bool
actionsEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The actions to execute when this alarm transitions to the
    -- @INSUFFICIENT_DATA@ state from any other state. Each action is specified
    -- as an Amazon Resource Name (ARN).
    --
    -- Valid Values: @arn:aws:automate:region:ec2:stop@ |
    -- @arn:aws:automate:region:ec2:terminate@ |
    -- @arn:aws:automate:region:ec2:recover@ |
    -- @arn:aws:automate:region:ec2:reboot@ |
    -- @arn:aws:sns:region:account-id:sns-topic-name @ |
    -- @arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id:autoScalingGroupName\/group-friendly-name:policyName\/policy-friendly-name @
    --
    -- Valid Values (for use with IAM roles):
    -- @>arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Stop\/1.0@
    -- |
    -- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Terminate\/1.0@
    -- |
    -- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Reboot\/1.0@
    PutMetricAlarm -> Maybe [Text]
insufficientDataActions :: Prelude.Maybe [Prelude.Text],
    -- | The dimensions for the metric specified in @MetricName@.
    PutMetricAlarm -> Maybe [Dimension]
dimensions :: Prelude.Maybe [Dimension],
    -- | The actions to execute when this alarm transitions to the @ALARM@ state
    -- from any other state. Each action is specified as an Amazon Resource
    -- Name (ARN).
    --
    -- Valid Values: @arn:aws:automate:region:ec2:stop@ |
    -- @arn:aws:automate:region:ec2:terminate@ |
    -- @arn:aws:automate:region:ec2:recover@ |
    -- @arn:aws:automate:region:ec2:reboot@ |
    -- @arn:aws:sns:region:account-id:sns-topic-name @ |
    -- @arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id:autoScalingGroupName\/group-friendly-name:policyName\/policy-friendly-name @
    -- | @arn:aws:ssm:region:account-id:opsitem:severity @ |
    -- @arn:aws:ssm-incidents::account-id:response-plan:response-plan-name @
    --
    -- Valid Values (for use with IAM roles):
    -- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Stop\/1.0@
    -- |
    -- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Terminate\/1.0@
    -- |
    -- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Reboot\/1.0@
    -- |
    -- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Recover\/1.0@
    PutMetricAlarm -> Maybe [Text]
alarmActions :: Prelude.Maybe [Prelude.Text],
    -- | The unit of measure for the statistic. For example, the units for the
    -- Amazon EC2 NetworkIn metric are Bytes because NetworkIn tracks the
    -- number of bytes that an instance receives on all network interfaces. You
    -- can also specify a unit when you create a custom metric. Units help
    -- provide conceptual meaning to your data. Metric data points that specify
    -- a unit of measure, such as Percent, are aggregated separately.
    --
    -- If you don\'t specify @Unit@, CloudWatch retrieves all unit types that
    -- have been published for the metric and attempts to evaluate the alarm.
    -- Usually, metrics are published with only one unit, so the alarm works as
    -- intended.
    --
    -- However, if the metric is published with multiple types of units and you
    -- don\'t specify a unit, the alarm\'s behavior is not defined and it
    -- behaves predictably.
    --
    -- We recommend omitting @Unit@ so that you don\'t inadvertently specify an
    -- incorrect unit that is not published for this metric. Doing so causes
    -- the alarm to be stuck in the @INSUFFICIENT DATA@ state.
    PutMetricAlarm -> Maybe StandardUnit
unit :: Prelude.Maybe StandardUnit,
    -- | The statistic for the metric specified in @MetricName@, other than
    -- percentile. For percentile statistics, use @ExtendedStatistic@. When you
    -- call @PutMetricAlarm@ and specify a @MetricName@, you must specify
    -- either @Statistic@ or @ExtendedStatistic,@ but not both.
    PutMetricAlarm -> Maybe Statistic
statistic :: Prelude.Maybe Statistic,
    -- | A list of key-value pairs to associate with the alarm. You can associate
    -- as many as 50 tags with an alarm.
    --
    -- Tags can help you organize and categorize your resources. You can also
    -- use them to scope user permissions by granting a user permission to
    -- access or change only resources with certain tag values.
    --
    -- If you are using this operation to update an existing alarm, any tags
    -- you specify in this parameter are ignored. To change the tags of an
    -- existing alarm, use
    -- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_TagResource.html TagResource>
    -- or
    -- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_UntagResource.html UntagResource>.
    PutMetricAlarm -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The percentile statistic for the metric specified in @MetricName@.
    -- Specify a value between p0.0 and p100. When you call @PutMetricAlarm@
    -- and specify a @MetricName@, you must specify either @Statistic@ or
    -- @ExtendedStatistic,@ but not both.
    PutMetricAlarm -> Maybe Text
extendedStatistic :: Prelude.Maybe Prelude.Text,
    -- | The name for the alarm. This name must be unique within the Region.
    PutMetricAlarm -> Text
alarmName :: Prelude.Text,
    -- | The number of periods over which data is compared to the specified
    -- threshold. If you are setting an alarm that requires that a number of
    -- consecutive data points be breaching to trigger the alarm, this value
    -- specifies that number. If you are setting an \"M out of N\" alarm, this
    -- value is the N.
    --
    -- An alarm\'s total current evaluation period can be no longer than one
    -- day, so this number multiplied by @Period@ cannot be more than 86,400
    -- seconds.
    PutMetricAlarm -> Natural
evaluationPeriods :: Prelude.Natural,
    -- | The arithmetic operation to use when comparing the specified statistic
    -- and threshold. The specified statistic value is used as the first
    -- operand.
    --
    -- The values @LessThanLowerOrGreaterThanUpperThreshold@,
    -- @LessThanLowerThreshold@, and @GreaterThanUpperThreshold@ are used only
    -- for alarms based on anomaly detection models.
    PutMetricAlarm -> ComparisonOperator
comparisonOperator :: ComparisonOperator
  }
  deriving (PutMetricAlarm -> PutMetricAlarm -> Bool
(PutMetricAlarm -> PutMetricAlarm -> Bool)
-> (PutMetricAlarm -> PutMetricAlarm -> Bool) -> Eq PutMetricAlarm
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutMetricAlarm -> PutMetricAlarm -> Bool
$c/= :: PutMetricAlarm -> PutMetricAlarm -> Bool
== :: PutMetricAlarm -> PutMetricAlarm -> Bool
$c== :: PutMetricAlarm -> PutMetricAlarm -> Bool
Prelude.Eq, ReadPrec [PutMetricAlarm]
ReadPrec PutMetricAlarm
Int -> ReadS PutMetricAlarm
ReadS [PutMetricAlarm]
(Int -> ReadS PutMetricAlarm)
-> ReadS [PutMetricAlarm]
-> ReadPrec PutMetricAlarm
-> ReadPrec [PutMetricAlarm]
-> Read PutMetricAlarm
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutMetricAlarm]
$creadListPrec :: ReadPrec [PutMetricAlarm]
readPrec :: ReadPrec PutMetricAlarm
$creadPrec :: ReadPrec PutMetricAlarm
readList :: ReadS [PutMetricAlarm]
$creadList :: ReadS [PutMetricAlarm]
readsPrec :: Int -> ReadS PutMetricAlarm
$creadsPrec :: Int -> ReadS PutMetricAlarm
Prelude.Read, Int -> PutMetricAlarm -> ShowS
[PutMetricAlarm] -> ShowS
PutMetricAlarm -> String
(Int -> PutMetricAlarm -> ShowS)
-> (PutMetricAlarm -> String)
-> ([PutMetricAlarm] -> ShowS)
-> Show PutMetricAlarm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutMetricAlarm] -> ShowS
$cshowList :: [PutMetricAlarm] -> ShowS
show :: PutMetricAlarm -> String
$cshow :: PutMetricAlarm -> String
showsPrec :: Int -> PutMetricAlarm -> ShowS
$cshowsPrec :: Int -> PutMetricAlarm -> ShowS
Prelude.Show, (forall x. PutMetricAlarm -> Rep PutMetricAlarm x)
-> (forall x. Rep PutMetricAlarm x -> PutMetricAlarm)
-> Generic PutMetricAlarm
forall x. Rep PutMetricAlarm x -> PutMetricAlarm
forall x. PutMetricAlarm -> Rep PutMetricAlarm x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutMetricAlarm x -> PutMetricAlarm
$cfrom :: forall x. PutMetricAlarm -> Rep PutMetricAlarm x
Prelude.Generic)

-- |
-- Create a value of 'PutMetricAlarm' 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:
--
-- 'metrics', 'putMetricAlarm_metrics' - An array of @MetricDataQuery@ structures that enable you to create an
-- alarm based on the result of a metric math expression. For each
-- @PutMetricAlarm@ operation, you must specify either @MetricName@ or a
-- @Metrics@ array.
--
-- Each item in the @Metrics@ array either retrieves a metric or performs a
-- math expression.
--
-- One item in the @Metrics@ array is the expression that the alarm
-- watches. You designate this expression by setting @ReturnData@ to true
-- for this object in the array. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDataQuery.html MetricDataQuery>.
--
-- If you use the @Metrics@ parameter, you cannot include the @MetricName@,
-- @Dimensions@, @Period@, @Namespace@, @Statistic@, or @ExtendedStatistic@
-- parameters of @PutMetricAlarm@ in the same operation. Instead, you
-- retrieve the metrics you are using in your math expression as part of
-- the @Metrics@ array.
--
-- 'treatMissingData', 'putMetricAlarm_treatMissingData' - Sets how this alarm is to handle missing data points. If
-- @TreatMissingData@ is omitted, the default behavior of @missing@ is
-- used. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-missing-data Configuring How CloudWatch Alarms Treats Missing Data>.
--
-- Valid Values: @breaching | notBreaching | ignore | missing@
--
-- 'period', 'putMetricAlarm_period' - The length, in seconds, used each time the metric specified in
-- @MetricName@ is evaluated. Valid values are 10, 30, and any multiple of
-- 60.
--
-- @Period@ is required for alarms based on static thresholds. If you are
-- creating an alarm based on a metric math expression, you specify the
-- period for each metric within the objects in the @Metrics@ array.
--
-- Be sure to specify 10 or 30 only for metrics that are stored by a
-- @PutMetricData@ call with a @StorageResolution@ of 1. If you specify a
-- period of 10 or 30 for a metric that does not have sub-minute
-- resolution, the alarm still attempts to gather data at the period rate
-- that you specify. In this case, it does not receive data for the
-- attempts that do not correspond to a one-minute data resolution, and the
-- alarm might often lapse into INSUFFICENT_DATA status. Specifying 10 or
-- 30 also sets this alarm as a high-resolution alarm, which has a higher
-- charge than other alarms. For more information about pricing, see
-- <https://aws.amazon.com/cloudwatch/pricing/ Amazon CloudWatch Pricing>.
--
-- An alarm\'s total current evaluation period can be no longer than one
-- day, so @Period@ multiplied by @EvaluationPeriods@ cannot be more than
-- 86,400 seconds.
--
-- 'alarmDescription', 'putMetricAlarm_alarmDescription' - The description for the alarm.
--
-- 'metricName', 'putMetricAlarm_metricName' - The name for the metric associated with the alarm. For each
-- @PutMetricAlarm@ operation, you must specify either @MetricName@ or a
-- @Metrics@ array.
--
-- If you are creating an alarm based on a math expression, you cannot
-- specify this parameter, or any of the @Dimensions@, @Period@,
-- @Namespace@, @Statistic@, or @ExtendedStatistic@ parameters. Instead,
-- you specify all this information in the @Metrics@ array.
--
-- 'namespace', 'putMetricAlarm_namespace' - The namespace for the metric associated specified in @MetricName@.
--
-- 'thresholdMetricId', 'putMetricAlarm_thresholdMetricId' - If this is an alarm based on an anomaly detection model, make this value
-- match the ID of the @ANOMALY_DETECTION_BAND@ function.
--
-- For an example of how to use this parameter, see the __Anomaly Detection
-- Model Alarm__ example on this page.
--
-- If your alarm uses this parameter, it cannot have Auto Scaling actions.
--
-- 'oKActions', 'putMetricAlarm_oKActions' - The actions to execute when this alarm transitions to an @OK@ state from
-- any other state. Each action is specified as an Amazon Resource Name
-- (ARN).
--
-- Valid Values: @arn:aws:automate:region:ec2:stop@ |
-- @arn:aws:automate:region:ec2:terminate@ |
-- @arn:aws:automate:region:ec2:recover@ |
-- @arn:aws:automate:region:ec2:reboot@ |
-- @arn:aws:sns:region:account-id:sns-topic-name @ |
-- @arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id:autoScalingGroupName\/group-friendly-name:policyName\/policy-friendly-name @
--
-- Valid Values (for use with IAM roles):
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Stop\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Terminate\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Reboot\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Recover\/1.0@
--
-- 'evaluateLowSampleCountPercentile', 'putMetricAlarm_evaluateLowSampleCountPercentile' - Used only for alarms based on percentiles. If you specify @ignore@, the
-- alarm state does not change during periods with too few data points to
-- be statistically significant. If you specify @evaluate@ or omit this
-- parameter, the alarm is always evaluated and possibly changes state no
-- matter how many data points are available. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#percentiles-with-low-samples Percentile-Based CloudWatch Alarms and Low Data Samples>.
--
-- Valid Values: @evaluate | ignore@
--
-- 'datapointsToAlarm', 'putMetricAlarm_datapointsToAlarm' - The number of data points that must be breaching to trigger the alarm.
-- This is used only if you are setting an \"M out of N\" alarm. In that
-- case, this value is the M. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarm-evaluation Evaluating an Alarm>
-- in the /Amazon CloudWatch User Guide/.
--
-- 'threshold', 'putMetricAlarm_threshold' - The value against which the specified statistic is compared.
--
-- This parameter is required for alarms based on static thresholds, but
-- should not be used for alarms based on anomaly detection models.
--
-- 'actionsEnabled', 'putMetricAlarm_actionsEnabled' - Indicates whether actions should be executed during any changes to the
-- alarm state. The default is @TRUE@.
--
-- 'insufficientDataActions', 'putMetricAlarm_insufficientDataActions' - The actions to execute when this alarm transitions to the
-- @INSUFFICIENT_DATA@ state from any other state. Each action is specified
-- as an Amazon Resource Name (ARN).
--
-- Valid Values: @arn:aws:automate:region:ec2:stop@ |
-- @arn:aws:automate:region:ec2:terminate@ |
-- @arn:aws:automate:region:ec2:recover@ |
-- @arn:aws:automate:region:ec2:reboot@ |
-- @arn:aws:sns:region:account-id:sns-topic-name @ |
-- @arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id:autoScalingGroupName\/group-friendly-name:policyName\/policy-friendly-name @
--
-- Valid Values (for use with IAM roles):
-- @>arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Stop\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Terminate\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Reboot\/1.0@
--
-- 'dimensions', 'putMetricAlarm_dimensions' - The dimensions for the metric specified in @MetricName@.
--
-- 'alarmActions', 'putMetricAlarm_alarmActions' - The actions to execute when this alarm transitions to the @ALARM@ state
-- from any other state. Each action is specified as an Amazon Resource
-- Name (ARN).
--
-- Valid Values: @arn:aws:automate:region:ec2:stop@ |
-- @arn:aws:automate:region:ec2:terminate@ |
-- @arn:aws:automate:region:ec2:recover@ |
-- @arn:aws:automate:region:ec2:reboot@ |
-- @arn:aws:sns:region:account-id:sns-topic-name @ |
-- @arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id:autoScalingGroupName\/group-friendly-name:policyName\/policy-friendly-name @
-- | @arn:aws:ssm:region:account-id:opsitem:severity @ |
-- @arn:aws:ssm-incidents::account-id:response-plan:response-plan-name @
--
-- Valid Values (for use with IAM roles):
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Stop\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Terminate\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Reboot\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Recover\/1.0@
--
-- 'unit', 'putMetricAlarm_unit' - The unit of measure for the statistic. For example, the units for the
-- Amazon EC2 NetworkIn metric are Bytes because NetworkIn tracks the
-- number of bytes that an instance receives on all network interfaces. You
-- can also specify a unit when you create a custom metric. Units help
-- provide conceptual meaning to your data. Metric data points that specify
-- a unit of measure, such as Percent, are aggregated separately.
--
-- If you don\'t specify @Unit@, CloudWatch retrieves all unit types that
-- have been published for the metric and attempts to evaluate the alarm.
-- Usually, metrics are published with only one unit, so the alarm works as
-- intended.
--
-- However, if the metric is published with multiple types of units and you
-- don\'t specify a unit, the alarm\'s behavior is not defined and it
-- behaves predictably.
--
-- We recommend omitting @Unit@ so that you don\'t inadvertently specify an
-- incorrect unit that is not published for this metric. Doing so causes
-- the alarm to be stuck in the @INSUFFICIENT DATA@ state.
--
-- 'statistic', 'putMetricAlarm_statistic' - The statistic for the metric specified in @MetricName@, other than
-- percentile. For percentile statistics, use @ExtendedStatistic@. When you
-- call @PutMetricAlarm@ and specify a @MetricName@, you must specify
-- either @Statistic@ or @ExtendedStatistic,@ but not both.
--
-- 'tags', 'putMetricAlarm_tags' - A list of key-value pairs to associate with the alarm. You can associate
-- as many as 50 tags with an alarm.
--
-- Tags can help you organize and categorize your resources. You can also
-- use them to scope user permissions by granting a user permission to
-- access or change only resources with certain tag values.
--
-- If you are using this operation to update an existing alarm, any tags
-- you specify in this parameter are ignored. To change the tags of an
-- existing alarm, use
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_TagResource.html TagResource>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_UntagResource.html UntagResource>.
--
-- 'extendedStatistic', 'putMetricAlarm_extendedStatistic' - The percentile statistic for the metric specified in @MetricName@.
-- Specify a value between p0.0 and p100. When you call @PutMetricAlarm@
-- and specify a @MetricName@, you must specify either @Statistic@ or
-- @ExtendedStatistic,@ but not both.
--
-- 'alarmName', 'putMetricAlarm_alarmName' - The name for the alarm. This name must be unique within the Region.
--
-- 'evaluationPeriods', 'putMetricAlarm_evaluationPeriods' - The number of periods over which data is compared to the specified
-- threshold. If you are setting an alarm that requires that a number of
-- consecutive data points be breaching to trigger the alarm, this value
-- specifies that number. If you are setting an \"M out of N\" alarm, this
-- value is the N.
--
-- An alarm\'s total current evaluation period can be no longer than one
-- day, so this number multiplied by @Period@ cannot be more than 86,400
-- seconds.
--
-- 'comparisonOperator', 'putMetricAlarm_comparisonOperator' - The arithmetic operation to use when comparing the specified statistic
-- and threshold. The specified statistic value is used as the first
-- operand.
--
-- The values @LessThanLowerOrGreaterThanUpperThreshold@,
-- @LessThanLowerThreshold@, and @GreaterThanUpperThreshold@ are used only
-- for alarms based on anomaly detection models.
newPutMetricAlarm ::
  -- | 'alarmName'
  Prelude.Text ->
  -- | 'evaluationPeriods'
  Prelude.Natural ->
  -- | 'comparisonOperator'
  ComparisonOperator ->
  PutMetricAlarm
newPutMetricAlarm :: Text -> Natural -> ComparisonOperator -> PutMetricAlarm
newPutMetricAlarm
  Text
pAlarmName_
  Natural
pEvaluationPeriods_
  ComparisonOperator
pComparisonOperator_ =
    PutMetricAlarm' :: Maybe [MetricDataQuery]
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Natural
-> Maybe Double
-> Maybe Bool
-> Maybe [Text]
-> Maybe [Dimension]
-> Maybe [Text]
-> Maybe StandardUnit
-> Maybe Statistic
-> Maybe [Tag]
-> Maybe Text
-> Text
-> Natural
-> ComparisonOperator
-> PutMetricAlarm
PutMetricAlarm'
      { $sel:metrics:PutMetricAlarm' :: Maybe [MetricDataQuery]
metrics = Maybe [MetricDataQuery]
forall a. Maybe a
Prelude.Nothing,
        $sel:treatMissingData:PutMetricAlarm' :: Maybe Text
treatMissingData = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:period:PutMetricAlarm' :: Maybe Natural
period = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:alarmDescription:PutMetricAlarm' :: Maybe Text
alarmDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:metricName:PutMetricAlarm' :: Maybe Text
metricName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:namespace:PutMetricAlarm' :: Maybe Text
namespace = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:thresholdMetricId:PutMetricAlarm' :: Maybe Text
thresholdMetricId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:oKActions:PutMetricAlarm' :: Maybe [Text]
oKActions = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:evaluateLowSampleCountPercentile:PutMetricAlarm' :: Maybe Text
evaluateLowSampleCountPercentile = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:datapointsToAlarm:PutMetricAlarm' :: Maybe Natural
datapointsToAlarm = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:threshold:PutMetricAlarm' :: Maybe Double
threshold = Maybe Double
forall a. Maybe a
Prelude.Nothing,
        $sel:actionsEnabled:PutMetricAlarm' :: Maybe Bool
actionsEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:insufficientDataActions:PutMetricAlarm' :: Maybe [Text]
insufficientDataActions = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:dimensions:PutMetricAlarm' :: Maybe [Dimension]
dimensions = Maybe [Dimension]
forall a. Maybe a
Prelude.Nothing,
        $sel:alarmActions:PutMetricAlarm' :: Maybe [Text]
alarmActions = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:unit:PutMetricAlarm' :: Maybe StandardUnit
unit = Maybe StandardUnit
forall a. Maybe a
Prelude.Nothing,
        $sel:statistic:PutMetricAlarm' :: Maybe Statistic
statistic = Maybe Statistic
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:PutMetricAlarm' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:extendedStatistic:PutMetricAlarm' :: Maybe Text
extendedStatistic = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:alarmName:PutMetricAlarm' :: Text
alarmName = Text
pAlarmName_,
        $sel:evaluationPeriods:PutMetricAlarm' :: Natural
evaluationPeriods = Natural
pEvaluationPeriods_,
        $sel:comparisonOperator:PutMetricAlarm' :: ComparisonOperator
comparisonOperator = ComparisonOperator
pComparisonOperator_
      }

-- | An array of @MetricDataQuery@ structures that enable you to create an
-- alarm based on the result of a metric math expression. For each
-- @PutMetricAlarm@ operation, you must specify either @MetricName@ or a
-- @Metrics@ array.
--
-- Each item in the @Metrics@ array either retrieves a metric or performs a
-- math expression.
--
-- One item in the @Metrics@ array is the expression that the alarm
-- watches. You designate this expression by setting @ReturnData@ to true
-- for this object in the array. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDataQuery.html MetricDataQuery>.
--
-- If you use the @Metrics@ parameter, you cannot include the @MetricName@,
-- @Dimensions@, @Period@, @Namespace@, @Statistic@, or @ExtendedStatistic@
-- parameters of @PutMetricAlarm@ in the same operation. Instead, you
-- retrieve the metrics you are using in your math expression as part of
-- the @Metrics@ array.
putMetricAlarm_metrics :: Lens.Lens' PutMetricAlarm (Prelude.Maybe [MetricDataQuery])
putMetricAlarm_metrics :: (Maybe [MetricDataQuery] -> f (Maybe [MetricDataQuery]))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_metrics = (PutMetricAlarm -> Maybe [MetricDataQuery])
-> (PutMetricAlarm -> Maybe [MetricDataQuery] -> PutMetricAlarm)
-> Lens
     PutMetricAlarm
     PutMetricAlarm
     (Maybe [MetricDataQuery])
     (Maybe [MetricDataQuery])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe [MetricDataQuery]
metrics :: Maybe [MetricDataQuery]
$sel:metrics:PutMetricAlarm' :: PutMetricAlarm -> Maybe [MetricDataQuery]
metrics} -> Maybe [MetricDataQuery]
metrics) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe [MetricDataQuery]
a -> PutMetricAlarm
s {$sel:metrics:PutMetricAlarm' :: Maybe [MetricDataQuery]
metrics = Maybe [MetricDataQuery]
a} :: PutMetricAlarm) ((Maybe [MetricDataQuery] -> f (Maybe [MetricDataQuery]))
 -> PutMetricAlarm -> f PutMetricAlarm)
-> ((Maybe [MetricDataQuery] -> f (Maybe [MetricDataQuery]))
    -> Maybe [MetricDataQuery] -> f (Maybe [MetricDataQuery]))
-> (Maybe [MetricDataQuery] -> f (Maybe [MetricDataQuery]))
-> PutMetricAlarm
-> f PutMetricAlarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [MetricDataQuery]
  [MetricDataQuery]
  [MetricDataQuery]
  [MetricDataQuery]
-> Iso
     (Maybe [MetricDataQuery])
     (Maybe [MetricDataQuery])
     (Maybe [MetricDataQuery])
     (Maybe [MetricDataQuery])
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
  [MetricDataQuery]
  [MetricDataQuery]
  [MetricDataQuery]
  [MetricDataQuery]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Sets how this alarm is to handle missing data points. If
-- @TreatMissingData@ is omitted, the default behavior of @missing@ is
-- used. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-missing-data Configuring How CloudWatch Alarms Treats Missing Data>.
--
-- Valid Values: @breaching | notBreaching | ignore | missing@
putMetricAlarm_treatMissingData :: Lens.Lens' PutMetricAlarm (Prelude.Maybe Prelude.Text)
putMetricAlarm_treatMissingData :: (Maybe Text -> f (Maybe Text))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_treatMissingData = (PutMetricAlarm -> Maybe Text)
-> (PutMetricAlarm -> Maybe Text -> PutMetricAlarm)
-> Lens PutMetricAlarm PutMetricAlarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe Text
treatMissingData :: Maybe Text
$sel:treatMissingData:PutMetricAlarm' :: PutMetricAlarm -> Maybe Text
treatMissingData} -> Maybe Text
treatMissingData) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe Text
a -> PutMetricAlarm
s {$sel:treatMissingData:PutMetricAlarm' :: Maybe Text
treatMissingData = Maybe Text
a} :: PutMetricAlarm)

-- | The length, in seconds, used each time the metric specified in
-- @MetricName@ is evaluated. Valid values are 10, 30, and any multiple of
-- 60.
--
-- @Period@ is required for alarms based on static thresholds. If you are
-- creating an alarm based on a metric math expression, you specify the
-- period for each metric within the objects in the @Metrics@ array.
--
-- Be sure to specify 10 or 30 only for metrics that are stored by a
-- @PutMetricData@ call with a @StorageResolution@ of 1. If you specify a
-- period of 10 or 30 for a metric that does not have sub-minute
-- resolution, the alarm still attempts to gather data at the period rate
-- that you specify. In this case, it does not receive data for the
-- attempts that do not correspond to a one-minute data resolution, and the
-- alarm might often lapse into INSUFFICENT_DATA status. Specifying 10 or
-- 30 also sets this alarm as a high-resolution alarm, which has a higher
-- charge than other alarms. For more information about pricing, see
-- <https://aws.amazon.com/cloudwatch/pricing/ Amazon CloudWatch Pricing>.
--
-- An alarm\'s total current evaluation period can be no longer than one
-- day, so @Period@ multiplied by @EvaluationPeriods@ cannot be more than
-- 86,400 seconds.
putMetricAlarm_period :: Lens.Lens' PutMetricAlarm (Prelude.Maybe Prelude.Natural)
putMetricAlarm_period :: (Maybe Natural -> f (Maybe Natural))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_period = (PutMetricAlarm -> Maybe Natural)
-> (PutMetricAlarm -> Maybe Natural -> PutMetricAlarm)
-> Lens
     PutMetricAlarm PutMetricAlarm (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe Natural
period :: Maybe Natural
$sel:period:PutMetricAlarm' :: PutMetricAlarm -> Maybe Natural
period} -> Maybe Natural
period) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe Natural
a -> PutMetricAlarm
s {$sel:period:PutMetricAlarm' :: Maybe Natural
period = Maybe Natural
a} :: PutMetricAlarm)

-- | The description for the alarm.
putMetricAlarm_alarmDescription :: Lens.Lens' PutMetricAlarm (Prelude.Maybe Prelude.Text)
putMetricAlarm_alarmDescription :: (Maybe Text -> f (Maybe Text))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_alarmDescription = (PutMetricAlarm -> Maybe Text)
-> (PutMetricAlarm -> Maybe Text -> PutMetricAlarm)
-> Lens PutMetricAlarm PutMetricAlarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe Text
alarmDescription :: Maybe Text
$sel:alarmDescription:PutMetricAlarm' :: PutMetricAlarm -> Maybe Text
alarmDescription} -> Maybe Text
alarmDescription) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe Text
a -> PutMetricAlarm
s {$sel:alarmDescription:PutMetricAlarm' :: Maybe Text
alarmDescription = Maybe Text
a} :: PutMetricAlarm)

-- | The name for the metric associated with the alarm. For each
-- @PutMetricAlarm@ operation, you must specify either @MetricName@ or a
-- @Metrics@ array.
--
-- If you are creating an alarm based on a math expression, you cannot
-- specify this parameter, or any of the @Dimensions@, @Period@,
-- @Namespace@, @Statistic@, or @ExtendedStatistic@ parameters. Instead,
-- you specify all this information in the @Metrics@ array.
putMetricAlarm_metricName :: Lens.Lens' PutMetricAlarm (Prelude.Maybe Prelude.Text)
putMetricAlarm_metricName :: (Maybe Text -> f (Maybe Text))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_metricName = (PutMetricAlarm -> Maybe Text)
-> (PutMetricAlarm -> Maybe Text -> PutMetricAlarm)
-> Lens PutMetricAlarm PutMetricAlarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe Text
metricName :: Maybe Text
$sel:metricName:PutMetricAlarm' :: PutMetricAlarm -> Maybe Text
metricName} -> Maybe Text
metricName) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe Text
a -> PutMetricAlarm
s {$sel:metricName:PutMetricAlarm' :: Maybe Text
metricName = Maybe Text
a} :: PutMetricAlarm)

-- | The namespace for the metric associated specified in @MetricName@.
putMetricAlarm_namespace :: Lens.Lens' PutMetricAlarm (Prelude.Maybe Prelude.Text)
putMetricAlarm_namespace :: (Maybe Text -> f (Maybe Text))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_namespace = (PutMetricAlarm -> Maybe Text)
-> (PutMetricAlarm -> Maybe Text -> PutMetricAlarm)
-> Lens PutMetricAlarm PutMetricAlarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe Text
namespace :: Maybe Text
$sel:namespace:PutMetricAlarm' :: PutMetricAlarm -> Maybe Text
namespace} -> Maybe Text
namespace) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe Text
a -> PutMetricAlarm
s {$sel:namespace:PutMetricAlarm' :: Maybe Text
namespace = Maybe Text
a} :: PutMetricAlarm)

-- | If this is an alarm based on an anomaly detection model, make this value
-- match the ID of the @ANOMALY_DETECTION_BAND@ function.
--
-- For an example of how to use this parameter, see the __Anomaly Detection
-- Model Alarm__ example on this page.
--
-- If your alarm uses this parameter, it cannot have Auto Scaling actions.
putMetricAlarm_thresholdMetricId :: Lens.Lens' PutMetricAlarm (Prelude.Maybe Prelude.Text)
putMetricAlarm_thresholdMetricId :: (Maybe Text -> f (Maybe Text))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_thresholdMetricId = (PutMetricAlarm -> Maybe Text)
-> (PutMetricAlarm -> Maybe Text -> PutMetricAlarm)
-> Lens PutMetricAlarm PutMetricAlarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe Text
thresholdMetricId :: Maybe Text
$sel:thresholdMetricId:PutMetricAlarm' :: PutMetricAlarm -> Maybe Text
thresholdMetricId} -> Maybe Text
thresholdMetricId) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe Text
a -> PutMetricAlarm
s {$sel:thresholdMetricId:PutMetricAlarm' :: Maybe Text
thresholdMetricId = Maybe Text
a} :: PutMetricAlarm)

-- | The actions to execute when this alarm transitions to an @OK@ state from
-- any other state. Each action is specified as an Amazon Resource Name
-- (ARN).
--
-- Valid Values: @arn:aws:automate:region:ec2:stop@ |
-- @arn:aws:automate:region:ec2:terminate@ |
-- @arn:aws:automate:region:ec2:recover@ |
-- @arn:aws:automate:region:ec2:reboot@ |
-- @arn:aws:sns:region:account-id:sns-topic-name @ |
-- @arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id:autoScalingGroupName\/group-friendly-name:policyName\/policy-friendly-name @
--
-- Valid Values (for use with IAM roles):
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Stop\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Terminate\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Reboot\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Recover\/1.0@
putMetricAlarm_oKActions :: Lens.Lens' PutMetricAlarm (Prelude.Maybe [Prelude.Text])
putMetricAlarm_oKActions :: (Maybe [Text] -> f (Maybe [Text]))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_oKActions = (PutMetricAlarm -> Maybe [Text])
-> (PutMetricAlarm -> Maybe [Text] -> PutMetricAlarm)
-> Lens PutMetricAlarm PutMetricAlarm (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe [Text]
oKActions :: Maybe [Text]
$sel:oKActions:PutMetricAlarm' :: PutMetricAlarm -> Maybe [Text]
oKActions} -> Maybe [Text]
oKActions) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe [Text]
a -> PutMetricAlarm
s {$sel:oKActions:PutMetricAlarm' :: Maybe [Text]
oKActions = Maybe [Text]
a} :: PutMetricAlarm) ((Maybe [Text] -> f (Maybe [Text]))
 -> PutMetricAlarm -> f PutMetricAlarm)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> PutMetricAlarm
-> f PutMetricAlarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Used only for alarms based on percentiles. If you specify @ignore@, the
-- alarm state does not change during periods with too few data points to
-- be statistically significant. If you specify @evaluate@ or omit this
-- parameter, the alarm is always evaluated and possibly changes state no
-- matter how many data points are available. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#percentiles-with-low-samples Percentile-Based CloudWatch Alarms and Low Data Samples>.
--
-- Valid Values: @evaluate | ignore@
putMetricAlarm_evaluateLowSampleCountPercentile :: Lens.Lens' PutMetricAlarm (Prelude.Maybe Prelude.Text)
putMetricAlarm_evaluateLowSampleCountPercentile :: (Maybe Text -> f (Maybe Text))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_evaluateLowSampleCountPercentile = (PutMetricAlarm -> Maybe Text)
-> (PutMetricAlarm -> Maybe Text -> PutMetricAlarm)
-> Lens PutMetricAlarm PutMetricAlarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe Text
evaluateLowSampleCountPercentile :: Maybe Text
$sel:evaluateLowSampleCountPercentile:PutMetricAlarm' :: PutMetricAlarm -> Maybe Text
evaluateLowSampleCountPercentile} -> Maybe Text
evaluateLowSampleCountPercentile) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe Text
a -> PutMetricAlarm
s {$sel:evaluateLowSampleCountPercentile:PutMetricAlarm' :: Maybe Text
evaluateLowSampleCountPercentile = Maybe Text
a} :: PutMetricAlarm)

-- | The number of data points that must be breaching to trigger the alarm.
-- This is used only if you are setting an \"M out of N\" alarm. In that
-- case, this value is the M. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarm-evaluation Evaluating an Alarm>
-- in the /Amazon CloudWatch User Guide/.
putMetricAlarm_datapointsToAlarm :: Lens.Lens' PutMetricAlarm (Prelude.Maybe Prelude.Natural)
putMetricAlarm_datapointsToAlarm :: (Maybe Natural -> f (Maybe Natural))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_datapointsToAlarm = (PutMetricAlarm -> Maybe Natural)
-> (PutMetricAlarm -> Maybe Natural -> PutMetricAlarm)
-> Lens
     PutMetricAlarm PutMetricAlarm (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe Natural
datapointsToAlarm :: Maybe Natural
$sel:datapointsToAlarm:PutMetricAlarm' :: PutMetricAlarm -> Maybe Natural
datapointsToAlarm} -> Maybe Natural
datapointsToAlarm) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe Natural
a -> PutMetricAlarm
s {$sel:datapointsToAlarm:PutMetricAlarm' :: Maybe Natural
datapointsToAlarm = Maybe Natural
a} :: PutMetricAlarm)

-- | The value against which the specified statistic is compared.
--
-- This parameter is required for alarms based on static thresholds, but
-- should not be used for alarms based on anomaly detection models.
putMetricAlarm_threshold :: Lens.Lens' PutMetricAlarm (Prelude.Maybe Prelude.Double)
putMetricAlarm_threshold :: (Maybe Double -> f (Maybe Double))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_threshold = (PutMetricAlarm -> Maybe Double)
-> (PutMetricAlarm -> Maybe Double -> PutMetricAlarm)
-> Lens PutMetricAlarm PutMetricAlarm (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe Double
threshold :: Maybe Double
$sel:threshold:PutMetricAlarm' :: PutMetricAlarm -> Maybe Double
threshold} -> Maybe Double
threshold) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe Double
a -> PutMetricAlarm
s {$sel:threshold:PutMetricAlarm' :: Maybe Double
threshold = Maybe Double
a} :: PutMetricAlarm)

-- | Indicates whether actions should be executed during any changes to the
-- alarm state. The default is @TRUE@.
putMetricAlarm_actionsEnabled :: Lens.Lens' PutMetricAlarm (Prelude.Maybe Prelude.Bool)
putMetricAlarm_actionsEnabled :: (Maybe Bool -> f (Maybe Bool))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_actionsEnabled = (PutMetricAlarm -> Maybe Bool)
-> (PutMetricAlarm -> Maybe Bool -> PutMetricAlarm)
-> Lens PutMetricAlarm PutMetricAlarm (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe Bool
actionsEnabled :: Maybe Bool
$sel:actionsEnabled:PutMetricAlarm' :: PutMetricAlarm -> Maybe Bool
actionsEnabled} -> Maybe Bool
actionsEnabled) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe Bool
a -> PutMetricAlarm
s {$sel:actionsEnabled:PutMetricAlarm' :: Maybe Bool
actionsEnabled = Maybe Bool
a} :: PutMetricAlarm)

-- | The actions to execute when this alarm transitions to the
-- @INSUFFICIENT_DATA@ state from any other state. Each action is specified
-- as an Amazon Resource Name (ARN).
--
-- Valid Values: @arn:aws:automate:region:ec2:stop@ |
-- @arn:aws:automate:region:ec2:terminate@ |
-- @arn:aws:automate:region:ec2:recover@ |
-- @arn:aws:automate:region:ec2:reboot@ |
-- @arn:aws:sns:region:account-id:sns-topic-name @ |
-- @arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id:autoScalingGroupName\/group-friendly-name:policyName\/policy-friendly-name @
--
-- Valid Values (for use with IAM roles):
-- @>arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Stop\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Terminate\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Reboot\/1.0@
putMetricAlarm_insufficientDataActions :: Lens.Lens' PutMetricAlarm (Prelude.Maybe [Prelude.Text])
putMetricAlarm_insufficientDataActions :: (Maybe [Text] -> f (Maybe [Text]))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_insufficientDataActions = (PutMetricAlarm -> Maybe [Text])
-> (PutMetricAlarm -> Maybe [Text] -> PutMetricAlarm)
-> Lens PutMetricAlarm PutMetricAlarm (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe [Text]
insufficientDataActions :: Maybe [Text]
$sel:insufficientDataActions:PutMetricAlarm' :: PutMetricAlarm -> Maybe [Text]
insufficientDataActions} -> Maybe [Text]
insufficientDataActions) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe [Text]
a -> PutMetricAlarm
s {$sel:insufficientDataActions:PutMetricAlarm' :: Maybe [Text]
insufficientDataActions = Maybe [Text]
a} :: PutMetricAlarm) ((Maybe [Text] -> f (Maybe [Text]))
 -> PutMetricAlarm -> f PutMetricAlarm)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> PutMetricAlarm
-> f PutMetricAlarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The dimensions for the metric specified in @MetricName@.
putMetricAlarm_dimensions :: Lens.Lens' PutMetricAlarm (Prelude.Maybe [Dimension])
putMetricAlarm_dimensions :: (Maybe [Dimension] -> f (Maybe [Dimension]))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_dimensions = (PutMetricAlarm -> Maybe [Dimension])
-> (PutMetricAlarm -> Maybe [Dimension] -> PutMetricAlarm)
-> Lens
     PutMetricAlarm
     PutMetricAlarm
     (Maybe [Dimension])
     (Maybe [Dimension])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe [Dimension]
dimensions :: Maybe [Dimension]
$sel:dimensions:PutMetricAlarm' :: PutMetricAlarm -> Maybe [Dimension]
dimensions} -> Maybe [Dimension]
dimensions) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe [Dimension]
a -> PutMetricAlarm
s {$sel:dimensions:PutMetricAlarm' :: Maybe [Dimension]
dimensions = Maybe [Dimension]
a} :: PutMetricAlarm) ((Maybe [Dimension] -> f (Maybe [Dimension]))
 -> PutMetricAlarm -> f PutMetricAlarm)
-> ((Maybe [Dimension] -> f (Maybe [Dimension]))
    -> Maybe [Dimension] -> f (Maybe [Dimension]))
-> (Maybe [Dimension] -> f (Maybe [Dimension]))
-> PutMetricAlarm
-> f PutMetricAlarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Dimension] [Dimension] [Dimension] [Dimension]
-> Iso
     (Maybe [Dimension])
     (Maybe [Dimension])
     (Maybe [Dimension])
     (Maybe [Dimension])
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 [Dimension] [Dimension] [Dimension] [Dimension]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The actions to execute when this alarm transitions to the @ALARM@ state
-- from any other state. Each action is specified as an Amazon Resource
-- Name (ARN).
--
-- Valid Values: @arn:aws:automate:region:ec2:stop@ |
-- @arn:aws:automate:region:ec2:terminate@ |
-- @arn:aws:automate:region:ec2:recover@ |
-- @arn:aws:automate:region:ec2:reboot@ |
-- @arn:aws:sns:region:account-id:sns-topic-name @ |
-- @arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id:autoScalingGroupName\/group-friendly-name:policyName\/policy-friendly-name @
-- | @arn:aws:ssm:region:account-id:opsitem:severity @ |
-- @arn:aws:ssm-incidents::account-id:response-plan:response-plan-name @
--
-- Valid Values (for use with IAM roles):
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Stop\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Terminate\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Reboot\/1.0@
-- |
-- @arn:aws:swf:region:account-id:action\/actions\/AWS_EC2.InstanceId.Recover\/1.0@
putMetricAlarm_alarmActions :: Lens.Lens' PutMetricAlarm (Prelude.Maybe [Prelude.Text])
putMetricAlarm_alarmActions :: (Maybe [Text] -> f (Maybe [Text]))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_alarmActions = (PutMetricAlarm -> Maybe [Text])
-> (PutMetricAlarm -> Maybe [Text] -> PutMetricAlarm)
-> Lens PutMetricAlarm PutMetricAlarm (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe [Text]
alarmActions :: Maybe [Text]
$sel:alarmActions:PutMetricAlarm' :: PutMetricAlarm -> Maybe [Text]
alarmActions} -> Maybe [Text]
alarmActions) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe [Text]
a -> PutMetricAlarm
s {$sel:alarmActions:PutMetricAlarm' :: Maybe [Text]
alarmActions = Maybe [Text]
a} :: PutMetricAlarm) ((Maybe [Text] -> f (Maybe [Text]))
 -> PutMetricAlarm -> f PutMetricAlarm)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> PutMetricAlarm
-> f PutMetricAlarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The unit of measure for the statistic. For example, the units for the
-- Amazon EC2 NetworkIn metric are Bytes because NetworkIn tracks the
-- number of bytes that an instance receives on all network interfaces. You
-- can also specify a unit when you create a custom metric. Units help
-- provide conceptual meaning to your data. Metric data points that specify
-- a unit of measure, such as Percent, are aggregated separately.
--
-- If you don\'t specify @Unit@, CloudWatch retrieves all unit types that
-- have been published for the metric and attempts to evaluate the alarm.
-- Usually, metrics are published with only one unit, so the alarm works as
-- intended.
--
-- However, if the metric is published with multiple types of units and you
-- don\'t specify a unit, the alarm\'s behavior is not defined and it
-- behaves predictably.
--
-- We recommend omitting @Unit@ so that you don\'t inadvertently specify an
-- incorrect unit that is not published for this metric. Doing so causes
-- the alarm to be stuck in the @INSUFFICIENT DATA@ state.
putMetricAlarm_unit :: Lens.Lens' PutMetricAlarm (Prelude.Maybe StandardUnit)
putMetricAlarm_unit :: (Maybe StandardUnit -> f (Maybe StandardUnit))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_unit = (PutMetricAlarm -> Maybe StandardUnit)
-> (PutMetricAlarm -> Maybe StandardUnit -> PutMetricAlarm)
-> Lens
     PutMetricAlarm
     PutMetricAlarm
     (Maybe StandardUnit)
     (Maybe StandardUnit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe StandardUnit
unit :: Maybe StandardUnit
$sel:unit:PutMetricAlarm' :: PutMetricAlarm -> Maybe StandardUnit
unit} -> Maybe StandardUnit
unit) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe StandardUnit
a -> PutMetricAlarm
s {$sel:unit:PutMetricAlarm' :: Maybe StandardUnit
unit = Maybe StandardUnit
a} :: PutMetricAlarm)

-- | The statistic for the metric specified in @MetricName@, other than
-- percentile. For percentile statistics, use @ExtendedStatistic@. When you
-- call @PutMetricAlarm@ and specify a @MetricName@, you must specify
-- either @Statistic@ or @ExtendedStatistic,@ but not both.
putMetricAlarm_statistic :: Lens.Lens' PutMetricAlarm (Prelude.Maybe Statistic)
putMetricAlarm_statistic :: (Maybe Statistic -> f (Maybe Statistic))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_statistic = (PutMetricAlarm -> Maybe Statistic)
-> (PutMetricAlarm -> Maybe Statistic -> PutMetricAlarm)
-> Lens
     PutMetricAlarm PutMetricAlarm (Maybe Statistic) (Maybe Statistic)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe Statistic
statistic :: Maybe Statistic
$sel:statistic:PutMetricAlarm' :: PutMetricAlarm -> Maybe Statistic
statistic} -> Maybe Statistic
statistic) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe Statistic
a -> PutMetricAlarm
s {$sel:statistic:PutMetricAlarm' :: Maybe Statistic
statistic = Maybe Statistic
a} :: PutMetricAlarm)

-- | A list of key-value pairs to associate with the alarm. You can associate
-- as many as 50 tags with an alarm.
--
-- Tags can help you organize and categorize your resources. You can also
-- use them to scope user permissions by granting a user permission to
-- access or change only resources with certain tag values.
--
-- If you are using this operation to update an existing alarm, any tags
-- you specify in this parameter are ignored. To change the tags of an
-- existing alarm, use
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_TagResource.html TagResource>
-- or
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_UntagResource.html UntagResource>.
putMetricAlarm_tags :: Lens.Lens' PutMetricAlarm (Prelude.Maybe [Tag])
putMetricAlarm_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_tags = (PutMetricAlarm -> Maybe [Tag])
-> (PutMetricAlarm -> Maybe [Tag] -> PutMetricAlarm)
-> Lens PutMetricAlarm PutMetricAlarm (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:PutMetricAlarm' :: PutMetricAlarm -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe [Tag]
a -> PutMetricAlarm
s {$sel:tags:PutMetricAlarm' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: PutMetricAlarm) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> PutMetricAlarm -> f PutMetricAlarm)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> PutMetricAlarm
-> f PutMetricAlarm
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The percentile statistic for the metric specified in @MetricName@.
-- Specify a value between p0.0 and p100. When you call @PutMetricAlarm@
-- and specify a @MetricName@, you must specify either @Statistic@ or
-- @ExtendedStatistic,@ but not both.
putMetricAlarm_extendedStatistic :: Lens.Lens' PutMetricAlarm (Prelude.Maybe Prelude.Text)
putMetricAlarm_extendedStatistic :: (Maybe Text -> f (Maybe Text))
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_extendedStatistic = (PutMetricAlarm -> Maybe Text)
-> (PutMetricAlarm -> Maybe Text -> PutMetricAlarm)
-> Lens PutMetricAlarm PutMetricAlarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Maybe Text
extendedStatistic :: Maybe Text
$sel:extendedStatistic:PutMetricAlarm' :: PutMetricAlarm -> Maybe Text
extendedStatistic} -> Maybe Text
extendedStatistic) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Maybe Text
a -> PutMetricAlarm
s {$sel:extendedStatistic:PutMetricAlarm' :: Maybe Text
extendedStatistic = Maybe Text
a} :: PutMetricAlarm)

-- | The name for the alarm. This name must be unique within the Region.
putMetricAlarm_alarmName :: Lens.Lens' PutMetricAlarm Prelude.Text
putMetricAlarm_alarmName :: (Text -> f Text) -> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_alarmName = (PutMetricAlarm -> Text)
-> (PutMetricAlarm -> Text -> PutMetricAlarm)
-> Lens PutMetricAlarm PutMetricAlarm Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Text
alarmName :: Text
$sel:alarmName:PutMetricAlarm' :: PutMetricAlarm -> Text
alarmName} -> Text
alarmName) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Text
a -> PutMetricAlarm
s {$sel:alarmName:PutMetricAlarm' :: Text
alarmName = Text
a} :: PutMetricAlarm)

-- | The number of periods over which data is compared to the specified
-- threshold. If you are setting an alarm that requires that a number of
-- consecutive data points be breaching to trigger the alarm, this value
-- specifies that number. If you are setting an \"M out of N\" alarm, this
-- value is the N.
--
-- An alarm\'s total current evaluation period can be no longer than one
-- day, so this number multiplied by @Period@ cannot be more than 86,400
-- seconds.
putMetricAlarm_evaluationPeriods :: Lens.Lens' PutMetricAlarm Prelude.Natural
putMetricAlarm_evaluationPeriods :: (Natural -> f Natural) -> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_evaluationPeriods = (PutMetricAlarm -> Natural)
-> (PutMetricAlarm -> Natural -> PutMetricAlarm)
-> Lens PutMetricAlarm PutMetricAlarm Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {Natural
evaluationPeriods :: Natural
$sel:evaluationPeriods:PutMetricAlarm' :: PutMetricAlarm -> Natural
evaluationPeriods} -> Natural
evaluationPeriods) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} Natural
a -> PutMetricAlarm
s {$sel:evaluationPeriods:PutMetricAlarm' :: Natural
evaluationPeriods = Natural
a} :: PutMetricAlarm)

-- | The arithmetic operation to use when comparing the specified statistic
-- and threshold. The specified statistic value is used as the first
-- operand.
--
-- The values @LessThanLowerOrGreaterThanUpperThreshold@,
-- @LessThanLowerThreshold@, and @GreaterThanUpperThreshold@ are used only
-- for alarms based on anomaly detection models.
putMetricAlarm_comparisonOperator :: Lens.Lens' PutMetricAlarm ComparisonOperator
putMetricAlarm_comparisonOperator :: (ComparisonOperator -> f ComparisonOperator)
-> PutMetricAlarm -> f PutMetricAlarm
putMetricAlarm_comparisonOperator = (PutMetricAlarm -> ComparisonOperator)
-> (PutMetricAlarm -> ComparisonOperator -> PutMetricAlarm)
-> Lens
     PutMetricAlarm PutMetricAlarm ComparisonOperator ComparisonOperator
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMetricAlarm' {ComparisonOperator
comparisonOperator :: ComparisonOperator
$sel:comparisonOperator:PutMetricAlarm' :: PutMetricAlarm -> ComparisonOperator
comparisonOperator} -> ComparisonOperator
comparisonOperator) (\s :: PutMetricAlarm
s@PutMetricAlarm' {} ComparisonOperator
a -> PutMetricAlarm
s {$sel:comparisonOperator:PutMetricAlarm' :: ComparisonOperator
comparisonOperator = ComparisonOperator
a} :: PutMetricAlarm)

instance Core.AWSRequest PutMetricAlarm where
  type
    AWSResponse PutMetricAlarm =
      PutMetricAlarmResponse
  request :: PutMetricAlarm -> Request PutMetricAlarm
request = Service -> PutMetricAlarm -> Request PutMetricAlarm
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy PutMetricAlarm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutMetricAlarm)))
response =
    AWSResponse PutMetricAlarm
-> Logger
-> Service
-> Proxy PutMetricAlarm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutMetricAlarm)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse PutMetricAlarm
PutMetricAlarmResponse
PutMetricAlarmResponse'

instance Prelude.Hashable PutMetricAlarm

instance Prelude.NFData PutMetricAlarm

instance Core.ToHeaders PutMetricAlarm where
  toHeaders :: PutMetricAlarm -> [Header]
toHeaders = [Header] -> PutMetricAlarm -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery PutMetricAlarm where
  toQuery :: PutMetricAlarm -> QueryString
toQuery PutMetricAlarm' {Natural
Maybe Bool
Maybe Double
Maybe Natural
Maybe [Text]
Maybe [Dimension]
Maybe [MetricDataQuery]
Maybe [Tag]
Maybe Text
Maybe StandardUnit
Maybe Statistic
Text
ComparisonOperator
comparisonOperator :: ComparisonOperator
evaluationPeriods :: Natural
alarmName :: Text
extendedStatistic :: Maybe Text
tags :: Maybe [Tag]
statistic :: Maybe Statistic
unit :: Maybe StandardUnit
alarmActions :: Maybe [Text]
dimensions :: Maybe [Dimension]
insufficientDataActions :: Maybe [Text]
actionsEnabled :: Maybe Bool
threshold :: Maybe Double
datapointsToAlarm :: Maybe Natural
evaluateLowSampleCountPercentile :: Maybe Text
oKActions :: Maybe [Text]
thresholdMetricId :: Maybe Text
namespace :: Maybe Text
metricName :: Maybe Text
alarmDescription :: Maybe Text
period :: Maybe Natural
treatMissingData :: Maybe Text
metrics :: Maybe [MetricDataQuery]
$sel:comparisonOperator:PutMetricAlarm' :: PutMetricAlarm -> ComparisonOperator
$sel:evaluationPeriods:PutMetricAlarm' :: PutMetricAlarm -> Natural
$sel:alarmName:PutMetricAlarm' :: PutMetricAlarm -> Text
$sel:extendedStatistic:PutMetricAlarm' :: PutMetricAlarm -> Maybe Text
$sel:tags:PutMetricAlarm' :: PutMetricAlarm -> Maybe [Tag]
$sel:statistic:PutMetricAlarm' :: PutMetricAlarm -> Maybe Statistic
$sel:unit:PutMetricAlarm' :: PutMetricAlarm -> Maybe StandardUnit
$sel:alarmActions:PutMetricAlarm' :: PutMetricAlarm -> Maybe [Text]
$sel:dimensions:PutMetricAlarm' :: PutMetricAlarm -> Maybe [Dimension]
$sel:insufficientDataActions:PutMetricAlarm' :: PutMetricAlarm -> Maybe [Text]
$sel:actionsEnabled:PutMetricAlarm' :: PutMetricAlarm -> Maybe Bool
$sel:threshold:PutMetricAlarm' :: PutMetricAlarm -> Maybe Double
$sel:datapointsToAlarm:PutMetricAlarm' :: PutMetricAlarm -> Maybe Natural
$sel:evaluateLowSampleCountPercentile:PutMetricAlarm' :: PutMetricAlarm -> Maybe Text
$sel:oKActions:PutMetricAlarm' :: PutMetricAlarm -> Maybe [Text]
$sel:thresholdMetricId:PutMetricAlarm' :: PutMetricAlarm -> Maybe Text
$sel:namespace:PutMetricAlarm' :: PutMetricAlarm -> Maybe Text
$sel:metricName:PutMetricAlarm' :: PutMetricAlarm -> Maybe Text
$sel:alarmDescription:PutMetricAlarm' :: PutMetricAlarm -> Maybe Text
$sel:period:PutMetricAlarm' :: PutMetricAlarm -> Maybe Natural
$sel:treatMissingData:PutMetricAlarm' :: PutMetricAlarm -> Maybe Text
$sel:metrics:PutMetricAlarm' :: PutMetricAlarm -> Maybe [MetricDataQuery]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"PutMetricAlarm" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
        ByteString
"Metrics"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [MetricDataQuery] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([MetricDataQuery] -> QueryString)
-> Maybe [MetricDataQuery] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [MetricDataQuery]
metrics),
        ByteString
"TreatMissingData" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
treatMissingData,
        ByteString
"Period" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
period,
        ByteString
"AlarmDescription" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
alarmDescription,
        ByteString
"MetricName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
metricName,
        ByteString
"Namespace" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
namespace,
        ByteString
"ThresholdMetricId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
thresholdMetricId,
        ByteString
"OKActions"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
oKActions),
        ByteString
"EvaluateLowSampleCountPercentile"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
evaluateLowSampleCountPercentile,
        ByteString
"DatapointsToAlarm" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
datapointsToAlarm,
        ByteString
"Threshold" ByteString -> Maybe Double -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Double
threshold,
        ByteString
"ActionsEnabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
actionsEnabled,
        ByteString
"InsufficientDataActions"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
insufficientDataActions
            ),
        ByteString
"Dimensions"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Dimension] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Dimension] -> QueryString)
-> Maybe [Dimension] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Dimension]
dimensions),
        ByteString
"AlarmActions"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
alarmActions),
        ByteString
"Unit" ByteString -> Maybe StandardUnit -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe StandardUnit
unit,
        ByteString
"Statistic" ByteString -> Maybe Statistic -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Statistic
statistic,
        ByteString
"Tags"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Tag] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Tag] -> QueryString) -> Maybe [Tag] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags),
        ByteString
"ExtendedStatistic" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
extendedStatistic,
        ByteString
"AlarmName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
alarmName,
        ByteString
"EvaluationPeriods" ByteString -> Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Natural
evaluationPeriods,
        ByteString
"ComparisonOperator" ByteString -> ComparisonOperator -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ComparisonOperator
comparisonOperator
      ]

-- | /See:/ 'newPutMetricAlarmResponse' smart constructor.
data PutMetricAlarmResponse = PutMetricAlarmResponse'
  {
  }
  deriving (PutMetricAlarmResponse -> PutMetricAlarmResponse -> Bool
(PutMetricAlarmResponse -> PutMetricAlarmResponse -> Bool)
-> (PutMetricAlarmResponse -> PutMetricAlarmResponse -> Bool)
-> Eq PutMetricAlarmResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutMetricAlarmResponse -> PutMetricAlarmResponse -> Bool
$c/= :: PutMetricAlarmResponse -> PutMetricAlarmResponse -> Bool
== :: PutMetricAlarmResponse -> PutMetricAlarmResponse -> Bool
$c== :: PutMetricAlarmResponse -> PutMetricAlarmResponse -> Bool
Prelude.Eq, ReadPrec [PutMetricAlarmResponse]
ReadPrec PutMetricAlarmResponse
Int -> ReadS PutMetricAlarmResponse
ReadS [PutMetricAlarmResponse]
(Int -> ReadS PutMetricAlarmResponse)
-> ReadS [PutMetricAlarmResponse]
-> ReadPrec PutMetricAlarmResponse
-> ReadPrec [PutMetricAlarmResponse]
-> Read PutMetricAlarmResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutMetricAlarmResponse]
$creadListPrec :: ReadPrec [PutMetricAlarmResponse]
readPrec :: ReadPrec PutMetricAlarmResponse
$creadPrec :: ReadPrec PutMetricAlarmResponse
readList :: ReadS [PutMetricAlarmResponse]
$creadList :: ReadS [PutMetricAlarmResponse]
readsPrec :: Int -> ReadS PutMetricAlarmResponse
$creadsPrec :: Int -> ReadS PutMetricAlarmResponse
Prelude.Read, Int -> PutMetricAlarmResponse -> ShowS
[PutMetricAlarmResponse] -> ShowS
PutMetricAlarmResponse -> String
(Int -> PutMetricAlarmResponse -> ShowS)
-> (PutMetricAlarmResponse -> String)
-> ([PutMetricAlarmResponse] -> ShowS)
-> Show PutMetricAlarmResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutMetricAlarmResponse] -> ShowS
$cshowList :: [PutMetricAlarmResponse] -> ShowS
show :: PutMetricAlarmResponse -> String
$cshow :: PutMetricAlarmResponse -> String
showsPrec :: Int -> PutMetricAlarmResponse -> ShowS
$cshowsPrec :: Int -> PutMetricAlarmResponse -> ShowS
Prelude.Show, (forall x. PutMetricAlarmResponse -> Rep PutMetricAlarmResponse x)
-> (forall x.
    Rep PutMetricAlarmResponse x -> PutMetricAlarmResponse)
-> Generic PutMetricAlarmResponse
forall x. Rep PutMetricAlarmResponse x -> PutMetricAlarmResponse
forall x. PutMetricAlarmResponse -> Rep PutMetricAlarmResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutMetricAlarmResponse x -> PutMetricAlarmResponse
$cfrom :: forall x. PutMetricAlarmResponse -> Rep PutMetricAlarmResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutMetricAlarmResponse' 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.
newPutMetricAlarmResponse ::
  PutMetricAlarmResponse
newPutMetricAlarmResponse :: PutMetricAlarmResponse
newPutMetricAlarmResponse = PutMetricAlarmResponse
PutMetricAlarmResponse'

instance Prelude.NFData PutMetricAlarmResponse