{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.AutoScaling.Types.ScalingPolicy
-- 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)
module Amazonka.AutoScaling.Types.ScalingPolicy where

import Amazonka.AutoScaling.Types.Alarm
import Amazonka.AutoScaling.Types.PredictiveScalingConfiguration
import Amazonka.AutoScaling.Types.StepAdjustment
import Amazonka.AutoScaling.Types.TargetTrackingConfiguration
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes a scaling policy.
--
-- /See:/ 'newScalingPolicy' smart constructor.
data ScalingPolicy = ScalingPolicy'
  { -- | Available for backward compatibility. Use @MinAdjustmentMagnitude@
    -- instead.
    ScalingPolicy -> Maybe Int
minAdjustmentStep :: Prelude.Maybe Prelude.Int,
    -- | The estimated time, in seconds, until a newly launched instance can
    -- contribute to the CloudWatch metrics.
    ScalingPolicy -> Maybe Int
estimatedInstanceWarmup :: Prelude.Maybe Prelude.Int,
    -- | The name of the scaling policy.
    ScalingPolicy -> Maybe Text
policyName :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether the policy is enabled (@true@) or disabled (@false@).
    ScalingPolicy -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | One of the following policy types:
    --
    -- -   @TargetTrackingScaling@
    --
    -- -   @StepScaling@
    --
    -- -   @SimpleScaling@ (default)
    --
    -- -   @PredictiveScaling@
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-target-tracking.html Target tracking scaling policies>
    -- and
    -- <https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html Step and simple scaling policies>
    -- in the /Amazon EC2 Auto Scaling User Guide/.
    ScalingPolicy -> Maybe Text
policyType :: Prelude.Maybe Prelude.Text,
    -- | A set of adjustments that enable you to scale based on the size of the
    -- alarm breach.
    ScalingPolicy -> Maybe [StepAdjustment]
stepAdjustments :: Prelude.Maybe [StepAdjustment],
    -- | A target tracking scaling policy.
    ScalingPolicy -> Maybe TargetTrackingConfiguration
targetTrackingConfiguration :: Prelude.Maybe TargetTrackingConfiguration,
    -- | Specifies how the scaling adjustment is interpreted (for example, an
    -- absolute number or a percentage). The valid values are
    -- @ChangeInCapacity@, @ExactCapacity@, and @PercentChangeInCapacity@.
    ScalingPolicy -> Maybe Text
adjustmentType :: Prelude.Maybe Prelude.Text,
    -- | The name of the Auto Scaling group.
    ScalingPolicy -> Maybe Text
autoScalingGroupName :: Prelude.Maybe Prelude.Text,
    -- | A predictive scaling policy.
    ScalingPolicy -> Maybe PredictiveScalingConfiguration
predictiveScalingConfiguration :: Prelude.Maybe PredictiveScalingConfiguration,
    -- | The amount by which to scale, based on the specified adjustment type. A
    -- positive value adds to the current capacity while a negative number
    -- removes from the current capacity.
    ScalingPolicy -> Maybe Int
scalingAdjustment :: Prelude.Maybe Prelude.Int,
    -- | The duration of the policy\'s cooldown period, in seconds.
    ScalingPolicy -> Maybe Int
cooldown :: Prelude.Maybe Prelude.Int,
    -- | The Amazon Resource Name (ARN) of the policy.
    ScalingPolicy -> Maybe Text
policyARN :: Prelude.Maybe Prelude.Text,
    -- | The CloudWatch alarms related to the policy.
    ScalingPolicy -> Maybe [Alarm]
alarms :: Prelude.Maybe [Alarm],
    -- | The aggregation type for the CloudWatch metrics. The valid values are
    -- @Minimum@, @Maximum@, and @Average@.
    ScalingPolicy -> Maybe Text
metricAggregationType :: Prelude.Maybe Prelude.Text,
    -- | The minimum value to scale by when the adjustment type is
    -- @PercentChangeInCapacity@.
    ScalingPolicy -> Maybe Int
minAdjustmentMagnitude :: Prelude.Maybe Prelude.Int
  }
  deriving (ScalingPolicy -> ScalingPolicy -> Bool
(ScalingPolicy -> ScalingPolicy -> Bool)
-> (ScalingPolicy -> ScalingPolicy -> Bool) -> Eq ScalingPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScalingPolicy -> ScalingPolicy -> Bool
$c/= :: ScalingPolicy -> ScalingPolicy -> Bool
== :: ScalingPolicy -> ScalingPolicy -> Bool
$c== :: ScalingPolicy -> ScalingPolicy -> Bool
Prelude.Eq, ReadPrec [ScalingPolicy]
ReadPrec ScalingPolicy
Int -> ReadS ScalingPolicy
ReadS [ScalingPolicy]
(Int -> ReadS ScalingPolicy)
-> ReadS [ScalingPolicy]
-> ReadPrec ScalingPolicy
-> ReadPrec [ScalingPolicy]
-> Read ScalingPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScalingPolicy]
$creadListPrec :: ReadPrec [ScalingPolicy]
readPrec :: ReadPrec ScalingPolicy
$creadPrec :: ReadPrec ScalingPolicy
readList :: ReadS [ScalingPolicy]
$creadList :: ReadS [ScalingPolicy]
readsPrec :: Int -> ReadS ScalingPolicy
$creadsPrec :: Int -> ReadS ScalingPolicy
Prelude.Read, Int -> ScalingPolicy -> ShowS
[ScalingPolicy] -> ShowS
ScalingPolicy -> String
(Int -> ScalingPolicy -> ShowS)
-> (ScalingPolicy -> String)
-> ([ScalingPolicy] -> ShowS)
-> Show ScalingPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScalingPolicy] -> ShowS
$cshowList :: [ScalingPolicy] -> ShowS
show :: ScalingPolicy -> String
$cshow :: ScalingPolicy -> String
showsPrec :: Int -> ScalingPolicy -> ShowS
$cshowsPrec :: Int -> ScalingPolicy -> ShowS
Prelude.Show, (forall x. ScalingPolicy -> Rep ScalingPolicy x)
-> (forall x. Rep ScalingPolicy x -> ScalingPolicy)
-> Generic ScalingPolicy
forall x. Rep ScalingPolicy x -> ScalingPolicy
forall x. ScalingPolicy -> Rep ScalingPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScalingPolicy x -> ScalingPolicy
$cfrom :: forall x. ScalingPolicy -> Rep ScalingPolicy x
Prelude.Generic)

-- |
-- Create a value of 'ScalingPolicy' 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:
--
-- 'minAdjustmentStep', 'scalingPolicy_minAdjustmentStep' - Available for backward compatibility. Use @MinAdjustmentMagnitude@
-- instead.
--
-- 'estimatedInstanceWarmup', 'scalingPolicy_estimatedInstanceWarmup' - The estimated time, in seconds, until a newly launched instance can
-- contribute to the CloudWatch metrics.
--
-- 'policyName', 'scalingPolicy_policyName' - The name of the scaling policy.
--
-- 'enabled', 'scalingPolicy_enabled' - Indicates whether the policy is enabled (@true@) or disabled (@false@).
--
-- 'policyType', 'scalingPolicy_policyType' - One of the following policy types:
--
-- -   @TargetTrackingScaling@
--
-- -   @StepScaling@
--
-- -   @SimpleScaling@ (default)
--
-- -   @PredictiveScaling@
--
-- For more information, see
-- <https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-target-tracking.html Target tracking scaling policies>
-- and
-- <https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html Step and simple scaling policies>
-- in the /Amazon EC2 Auto Scaling User Guide/.
--
-- 'stepAdjustments', 'scalingPolicy_stepAdjustments' - A set of adjustments that enable you to scale based on the size of the
-- alarm breach.
--
-- 'targetTrackingConfiguration', 'scalingPolicy_targetTrackingConfiguration' - A target tracking scaling policy.
--
-- 'adjustmentType', 'scalingPolicy_adjustmentType' - Specifies how the scaling adjustment is interpreted (for example, an
-- absolute number or a percentage). The valid values are
-- @ChangeInCapacity@, @ExactCapacity@, and @PercentChangeInCapacity@.
--
-- 'autoScalingGroupName', 'scalingPolicy_autoScalingGroupName' - The name of the Auto Scaling group.
--
-- 'predictiveScalingConfiguration', 'scalingPolicy_predictiveScalingConfiguration' - A predictive scaling policy.
--
-- 'scalingAdjustment', 'scalingPolicy_scalingAdjustment' - The amount by which to scale, based on the specified adjustment type. A
-- positive value adds to the current capacity while a negative number
-- removes from the current capacity.
--
-- 'cooldown', 'scalingPolicy_cooldown' - The duration of the policy\'s cooldown period, in seconds.
--
-- 'policyARN', 'scalingPolicy_policyARN' - The Amazon Resource Name (ARN) of the policy.
--
-- 'alarms', 'scalingPolicy_alarms' - The CloudWatch alarms related to the policy.
--
-- 'metricAggregationType', 'scalingPolicy_metricAggregationType' - The aggregation type for the CloudWatch metrics. The valid values are
-- @Minimum@, @Maximum@, and @Average@.
--
-- 'minAdjustmentMagnitude', 'scalingPolicy_minAdjustmentMagnitude' - The minimum value to scale by when the adjustment type is
-- @PercentChangeInCapacity@.
newScalingPolicy ::
  ScalingPolicy
newScalingPolicy :: ScalingPolicy
newScalingPolicy =
  ScalingPolicy' :: Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe [StepAdjustment]
-> Maybe TargetTrackingConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe PredictiveScalingConfiguration
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe [Alarm]
-> Maybe Text
-> Maybe Int
-> ScalingPolicy
ScalingPolicy'
    { $sel:minAdjustmentStep:ScalingPolicy' :: Maybe Int
minAdjustmentStep = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:estimatedInstanceWarmup:ScalingPolicy' :: Maybe Int
estimatedInstanceWarmup = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:policyName:ScalingPolicy' :: Maybe Text
policyName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:ScalingPolicy' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:policyType:ScalingPolicy' :: Maybe Text
policyType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:stepAdjustments:ScalingPolicy' :: Maybe [StepAdjustment]
stepAdjustments = Maybe [StepAdjustment]
forall a. Maybe a
Prelude.Nothing,
      $sel:targetTrackingConfiguration:ScalingPolicy' :: Maybe TargetTrackingConfiguration
targetTrackingConfiguration = Maybe TargetTrackingConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:adjustmentType:ScalingPolicy' :: Maybe Text
adjustmentType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:autoScalingGroupName:ScalingPolicy' :: Maybe Text
autoScalingGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:predictiveScalingConfiguration:ScalingPolicy' :: Maybe PredictiveScalingConfiguration
predictiveScalingConfiguration = Maybe PredictiveScalingConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:scalingAdjustment:ScalingPolicy' :: Maybe Int
scalingAdjustment = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:cooldown:ScalingPolicy' :: Maybe Int
cooldown = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:policyARN:ScalingPolicy' :: Maybe Text
policyARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:alarms:ScalingPolicy' :: Maybe [Alarm]
alarms = Maybe [Alarm]
forall a. Maybe a
Prelude.Nothing,
      $sel:metricAggregationType:ScalingPolicy' :: Maybe Text
metricAggregationType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:minAdjustmentMagnitude:ScalingPolicy' :: Maybe Int
minAdjustmentMagnitude = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | Available for backward compatibility. Use @MinAdjustmentMagnitude@
-- instead.
scalingPolicy_minAdjustmentStep :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Int)
scalingPolicy_minAdjustmentStep :: (Maybe Int -> f (Maybe Int)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_minAdjustmentStep = (ScalingPolicy -> Maybe Int)
-> (ScalingPolicy -> Maybe Int -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Int
minAdjustmentStep :: Maybe Int
$sel:minAdjustmentStep:ScalingPolicy' :: ScalingPolicy -> Maybe Int
minAdjustmentStep} -> Maybe Int
minAdjustmentStep) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Int
a -> ScalingPolicy
s {$sel:minAdjustmentStep:ScalingPolicy' :: Maybe Int
minAdjustmentStep = Maybe Int
a} :: ScalingPolicy)

-- | The estimated time, in seconds, until a newly launched instance can
-- contribute to the CloudWatch metrics.
scalingPolicy_estimatedInstanceWarmup :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Int)
scalingPolicy_estimatedInstanceWarmup :: (Maybe Int -> f (Maybe Int)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_estimatedInstanceWarmup = (ScalingPolicy -> Maybe Int)
-> (ScalingPolicy -> Maybe Int -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Int
estimatedInstanceWarmup :: Maybe Int
$sel:estimatedInstanceWarmup:ScalingPolicy' :: ScalingPolicy -> Maybe Int
estimatedInstanceWarmup} -> Maybe Int
estimatedInstanceWarmup) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Int
a -> ScalingPolicy
s {$sel:estimatedInstanceWarmup:ScalingPolicy' :: Maybe Int
estimatedInstanceWarmup = Maybe Int
a} :: ScalingPolicy)

-- | The name of the scaling policy.
scalingPolicy_policyName :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Text)
scalingPolicy_policyName :: (Maybe Text -> f (Maybe Text)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_policyName = (ScalingPolicy -> Maybe Text)
-> (ScalingPolicy -> Maybe Text -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Text
policyName :: Maybe Text
$sel:policyName:ScalingPolicy' :: ScalingPolicy -> Maybe Text
policyName} -> Maybe Text
policyName) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Text
a -> ScalingPolicy
s {$sel:policyName:ScalingPolicy' :: Maybe Text
policyName = Maybe Text
a} :: ScalingPolicy)

-- | Indicates whether the policy is enabled (@true@) or disabled (@false@).
scalingPolicy_enabled :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Bool)
scalingPolicy_enabled :: (Maybe Bool -> f (Maybe Bool)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_enabled = (ScalingPolicy -> Maybe Bool)
-> (ScalingPolicy -> Maybe Bool -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:ScalingPolicy' :: ScalingPolicy -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Bool
a -> ScalingPolicy
s {$sel:enabled:ScalingPolicy' :: Maybe Bool
enabled = Maybe Bool
a} :: ScalingPolicy)

-- | One of the following policy types:
--
-- -   @TargetTrackingScaling@
--
-- -   @StepScaling@
--
-- -   @SimpleScaling@ (default)
--
-- -   @PredictiveScaling@
--
-- For more information, see
-- <https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-target-tracking.html Target tracking scaling policies>
-- and
-- <https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html Step and simple scaling policies>
-- in the /Amazon EC2 Auto Scaling User Guide/.
scalingPolicy_policyType :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Text)
scalingPolicy_policyType :: (Maybe Text -> f (Maybe Text)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_policyType = (ScalingPolicy -> Maybe Text)
-> (ScalingPolicy -> Maybe Text -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Text
policyType :: Maybe Text
$sel:policyType:ScalingPolicy' :: ScalingPolicy -> Maybe Text
policyType} -> Maybe Text
policyType) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Text
a -> ScalingPolicy
s {$sel:policyType:ScalingPolicy' :: Maybe Text
policyType = Maybe Text
a} :: ScalingPolicy)

-- | A set of adjustments that enable you to scale based on the size of the
-- alarm breach.
scalingPolicy_stepAdjustments :: Lens.Lens' ScalingPolicy (Prelude.Maybe [StepAdjustment])
scalingPolicy_stepAdjustments :: (Maybe [StepAdjustment] -> f (Maybe [StepAdjustment]))
-> ScalingPolicy -> f ScalingPolicy
scalingPolicy_stepAdjustments = (ScalingPolicy -> Maybe [StepAdjustment])
-> (ScalingPolicy -> Maybe [StepAdjustment] -> ScalingPolicy)
-> Lens
     ScalingPolicy
     ScalingPolicy
     (Maybe [StepAdjustment])
     (Maybe [StepAdjustment])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe [StepAdjustment]
stepAdjustments :: Maybe [StepAdjustment]
$sel:stepAdjustments:ScalingPolicy' :: ScalingPolicy -> Maybe [StepAdjustment]
stepAdjustments} -> Maybe [StepAdjustment]
stepAdjustments) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe [StepAdjustment]
a -> ScalingPolicy
s {$sel:stepAdjustments:ScalingPolicy' :: Maybe [StepAdjustment]
stepAdjustments = Maybe [StepAdjustment]
a} :: ScalingPolicy) ((Maybe [StepAdjustment] -> f (Maybe [StepAdjustment]))
 -> ScalingPolicy -> f ScalingPolicy)
-> ((Maybe [StepAdjustment] -> f (Maybe [StepAdjustment]))
    -> Maybe [StepAdjustment] -> f (Maybe [StepAdjustment]))
-> (Maybe [StepAdjustment] -> f (Maybe [StepAdjustment]))
-> ScalingPolicy
-> f ScalingPolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [StepAdjustment] [StepAdjustment] [StepAdjustment] [StepAdjustment]
-> Iso
     (Maybe [StepAdjustment])
     (Maybe [StepAdjustment])
     (Maybe [StepAdjustment])
     (Maybe [StepAdjustment])
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
  [StepAdjustment] [StepAdjustment] [StepAdjustment] [StepAdjustment]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A target tracking scaling policy.
scalingPolicy_targetTrackingConfiguration :: Lens.Lens' ScalingPolicy (Prelude.Maybe TargetTrackingConfiguration)
scalingPolicy_targetTrackingConfiguration :: (Maybe TargetTrackingConfiguration
 -> f (Maybe TargetTrackingConfiguration))
-> ScalingPolicy -> f ScalingPolicy
scalingPolicy_targetTrackingConfiguration = (ScalingPolicy -> Maybe TargetTrackingConfiguration)
-> (ScalingPolicy
    -> Maybe TargetTrackingConfiguration -> ScalingPolicy)
-> Lens
     ScalingPolicy
     ScalingPolicy
     (Maybe TargetTrackingConfiguration)
     (Maybe TargetTrackingConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe TargetTrackingConfiguration
targetTrackingConfiguration :: Maybe TargetTrackingConfiguration
$sel:targetTrackingConfiguration:ScalingPolicy' :: ScalingPolicy -> Maybe TargetTrackingConfiguration
targetTrackingConfiguration} -> Maybe TargetTrackingConfiguration
targetTrackingConfiguration) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe TargetTrackingConfiguration
a -> ScalingPolicy
s {$sel:targetTrackingConfiguration:ScalingPolicy' :: Maybe TargetTrackingConfiguration
targetTrackingConfiguration = Maybe TargetTrackingConfiguration
a} :: ScalingPolicy)

-- | Specifies how the scaling adjustment is interpreted (for example, an
-- absolute number or a percentage). The valid values are
-- @ChangeInCapacity@, @ExactCapacity@, and @PercentChangeInCapacity@.
scalingPolicy_adjustmentType :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Text)
scalingPolicy_adjustmentType :: (Maybe Text -> f (Maybe Text)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_adjustmentType = (ScalingPolicy -> Maybe Text)
-> (ScalingPolicy -> Maybe Text -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Text
adjustmentType :: Maybe Text
$sel:adjustmentType:ScalingPolicy' :: ScalingPolicy -> Maybe Text
adjustmentType} -> Maybe Text
adjustmentType) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Text
a -> ScalingPolicy
s {$sel:adjustmentType:ScalingPolicy' :: Maybe Text
adjustmentType = Maybe Text
a} :: ScalingPolicy)

-- | The name of the Auto Scaling group.
scalingPolicy_autoScalingGroupName :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Text)
scalingPolicy_autoScalingGroupName :: (Maybe Text -> f (Maybe Text)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_autoScalingGroupName = (ScalingPolicy -> Maybe Text)
-> (ScalingPolicy -> Maybe Text -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Text
autoScalingGroupName :: Maybe Text
$sel:autoScalingGroupName:ScalingPolicy' :: ScalingPolicy -> Maybe Text
autoScalingGroupName} -> Maybe Text
autoScalingGroupName) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Text
a -> ScalingPolicy
s {$sel:autoScalingGroupName:ScalingPolicy' :: Maybe Text
autoScalingGroupName = Maybe Text
a} :: ScalingPolicy)

-- | A predictive scaling policy.
scalingPolicy_predictiveScalingConfiguration :: Lens.Lens' ScalingPolicy (Prelude.Maybe PredictiveScalingConfiguration)
scalingPolicy_predictiveScalingConfiguration :: (Maybe PredictiveScalingConfiguration
 -> f (Maybe PredictiveScalingConfiguration))
-> ScalingPolicy -> f ScalingPolicy
scalingPolicy_predictiveScalingConfiguration = (ScalingPolicy -> Maybe PredictiveScalingConfiguration)
-> (ScalingPolicy
    -> Maybe PredictiveScalingConfiguration -> ScalingPolicy)
-> Lens
     ScalingPolicy
     ScalingPolicy
     (Maybe PredictiveScalingConfiguration)
     (Maybe PredictiveScalingConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe PredictiveScalingConfiguration
predictiveScalingConfiguration :: Maybe PredictiveScalingConfiguration
$sel:predictiveScalingConfiguration:ScalingPolicy' :: ScalingPolicy -> Maybe PredictiveScalingConfiguration
predictiveScalingConfiguration} -> Maybe PredictiveScalingConfiguration
predictiveScalingConfiguration) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe PredictiveScalingConfiguration
a -> ScalingPolicy
s {$sel:predictiveScalingConfiguration:ScalingPolicy' :: Maybe PredictiveScalingConfiguration
predictiveScalingConfiguration = Maybe PredictiveScalingConfiguration
a} :: ScalingPolicy)

-- | The amount by which to scale, based on the specified adjustment type. A
-- positive value adds to the current capacity while a negative number
-- removes from the current capacity.
scalingPolicy_scalingAdjustment :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Int)
scalingPolicy_scalingAdjustment :: (Maybe Int -> f (Maybe Int)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_scalingAdjustment = (ScalingPolicy -> Maybe Int)
-> (ScalingPolicy -> Maybe Int -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Int
scalingAdjustment :: Maybe Int
$sel:scalingAdjustment:ScalingPolicy' :: ScalingPolicy -> Maybe Int
scalingAdjustment} -> Maybe Int
scalingAdjustment) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Int
a -> ScalingPolicy
s {$sel:scalingAdjustment:ScalingPolicy' :: Maybe Int
scalingAdjustment = Maybe Int
a} :: ScalingPolicy)

-- | The duration of the policy\'s cooldown period, in seconds.
scalingPolicy_cooldown :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Int)
scalingPolicy_cooldown :: (Maybe Int -> f (Maybe Int)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_cooldown = (ScalingPolicy -> Maybe Int)
-> (ScalingPolicy -> Maybe Int -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Int
cooldown :: Maybe Int
$sel:cooldown:ScalingPolicy' :: ScalingPolicy -> Maybe Int
cooldown} -> Maybe Int
cooldown) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Int
a -> ScalingPolicy
s {$sel:cooldown:ScalingPolicy' :: Maybe Int
cooldown = Maybe Int
a} :: ScalingPolicy)

-- | The Amazon Resource Name (ARN) of the policy.
scalingPolicy_policyARN :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Text)
scalingPolicy_policyARN :: (Maybe Text -> f (Maybe Text)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_policyARN = (ScalingPolicy -> Maybe Text)
-> (ScalingPolicy -> Maybe Text -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Text
policyARN :: Maybe Text
$sel:policyARN:ScalingPolicy' :: ScalingPolicy -> Maybe Text
policyARN} -> Maybe Text
policyARN) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Text
a -> ScalingPolicy
s {$sel:policyARN:ScalingPolicy' :: Maybe Text
policyARN = Maybe Text
a} :: ScalingPolicy)

-- | The CloudWatch alarms related to the policy.
scalingPolicy_alarms :: Lens.Lens' ScalingPolicy (Prelude.Maybe [Alarm])
scalingPolicy_alarms :: (Maybe [Alarm] -> f (Maybe [Alarm]))
-> ScalingPolicy -> f ScalingPolicy
scalingPolicy_alarms = (ScalingPolicy -> Maybe [Alarm])
-> (ScalingPolicy -> Maybe [Alarm] -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe [Alarm]) (Maybe [Alarm])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe [Alarm]
alarms :: Maybe [Alarm]
$sel:alarms:ScalingPolicy' :: ScalingPolicy -> Maybe [Alarm]
alarms} -> Maybe [Alarm]
alarms) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe [Alarm]
a -> ScalingPolicy
s {$sel:alarms:ScalingPolicy' :: Maybe [Alarm]
alarms = Maybe [Alarm]
a} :: ScalingPolicy) ((Maybe [Alarm] -> f (Maybe [Alarm]))
 -> ScalingPolicy -> f ScalingPolicy)
-> ((Maybe [Alarm] -> f (Maybe [Alarm]))
    -> Maybe [Alarm] -> f (Maybe [Alarm]))
-> (Maybe [Alarm] -> f (Maybe [Alarm]))
-> ScalingPolicy
-> f ScalingPolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Alarm] [Alarm] [Alarm] [Alarm]
-> Iso
     (Maybe [Alarm]) (Maybe [Alarm]) (Maybe [Alarm]) (Maybe [Alarm])
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 [Alarm] [Alarm] [Alarm] [Alarm]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The aggregation type for the CloudWatch metrics. The valid values are
-- @Minimum@, @Maximum@, and @Average@.
scalingPolicy_metricAggregationType :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Text)
scalingPolicy_metricAggregationType :: (Maybe Text -> f (Maybe Text)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_metricAggregationType = (ScalingPolicy -> Maybe Text)
-> (ScalingPolicy -> Maybe Text -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Text
metricAggregationType :: Maybe Text
$sel:metricAggregationType:ScalingPolicy' :: ScalingPolicy -> Maybe Text
metricAggregationType} -> Maybe Text
metricAggregationType) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Text
a -> ScalingPolicy
s {$sel:metricAggregationType:ScalingPolicy' :: Maybe Text
metricAggregationType = Maybe Text
a} :: ScalingPolicy)

-- | The minimum value to scale by when the adjustment type is
-- @PercentChangeInCapacity@.
scalingPolicy_minAdjustmentMagnitude :: Lens.Lens' ScalingPolicy (Prelude.Maybe Prelude.Int)
scalingPolicy_minAdjustmentMagnitude :: (Maybe Int -> f (Maybe Int)) -> ScalingPolicy -> f ScalingPolicy
scalingPolicy_minAdjustmentMagnitude = (ScalingPolicy -> Maybe Int)
-> (ScalingPolicy -> Maybe Int -> ScalingPolicy)
-> Lens ScalingPolicy ScalingPolicy (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingPolicy' {Maybe Int
minAdjustmentMagnitude :: Maybe Int
$sel:minAdjustmentMagnitude:ScalingPolicy' :: ScalingPolicy -> Maybe Int
minAdjustmentMagnitude} -> Maybe Int
minAdjustmentMagnitude) (\s :: ScalingPolicy
s@ScalingPolicy' {} Maybe Int
a -> ScalingPolicy
s {$sel:minAdjustmentMagnitude:ScalingPolicy' :: Maybe Int
minAdjustmentMagnitude = Maybe Int
a} :: ScalingPolicy)

instance Core.FromXML ScalingPolicy where
  parseXML :: [Node] -> Either String ScalingPolicy
parseXML [Node]
x =
    Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe [StepAdjustment]
-> Maybe TargetTrackingConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe PredictiveScalingConfiguration
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe [Alarm]
-> Maybe Text
-> Maybe Int
-> ScalingPolicy
ScalingPolicy'
      (Maybe Int
 -> Maybe Int
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe [StepAdjustment]
 -> Maybe TargetTrackingConfiguration
 -> Maybe Text
 -> Maybe Text
 -> Maybe PredictiveScalingConfiguration
 -> Maybe Int
 -> Maybe Int
 -> Maybe Text
 -> Maybe [Alarm]
 -> Maybe Text
 -> Maybe Int
 -> ScalingPolicy)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe [StepAdjustment]
      -> Maybe TargetTrackingConfiguration
      -> Maybe Text
      -> Maybe Text
      -> Maybe PredictiveScalingConfiguration
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Alarm]
      -> Maybe Text
      -> Maybe Int
      -> ScalingPolicy)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MinAdjustmentStep")
      Either
  String
  (Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe [StepAdjustment]
   -> Maybe TargetTrackingConfiguration
   -> Maybe Text
   -> Maybe Text
   -> Maybe PredictiveScalingConfiguration
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Alarm]
   -> Maybe Text
   -> Maybe Int
   -> ScalingPolicy)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe [StepAdjustment]
      -> Maybe TargetTrackingConfiguration
      -> Maybe Text
      -> Maybe Text
      -> Maybe PredictiveScalingConfiguration
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Alarm]
      -> Maybe Text
      -> Maybe Int
      -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"EstimatedInstanceWarmup")
      Either
  String
  (Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe [StepAdjustment]
   -> Maybe TargetTrackingConfiguration
   -> Maybe Text
   -> Maybe Text
   -> Maybe PredictiveScalingConfiguration
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Alarm]
   -> Maybe Text
   -> Maybe Int
   -> ScalingPolicy)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Bool
      -> Maybe Text
      -> Maybe [StepAdjustment]
      -> Maybe TargetTrackingConfiguration
      -> Maybe Text
      -> Maybe Text
      -> Maybe PredictiveScalingConfiguration
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Alarm]
      -> Maybe Text
      -> Maybe Int
      -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PolicyName")
      Either
  String
  (Maybe Bool
   -> Maybe Text
   -> Maybe [StepAdjustment]
   -> Maybe TargetTrackingConfiguration
   -> Maybe Text
   -> Maybe Text
   -> Maybe PredictiveScalingConfiguration
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Alarm]
   -> Maybe Text
   -> Maybe Int
   -> ScalingPolicy)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Text
      -> Maybe [StepAdjustment]
      -> Maybe TargetTrackingConfiguration
      -> Maybe Text
      -> Maybe Text
      -> Maybe PredictiveScalingConfiguration
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Alarm]
      -> Maybe Text
      -> Maybe Int
      -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Enabled")
      Either
  String
  (Maybe Text
   -> Maybe [StepAdjustment]
   -> Maybe TargetTrackingConfiguration
   -> Maybe Text
   -> Maybe Text
   -> Maybe PredictiveScalingConfiguration
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Alarm]
   -> Maybe Text
   -> Maybe Int
   -> ScalingPolicy)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [StepAdjustment]
      -> Maybe TargetTrackingConfiguration
      -> Maybe Text
      -> Maybe Text
      -> Maybe PredictiveScalingConfiguration
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Alarm]
      -> Maybe Text
      -> Maybe Int
      -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PolicyType")
      Either
  String
  (Maybe [StepAdjustment]
   -> Maybe TargetTrackingConfiguration
   -> Maybe Text
   -> Maybe Text
   -> Maybe PredictiveScalingConfiguration
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Alarm]
   -> Maybe Text
   -> Maybe Int
   -> ScalingPolicy)
-> Either String (Maybe [StepAdjustment])
-> Either
     String
     (Maybe TargetTrackingConfiguration
      -> Maybe Text
      -> Maybe Text
      -> Maybe PredictiveScalingConfiguration
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Alarm]
      -> Maybe Text
      -> Maybe Int
      -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StepAdjustments" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [StepAdjustment]))
-> Either String (Maybe [StepAdjustment])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [StepAdjustment])
-> [Node] -> Either String (Maybe [StepAdjustment])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [StepAdjustment]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either
  String
  (Maybe TargetTrackingConfiguration
   -> Maybe Text
   -> Maybe Text
   -> Maybe PredictiveScalingConfiguration
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Alarm]
   -> Maybe Text
   -> Maybe Int
   -> ScalingPolicy)
-> Either String (Maybe TargetTrackingConfiguration)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe PredictiveScalingConfiguration
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Alarm]
      -> Maybe Text
      -> Maybe Int
      -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe TargetTrackingConfiguration)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TargetTrackingConfiguration")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe PredictiveScalingConfiguration
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Alarm]
   -> Maybe Text
   -> Maybe Int
   -> ScalingPolicy)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe PredictiveScalingConfiguration
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Alarm]
      -> Maybe Text
      -> Maybe Int
      -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AdjustmentType")
      Either
  String
  (Maybe Text
   -> Maybe PredictiveScalingConfiguration
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Alarm]
   -> Maybe Text
   -> Maybe Int
   -> ScalingPolicy)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe PredictiveScalingConfiguration
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Alarm]
      -> Maybe Text
      -> Maybe Int
      -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AutoScalingGroupName")
      Either
  String
  (Maybe PredictiveScalingConfiguration
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Alarm]
   -> Maybe Text
   -> Maybe Int
   -> ScalingPolicy)
-> Either String (Maybe PredictiveScalingConfiguration)
-> Either
     String
     (Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Alarm]
      -> Maybe Text
      -> Maybe Int
      -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node]
-> Text -> Either String (Maybe PredictiveScalingConfiguration)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PredictiveScalingConfiguration")
      Either
  String
  (Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Alarm]
   -> Maybe Text
   -> Maybe Int
   -> ScalingPolicy)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Int
      -> Maybe Text
      -> Maybe [Alarm]
      -> Maybe Text
      -> Maybe Int
      -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ScalingAdjustment")
      Either
  String
  (Maybe Int
   -> Maybe Text
   -> Maybe [Alarm]
   -> Maybe Text
   -> Maybe Int
   -> ScalingPolicy)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Text
      -> Maybe [Alarm] -> Maybe Text -> Maybe Int -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Cooldown")
      Either
  String
  (Maybe Text
   -> Maybe [Alarm] -> Maybe Text -> Maybe Int -> ScalingPolicy)
-> Either String (Maybe Text)
-> Either
     String (Maybe [Alarm] -> Maybe Text -> Maybe Int -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PolicyARN")
      Either
  String (Maybe [Alarm] -> Maybe Text -> Maybe Int -> ScalingPolicy)
-> Either String (Maybe [Alarm])
-> Either String (Maybe Text -> Maybe Int -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Alarms" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [Alarm]))
-> Either String (Maybe [Alarm])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Alarm])
-> [Node] -> Either String (Maybe [Alarm])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Alarm]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either String (Maybe Text -> Maybe Int -> ScalingPolicy)
-> Either String (Maybe Text)
-> Either String (Maybe Int -> ScalingPolicy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MetricAggregationType")
      Either String (Maybe Int -> ScalingPolicy)
-> Either String (Maybe Int) -> Either String ScalingPolicy
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MinAdjustmentMagnitude")

instance Prelude.Hashable ScalingPolicy

instance Prelude.NFData ScalingPolicy