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

import Amazonka.ComputeOptimizer.Types.EnhancedInfrastructureMetrics
import Amazonka.ComputeOptimizer.Types.ExternalMetricsPreference
import Amazonka.ComputeOptimizer.Types.InferredWorkloadTypesPreference
import Amazonka.ComputeOptimizer.Types.ResourceType
import Amazonka.ComputeOptimizer.Types.Scope
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 recommendation preference.
--
-- /See:/ 'newRecommendationPreferencesDetail' smart constructor.
data RecommendationPreferencesDetail = RecommendationPreferencesDetail'
  { -- | The status of the enhanced infrastructure metrics recommendation
    -- preference.
    --
    -- When the recommendations page is refreshed, a status of @Active@
    -- confirms that the preference is applied to the recommendations, and a
    -- status of @Inactive@ confirms that the preference isn\'t yet applied to
    -- recommendations.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Enhanced infrastructure metrics>
    -- in the /Compute Optimizer User Guide/.
    RecommendationPreferencesDetail
-> Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics :: Prelude.Maybe EnhancedInfrastructureMetrics,
    -- | An object that describes the external metrics recommendation preference.
    --
    -- If the preference is applied in the latest recommendation refresh, an
    -- object with a valid @source@ value appears in the response. If the
    -- preference isn\'t applied to the recommendations already, then this
    -- object doesn\'t appear in the response.
    RecommendationPreferencesDetail -> Maybe ExternalMetricsPreference
externalMetricsPreference :: Prelude.Maybe ExternalMetricsPreference,
    -- | The status of the inferred workload types recommendation preference.
    --
    -- When the recommendations page is refreshed, a status of @Active@
    -- confirms that the preference is applied to the recommendations, and a
    -- status of @Inactive@ confirms that the preference isn\'t yet applied to
    -- recommendations.
    RecommendationPreferencesDetail
-> Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes :: Prelude.Maybe InferredWorkloadTypesPreference,
    -- | The target resource type of the recommendation preference to create.
    --
    -- The @Ec2Instance@ option encompasses standalone instances and instances
    -- that are part of Auto Scaling groups. The @AutoScalingGroup@ option
    -- encompasses only instances that are part of an Auto Scaling group.
    RecommendationPreferencesDetail -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
    -- | An object that describes the scope of the recommendation preference.
    --
    -- Recommendation preferences can be created at the organization level (for
    -- management accounts of an organization only), account level, and
    -- resource level. For more information, see
    -- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Activating enhanced infrastructure metrics>
    -- in the /Compute Optimizer User Guide/.
    RecommendationPreferencesDetail -> Maybe Scope
scope :: Prelude.Maybe Scope
  }
  deriving (RecommendationPreferencesDetail
-> RecommendationPreferencesDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecommendationPreferencesDetail
-> RecommendationPreferencesDetail -> Bool
$c/= :: RecommendationPreferencesDetail
-> RecommendationPreferencesDetail -> Bool
== :: RecommendationPreferencesDetail
-> RecommendationPreferencesDetail -> Bool
$c== :: RecommendationPreferencesDetail
-> RecommendationPreferencesDetail -> Bool
Prelude.Eq, ReadPrec [RecommendationPreferencesDetail]
ReadPrec RecommendationPreferencesDetail
Int -> ReadS RecommendationPreferencesDetail
ReadS [RecommendationPreferencesDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecommendationPreferencesDetail]
$creadListPrec :: ReadPrec [RecommendationPreferencesDetail]
readPrec :: ReadPrec RecommendationPreferencesDetail
$creadPrec :: ReadPrec RecommendationPreferencesDetail
readList :: ReadS [RecommendationPreferencesDetail]
$creadList :: ReadS [RecommendationPreferencesDetail]
readsPrec :: Int -> ReadS RecommendationPreferencesDetail
$creadsPrec :: Int -> ReadS RecommendationPreferencesDetail
Prelude.Read, Int -> RecommendationPreferencesDetail -> ShowS
[RecommendationPreferencesDetail] -> ShowS
RecommendationPreferencesDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecommendationPreferencesDetail] -> ShowS
$cshowList :: [RecommendationPreferencesDetail] -> ShowS
show :: RecommendationPreferencesDetail -> String
$cshow :: RecommendationPreferencesDetail -> String
showsPrec :: Int -> RecommendationPreferencesDetail -> ShowS
$cshowsPrec :: Int -> RecommendationPreferencesDetail -> ShowS
Prelude.Show, forall x.
Rep RecommendationPreferencesDetail x
-> RecommendationPreferencesDetail
forall x.
RecommendationPreferencesDetail
-> Rep RecommendationPreferencesDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RecommendationPreferencesDetail x
-> RecommendationPreferencesDetail
$cfrom :: forall x.
RecommendationPreferencesDetail
-> Rep RecommendationPreferencesDetail x
Prelude.Generic)

-- |
-- Create a value of 'RecommendationPreferencesDetail' 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:
--
-- 'enhancedInfrastructureMetrics', 'recommendationPreferencesDetail_enhancedInfrastructureMetrics' - The status of the enhanced infrastructure metrics recommendation
-- preference.
--
-- When the recommendations page is refreshed, a status of @Active@
-- confirms that the preference is applied to the recommendations, and a
-- status of @Inactive@ confirms that the preference isn\'t yet applied to
-- recommendations.
--
-- For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Enhanced infrastructure metrics>
-- in the /Compute Optimizer User Guide/.
--
-- 'externalMetricsPreference', 'recommendationPreferencesDetail_externalMetricsPreference' - An object that describes the external metrics recommendation preference.
--
-- If the preference is applied in the latest recommendation refresh, an
-- object with a valid @source@ value appears in the response. If the
-- preference isn\'t applied to the recommendations already, then this
-- object doesn\'t appear in the response.
--
-- 'inferredWorkloadTypes', 'recommendationPreferencesDetail_inferredWorkloadTypes' - The status of the inferred workload types recommendation preference.
--
-- When the recommendations page is refreshed, a status of @Active@
-- confirms that the preference is applied to the recommendations, and a
-- status of @Inactive@ confirms that the preference isn\'t yet applied to
-- recommendations.
--
-- 'resourceType', 'recommendationPreferencesDetail_resourceType' - The target resource type of the recommendation preference to create.
--
-- The @Ec2Instance@ option encompasses standalone instances and instances
-- that are part of Auto Scaling groups. The @AutoScalingGroup@ option
-- encompasses only instances that are part of an Auto Scaling group.
--
-- 'scope', 'recommendationPreferencesDetail_scope' - An object that describes the scope of the recommendation preference.
--
-- Recommendation preferences can be created at the organization level (for
-- management accounts of an organization only), account level, and
-- resource level. For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Activating enhanced infrastructure metrics>
-- in the /Compute Optimizer User Guide/.
newRecommendationPreferencesDetail ::
  RecommendationPreferencesDetail
newRecommendationPreferencesDetail :: RecommendationPreferencesDetail
newRecommendationPreferencesDetail =
  RecommendationPreferencesDetail'
    { $sel:enhancedInfrastructureMetrics:RecommendationPreferencesDetail' :: Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics =
        forall a. Maybe a
Prelude.Nothing,
      $sel:externalMetricsPreference:RecommendationPreferencesDetail' :: Maybe ExternalMetricsPreference
externalMetricsPreference =
        forall a. Maybe a
Prelude.Nothing,
      $sel:inferredWorkloadTypes:RecommendationPreferencesDetail' :: Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:RecommendationPreferencesDetail' :: Maybe ResourceType
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:scope:RecommendationPreferencesDetail' :: Maybe Scope
scope = forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the enhanced infrastructure metrics recommendation
-- preference.
--
-- When the recommendations page is refreshed, a status of @Active@
-- confirms that the preference is applied to the recommendations, and a
-- status of @Inactive@ confirms that the preference isn\'t yet applied to
-- recommendations.
--
-- For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Enhanced infrastructure metrics>
-- in the /Compute Optimizer User Guide/.
recommendationPreferencesDetail_enhancedInfrastructureMetrics :: Lens.Lens' RecommendationPreferencesDetail (Prelude.Maybe EnhancedInfrastructureMetrics)
recommendationPreferencesDetail_enhancedInfrastructureMetrics :: Lens'
  RecommendationPreferencesDetail
  (Maybe EnhancedInfrastructureMetrics)
recommendationPreferencesDetail_enhancedInfrastructureMetrics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationPreferencesDetail' {Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics :: Maybe EnhancedInfrastructureMetrics
$sel:enhancedInfrastructureMetrics:RecommendationPreferencesDetail' :: RecommendationPreferencesDetail
-> Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics} -> Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics) (\s :: RecommendationPreferencesDetail
s@RecommendationPreferencesDetail' {} Maybe EnhancedInfrastructureMetrics
a -> RecommendationPreferencesDetail
s {$sel:enhancedInfrastructureMetrics:RecommendationPreferencesDetail' :: Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics = Maybe EnhancedInfrastructureMetrics
a} :: RecommendationPreferencesDetail)

-- | An object that describes the external metrics recommendation preference.
--
-- If the preference is applied in the latest recommendation refresh, an
-- object with a valid @source@ value appears in the response. If the
-- preference isn\'t applied to the recommendations already, then this
-- object doesn\'t appear in the response.
recommendationPreferencesDetail_externalMetricsPreference :: Lens.Lens' RecommendationPreferencesDetail (Prelude.Maybe ExternalMetricsPreference)
recommendationPreferencesDetail_externalMetricsPreference :: Lens'
  RecommendationPreferencesDetail (Maybe ExternalMetricsPreference)
recommendationPreferencesDetail_externalMetricsPreference = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationPreferencesDetail' {Maybe ExternalMetricsPreference
externalMetricsPreference :: Maybe ExternalMetricsPreference
$sel:externalMetricsPreference:RecommendationPreferencesDetail' :: RecommendationPreferencesDetail -> Maybe ExternalMetricsPreference
externalMetricsPreference} -> Maybe ExternalMetricsPreference
externalMetricsPreference) (\s :: RecommendationPreferencesDetail
s@RecommendationPreferencesDetail' {} Maybe ExternalMetricsPreference
a -> RecommendationPreferencesDetail
s {$sel:externalMetricsPreference:RecommendationPreferencesDetail' :: Maybe ExternalMetricsPreference
externalMetricsPreference = Maybe ExternalMetricsPreference
a} :: RecommendationPreferencesDetail)

-- | The status of the inferred workload types recommendation preference.
--
-- When the recommendations page is refreshed, a status of @Active@
-- confirms that the preference is applied to the recommendations, and a
-- status of @Inactive@ confirms that the preference isn\'t yet applied to
-- recommendations.
recommendationPreferencesDetail_inferredWorkloadTypes :: Lens.Lens' RecommendationPreferencesDetail (Prelude.Maybe InferredWorkloadTypesPreference)
recommendationPreferencesDetail_inferredWorkloadTypes :: Lens'
  RecommendationPreferencesDetail
  (Maybe InferredWorkloadTypesPreference)
recommendationPreferencesDetail_inferredWorkloadTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationPreferencesDetail' {Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes :: Maybe InferredWorkloadTypesPreference
$sel:inferredWorkloadTypes:RecommendationPreferencesDetail' :: RecommendationPreferencesDetail
-> Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes} -> Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes) (\s :: RecommendationPreferencesDetail
s@RecommendationPreferencesDetail' {} Maybe InferredWorkloadTypesPreference
a -> RecommendationPreferencesDetail
s {$sel:inferredWorkloadTypes:RecommendationPreferencesDetail' :: Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes = Maybe InferredWorkloadTypesPreference
a} :: RecommendationPreferencesDetail)

-- | The target resource type of the recommendation preference to create.
--
-- The @Ec2Instance@ option encompasses standalone instances and instances
-- that are part of Auto Scaling groups. The @AutoScalingGroup@ option
-- encompasses only instances that are part of an Auto Scaling group.
recommendationPreferencesDetail_resourceType :: Lens.Lens' RecommendationPreferencesDetail (Prelude.Maybe ResourceType)
recommendationPreferencesDetail_resourceType :: Lens' RecommendationPreferencesDetail (Maybe ResourceType)
recommendationPreferencesDetail_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationPreferencesDetail' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:RecommendationPreferencesDetail' :: RecommendationPreferencesDetail -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: RecommendationPreferencesDetail
s@RecommendationPreferencesDetail' {} Maybe ResourceType
a -> RecommendationPreferencesDetail
s {$sel:resourceType:RecommendationPreferencesDetail' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: RecommendationPreferencesDetail)

-- | An object that describes the scope of the recommendation preference.
--
-- Recommendation preferences can be created at the organization level (for
-- management accounts of an organization only), account level, and
-- resource level. For more information, see
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html Activating enhanced infrastructure metrics>
-- in the /Compute Optimizer User Guide/.
recommendationPreferencesDetail_scope :: Lens.Lens' RecommendationPreferencesDetail (Prelude.Maybe Scope)
recommendationPreferencesDetail_scope :: Lens' RecommendationPreferencesDetail (Maybe Scope)
recommendationPreferencesDetail_scope = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationPreferencesDetail' {Maybe Scope
scope :: Maybe Scope
$sel:scope:RecommendationPreferencesDetail' :: RecommendationPreferencesDetail -> Maybe Scope
scope} -> Maybe Scope
scope) (\s :: RecommendationPreferencesDetail
s@RecommendationPreferencesDetail' {} Maybe Scope
a -> RecommendationPreferencesDetail
s {$sel:scope:RecommendationPreferencesDetail' :: Maybe Scope
scope = Maybe Scope
a} :: RecommendationPreferencesDetail)

instance
  Data.FromJSON
    RecommendationPreferencesDetail
  where
  parseJSON :: Value -> Parser RecommendationPreferencesDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RecommendationPreferencesDetail"
      ( \Object
x ->
          Maybe EnhancedInfrastructureMetrics
-> Maybe ExternalMetricsPreference
-> Maybe InferredWorkloadTypesPreference
-> Maybe ResourceType
-> Maybe Scope
-> RecommendationPreferencesDetail
RecommendationPreferencesDetail'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"enhancedInfrastructureMetrics")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"externalMetricsPreference")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"inferredWorkloadTypes")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"resourceType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"scope")
      )

instance
  Prelude.Hashable
    RecommendationPreferencesDetail
  where
  hashWithSalt :: Int -> RecommendationPreferencesDetail -> Int
hashWithSalt
    Int
_salt
    RecommendationPreferencesDetail' {Maybe EnhancedInfrastructureMetrics
Maybe ExternalMetricsPreference
Maybe InferredWorkloadTypesPreference
Maybe ResourceType
Maybe Scope
scope :: Maybe Scope
resourceType :: Maybe ResourceType
inferredWorkloadTypes :: Maybe InferredWorkloadTypesPreference
externalMetricsPreference :: Maybe ExternalMetricsPreference
enhancedInfrastructureMetrics :: Maybe EnhancedInfrastructureMetrics
$sel:scope:RecommendationPreferencesDetail' :: RecommendationPreferencesDetail -> Maybe Scope
$sel:resourceType:RecommendationPreferencesDetail' :: RecommendationPreferencesDetail -> Maybe ResourceType
$sel:inferredWorkloadTypes:RecommendationPreferencesDetail' :: RecommendationPreferencesDetail
-> Maybe InferredWorkloadTypesPreference
$sel:externalMetricsPreference:RecommendationPreferencesDetail' :: RecommendationPreferencesDetail -> Maybe ExternalMetricsPreference
$sel:enhancedInfrastructureMetrics:RecommendationPreferencesDetail' :: RecommendationPreferencesDetail
-> Maybe EnhancedInfrastructureMetrics
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExternalMetricsPreference
externalMetricsPreference
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceType
resourceType
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Scope
scope

instance
  Prelude.NFData
    RecommendationPreferencesDetail
  where
  rnf :: RecommendationPreferencesDetail -> ()
rnf RecommendationPreferencesDetail' {Maybe EnhancedInfrastructureMetrics
Maybe ExternalMetricsPreference
Maybe InferredWorkloadTypesPreference
Maybe ResourceType
Maybe Scope
scope :: Maybe Scope
resourceType :: Maybe ResourceType
inferredWorkloadTypes :: Maybe InferredWorkloadTypesPreference
externalMetricsPreference :: Maybe ExternalMetricsPreference
enhancedInfrastructureMetrics :: Maybe EnhancedInfrastructureMetrics
$sel:scope:RecommendationPreferencesDetail' :: RecommendationPreferencesDetail -> Maybe Scope
$sel:resourceType:RecommendationPreferencesDetail' :: RecommendationPreferencesDetail -> Maybe ResourceType
$sel:inferredWorkloadTypes:RecommendationPreferencesDetail' :: RecommendationPreferencesDetail
-> Maybe InferredWorkloadTypesPreference
$sel:externalMetricsPreference:RecommendationPreferencesDetail' :: RecommendationPreferencesDetail -> Maybe ExternalMetricsPreference
$sel:enhancedInfrastructureMetrics:RecommendationPreferencesDetail' :: RecommendationPreferencesDetail
-> Maybe EnhancedInfrastructureMetrics
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe EnhancedInfrastructureMetrics
enhancedInfrastructureMetrics
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ExternalMetricsPreference
externalMetricsPreference
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InferredWorkloadTypesPreference
inferredWorkloadTypes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceType
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Scope
scope