{-# 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.CostExplorer.Types.RightsizingRecommendationConfiguration
-- 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.CostExplorer.Types.RightsizingRecommendationConfiguration where

import qualified Amazonka.Core as Core
import Amazonka.CostExplorer.Types.RecommendationTarget
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | You can use @RightsizingRecommendationConfiguration@ to customize
-- recommendations across two attributes. You can choose to view
-- recommendations for instances within the same instance families or
-- across different instance families. You can also choose to view your
-- estimated savings that are associated with recommendations with
-- consideration of existing Savings Plans or RI benefits, or neither.
--
-- /See:/ 'newRightsizingRecommendationConfiguration' smart constructor.
data RightsizingRecommendationConfiguration = RightsizingRecommendationConfiguration'
  { -- | The option to see recommendations within the same instance family or
    -- recommendations for instances across other families. The default value
    -- is @SAME_INSTANCE_FAMILY@.
    RightsizingRecommendationConfiguration -> RecommendationTarget
recommendationTarget :: RecommendationTarget,
    -- | The option to consider RI or Savings Plans discount benefits in your
    -- savings calculation. The default value is @TRUE@.
    RightsizingRecommendationConfiguration -> Bool
benefitsConsidered :: Prelude.Bool
  }
  deriving (RightsizingRecommendationConfiguration
-> RightsizingRecommendationConfiguration -> Bool
(RightsizingRecommendationConfiguration
 -> RightsizingRecommendationConfiguration -> Bool)
-> (RightsizingRecommendationConfiguration
    -> RightsizingRecommendationConfiguration -> Bool)
-> Eq RightsizingRecommendationConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RightsizingRecommendationConfiguration
-> RightsizingRecommendationConfiguration -> Bool
$c/= :: RightsizingRecommendationConfiguration
-> RightsizingRecommendationConfiguration -> Bool
== :: RightsizingRecommendationConfiguration
-> RightsizingRecommendationConfiguration -> Bool
$c== :: RightsizingRecommendationConfiguration
-> RightsizingRecommendationConfiguration -> Bool
Prelude.Eq, ReadPrec [RightsizingRecommendationConfiguration]
ReadPrec RightsizingRecommendationConfiguration
Int -> ReadS RightsizingRecommendationConfiguration
ReadS [RightsizingRecommendationConfiguration]
(Int -> ReadS RightsizingRecommendationConfiguration)
-> ReadS [RightsizingRecommendationConfiguration]
-> ReadPrec RightsizingRecommendationConfiguration
-> ReadPrec [RightsizingRecommendationConfiguration]
-> Read RightsizingRecommendationConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RightsizingRecommendationConfiguration]
$creadListPrec :: ReadPrec [RightsizingRecommendationConfiguration]
readPrec :: ReadPrec RightsizingRecommendationConfiguration
$creadPrec :: ReadPrec RightsizingRecommendationConfiguration
readList :: ReadS [RightsizingRecommendationConfiguration]
$creadList :: ReadS [RightsizingRecommendationConfiguration]
readsPrec :: Int -> ReadS RightsizingRecommendationConfiguration
$creadsPrec :: Int -> ReadS RightsizingRecommendationConfiguration
Prelude.Read, Int -> RightsizingRecommendationConfiguration -> ShowS
[RightsizingRecommendationConfiguration] -> ShowS
RightsizingRecommendationConfiguration -> String
(Int -> RightsizingRecommendationConfiguration -> ShowS)
-> (RightsizingRecommendationConfiguration -> String)
-> ([RightsizingRecommendationConfiguration] -> ShowS)
-> Show RightsizingRecommendationConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RightsizingRecommendationConfiguration] -> ShowS
$cshowList :: [RightsizingRecommendationConfiguration] -> ShowS
show :: RightsizingRecommendationConfiguration -> String
$cshow :: RightsizingRecommendationConfiguration -> String
showsPrec :: Int -> RightsizingRecommendationConfiguration -> ShowS
$cshowsPrec :: Int -> RightsizingRecommendationConfiguration -> ShowS
Prelude.Show, (forall x.
 RightsizingRecommendationConfiguration
 -> Rep RightsizingRecommendationConfiguration x)
-> (forall x.
    Rep RightsizingRecommendationConfiguration x
    -> RightsizingRecommendationConfiguration)
-> Generic RightsizingRecommendationConfiguration
forall x.
Rep RightsizingRecommendationConfiguration x
-> RightsizingRecommendationConfiguration
forall x.
RightsizingRecommendationConfiguration
-> Rep RightsizingRecommendationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RightsizingRecommendationConfiguration x
-> RightsizingRecommendationConfiguration
$cfrom :: forall x.
RightsizingRecommendationConfiguration
-> Rep RightsizingRecommendationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'RightsizingRecommendationConfiguration' 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:
--
-- 'recommendationTarget', 'rightsizingRecommendationConfiguration_recommendationTarget' - The option to see recommendations within the same instance family or
-- recommendations for instances across other families. The default value
-- is @SAME_INSTANCE_FAMILY@.
--
-- 'benefitsConsidered', 'rightsizingRecommendationConfiguration_benefitsConsidered' - The option to consider RI or Savings Plans discount benefits in your
-- savings calculation. The default value is @TRUE@.
newRightsizingRecommendationConfiguration ::
  -- | 'recommendationTarget'
  RecommendationTarget ->
  -- | 'benefitsConsidered'
  Prelude.Bool ->
  RightsizingRecommendationConfiguration
newRightsizingRecommendationConfiguration :: RecommendationTarget
-> Bool -> RightsizingRecommendationConfiguration
newRightsizingRecommendationConfiguration
  RecommendationTarget
pRecommendationTarget_
  Bool
pBenefitsConsidered_ =
    RightsizingRecommendationConfiguration' :: RecommendationTarget
-> Bool -> RightsizingRecommendationConfiguration
RightsizingRecommendationConfiguration'
      { $sel:recommendationTarget:RightsizingRecommendationConfiguration' :: RecommendationTarget
recommendationTarget =
          RecommendationTarget
pRecommendationTarget_,
        $sel:benefitsConsidered:RightsizingRecommendationConfiguration' :: Bool
benefitsConsidered =
          Bool
pBenefitsConsidered_
      }

-- | The option to see recommendations within the same instance family or
-- recommendations for instances across other families. The default value
-- is @SAME_INSTANCE_FAMILY@.
rightsizingRecommendationConfiguration_recommendationTarget :: Lens.Lens' RightsizingRecommendationConfiguration RecommendationTarget
rightsizingRecommendationConfiguration_recommendationTarget :: (RecommendationTarget -> f RecommendationTarget)
-> RightsizingRecommendationConfiguration
-> f RightsizingRecommendationConfiguration
rightsizingRecommendationConfiguration_recommendationTarget = (RightsizingRecommendationConfiguration -> RecommendationTarget)
-> (RightsizingRecommendationConfiguration
    -> RecommendationTarget -> RightsizingRecommendationConfiguration)
-> Lens
     RightsizingRecommendationConfiguration
     RightsizingRecommendationConfiguration
     RecommendationTarget
     RecommendationTarget
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RightsizingRecommendationConfiguration' {RecommendationTarget
recommendationTarget :: RecommendationTarget
$sel:recommendationTarget:RightsizingRecommendationConfiguration' :: RightsizingRecommendationConfiguration -> RecommendationTarget
recommendationTarget} -> RecommendationTarget
recommendationTarget) (\s :: RightsizingRecommendationConfiguration
s@RightsizingRecommendationConfiguration' {} RecommendationTarget
a -> RightsizingRecommendationConfiguration
s {$sel:recommendationTarget:RightsizingRecommendationConfiguration' :: RecommendationTarget
recommendationTarget = RecommendationTarget
a} :: RightsizingRecommendationConfiguration)

-- | The option to consider RI or Savings Plans discount benefits in your
-- savings calculation. The default value is @TRUE@.
rightsizingRecommendationConfiguration_benefitsConsidered :: Lens.Lens' RightsizingRecommendationConfiguration Prelude.Bool
rightsizingRecommendationConfiguration_benefitsConsidered :: (Bool -> f Bool)
-> RightsizingRecommendationConfiguration
-> f RightsizingRecommendationConfiguration
rightsizingRecommendationConfiguration_benefitsConsidered = (RightsizingRecommendationConfiguration -> Bool)
-> (RightsizingRecommendationConfiguration
    -> Bool -> RightsizingRecommendationConfiguration)
-> Lens
     RightsizingRecommendationConfiguration
     RightsizingRecommendationConfiguration
     Bool
     Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RightsizingRecommendationConfiguration' {Bool
benefitsConsidered :: Bool
$sel:benefitsConsidered:RightsizingRecommendationConfiguration' :: RightsizingRecommendationConfiguration -> Bool
benefitsConsidered} -> Bool
benefitsConsidered) (\s :: RightsizingRecommendationConfiguration
s@RightsizingRecommendationConfiguration' {} Bool
a -> RightsizingRecommendationConfiguration
s {$sel:benefitsConsidered:RightsizingRecommendationConfiguration' :: Bool
benefitsConsidered = Bool
a} :: RightsizingRecommendationConfiguration)

instance
  Core.FromJSON
    RightsizingRecommendationConfiguration
  where
  parseJSON :: Value -> Parser RightsizingRecommendationConfiguration
parseJSON =
    String
-> (Object -> Parser RightsizingRecommendationConfiguration)
-> Value
-> Parser RightsizingRecommendationConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RightsizingRecommendationConfiguration"
      ( \Object
x ->
          RecommendationTarget
-> Bool -> RightsizingRecommendationConfiguration
RightsizingRecommendationConfiguration'
            (RecommendationTarget
 -> Bool -> RightsizingRecommendationConfiguration)
-> Parser RecommendationTarget
-> Parser (Bool -> RightsizingRecommendationConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser RecommendationTarget
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RecommendationTarget")
            Parser (Bool -> RightsizingRecommendationConfiguration)
-> Parser Bool -> Parser RightsizingRecommendationConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"BenefitsConsidered")
      )

instance
  Prelude.Hashable
    RightsizingRecommendationConfiguration

instance
  Prelude.NFData
    RightsizingRecommendationConfiguration

instance
  Core.ToJSON
    RightsizingRecommendationConfiguration
  where
  toJSON :: RightsizingRecommendationConfiguration -> Value
toJSON RightsizingRecommendationConfiguration' {Bool
RecommendationTarget
benefitsConsidered :: Bool
recommendationTarget :: RecommendationTarget
$sel:benefitsConsidered:RightsizingRecommendationConfiguration' :: RightsizingRecommendationConfiguration -> Bool
$sel:recommendationTarget:RightsizingRecommendationConfiguration' :: RightsizingRecommendationConfiguration -> RecommendationTarget
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"RecommendationTarget"
                  Text -> RecommendationTarget -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RecommendationTarget
recommendationTarget
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"BenefitsConsidered" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
benefitsConsidered)
          ]
      )