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

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

-- | One or more metric data queries to provide the data points for a scaling
-- metric. Use multiple metric data queries only if you are performing a
-- math expression on returned data.
predictiveScalingCustomizedScalingMetric_metricDataQueries :: Lens.Lens' PredictiveScalingCustomizedScalingMetric [MetricDataQuery]
predictiveScalingCustomizedScalingMetric_metricDataQueries :: Lens' PredictiveScalingCustomizedScalingMetric [MetricDataQuery]
predictiveScalingCustomizedScalingMetric_metricDataQueries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PredictiveScalingCustomizedScalingMetric' {[MetricDataQuery]
metricDataQueries :: [MetricDataQuery]
$sel:metricDataQueries:PredictiveScalingCustomizedScalingMetric' :: PredictiveScalingCustomizedScalingMetric -> [MetricDataQuery]
metricDataQueries} -> [MetricDataQuery]
metricDataQueries) (\s :: PredictiveScalingCustomizedScalingMetric
s@PredictiveScalingCustomizedScalingMetric' {} [MetricDataQuery]
a -> PredictiveScalingCustomizedScalingMetric
s {$sel:metricDataQueries:PredictiveScalingCustomizedScalingMetric' :: [MetricDataQuery]
metricDataQueries = [MetricDataQuery]
a} :: PredictiveScalingCustomizedScalingMetric) 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
    PredictiveScalingCustomizedScalingMetric
  where
  parseXML :: [Node] -> Either String PredictiveScalingCustomizedScalingMetric
parseXML [Node]
x =
    [MetricDataQuery] -> PredictiveScalingCustomizedScalingMetric
PredictiveScalingCustomizedScalingMetric'
      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
    PredictiveScalingCustomizedScalingMetric
  where
  hashWithSalt :: Int -> PredictiveScalingCustomizedScalingMetric -> Int
hashWithSalt
    Int
_salt
    PredictiveScalingCustomizedScalingMetric' {[MetricDataQuery]
metricDataQueries :: [MetricDataQuery]
$sel:metricDataQueries:PredictiveScalingCustomizedScalingMetric' :: PredictiveScalingCustomizedScalingMetric -> [MetricDataQuery]
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [MetricDataQuery]
metricDataQueries

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

instance
  Data.ToQuery
    PredictiveScalingCustomizedScalingMetric
  where
  toQuery :: PredictiveScalingCustomizedScalingMetric -> QueryString
toQuery PredictiveScalingCustomizedScalingMetric' {[MetricDataQuery]
metricDataQueries :: [MetricDataQuery]
$sel:metricDataQueries:PredictiveScalingCustomizedScalingMetric' :: PredictiveScalingCustomizedScalingMetric -> [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
      ]