{-# 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.PredictiveScalingMetricSpecification
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AutoScaling.Types.PredictiveScalingMetricSpecification where

import Amazonka.AutoScaling.Types.PredictiveScalingCustomizedCapacityMetric
import Amazonka.AutoScaling.Types.PredictiveScalingCustomizedLoadMetric
import Amazonka.AutoScaling.Types.PredictiveScalingCustomizedScalingMetric
import Amazonka.AutoScaling.Types.PredictiveScalingPredefinedLoadMetric
import Amazonka.AutoScaling.Types.PredictiveScalingPredefinedMetricPair
import Amazonka.AutoScaling.Types.PredictiveScalingPredefinedScalingMetric
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | This structure specifies the metrics and target utilization settings for
-- a predictive scaling policy.
--
-- You must specify either a metric pair, or a load metric and a scaling
-- metric individually. Specifying a metric pair instead of individual
-- metrics provides a simpler way to configure metrics for a scaling
-- policy. You choose the metric pair, and the policy automatically knows
-- the correct sum and average statistics to use for the load metric and
-- the scaling metric.
--
-- Example
--
-- -   You create a predictive scaling policy and specify @ALBRequestCount@
--     as the value for the metric pair and @1000.0@ as the target value.
--     For this type of metric, you must provide the metric dimension for
--     the corresponding target group, so you also provide a resource label
--     for the Application Load Balancer target group that is attached to
--     your Auto Scaling group.
--
-- -   The number of requests the target group receives per minute provides
--     the load metric, and the request count averaged between the members
--     of the target group provides the scaling metric. In CloudWatch, this
--     refers to the @RequestCount@ and @RequestCountPerTarget@ metrics,
--     respectively.
--
-- -   For optimal use of predictive scaling, you adhere to the best
--     practice of using a dynamic scaling policy to automatically scale
--     between the minimum capacity and maximum capacity in response to
--     real-time changes in resource utilization.
--
-- -   Amazon EC2 Auto Scaling consumes data points for the load metric
--     over the last 14 days and creates an hourly load forecast for
--     predictive scaling. (A minimum of 24 hours of data is required.)
--
-- -   After creating the load forecast, Amazon EC2 Auto Scaling determines
--     when to reduce or increase the capacity of your Auto Scaling group
--     in each hour of the forecast period so that the average number of
--     requests received by each instance is as close to 1000 requests per
--     minute as possible at all times.
--
-- For information about using custom metrics with predictive scaling, see
-- <https://docs.aws.amazon.com/autoscaling/ec2/userguide/predictive-scaling-customized-metric-specification.html Advanced predictive scaling policy configurations using custom metrics>
-- in the /Amazon EC2 Auto Scaling User Guide/.
--
-- /See:/ 'newPredictiveScalingMetricSpecification' smart constructor.
data PredictiveScalingMetricSpecification = PredictiveScalingMetricSpecification'
  { -- | The customized capacity metric specification.
    PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingCustomizedCapacityMetric
customizedCapacityMetricSpecification :: Prelude.Maybe PredictiveScalingCustomizedCapacityMetric,
    -- | The customized load metric specification.
    PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingCustomizedLoadMetric
customizedLoadMetricSpecification :: Prelude.Maybe PredictiveScalingCustomizedLoadMetric,
    -- | The customized scaling metric specification.
    PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingCustomizedScalingMetric
customizedScalingMetricSpecification :: Prelude.Maybe PredictiveScalingCustomizedScalingMetric,
    -- | The predefined load metric specification.
    PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingPredefinedLoadMetric
predefinedLoadMetricSpecification :: Prelude.Maybe PredictiveScalingPredefinedLoadMetric,
    -- | The predefined metric pair specification from which Amazon EC2 Auto
    -- Scaling determines the appropriate scaling metric and load metric to
    -- use.
    PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingPredefinedMetricPair
predefinedMetricPairSpecification :: Prelude.Maybe PredictiveScalingPredefinedMetricPair,
    -- | The predefined scaling metric specification.
    PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingPredefinedScalingMetric
predefinedScalingMetricSpecification :: Prelude.Maybe PredictiveScalingPredefinedScalingMetric,
    -- | Specifies the target utilization.
    --
    -- Some metrics are based on a count instead of a percentage, such as the
    -- request count for an Application Load Balancer or the number of messages
    -- in an SQS queue. If the scaling policy specifies one of these metrics,
    -- specify the target utilization as the optimal average request or message
    -- count per instance during any one-minute interval.
    PredictiveScalingMetricSpecification -> Double
targetValue :: Prelude.Double
  }
  deriving (PredictiveScalingMetricSpecification
-> PredictiveScalingMetricSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PredictiveScalingMetricSpecification
-> PredictiveScalingMetricSpecification -> Bool
$c/= :: PredictiveScalingMetricSpecification
-> PredictiveScalingMetricSpecification -> Bool
== :: PredictiveScalingMetricSpecification
-> PredictiveScalingMetricSpecification -> Bool
$c== :: PredictiveScalingMetricSpecification
-> PredictiveScalingMetricSpecification -> Bool
Prelude.Eq, ReadPrec [PredictiveScalingMetricSpecification]
ReadPrec PredictiveScalingMetricSpecification
Int -> ReadS PredictiveScalingMetricSpecification
ReadS [PredictiveScalingMetricSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PredictiveScalingMetricSpecification]
$creadListPrec :: ReadPrec [PredictiveScalingMetricSpecification]
readPrec :: ReadPrec PredictiveScalingMetricSpecification
$creadPrec :: ReadPrec PredictiveScalingMetricSpecification
readList :: ReadS [PredictiveScalingMetricSpecification]
$creadList :: ReadS [PredictiveScalingMetricSpecification]
readsPrec :: Int -> ReadS PredictiveScalingMetricSpecification
$creadsPrec :: Int -> ReadS PredictiveScalingMetricSpecification
Prelude.Read, Int -> PredictiveScalingMetricSpecification -> ShowS
[PredictiveScalingMetricSpecification] -> ShowS
PredictiveScalingMetricSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PredictiveScalingMetricSpecification] -> ShowS
$cshowList :: [PredictiveScalingMetricSpecification] -> ShowS
show :: PredictiveScalingMetricSpecification -> String
$cshow :: PredictiveScalingMetricSpecification -> String
showsPrec :: Int -> PredictiveScalingMetricSpecification -> ShowS
$cshowsPrec :: Int -> PredictiveScalingMetricSpecification -> ShowS
Prelude.Show, forall x.
Rep PredictiveScalingMetricSpecification x
-> PredictiveScalingMetricSpecification
forall x.
PredictiveScalingMetricSpecification
-> Rep PredictiveScalingMetricSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PredictiveScalingMetricSpecification x
-> PredictiveScalingMetricSpecification
$cfrom :: forall x.
PredictiveScalingMetricSpecification
-> Rep PredictiveScalingMetricSpecification x
Prelude.Generic)

-- |
-- Create a value of 'PredictiveScalingMetricSpecification' 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:
--
-- 'customizedCapacityMetricSpecification', 'predictiveScalingMetricSpecification_customizedCapacityMetricSpecification' - The customized capacity metric specification.
--
-- 'customizedLoadMetricSpecification', 'predictiveScalingMetricSpecification_customizedLoadMetricSpecification' - The customized load metric specification.
--
-- 'customizedScalingMetricSpecification', 'predictiveScalingMetricSpecification_customizedScalingMetricSpecification' - The customized scaling metric specification.
--
-- 'predefinedLoadMetricSpecification', 'predictiveScalingMetricSpecification_predefinedLoadMetricSpecification' - The predefined load metric specification.
--
-- 'predefinedMetricPairSpecification', 'predictiveScalingMetricSpecification_predefinedMetricPairSpecification' - The predefined metric pair specification from which Amazon EC2 Auto
-- Scaling determines the appropriate scaling metric and load metric to
-- use.
--
-- 'predefinedScalingMetricSpecification', 'predictiveScalingMetricSpecification_predefinedScalingMetricSpecification' - The predefined scaling metric specification.
--
-- 'targetValue', 'predictiveScalingMetricSpecification_targetValue' - Specifies the target utilization.
--
-- Some metrics are based on a count instead of a percentage, such as the
-- request count for an Application Load Balancer or the number of messages
-- in an SQS queue. If the scaling policy specifies one of these metrics,
-- specify the target utilization as the optimal average request or message
-- count per instance during any one-minute interval.
newPredictiveScalingMetricSpecification ::
  -- | 'targetValue'
  Prelude.Double ->
  PredictiveScalingMetricSpecification
newPredictiveScalingMetricSpecification :: Double -> PredictiveScalingMetricSpecification
newPredictiveScalingMetricSpecification Double
pTargetValue_ =
  PredictiveScalingMetricSpecification'
    { $sel:customizedCapacityMetricSpecification:PredictiveScalingMetricSpecification' :: Maybe PredictiveScalingCustomizedCapacityMetric
customizedCapacityMetricSpecification =
        forall a. Maybe a
Prelude.Nothing,
      $sel:customizedLoadMetricSpecification:PredictiveScalingMetricSpecification' :: Maybe PredictiveScalingCustomizedLoadMetric
customizedLoadMetricSpecification =
        forall a. Maybe a
Prelude.Nothing,
      $sel:customizedScalingMetricSpecification:PredictiveScalingMetricSpecification' :: Maybe PredictiveScalingCustomizedScalingMetric
customizedScalingMetricSpecification =
        forall a. Maybe a
Prelude.Nothing,
      $sel:predefinedLoadMetricSpecification:PredictiveScalingMetricSpecification' :: Maybe PredictiveScalingPredefinedLoadMetric
predefinedLoadMetricSpecification =
        forall a. Maybe a
Prelude.Nothing,
      $sel:predefinedMetricPairSpecification:PredictiveScalingMetricSpecification' :: Maybe PredictiveScalingPredefinedMetricPair
predefinedMetricPairSpecification =
        forall a. Maybe a
Prelude.Nothing,
      $sel:predefinedScalingMetricSpecification:PredictiveScalingMetricSpecification' :: Maybe PredictiveScalingPredefinedScalingMetric
predefinedScalingMetricSpecification =
        forall a. Maybe a
Prelude.Nothing,
      $sel:targetValue:PredictiveScalingMetricSpecification' :: Double
targetValue = Double
pTargetValue_
    }

-- | The customized capacity metric specification.
predictiveScalingMetricSpecification_customizedCapacityMetricSpecification :: Lens.Lens' PredictiveScalingMetricSpecification (Prelude.Maybe PredictiveScalingCustomizedCapacityMetric)
predictiveScalingMetricSpecification_customizedCapacityMetricSpecification :: Lens'
  PredictiveScalingMetricSpecification
  (Maybe PredictiveScalingCustomizedCapacityMetric)
predictiveScalingMetricSpecification_customizedCapacityMetricSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredictiveScalingMetricSpecification' {Maybe PredictiveScalingCustomizedCapacityMetric
customizedCapacityMetricSpecification :: Maybe PredictiveScalingCustomizedCapacityMetric
$sel:customizedCapacityMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingCustomizedCapacityMetric
customizedCapacityMetricSpecification} -> Maybe PredictiveScalingCustomizedCapacityMetric
customizedCapacityMetricSpecification) (\s :: PredictiveScalingMetricSpecification
s@PredictiveScalingMetricSpecification' {} Maybe PredictiveScalingCustomizedCapacityMetric
a -> PredictiveScalingMetricSpecification
s {$sel:customizedCapacityMetricSpecification:PredictiveScalingMetricSpecification' :: Maybe PredictiveScalingCustomizedCapacityMetric
customizedCapacityMetricSpecification = Maybe PredictiveScalingCustomizedCapacityMetric
a} :: PredictiveScalingMetricSpecification)

-- | The customized load metric specification.
predictiveScalingMetricSpecification_customizedLoadMetricSpecification :: Lens.Lens' PredictiveScalingMetricSpecification (Prelude.Maybe PredictiveScalingCustomizedLoadMetric)
predictiveScalingMetricSpecification_customizedLoadMetricSpecification :: Lens'
  PredictiveScalingMetricSpecification
  (Maybe PredictiveScalingCustomizedLoadMetric)
predictiveScalingMetricSpecification_customizedLoadMetricSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredictiveScalingMetricSpecification' {Maybe PredictiveScalingCustomizedLoadMetric
customizedLoadMetricSpecification :: Maybe PredictiveScalingCustomizedLoadMetric
$sel:customizedLoadMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingCustomizedLoadMetric
customizedLoadMetricSpecification} -> Maybe PredictiveScalingCustomizedLoadMetric
customizedLoadMetricSpecification) (\s :: PredictiveScalingMetricSpecification
s@PredictiveScalingMetricSpecification' {} Maybe PredictiveScalingCustomizedLoadMetric
a -> PredictiveScalingMetricSpecification
s {$sel:customizedLoadMetricSpecification:PredictiveScalingMetricSpecification' :: Maybe PredictiveScalingCustomizedLoadMetric
customizedLoadMetricSpecification = Maybe PredictiveScalingCustomizedLoadMetric
a} :: PredictiveScalingMetricSpecification)

-- | The customized scaling metric specification.
predictiveScalingMetricSpecification_customizedScalingMetricSpecification :: Lens.Lens' PredictiveScalingMetricSpecification (Prelude.Maybe PredictiveScalingCustomizedScalingMetric)
predictiveScalingMetricSpecification_customizedScalingMetricSpecification :: Lens'
  PredictiveScalingMetricSpecification
  (Maybe PredictiveScalingCustomizedScalingMetric)
predictiveScalingMetricSpecification_customizedScalingMetricSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredictiveScalingMetricSpecification' {Maybe PredictiveScalingCustomizedScalingMetric
customizedScalingMetricSpecification :: Maybe PredictiveScalingCustomizedScalingMetric
$sel:customizedScalingMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingCustomizedScalingMetric
customizedScalingMetricSpecification} -> Maybe PredictiveScalingCustomizedScalingMetric
customizedScalingMetricSpecification) (\s :: PredictiveScalingMetricSpecification
s@PredictiveScalingMetricSpecification' {} Maybe PredictiveScalingCustomizedScalingMetric
a -> PredictiveScalingMetricSpecification
s {$sel:customizedScalingMetricSpecification:PredictiveScalingMetricSpecification' :: Maybe PredictiveScalingCustomizedScalingMetric
customizedScalingMetricSpecification = Maybe PredictiveScalingCustomizedScalingMetric
a} :: PredictiveScalingMetricSpecification)

-- | The predefined load metric specification.
predictiveScalingMetricSpecification_predefinedLoadMetricSpecification :: Lens.Lens' PredictiveScalingMetricSpecification (Prelude.Maybe PredictiveScalingPredefinedLoadMetric)
predictiveScalingMetricSpecification_predefinedLoadMetricSpecification :: Lens'
  PredictiveScalingMetricSpecification
  (Maybe PredictiveScalingPredefinedLoadMetric)
predictiveScalingMetricSpecification_predefinedLoadMetricSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredictiveScalingMetricSpecification' {Maybe PredictiveScalingPredefinedLoadMetric
predefinedLoadMetricSpecification :: Maybe PredictiveScalingPredefinedLoadMetric
$sel:predefinedLoadMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingPredefinedLoadMetric
predefinedLoadMetricSpecification} -> Maybe PredictiveScalingPredefinedLoadMetric
predefinedLoadMetricSpecification) (\s :: PredictiveScalingMetricSpecification
s@PredictiveScalingMetricSpecification' {} Maybe PredictiveScalingPredefinedLoadMetric
a -> PredictiveScalingMetricSpecification
s {$sel:predefinedLoadMetricSpecification:PredictiveScalingMetricSpecification' :: Maybe PredictiveScalingPredefinedLoadMetric
predefinedLoadMetricSpecification = Maybe PredictiveScalingPredefinedLoadMetric
a} :: PredictiveScalingMetricSpecification)

-- | The predefined metric pair specification from which Amazon EC2 Auto
-- Scaling determines the appropriate scaling metric and load metric to
-- use.
predictiveScalingMetricSpecification_predefinedMetricPairSpecification :: Lens.Lens' PredictiveScalingMetricSpecification (Prelude.Maybe PredictiveScalingPredefinedMetricPair)
predictiveScalingMetricSpecification_predefinedMetricPairSpecification :: Lens'
  PredictiveScalingMetricSpecification
  (Maybe PredictiveScalingPredefinedMetricPair)
predictiveScalingMetricSpecification_predefinedMetricPairSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredictiveScalingMetricSpecification' {Maybe PredictiveScalingPredefinedMetricPair
predefinedMetricPairSpecification :: Maybe PredictiveScalingPredefinedMetricPair
$sel:predefinedMetricPairSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingPredefinedMetricPair
predefinedMetricPairSpecification} -> Maybe PredictiveScalingPredefinedMetricPair
predefinedMetricPairSpecification) (\s :: PredictiveScalingMetricSpecification
s@PredictiveScalingMetricSpecification' {} Maybe PredictiveScalingPredefinedMetricPair
a -> PredictiveScalingMetricSpecification
s {$sel:predefinedMetricPairSpecification:PredictiveScalingMetricSpecification' :: Maybe PredictiveScalingPredefinedMetricPair
predefinedMetricPairSpecification = Maybe PredictiveScalingPredefinedMetricPair
a} :: PredictiveScalingMetricSpecification)

-- | The predefined scaling metric specification.
predictiveScalingMetricSpecification_predefinedScalingMetricSpecification :: Lens.Lens' PredictiveScalingMetricSpecification (Prelude.Maybe PredictiveScalingPredefinedScalingMetric)
predictiveScalingMetricSpecification_predefinedScalingMetricSpecification :: Lens'
  PredictiveScalingMetricSpecification
  (Maybe PredictiveScalingPredefinedScalingMetric)
predictiveScalingMetricSpecification_predefinedScalingMetricSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredictiveScalingMetricSpecification' {Maybe PredictiveScalingPredefinedScalingMetric
predefinedScalingMetricSpecification :: Maybe PredictiveScalingPredefinedScalingMetric
$sel:predefinedScalingMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingPredefinedScalingMetric
predefinedScalingMetricSpecification} -> Maybe PredictiveScalingPredefinedScalingMetric
predefinedScalingMetricSpecification) (\s :: PredictiveScalingMetricSpecification
s@PredictiveScalingMetricSpecification' {} Maybe PredictiveScalingPredefinedScalingMetric
a -> PredictiveScalingMetricSpecification
s {$sel:predefinedScalingMetricSpecification:PredictiveScalingMetricSpecification' :: Maybe PredictiveScalingPredefinedScalingMetric
predefinedScalingMetricSpecification = Maybe PredictiveScalingPredefinedScalingMetric
a} :: PredictiveScalingMetricSpecification)

-- | Specifies the target utilization.
--
-- Some metrics are based on a count instead of a percentage, such as the
-- request count for an Application Load Balancer or the number of messages
-- in an SQS queue. If the scaling policy specifies one of these metrics,
-- specify the target utilization as the optimal average request or message
-- count per instance during any one-minute interval.
predictiveScalingMetricSpecification_targetValue :: Lens.Lens' PredictiveScalingMetricSpecification Prelude.Double
predictiveScalingMetricSpecification_targetValue :: Lens' PredictiveScalingMetricSpecification Double
predictiveScalingMetricSpecification_targetValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredictiveScalingMetricSpecification' {Double
targetValue :: Double
$sel:targetValue:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification -> Double
targetValue} -> Double
targetValue) (\s :: PredictiveScalingMetricSpecification
s@PredictiveScalingMetricSpecification' {} Double
a -> PredictiveScalingMetricSpecification
s {$sel:targetValue:PredictiveScalingMetricSpecification' :: Double
targetValue = Double
a} :: PredictiveScalingMetricSpecification)

instance
  Data.FromXML
    PredictiveScalingMetricSpecification
  where
  parseXML :: [Node] -> Either String PredictiveScalingMetricSpecification
parseXML [Node]
x =
    Maybe PredictiveScalingCustomizedCapacityMetric
-> Maybe PredictiveScalingCustomizedLoadMetric
-> Maybe PredictiveScalingCustomizedScalingMetric
-> Maybe PredictiveScalingPredefinedLoadMetric
-> Maybe PredictiveScalingPredefinedMetricPair
-> Maybe PredictiveScalingPredefinedScalingMetric
-> Double
-> PredictiveScalingMetricSpecification
PredictiveScalingMetricSpecification'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"CustomizedCapacityMetricSpecification")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"CustomizedLoadMetricSpecification")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"CustomizedScalingMetricSpecification")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"PredefinedLoadMetricSpecification")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"PredefinedMetricPairSpecification")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"PredefinedScalingMetricSpecification")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"TargetValue")

instance
  Prelude.Hashable
    PredictiveScalingMetricSpecification
  where
  hashWithSalt :: Int -> PredictiveScalingMetricSpecification -> Int
hashWithSalt
    Int
_salt
    PredictiveScalingMetricSpecification' {Double
Maybe PredictiveScalingCustomizedCapacityMetric
Maybe PredictiveScalingCustomizedLoadMetric
Maybe PredictiveScalingCustomizedScalingMetric
Maybe PredictiveScalingPredefinedLoadMetric
Maybe PredictiveScalingPredefinedMetricPair
Maybe PredictiveScalingPredefinedScalingMetric
targetValue :: Double
predefinedScalingMetricSpecification :: Maybe PredictiveScalingPredefinedScalingMetric
predefinedMetricPairSpecification :: Maybe PredictiveScalingPredefinedMetricPair
predefinedLoadMetricSpecification :: Maybe PredictiveScalingPredefinedLoadMetric
customizedScalingMetricSpecification :: Maybe PredictiveScalingCustomizedScalingMetric
customizedLoadMetricSpecification :: Maybe PredictiveScalingCustomizedLoadMetric
customizedCapacityMetricSpecification :: Maybe PredictiveScalingCustomizedCapacityMetric
$sel:targetValue:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification -> Double
$sel:predefinedScalingMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingPredefinedScalingMetric
$sel:predefinedMetricPairSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingPredefinedMetricPair
$sel:predefinedLoadMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingPredefinedLoadMetric
$sel:customizedScalingMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingCustomizedScalingMetric
$sel:customizedLoadMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingCustomizedLoadMetric
$sel:customizedCapacityMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingCustomizedCapacityMetric
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PredictiveScalingCustomizedCapacityMetric
customizedCapacityMetricSpecification
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PredictiveScalingCustomizedLoadMetric
customizedLoadMetricSpecification
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PredictiveScalingCustomizedScalingMetric
customizedScalingMetricSpecification
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PredictiveScalingPredefinedLoadMetric
predefinedLoadMetricSpecification
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PredictiveScalingPredefinedMetricPair
predefinedMetricPairSpecification
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PredictiveScalingPredefinedScalingMetric
predefinedScalingMetricSpecification
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
targetValue

instance
  Prelude.NFData
    PredictiveScalingMetricSpecification
  where
  rnf :: PredictiveScalingMetricSpecification -> ()
rnf PredictiveScalingMetricSpecification' {Double
Maybe PredictiveScalingCustomizedCapacityMetric
Maybe PredictiveScalingCustomizedLoadMetric
Maybe PredictiveScalingCustomizedScalingMetric
Maybe PredictiveScalingPredefinedLoadMetric
Maybe PredictiveScalingPredefinedMetricPair
Maybe PredictiveScalingPredefinedScalingMetric
targetValue :: Double
predefinedScalingMetricSpecification :: Maybe PredictiveScalingPredefinedScalingMetric
predefinedMetricPairSpecification :: Maybe PredictiveScalingPredefinedMetricPair
predefinedLoadMetricSpecification :: Maybe PredictiveScalingPredefinedLoadMetric
customizedScalingMetricSpecification :: Maybe PredictiveScalingCustomizedScalingMetric
customizedLoadMetricSpecification :: Maybe PredictiveScalingCustomizedLoadMetric
customizedCapacityMetricSpecification :: Maybe PredictiveScalingCustomizedCapacityMetric
$sel:targetValue:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification -> Double
$sel:predefinedScalingMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingPredefinedScalingMetric
$sel:predefinedMetricPairSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingPredefinedMetricPair
$sel:predefinedLoadMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingPredefinedLoadMetric
$sel:customizedScalingMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingCustomizedScalingMetric
$sel:customizedLoadMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingCustomizedLoadMetric
$sel:customizedCapacityMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingCustomizedCapacityMetric
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe PredictiveScalingCustomizedCapacityMetric
customizedCapacityMetricSpecification
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PredictiveScalingCustomizedLoadMetric
customizedLoadMetricSpecification
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PredictiveScalingCustomizedScalingMetric
customizedScalingMetricSpecification
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PredictiveScalingPredefinedLoadMetric
predefinedLoadMetricSpecification
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PredictiveScalingPredefinedMetricPair
predefinedMetricPairSpecification
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PredictiveScalingPredefinedScalingMetric
predefinedScalingMetricSpecification
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
targetValue

instance
  Data.ToQuery
    PredictiveScalingMetricSpecification
  where
  toQuery :: PredictiveScalingMetricSpecification -> QueryString
toQuery PredictiveScalingMetricSpecification' {Double
Maybe PredictiveScalingCustomizedCapacityMetric
Maybe PredictiveScalingCustomizedLoadMetric
Maybe PredictiveScalingCustomizedScalingMetric
Maybe PredictiveScalingPredefinedLoadMetric
Maybe PredictiveScalingPredefinedMetricPair
Maybe PredictiveScalingPredefinedScalingMetric
targetValue :: Double
predefinedScalingMetricSpecification :: Maybe PredictiveScalingPredefinedScalingMetric
predefinedMetricPairSpecification :: Maybe PredictiveScalingPredefinedMetricPair
predefinedLoadMetricSpecification :: Maybe PredictiveScalingPredefinedLoadMetric
customizedScalingMetricSpecification :: Maybe PredictiveScalingCustomizedScalingMetric
customizedLoadMetricSpecification :: Maybe PredictiveScalingCustomizedLoadMetric
customizedCapacityMetricSpecification :: Maybe PredictiveScalingCustomizedCapacityMetric
$sel:targetValue:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification -> Double
$sel:predefinedScalingMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingPredefinedScalingMetric
$sel:predefinedMetricPairSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingPredefinedMetricPair
$sel:predefinedLoadMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingPredefinedLoadMetric
$sel:customizedScalingMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingCustomizedScalingMetric
$sel:customizedLoadMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingCustomizedLoadMetric
$sel:customizedCapacityMetricSpecification:PredictiveScalingMetricSpecification' :: PredictiveScalingMetricSpecification
-> Maybe PredictiveScalingCustomizedCapacityMetric
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"CustomizedCapacityMetricSpecification"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe PredictiveScalingCustomizedCapacityMetric
customizedCapacityMetricSpecification,
        ByteString
"CustomizedLoadMetricSpecification"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe PredictiveScalingCustomizedLoadMetric
customizedLoadMetricSpecification,
        ByteString
"CustomizedScalingMetricSpecification"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe PredictiveScalingCustomizedScalingMetric
customizedScalingMetricSpecification,
        ByteString
"PredefinedLoadMetricSpecification"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe PredictiveScalingPredefinedLoadMetric
predefinedLoadMetricSpecification,
        ByteString
"PredefinedMetricPairSpecification"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe PredictiveScalingPredefinedMetricPair
predefinedMetricPairSpecification,
        ByteString
"PredefinedScalingMetricSpecification"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe PredictiveScalingPredefinedScalingMetric
predefinedScalingMetricSpecification,
        ByteString
"TargetValue" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Double
targetValue
      ]