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

import Amazonka.ComputeOptimizer.Types.CpuVendorArchitecture
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes preferences for recommendations.
--
-- /See:/ 'newRecommendationPreferences' smart constructor.
data RecommendationPreferences = RecommendationPreferences'
  { -- | Specifies the CPU vendor and architecture for Amazon EC2 instance and
    -- Auto Scaling group recommendations.
    --
    -- For example, when you specify @AWS_ARM64@ with:
    --
    -- -   A GetEC2InstanceRecommendations or
    --     GetAutoScalingGroupRecommendations request, Compute Optimizer
    --     returns recommendations that consist of Graviton2 instance types
    --     only.
    --
    -- -   A GetEC2RecommendationProjectedMetrics request, Compute Optimizer
    --     returns projected utilization metrics for Graviton2 instance type
    --     recommendations only.
    --
    -- -   A ExportEC2InstanceRecommendations or
    --     ExportAutoScalingGroupRecommendations request, Compute Optimizer
    --     exports recommendations that consist of Graviton2 instance types
    --     only.
    RecommendationPreferences -> Maybe [CpuVendorArchitecture]
cpuVendorArchitectures :: Prelude.Maybe [CpuVendorArchitecture]
  }
  deriving (RecommendationPreferences -> RecommendationPreferences -> Bool
(RecommendationPreferences -> RecommendationPreferences -> Bool)
-> (RecommendationPreferences -> RecommendationPreferences -> Bool)
-> Eq RecommendationPreferences
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecommendationPreferences -> RecommendationPreferences -> Bool
$c/= :: RecommendationPreferences -> RecommendationPreferences -> Bool
== :: RecommendationPreferences -> RecommendationPreferences -> Bool
$c== :: RecommendationPreferences -> RecommendationPreferences -> Bool
Prelude.Eq, ReadPrec [RecommendationPreferences]
ReadPrec RecommendationPreferences
Int -> ReadS RecommendationPreferences
ReadS [RecommendationPreferences]
(Int -> ReadS RecommendationPreferences)
-> ReadS [RecommendationPreferences]
-> ReadPrec RecommendationPreferences
-> ReadPrec [RecommendationPreferences]
-> Read RecommendationPreferences
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecommendationPreferences]
$creadListPrec :: ReadPrec [RecommendationPreferences]
readPrec :: ReadPrec RecommendationPreferences
$creadPrec :: ReadPrec RecommendationPreferences
readList :: ReadS [RecommendationPreferences]
$creadList :: ReadS [RecommendationPreferences]
readsPrec :: Int -> ReadS RecommendationPreferences
$creadsPrec :: Int -> ReadS RecommendationPreferences
Prelude.Read, Int -> RecommendationPreferences -> ShowS
[RecommendationPreferences] -> ShowS
RecommendationPreferences -> String
(Int -> RecommendationPreferences -> ShowS)
-> (RecommendationPreferences -> String)
-> ([RecommendationPreferences] -> ShowS)
-> Show RecommendationPreferences
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecommendationPreferences] -> ShowS
$cshowList :: [RecommendationPreferences] -> ShowS
show :: RecommendationPreferences -> String
$cshow :: RecommendationPreferences -> String
showsPrec :: Int -> RecommendationPreferences -> ShowS
$cshowsPrec :: Int -> RecommendationPreferences -> ShowS
Prelude.Show, (forall x.
 RecommendationPreferences -> Rep RecommendationPreferences x)
-> (forall x.
    Rep RecommendationPreferences x -> RecommendationPreferences)
-> Generic RecommendationPreferences
forall x.
Rep RecommendationPreferences x -> RecommendationPreferences
forall x.
RecommendationPreferences -> Rep RecommendationPreferences x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RecommendationPreferences x -> RecommendationPreferences
$cfrom :: forall x.
RecommendationPreferences -> Rep RecommendationPreferences x
Prelude.Generic)

-- |
-- Create a value of 'RecommendationPreferences' 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:
--
-- 'cpuVendorArchitectures', 'recommendationPreferences_cpuVendorArchitectures' - Specifies the CPU vendor and architecture for Amazon EC2 instance and
-- Auto Scaling group recommendations.
--
-- For example, when you specify @AWS_ARM64@ with:
--
-- -   A GetEC2InstanceRecommendations or
--     GetAutoScalingGroupRecommendations request, Compute Optimizer
--     returns recommendations that consist of Graviton2 instance types
--     only.
--
-- -   A GetEC2RecommendationProjectedMetrics request, Compute Optimizer
--     returns projected utilization metrics for Graviton2 instance type
--     recommendations only.
--
-- -   A ExportEC2InstanceRecommendations or
--     ExportAutoScalingGroupRecommendations request, Compute Optimizer
--     exports recommendations that consist of Graviton2 instance types
--     only.
newRecommendationPreferences ::
  RecommendationPreferences
newRecommendationPreferences :: RecommendationPreferences
newRecommendationPreferences =
  RecommendationPreferences' :: Maybe [CpuVendorArchitecture] -> RecommendationPreferences
RecommendationPreferences'
    { $sel:cpuVendorArchitectures:RecommendationPreferences' :: Maybe [CpuVendorArchitecture]
cpuVendorArchitectures =
        Maybe [CpuVendorArchitecture]
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the CPU vendor and architecture for Amazon EC2 instance and
-- Auto Scaling group recommendations.
--
-- For example, when you specify @AWS_ARM64@ with:
--
-- -   A GetEC2InstanceRecommendations or
--     GetAutoScalingGroupRecommendations request, Compute Optimizer
--     returns recommendations that consist of Graviton2 instance types
--     only.
--
-- -   A GetEC2RecommendationProjectedMetrics request, Compute Optimizer
--     returns projected utilization metrics for Graviton2 instance type
--     recommendations only.
--
-- -   A ExportEC2InstanceRecommendations or
--     ExportAutoScalingGroupRecommendations request, Compute Optimizer
--     exports recommendations that consist of Graviton2 instance types
--     only.
recommendationPreferences_cpuVendorArchitectures :: Lens.Lens' RecommendationPreferences (Prelude.Maybe [CpuVendorArchitecture])
recommendationPreferences_cpuVendorArchitectures :: (Maybe [CpuVendorArchitecture]
 -> f (Maybe [CpuVendorArchitecture]))
-> RecommendationPreferences -> f RecommendationPreferences
recommendationPreferences_cpuVendorArchitectures = (RecommendationPreferences -> Maybe [CpuVendorArchitecture])
-> (RecommendationPreferences
    -> Maybe [CpuVendorArchitecture] -> RecommendationPreferences)
-> Lens
     RecommendationPreferences
     RecommendationPreferences
     (Maybe [CpuVendorArchitecture])
     (Maybe [CpuVendorArchitecture])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationPreferences' {Maybe [CpuVendorArchitecture]
cpuVendorArchitectures :: Maybe [CpuVendorArchitecture]
$sel:cpuVendorArchitectures:RecommendationPreferences' :: RecommendationPreferences -> Maybe [CpuVendorArchitecture]
cpuVendorArchitectures} -> Maybe [CpuVendorArchitecture]
cpuVendorArchitectures) (\s :: RecommendationPreferences
s@RecommendationPreferences' {} Maybe [CpuVendorArchitecture]
a -> RecommendationPreferences
s {$sel:cpuVendorArchitectures:RecommendationPreferences' :: Maybe [CpuVendorArchitecture]
cpuVendorArchitectures = Maybe [CpuVendorArchitecture]
a} :: RecommendationPreferences) ((Maybe [CpuVendorArchitecture]
  -> f (Maybe [CpuVendorArchitecture]))
 -> RecommendationPreferences -> f RecommendationPreferences)
-> ((Maybe [CpuVendorArchitecture]
     -> f (Maybe [CpuVendorArchitecture]))
    -> Maybe [CpuVendorArchitecture]
    -> f (Maybe [CpuVendorArchitecture]))
-> (Maybe [CpuVendorArchitecture]
    -> f (Maybe [CpuVendorArchitecture]))
-> RecommendationPreferences
-> f RecommendationPreferences
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CpuVendorArchitecture]
  [CpuVendorArchitecture]
  [CpuVendorArchitecture]
  [CpuVendorArchitecture]
-> Iso
     (Maybe [CpuVendorArchitecture])
     (Maybe [CpuVendorArchitecture])
     (Maybe [CpuVendorArchitecture])
     (Maybe [CpuVendorArchitecture])
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
  [CpuVendorArchitecture]
  [CpuVendorArchitecture]
  [CpuVendorArchitecture]
  [CpuVendorArchitecture]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable RecommendationPreferences

instance Prelude.NFData RecommendationPreferences

instance Core.ToJSON RecommendationPreferences where
  toJSON :: RecommendationPreferences -> Value
toJSON RecommendationPreferences' {Maybe [CpuVendorArchitecture]
cpuVendorArchitectures :: Maybe [CpuVendorArchitecture]
$sel:cpuVendorArchitectures:RecommendationPreferences' :: RecommendationPreferences -> Maybe [CpuVendorArchitecture]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"cpuVendorArchitectures" Text -> [CpuVendorArchitecture] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([CpuVendorArchitecture] -> Pair)
-> Maybe [CpuVendorArchitecture] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CpuVendorArchitecture]
cpuVendorArchitectures
          ]
      )