{-# 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.ComputeOptimizer.Types.AutoScalingGroupRecommendationOption
-- 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.ComputeOptimizer.Types.AutoScalingGroupRecommendationOption where

import Amazonka.ComputeOptimizer.Types.AutoScalingGroupConfiguration
import Amazonka.ComputeOptimizer.Types.UtilizationMetric
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes a recommendation option for an Auto Scaling group.
--
-- /See:/ 'newAutoScalingGroupRecommendationOption' smart constructor.
data AutoScalingGroupRecommendationOption = AutoScalingGroupRecommendationOption'
  { -- | The performance risk of the Auto Scaling group configuration
    -- recommendation.
    --
    -- Performance risk indicates the likelihood of the recommended instance
    -- type not meeting the resource needs of your workload. Compute Optimizer
    -- calculates an individual performance risk score for each specification
    -- of the recommended instance, including CPU, memory, EBS throughput, EBS
    -- IOPS, disk throughput, disk IOPS, network throughput, and network PPS.
    -- The performance risk of the recommended instance is calculated as the
    -- maximum performance risk score across the analyzed resource
    -- specifications.
    --
    -- The value ranges from @0@ - @4@, with @0@ meaning that the recommended
    -- resource is predicted to always provide enough hardware capability. The
    -- higher the performance risk is, the more likely you should validate
    -- whether the recommendation will meet the performance requirements of
    -- your workload before migrating your resource.
    AutoScalingGroupRecommendationOption -> Maybe Double
performanceRisk :: Prelude.Maybe Prelude.Double,
    -- | An array of objects that describe the projected utilization metrics of
    -- the Auto Scaling group recommendation option.
    --
    -- The @Cpu@ and @Memory@ metrics are the only projected utilization
    -- metrics returned. Additionally, the @Memory@ metric is returned only for
    -- resources that have the unified CloudWatch agent installed on them. For
    -- more information, see
    -- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/metrics.html#cw-agent Enabling Memory Utilization with the CloudWatch Agent>.
    AutoScalingGroupRecommendationOption -> Maybe [UtilizationMetric]
projectedUtilizationMetrics :: Prelude.Maybe [UtilizationMetric],
    -- | An array of objects that describe an Auto Scaling group configuration.
    AutoScalingGroupRecommendationOption
-> Maybe AutoScalingGroupConfiguration
configuration :: Prelude.Maybe AutoScalingGroupConfiguration,
    -- | The rank of the Auto Scaling group recommendation option.
    --
    -- The top recommendation option is ranked as @1@.
    AutoScalingGroupRecommendationOption -> Maybe Int
rank :: Prelude.Maybe Prelude.Int
  }
  deriving (AutoScalingGroupRecommendationOption
-> AutoScalingGroupRecommendationOption -> Bool
(AutoScalingGroupRecommendationOption
 -> AutoScalingGroupRecommendationOption -> Bool)
-> (AutoScalingGroupRecommendationOption
    -> AutoScalingGroupRecommendationOption -> Bool)
-> Eq AutoScalingGroupRecommendationOption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoScalingGroupRecommendationOption
-> AutoScalingGroupRecommendationOption -> Bool
$c/= :: AutoScalingGroupRecommendationOption
-> AutoScalingGroupRecommendationOption -> Bool
== :: AutoScalingGroupRecommendationOption
-> AutoScalingGroupRecommendationOption -> Bool
$c== :: AutoScalingGroupRecommendationOption
-> AutoScalingGroupRecommendationOption -> Bool
Prelude.Eq, ReadPrec [AutoScalingGroupRecommendationOption]
ReadPrec AutoScalingGroupRecommendationOption
Int -> ReadS AutoScalingGroupRecommendationOption
ReadS [AutoScalingGroupRecommendationOption]
(Int -> ReadS AutoScalingGroupRecommendationOption)
-> ReadS [AutoScalingGroupRecommendationOption]
-> ReadPrec AutoScalingGroupRecommendationOption
-> ReadPrec [AutoScalingGroupRecommendationOption]
-> Read AutoScalingGroupRecommendationOption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoScalingGroupRecommendationOption]
$creadListPrec :: ReadPrec [AutoScalingGroupRecommendationOption]
readPrec :: ReadPrec AutoScalingGroupRecommendationOption
$creadPrec :: ReadPrec AutoScalingGroupRecommendationOption
readList :: ReadS [AutoScalingGroupRecommendationOption]
$creadList :: ReadS [AutoScalingGroupRecommendationOption]
readsPrec :: Int -> ReadS AutoScalingGroupRecommendationOption
$creadsPrec :: Int -> ReadS AutoScalingGroupRecommendationOption
Prelude.Read, Int -> AutoScalingGroupRecommendationOption -> ShowS
[AutoScalingGroupRecommendationOption] -> ShowS
AutoScalingGroupRecommendationOption -> String
(Int -> AutoScalingGroupRecommendationOption -> ShowS)
-> (AutoScalingGroupRecommendationOption -> String)
-> ([AutoScalingGroupRecommendationOption] -> ShowS)
-> Show AutoScalingGroupRecommendationOption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoScalingGroupRecommendationOption] -> ShowS
$cshowList :: [AutoScalingGroupRecommendationOption] -> ShowS
show :: AutoScalingGroupRecommendationOption -> String
$cshow :: AutoScalingGroupRecommendationOption -> String
showsPrec :: Int -> AutoScalingGroupRecommendationOption -> ShowS
$cshowsPrec :: Int -> AutoScalingGroupRecommendationOption -> ShowS
Prelude.Show, (forall x.
 AutoScalingGroupRecommendationOption
 -> Rep AutoScalingGroupRecommendationOption x)
-> (forall x.
    Rep AutoScalingGroupRecommendationOption x
    -> AutoScalingGroupRecommendationOption)
-> Generic AutoScalingGroupRecommendationOption
forall x.
Rep AutoScalingGroupRecommendationOption x
-> AutoScalingGroupRecommendationOption
forall x.
AutoScalingGroupRecommendationOption
-> Rep AutoScalingGroupRecommendationOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AutoScalingGroupRecommendationOption x
-> AutoScalingGroupRecommendationOption
$cfrom :: forall x.
AutoScalingGroupRecommendationOption
-> Rep AutoScalingGroupRecommendationOption x
Prelude.Generic)

-- |
-- Create a value of 'AutoScalingGroupRecommendationOption' 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:
--
-- 'performanceRisk', 'autoScalingGroupRecommendationOption_performanceRisk' - The performance risk of the Auto Scaling group configuration
-- recommendation.
--
-- Performance risk indicates the likelihood of the recommended instance
-- type not meeting the resource needs of your workload. Compute Optimizer
-- calculates an individual performance risk score for each specification
-- of the recommended instance, including CPU, memory, EBS throughput, EBS
-- IOPS, disk throughput, disk IOPS, network throughput, and network PPS.
-- The performance risk of the recommended instance is calculated as the
-- maximum performance risk score across the analyzed resource
-- specifications.
--
-- The value ranges from @0@ - @4@, with @0@ meaning that the recommended
-- resource is predicted to always provide enough hardware capability. The
-- higher the performance risk is, the more likely you should validate
-- whether the recommendation will meet the performance requirements of
-- your workload before migrating your resource.
--
-- 'projectedUtilizationMetrics', 'autoScalingGroupRecommendationOption_projectedUtilizationMetrics' - An array of objects that describe the projected utilization metrics of
-- the Auto Scaling group recommendation option.
--
-- The @Cpu@ and @Memory@ metrics are the only projected utilization
-- metrics returned. Additionally, the @Memory@ metric is returned only for
-- resources that have the unified CloudWatch agent installed on them. For
-- more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/metrics.html#cw-agent Enabling Memory Utilization with the CloudWatch Agent>.
--
-- 'configuration', 'autoScalingGroupRecommendationOption_configuration' - An array of objects that describe an Auto Scaling group configuration.
--
-- 'rank', 'autoScalingGroupRecommendationOption_rank' - The rank of the Auto Scaling group recommendation option.
--
-- The top recommendation option is ranked as @1@.
newAutoScalingGroupRecommendationOption ::
  AutoScalingGroupRecommendationOption
newAutoScalingGroupRecommendationOption :: AutoScalingGroupRecommendationOption
newAutoScalingGroupRecommendationOption =
  AutoScalingGroupRecommendationOption' :: Maybe Double
-> Maybe [UtilizationMetric]
-> Maybe AutoScalingGroupConfiguration
-> Maybe Int
-> AutoScalingGroupRecommendationOption
AutoScalingGroupRecommendationOption'
    { $sel:performanceRisk:AutoScalingGroupRecommendationOption' :: Maybe Double
performanceRisk =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:projectedUtilizationMetrics:AutoScalingGroupRecommendationOption' :: Maybe [UtilizationMetric]
projectedUtilizationMetrics =
        Maybe [UtilizationMetric]
forall a. Maybe a
Prelude.Nothing,
      $sel:configuration:AutoScalingGroupRecommendationOption' :: Maybe AutoScalingGroupConfiguration
configuration = Maybe AutoScalingGroupConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:rank:AutoScalingGroupRecommendationOption' :: Maybe Int
rank = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The performance risk of the Auto Scaling group configuration
-- recommendation.
--
-- Performance risk indicates the likelihood of the recommended instance
-- type not meeting the resource needs of your workload. Compute Optimizer
-- calculates an individual performance risk score for each specification
-- of the recommended instance, including CPU, memory, EBS throughput, EBS
-- IOPS, disk throughput, disk IOPS, network throughput, and network PPS.
-- The performance risk of the recommended instance is calculated as the
-- maximum performance risk score across the analyzed resource
-- specifications.
--
-- The value ranges from @0@ - @4@, with @0@ meaning that the recommended
-- resource is predicted to always provide enough hardware capability. The
-- higher the performance risk is, the more likely you should validate
-- whether the recommendation will meet the performance requirements of
-- your workload before migrating your resource.
autoScalingGroupRecommendationOption_performanceRisk :: Lens.Lens' AutoScalingGroupRecommendationOption (Prelude.Maybe Prelude.Double)
autoScalingGroupRecommendationOption_performanceRisk :: (Maybe Double -> f (Maybe Double))
-> AutoScalingGroupRecommendationOption
-> f AutoScalingGroupRecommendationOption
autoScalingGroupRecommendationOption_performanceRisk = (AutoScalingGroupRecommendationOption -> Maybe Double)
-> (AutoScalingGroupRecommendationOption
    -> Maybe Double -> AutoScalingGroupRecommendationOption)
-> Lens
     AutoScalingGroupRecommendationOption
     AutoScalingGroupRecommendationOption
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingGroupRecommendationOption' {Maybe Double
performanceRisk :: Maybe Double
$sel:performanceRisk:AutoScalingGroupRecommendationOption' :: AutoScalingGroupRecommendationOption -> Maybe Double
performanceRisk} -> Maybe Double
performanceRisk) (\s :: AutoScalingGroupRecommendationOption
s@AutoScalingGroupRecommendationOption' {} Maybe Double
a -> AutoScalingGroupRecommendationOption
s {$sel:performanceRisk:AutoScalingGroupRecommendationOption' :: Maybe Double
performanceRisk = Maybe Double
a} :: AutoScalingGroupRecommendationOption)

-- | An array of objects that describe the projected utilization metrics of
-- the Auto Scaling group recommendation option.
--
-- The @Cpu@ and @Memory@ metrics are the only projected utilization
-- metrics returned. Additionally, the @Memory@ metric is returned only for
-- resources that have the unified CloudWatch agent installed on them. For
-- more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/metrics.html#cw-agent Enabling Memory Utilization with the CloudWatch Agent>.
autoScalingGroupRecommendationOption_projectedUtilizationMetrics :: Lens.Lens' AutoScalingGroupRecommendationOption (Prelude.Maybe [UtilizationMetric])
autoScalingGroupRecommendationOption_projectedUtilizationMetrics :: (Maybe [UtilizationMetric] -> f (Maybe [UtilizationMetric]))
-> AutoScalingGroupRecommendationOption
-> f AutoScalingGroupRecommendationOption
autoScalingGroupRecommendationOption_projectedUtilizationMetrics = (AutoScalingGroupRecommendationOption -> Maybe [UtilizationMetric])
-> (AutoScalingGroupRecommendationOption
    -> Maybe [UtilizationMetric]
    -> AutoScalingGroupRecommendationOption)
-> Lens
     AutoScalingGroupRecommendationOption
     AutoScalingGroupRecommendationOption
     (Maybe [UtilizationMetric])
     (Maybe [UtilizationMetric])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingGroupRecommendationOption' {Maybe [UtilizationMetric]
projectedUtilizationMetrics :: Maybe [UtilizationMetric]
$sel:projectedUtilizationMetrics:AutoScalingGroupRecommendationOption' :: AutoScalingGroupRecommendationOption -> Maybe [UtilizationMetric]
projectedUtilizationMetrics} -> Maybe [UtilizationMetric]
projectedUtilizationMetrics) (\s :: AutoScalingGroupRecommendationOption
s@AutoScalingGroupRecommendationOption' {} Maybe [UtilizationMetric]
a -> AutoScalingGroupRecommendationOption
s {$sel:projectedUtilizationMetrics:AutoScalingGroupRecommendationOption' :: Maybe [UtilizationMetric]
projectedUtilizationMetrics = Maybe [UtilizationMetric]
a} :: AutoScalingGroupRecommendationOption) ((Maybe [UtilizationMetric] -> f (Maybe [UtilizationMetric]))
 -> AutoScalingGroupRecommendationOption
 -> f AutoScalingGroupRecommendationOption)
-> ((Maybe [UtilizationMetric] -> f (Maybe [UtilizationMetric]))
    -> Maybe [UtilizationMetric] -> f (Maybe [UtilizationMetric]))
-> (Maybe [UtilizationMetric] -> f (Maybe [UtilizationMetric]))
-> AutoScalingGroupRecommendationOption
-> f AutoScalingGroupRecommendationOption
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [UtilizationMetric]
  [UtilizationMetric]
  [UtilizationMetric]
  [UtilizationMetric]
-> Iso
     (Maybe [UtilizationMetric])
     (Maybe [UtilizationMetric])
     (Maybe [UtilizationMetric])
     (Maybe [UtilizationMetric])
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
  [UtilizationMetric]
  [UtilizationMetric]
  [UtilizationMetric]
  [UtilizationMetric]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An array of objects that describe an Auto Scaling group configuration.
autoScalingGroupRecommendationOption_configuration :: Lens.Lens' AutoScalingGroupRecommendationOption (Prelude.Maybe AutoScalingGroupConfiguration)
autoScalingGroupRecommendationOption_configuration :: (Maybe AutoScalingGroupConfiguration
 -> f (Maybe AutoScalingGroupConfiguration))
-> AutoScalingGroupRecommendationOption
-> f AutoScalingGroupRecommendationOption
autoScalingGroupRecommendationOption_configuration = (AutoScalingGroupRecommendationOption
 -> Maybe AutoScalingGroupConfiguration)
-> (AutoScalingGroupRecommendationOption
    -> Maybe AutoScalingGroupConfiguration
    -> AutoScalingGroupRecommendationOption)
-> Lens
     AutoScalingGroupRecommendationOption
     AutoScalingGroupRecommendationOption
     (Maybe AutoScalingGroupConfiguration)
     (Maybe AutoScalingGroupConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingGroupRecommendationOption' {Maybe AutoScalingGroupConfiguration
configuration :: Maybe AutoScalingGroupConfiguration
$sel:configuration:AutoScalingGroupRecommendationOption' :: AutoScalingGroupRecommendationOption
-> Maybe AutoScalingGroupConfiguration
configuration} -> Maybe AutoScalingGroupConfiguration
configuration) (\s :: AutoScalingGroupRecommendationOption
s@AutoScalingGroupRecommendationOption' {} Maybe AutoScalingGroupConfiguration
a -> AutoScalingGroupRecommendationOption
s {$sel:configuration:AutoScalingGroupRecommendationOption' :: Maybe AutoScalingGroupConfiguration
configuration = Maybe AutoScalingGroupConfiguration
a} :: AutoScalingGroupRecommendationOption)

-- | The rank of the Auto Scaling group recommendation option.
--
-- The top recommendation option is ranked as @1@.
autoScalingGroupRecommendationOption_rank :: Lens.Lens' AutoScalingGroupRecommendationOption (Prelude.Maybe Prelude.Int)
autoScalingGroupRecommendationOption_rank :: (Maybe Int -> f (Maybe Int))
-> AutoScalingGroupRecommendationOption
-> f AutoScalingGroupRecommendationOption
autoScalingGroupRecommendationOption_rank = (AutoScalingGroupRecommendationOption -> Maybe Int)
-> (AutoScalingGroupRecommendationOption
    -> Maybe Int -> AutoScalingGroupRecommendationOption)
-> Lens
     AutoScalingGroupRecommendationOption
     AutoScalingGroupRecommendationOption
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingGroupRecommendationOption' {Maybe Int
rank :: Maybe Int
$sel:rank:AutoScalingGroupRecommendationOption' :: AutoScalingGroupRecommendationOption -> Maybe Int
rank} -> Maybe Int
rank) (\s :: AutoScalingGroupRecommendationOption
s@AutoScalingGroupRecommendationOption' {} Maybe Int
a -> AutoScalingGroupRecommendationOption
s {$sel:rank:AutoScalingGroupRecommendationOption' :: Maybe Int
rank = Maybe Int
a} :: AutoScalingGroupRecommendationOption)

instance
  Core.FromJSON
    AutoScalingGroupRecommendationOption
  where
  parseJSON :: Value -> Parser AutoScalingGroupRecommendationOption
parseJSON =
    String
-> (Object -> Parser AutoScalingGroupRecommendationOption)
-> Value
-> Parser AutoScalingGroupRecommendationOption
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AutoScalingGroupRecommendationOption"
      ( \Object
x ->
          Maybe Double
-> Maybe [UtilizationMetric]
-> Maybe AutoScalingGroupConfiguration
-> Maybe Int
-> AutoScalingGroupRecommendationOption
AutoScalingGroupRecommendationOption'
            (Maybe Double
 -> Maybe [UtilizationMetric]
 -> Maybe AutoScalingGroupConfiguration
 -> Maybe Int
 -> AutoScalingGroupRecommendationOption)
-> Parser (Maybe Double)
-> Parser
     (Maybe [UtilizationMetric]
      -> Maybe AutoScalingGroupConfiguration
      -> Maybe Int
      -> AutoScalingGroupRecommendationOption)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"performanceRisk")
            Parser
  (Maybe [UtilizationMetric]
   -> Maybe AutoScalingGroupConfiguration
   -> Maybe Int
   -> AutoScalingGroupRecommendationOption)
-> Parser (Maybe [UtilizationMetric])
-> Parser
     (Maybe AutoScalingGroupConfiguration
      -> Maybe Int -> AutoScalingGroupRecommendationOption)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [UtilizationMetric]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"projectedUtilizationMetrics"
                            Parser (Maybe (Maybe [UtilizationMetric]))
-> Maybe [UtilizationMetric] -> Parser (Maybe [UtilizationMetric])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [UtilizationMetric]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe AutoScalingGroupConfiguration
   -> Maybe Int -> AutoScalingGroupRecommendationOption)
-> Parser (Maybe AutoScalingGroupConfiguration)
-> Parser (Maybe Int -> AutoScalingGroupRecommendationOption)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AutoScalingGroupConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"configuration")
            Parser (Maybe Int -> AutoScalingGroupRecommendationOption)
-> Parser (Maybe Int)
-> Parser AutoScalingGroupRecommendationOption
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"rank")
      )

instance
  Prelude.Hashable
    AutoScalingGroupRecommendationOption

instance
  Prelude.NFData
    AutoScalingGroupRecommendationOption