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

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

-- | The summary of rightsizing recommendations
--
-- /See:/ 'newRightsizingRecommendationSummary' smart constructor.
data RightsizingRecommendationSummary = RightsizingRecommendationSummary'
  { -- | The estimated total savings resulting from modifications, on a monthly
    -- basis.
    RightsizingRecommendationSummary -> Maybe Text
estimatedTotalMonthlySavingsAmount :: Prelude.Maybe Prelude.Text,
    -- | The currency code that Amazon Web Services used to calculate the
    -- savings.
    RightsizingRecommendationSummary -> Maybe Text
savingsCurrencyCode :: Prelude.Maybe Prelude.Text,
    -- | The savings percentage based on the recommended modifications. It\'s
    -- relative to the total On-Demand costs that are associated with these
    -- instances.
    RightsizingRecommendationSummary -> Maybe Text
savingsPercentage :: Prelude.Maybe Prelude.Text,
    -- | The total number of instance recommendations.
    RightsizingRecommendationSummary -> Maybe Text
totalRecommendationCount :: Prelude.Maybe Prelude.Text
  }
  deriving (RightsizingRecommendationSummary
-> RightsizingRecommendationSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RightsizingRecommendationSummary
-> RightsizingRecommendationSummary -> Bool
$c/= :: RightsizingRecommendationSummary
-> RightsizingRecommendationSummary -> Bool
== :: RightsizingRecommendationSummary
-> RightsizingRecommendationSummary -> Bool
$c== :: RightsizingRecommendationSummary
-> RightsizingRecommendationSummary -> Bool
Prelude.Eq, ReadPrec [RightsizingRecommendationSummary]
ReadPrec RightsizingRecommendationSummary
Int -> ReadS RightsizingRecommendationSummary
ReadS [RightsizingRecommendationSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RightsizingRecommendationSummary]
$creadListPrec :: ReadPrec [RightsizingRecommendationSummary]
readPrec :: ReadPrec RightsizingRecommendationSummary
$creadPrec :: ReadPrec RightsizingRecommendationSummary
readList :: ReadS [RightsizingRecommendationSummary]
$creadList :: ReadS [RightsizingRecommendationSummary]
readsPrec :: Int -> ReadS RightsizingRecommendationSummary
$creadsPrec :: Int -> ReadS RightsizingRecommendationSummary
Prelude.Read, Int -> RightsizingRecommendationSummary -> ShowS
[RightsizingRecommendationSummary] -> ShowS
RightsizingRecommendationSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RightsizingRecommendationSummary] -> ShowS
$cshowList :: [RightsizingRecommendationSummary] -> ShowS
show :: RightsizingRecommendationSummary -> String
$cshow :: RightsizingRecommendationSummary -> String
showsPrec :: Int -> RightsizingRecommendationSummary -> ShowS
$cshowsPrec :: Int -> RightsizingRecommendationSummary -> ShowS
Prelude.Show, forall x.
Rep RightsizingRecommendationSummary x
-> RightsizingRecommendationSummary
forall x.
RightsizingRecommendationSummary
-> Rep RightsizingRecommendationSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RightsizingRecommendationSummary x
-> RightsizingRecommendationSummary
$cfrom :: forall x.
RightsizingRecommendationSummary
-> Rep RightsizingRecommendationSummary x
Prelude.Generic)

-- |
-- Create a value of 'RightsizingRecommendationSummary' 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:
--
-- 'estimatedTotalMonthlySavingsAmount', 'rightsizingRecommendationSummary_estimatedTotalMonthlySavingsAmount' - The estimated total savings resulting from modifications, on a monthly
-- basis.
--
-- 'savingsCurrencyCode', 'rightsizingRecommendationSummary_savingsCurrencyCode' - The currency code that Amazon Web Services used to calculate the
-- savings.
--
-- 'savingsPercentage', 'rightsizingRecommendationSummary_savingsPercentage' - The savings percentage based on the recommended modifications. It\'s
-- relative to the total On-Demand costs that are associated with these
-- instances.
--
-- 'totalRecommendationCount', 'rightsizingRecommendationSummary_totalRecommendationCount' - The total number of instance recommendations.
newRightsizingRecommendationSummary ::
  RightsizingRecommendationSummary
newRightsizingRecommendationSummary :: RightsizingRecommendationSummary
newRightsizingRecommendationSummary =
  RightsizingRecommendationSummary'
    { $sel:estimatedTotalMonthlySavingsAmount:RightsizingRecommendationSummary' :: Maybe Text
estimatedTotalMonthlySavingsAmount =
        forall a. Maybe a
Prelude.Nothing,
      $sel:savingsCurrencyCode:RightsizingRecommendationSummary' :: Maybe Text
savingsCurrencyCode = forall a. Maybe a
Prelude.Nothing,
      $sel:savingsPercentage:RightsizingRecommendationSummary' :: Maybe Text
savingsPercentage = forall a. Maybe a
Prelude.Nothing,
      $sel:totalRecommendationCount:RightsizingRecommendationSummary' :: Maybe Text
totalRecommendationCount =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The estimated total savings resulting from modifications, on a monthly
-- basis.
rightsizingRecommendationSummary_estimatedTotalMonthlySavingsAmount :: Lens.Lens' RightsizingRecommendationSummary (Prelude.Maybe Prelude.Text)
rightsizingRecommendationSummary_estimatedTotalMonthlySavingsAmount :: Lens' RightsizingRecommendationSummary (Maybe Text)
rightsizingRecommendationSummary_estimatedTotalMonthlySavingsAmount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RightsizingRecommendationSummary' {Maybe Text
estimatedTotalMonthlySavingsAmount :: Maybe Text
$sel:estimatedTotalMonthlySavingsAmount:RightsizingRecommendationSummary' :: RightsizingRecommendationSummary -> Maybe Text
estimatedTotalMonthlySavingsAmount} -> Maybe Text
estimatedTotalMonthlySavingsAmount) (\s :: RightsizingRecommendationSummary
s@RightsizingRecommendationSummary' {} Maybe Text
a -> RightsizingRecommendationSummary
s {$sel:estimatedTotalMonthlySavingsAmount:RightsizingRecommendationSummary' :: Maybe Text
estimatedTotalMonthlySavingsAmount = Maybe Text
a} :: RightsizingRecommendationSummary)

-- | The currency code that Amazon Web Services used to calculate the
-- savings.
rightsizingRecommendationSummary_savingsCurrencyCode :: Lens.Lens' RightsizingRecommendationSummary (Prelude.Maybe Prelude.Text)
rightsizingRecommendationSummary_savingsCurrencyCode :: Lens' RightsizingRecommendationSummary (Maybe Text)
rightsizingRecommendationSummary_savingsCurrencyCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RightsizingRecommendationSummary' {Maybe Text
savingsCurrencyCode :: Maybe Text
$sel:savingsCurrencyCode:RightsizingRecommendationSummary' :: RightsizingRecommendationSummary -> Maybe Text
savingsCurrencyCode} -> Maybe Text
savingsCurrencyCode) (\s :: RightsizingRecommendationSummary
s@RightsizingRecommendationSummary' {} Maybe Text
a -> RightsizingRecommendationSummary
s {$sel:savingsCurrencyCode:RightsizingRecommendationSummary' :: Maybe Text
savingsCurrencyCode = Maybe Text
a} :: RightsizingRecommendationSummary)

-- | The savings percentage based on the recommended modifications. It\'s
-- relative to the total On-Demand costs that are associated with these
-- instances.
rightsizingRecommendationSummary_savingsPercentage :: Lens.Lens' RightsizingRecommendationSummary (Prelude.Maybe Prelude.Text)
rightsizingRecommendationSummary_savingsPercentage :: Lens' RightsizingRecommendationSummary (Maybe Text)
rightsizingRecommendationSummary_savingsPercentage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RightsizingRecommendationSummary' {Maybe Text
savingsPercentage :: Maybe Text
$sel:savingsPercentage:RightsizingRecommendationSummary' :: RightsizingRecommendationSummary -> Maybe Text
savingsPercentage} -> Maybe Text
savingsPercentage) (\s :: RightsizingRecommendationSummary
s@RightsizingRecommendationSummary' {} Maybe Text
a -> RightsizingRecommendationSummary
s {$sel:savingsPercentage:RightsizingRecommendationSummary' :: Maybe Text
savingsPercentage = Maybe Text
a} :: RightsizingRecommendationSummary)

-- | The total number of instance recommendations.
rightsizingRecommendationSummary_totalRecommendationCount :: Lens.Lens' RightsizingRecommendationSummary (Prelude.Maybe Prelude.Text)
rightsizingRecommendationSummary_totalRecommendationCount :: Lens' RightsizingRecommendationSummary (Maybe Text)
rightsizingRecommendationSummary_totalRecommendationCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RightsizingRecommendationSummary' {Maybe Text
totalRecommendationCount :: Maybe Text
$sel:totalRecommendationCount:RightsizingRecommendationSummary' :: RightsizingRecommendationSummary -> Maybe Text
totalRecommendationCount} -> Maybe Text
totalRecommendationCount) (\s :: RightsizingRecommendationSummary
s@RightsizingRecommendationSummary' {} Maybe Text
a -> RightsizingRecommendationSummary
s {$sel:totalRecommendationCount:RightsizingRecommendationSummary' :: Maybe Text
totalRecommendationCount = Maybe Text
a} :: RightsizingRecommendationSummary)

instance
  Data.FromJSON
    RightsizingRecommendationSummary
  where
  parseJSON :: Value -> Parser RightsizingRecommendationSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RightsizingRecommendationSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> RightsizingRecommendationSummary
RightsizingRecommendationSummary'
            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
"EstimatedTotalMonthlySavingsAmount")
            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
"SavingsCurrencyCode")
            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
"SavingsPercentage")
            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
"TotalRecommendationCount")
      )

instance
  Prelude.Hashable
    RightsizingRecommendationSummary
  where
  hashWithSalt :: Int -> RightsizingRecommendationSummary -> Int
hashWithSalt
    Int
_salt
    RightsizingRecommendationSummary' {Maybe Text
totalRecommendationCount :: Maybe Text
savingsPercentage :: Maybe Text
savingsCurrencyCode :: Maybe Text
estimatedTotalMonthlySavingsAmount :: Maybe Text
$sel:totalRecommendationCount:RightsizingRecommendationSummary' :: RightsizingRecommendationSummary -> Maybe Text
$sel:savingsPercentage:RightsizingRecommendationSummary' :: RightsizingRecommendationSummary -> Maybe Text
$sel:savingsCurrencyCode:RightsizingRecommendationSummary' :: RightsizingRecommendationSummary -> Maybe Text
$sel:estimatedTotalMonthlySavingsAmount:RightsizingRecommendationSummary' :: RightsizingRecommendationSummary -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
estimatedTotalMonthlySavingsAmount
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
savingsCurrencyCode
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
savingsPercentage
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
totalRecommendationCount

instance
  Prelude.NFData
    RightsizingRecommendationSummary
  where
  rnf :: RightsizingRecommendationSummary -> ()
rnf RightsizingRecommendationSummary' {Maybe Text
totalRecommendationCount :: Maybe Text
savingsPercentage :: Maybe Text
savingsCurrencyCode :: Maybe Text
estimatedTotalMonthlySavingsAmount :: Maybe Text
$sel:totalRecommendationCount:RightsizingRecommendationSummary' :: RightsizingRecommendationSummary -> Maybe Text
$sel:savingsPercentage:RightsizingRecommendationSummary' :: RightsizingRecommendationSummary -> Maybe Text
$sel:savingsCurrencyCode:RightsizingRecommendationSummary' :: RightsizingRecommendationSummary -> Maybe Text
$sel:estimatedTotalMonthlySavingsAmount:RightsizingRecommendationSummary' :: RightsizingRecommendationSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
estimatedTotalMonthlySavingsAmount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
savingsCurrencyCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
savingsPercentage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
totalRecommendationCount