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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The summary of rightsizing recommendations
--
-- /See:/ 'newRightsizingRecommendationSummary' smart constructor.
data RightsizingRecommendationSummary = 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 -> Maybe Text
savingsPercentage :: 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 total number of instance recommendations.
    RightsizingRecommendationSummary -> Maybe Text
totalRecommendationCount :: Prelude.Maybe Prelude.Text,
    -- | The estimated total savings resulting from modifications, on a monthly
    -- basis.
    RightsizingRecommendationSummary -> Maybe Text
estimatedTotalMonthlySavingsAmount :: Prelude.Maybe Prelude.Text
  }
  deriving (RightsizingRecommendationSummary
-> RightsizingRecommendationSummary -> Bool
(RightsizingRecommendationSummary
 -> RightsizingRecommendationSummary -> Bool)
-> (RightsizingRecommendationSummary
    -> RightsizingRecommendationSummary -> Bool)
-> Eq RightsizingRecommendationSummary
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]
(Int -> ReadS RightsizingRecommendationSummary)
-> ReadS [RightsizingRecommendationSummary]
-> ReadPrec RightsizingRecommendationSummary
-> ReadPrec [RightsizingRecommendationSummary]
-> Read 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
(Int -> RightsizingRecommendationSummary -> ShowS)
-> (RightsizingRecommendationSummary -> String)
-> ([RightsizingRecommendationSummary] -> ShowS)
-> Show RightsizingRecommendationSummary
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.
 RightsizingRecommendationSummary
 -> Rep RightsizingRecommendationSummary x)
-> (forall x.
    Rep RightsizingRecommendationSummary x
    -> RightsizingRecommendationSummary)
-> Generic RightsizingRecommendationSummary
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:
--
-- '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.
--
-- 'savingsCurrencyCode', 'rightsizingRecommendationSummary_savingsCurrencyCode' - The currency code that Amazon Web Services used to calculate the
-- savings.
--
-- 'totalRecommendationCount', 'rightsizingRecommendationSummary_totalRecommendationCount' - The total number of instance recommendations.
--
-- 'estimatedTotalMonthlySavingsAmount', 'rightsizingRecommendationSummary_estimatedTotalMonthlySavingsAmount' - The estimated total savings resulting from modifications, on a monthly
-- basis.
newRightsizingRecommendationSummary ::
  RightsizingRecommendationSummary
newRightsizingRecommendationSummary :: RightsizingRecommendationSummary
newRightsizingRecommendationSummary =
  RightsizingRecommendationSummary' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> RightsizingRecommendationSummary
RightsizingRecommendationSummary'
    { $sel:savingsPercentage:RightsizingRecommendationSummary' :: Maybe Text
savingsPercentage =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:savingsCurrencyCode:RightsizingRecommendationSummary' :: Maybe Text
savingsCurrencyCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:totalRecommendationCount:RightsizingRecommendationSummary' :: Maybe Text
totalRecommendationCount =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:estimatedTotalMonthlySavingsAmount:RightsizingRecommendationSummary' :: Maybe Text
estimatedTotalMonthlySavingsAmount =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> RightsizingRecommendationSummary
-> f RightsizingRecommendationSummary
rightsizingRecommendationSummary_savingsPercentage = (RightsizingRecommendationSummary -> Maybe Text)
-> (RightsizingRecommendationSummary
    -> Maybe Text -> RightsizingRecommendationSummary)
-> Lens
     RightsizingRecommendationSummary
     RightsizingRecommendationSummary
     (Maybe Text)
     (Maybe Text)
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 currency code that Amazon Web Services used to calculate the
-- savings.
rightsizingRecommendationSummary_savingsCurrencyCode :: Lens.Lens' RightsizingRecommendationSummary (Prelude.Maybe Prelude.Text)
rightsizingRecommendationSummary_savingsCurrencyCode :: (Maybe Text -> f (Maybe Text))
-> RightsizingRecommendationSummary
-> f RightsizingRecommendationSummary
rightsizingRecommendationSummary_savingsCurrencyCode = (RightsizingRecommendationSummary -> Maybe Text)
-> (RightsizingRecommendationSummary
    -> Maybe Text -> RightsizingRecommendationSummary)
-> Lens
     RightsizingRecommendationSummary
     RightsizingRecommendationSummary
     (Maybe Text)
     (Maybe Text)
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 total number of instance recommendations.
rightsizingRecommendationSummary_totalRecommendationCount :: Lens.Lens' RightsizingRecommendationSummary (Prelude.Maybe Prelude.Text)
rightsizingRecommendationSummary_totalRecommendationCount :: (Maybe Text -> f (Maybe Text))
-> RightsizingRecommendationSummary
-> f RightsizingRecommendationSummary
rightsizingRecommendationSummary_totalRecommendationCount = (RightsizingRecommendationSummary -> Maybe Text)
-> (RightsizingRecommendationSummary
    -> Maybe Text -> RightsizingRecommendationSummary)
-> Lens
     RightsizingRecommendationSummary
     RightsizingRecommendationSummary
     (Maybe Text)
     (Maybe Text)
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)

-- | The estimated total savings resulting from modifications, on a monthly
-- basis.
rightsizingRecommendationSummary_estimatedTotalMonthlySavingsAmount :: Lens.Lens' RightsizingRecommendationSummary (Prelude.Maybe Prelude.Text)
rightsizingRecommendationSummary_estimatedTotalMonthlySavingsAmount :: (Maybe Text -> f (Maybe Text))
-> RightsizingRecommendationSummary
-> f RightsizingRecommendationSummary
rightsizingRecommendationSummary_estimatedTotalMonthlySavingsAmount = (RightsizingRecommendationSummary -> Maybe Text)
-> (RightsizingRecommendationSummary
    -> Maybe Text -> RightsizingRecommendationSummary)
-> Lens
     RightsizingRecommendationSummary
     RightsizingRecommendationSummary
     (Maybe Text)
     (Maybe Text)
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)

instance
  Core.FromJSON
    RightsizingRecommendationSummary
  where
  parseJSON :: Value -> Parser RightsizingRecommendationSummary
parseJSON =
    String
-> (Object -> Parser RightsizingRecommendationSummary)
-> Value
-> Parser RightsizingRecommendationSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RightsizingRecommendationSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> RightsizingRecommendationSummary
RightsizingRecommendationSummary'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> RightsizingRecommendationSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> RightsizingRecommendationSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SavingsPercentage")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> RightsizingRecommendationSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> RightsizingRecommendationSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SavingsCurrencyCode")
            Parser
  (Maybe Text -> Maybe Text -> RightsizingRecommendationSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> RightsizingRecommendationSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TotalRecommendationCount")
            Parser (Maybe Text -> RightsizingRecommendationSummary)
-> Parser (Maybe Text) -> Parser RightsizingRecommendationSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EstimatedTotalMonthlySavingsAmount")
      )

instance
  Prelude.Hashable
    RightsizingRecommendationSummary

instance
  Prelude.NFData
    RightsizingRecommendationSummary