{-# 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.PredictiveScalingCustomizedCapacityMetric
-- 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.PredictiveScalingCustomizedCapacityMetric where

import Amazonka.AutoScaling.Types.MetricDataQuery
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

-- | Describes a customized capacity metric for a predictive scaling policy.
--
-- /See:/ 'newPredictiveScalingCustomizedCapacityMetric' smart constructor.
data PredictiveScalingCustomizedCapacityMetric = PredictiveScalingCustomizedCapacityMetric'
  { -- | One or more metric data queries to provide the data points for a
    -- capacity metric. Use multiple metric data queries only if you are
    -- performing a math expression on returned data.
    PredictiveScalingCustomizedCapacityMetric -> [MetricDataQuery]
metricDataQueries :: [MetricDataQuery]
  }
  deriving (PredictiveScalingCustomizedCapacityMetric
-> PredictiveScalingCustomizedCapacityMetric -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PredictiveScalingCustomizedCapacityMetric
-> PredictiveScalingCustomizedCapacityMetric -> Bool
$c/= :: PredictiveScalingCustomizedCapacityMetric
-> PredictiveScalingCustomizedCapacityMetric -> Bool
== :: PredictiveScalingCustomizedCapacityMetric
-> PredictiveScalingCustomizedCapacityMetric -> Bool
$c== :: PredictiveScalingCustomizedCapacityMetric
-> PredictiveScalingCustomizedCapacityMetric -> Bool
Prelude.Eq, ReadPrec [PredictiveScalingCustomizedCapacityMetric]
ReadPrec PredictiveScalingCustomizedCapacityMetric
Int -> ReadS PredictiveScalingCustomizedCapacityMetric
ReadS [PredictiveScalingCustomizedCapacityMetric]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PredictiveScalingCustomizedCapacityMetric]
$creadListPrec :: ReadPrec [PredictiveScalingCustomizedCapacityMetric]
readPrec :: ReadPrec PredictiveScalingCustomizedCapacityMetric
$creadPrec :: ReadPrec PredictiveScalingCustomizedCapacityMetric
readList :: ReadS [PredictiveScalingCustomizedCapacityMetric]
$creadList :: ReadS [PredictiveScalingCustomizedCapacityMetric]
readsPrec :: Int -> ReadS PredictiveScalingCustomizedCapacityMetric
$creadsPrec :: Int -> ReadS PredictiveScalingCustomizedCapacityMetric
Prelude.Read, Int -> PredictiveScalingCustomizedCapacityMetric -> ShowS
[PredictiveScalingCustomizedCapacityMetric] -> ShowS
PredictiveScalingCustomizedCapacityMetric -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PredictiveScalingCustomizedCapacityMetric] -> ShowS
$cshowList :: [PredictiveScalingCustomizedCapacityMetric] -> ShowS
show :: PredictiveScalingCustomizedCapacityMetric -> String
$cshow :: PredictiveScalingCustomizedCapacityMetric -> String
showsPrec :: Int -> PredictiveScalingCustomizedCapacityMetric -> ShowS
$cshowsPrec :: Int -> PredictiveScalingCustomizedCapacityMetric -> ShowS
Prelude.Show, forall x.
Rep PredictiveScalingCustomizedCapacityMetric x
-> PredictiveScalingCustomizedCapacityMetric
forall x.
PredictiveScalingCustomizedCapacityMetric
-> Rep PredictiveScalingCustomizedCapacityMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PredictiveScalingCustomizedCapacityMetric x
-> PredictiveScalingCustomizedCapacityMetric
$cfrom :: forall x.
PredictiveScalingCustomizedCapacityMetric
-> Rep PredictiveScalingCustomizedCapacityMetric x
Prelude.Generic)

-- |
-- Create a value of 'PredictiveScalingCustomizedCapacityMetric' 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:
--
-- 'metricDataQueries', 'predictiveScalingCustomizedCapacityMetric_metricDataQueries' - One or more metric data queries to provide the data points for a
-- capacity metric. Use multiple metric data queries only if you are
-- performing a math expression on returned data.
newPredictiveScalingCustomizedCapacityMetric ::
  PredictiveScalingCustomizedCapacityMetric
newPredictiveScalingCustomizedCapacityMetric :: PredictiveScalingCustomizedCapacityMetric
newPredictiveScalingCustomizedCapacityMetric =
  PredictiveScalingCustomizedCapacityMetric'
    { $sel:metricDataQueries:PredictiveScalingCustomizedCapacityMetric' :: [MetricDataQuery]
metricDataQueries =
        forall a. Monoid a => a
Prelude.mempty
    }

-- | One or more metric data queries to provide the data points for a
-- capacity metric. Use multiple metric data queries only if you are
-- performing a math expression on returned data.
predictiveScalingCustomizedCapacityMetric_metricDataQueries :: Lens.Lens' PredictiveScalingCustomizedCapacityMetric [MetricDataQuery]
predictiveScalingCustomizedCapacityMetric_metricDataQueries :: Lens' PredictiveScalingCustomizedCapacityMetric [MetricDataQuery]
predictiveScalingCustomizedCapacityMetric_metricDataQueries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredictiveScalingCustomizedCapacityMetric' {[MetricDataQuery]
metricDataQueries :: [MetricDataQuery]
$sel:metricDataQueries:PredictiveScalingCustomizedCapacityMetric' :: PredictiveScalingCustomizedCapacityMetric -> [MetricDataQuery]
metricDataQueries} -> [MetricDataQuery]
metricDataQueries) (\s :: PredictiveScalingCustomizedCapacityMetric
s@PredictiveScalingCustomizedCapacityMetric' {} [MetricDataQuery]
a -> PredictiveScalingCustomizedCapacityMetric
s {$sel:metricDataQueries:PredictiveScalingCustomizedCapacityMetric' :: [MetricDataQuery]
metricDataQueries = [MetricDataQuery]
a} :: PredictiveScalingCustomizedCapacityMetric) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Data.FromXML
    PredictiveScalingCustomizedCapacityMetric
  where
  parseXML :: [Node] -> Either String PredictiveScalingCustomizedCapacityMetric
parseXML [Node]
x =
    [MetricDataQuery] -> PredictiveScalingCustomizedCapacityMetric
PredictiveScalingCustomizedCapacityMetric'
      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
"MetricDataQueries"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member"
                  )

instance
  Prelude.Hashable
    PredictiveScalingCustomizedCapacityMetric
  where
  hashWithSalt :: Int -> PredictiveScalingCustomizedCapacityMetric -> Int
hashWithSalt
    Int
_salt
    PredictiveScalingCustomizedCapacityMetric' {[MetricDataQuery]
metricDataQueries :: [MetricDataQuery]
$sel:metricDataQueries:PredictiveScalingCustomizedCapacityMetric' :: PredictiveScalingCustomizedCapacityMetric -> [MetricDataQuery]
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [MetricDataQuery]
metricDataQueries

instance
  Prelude.NFData
    PredictiveScalingCustomizedCapacityMetric
  where
  rnf :: PredictiveScalingCustomizedCapacityMetric -> ()
rnf PredictiveScalingCustomizedCapacityMetric' {[MetricDataQuery]
metricDataQueries :: [MetricDataQuery]
$sel:metricDataQueries:PredictiveScalingCustomizedCapacityMetric' :: PredictiveScalingCustomizedCapacityMetric -> [MetricDataQuery]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf [MetricDataQuery]
metricDataQueries

instance
  Data.ToQuery
    PredictiveScalingCustomizedCapacityMetric
  where
  toQuery :: PredictiveScalingCustomizedCapacityMetric -> QueryString
toQuery
    PredictiveScalingCustomizedCapacityMetric' {[MetricDataQuery]
metricDataQueries :: [MetricDataQuery]
$sel:metricDataQueries:PredictiveScalingCustomizedCapacityMetric' :: PredictiveScalingCustomizedCapacityMetric -> [MetricDataQuery]
..} =
      forall a. Monoid a => [a] -> a
Prelude.mconcat
        [ ByteString
"MetricDataQueries"
            forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member" [MetricDataQuery]
metricDataQueries
        ]