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

import Amazonka.ComputeOptimizer.Types.CurrentPerformanceRiskRatings
import Amazonka.ComputeOptimizer.Types.RecommendationSourceType
import Amazonka.ComputeOptimizer.Types.SavingsOpportunity
import Amazonka.ComputeOptimizer.Types.Summary
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

-- | A summary of a recommendation.
--
-- /See:/ 'newRecommendationSummary' smart constructor.
data RecommendationSummary = RecommendationSummary'
  { -- | The Amazon Web Services account ID of the recommendation summary.
    RecommendationSummary -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | An object that describes the performance risk ratings for a given
    -- resource type.
    RecommendationSummary -> Maybe CurrentPerformanceRiskRatings
currentPerformanceRiskRatings :: Prelude.Maybe CurrentPerformanceRiskRatings,
    -- | The resource type that the recommendation summary applies to.
    RecommendationSummary -> Maybe RecommendationSourceType
recommendationResourceType :: Prelude.Maybe RecommendationSourceType,
    -- | An object that describes the savings opportunity for a given resource
    -- type. Savings opportunity includes the estimated monthly savings amount
    -- and percentage.
    RecommendationSummary -> Maybe SavingsOpportunity
savingsOpportunity :: Prelude.Maybe SavingsOpportunity,
    -- | An array of objects that describe a recommendation summary.
    RecommendationSummary -> Maybe [Summary]
summaries :: Prelude.Maybe [Summary]
  }
  deriving (RecommendationSummary -> RecommendationSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecommendationSummary -> RecommendationSummary -> Bool
$c/= :: RecommendationSummary -> RecommendationSummary -> Bool
== :: RecommendationSummary -> RecommendationSummary -> Bool
$c== :: RecommendationSummary -> RecommendationSummary -> Bool
Prelude.Eq, ReadPrec [RecommendationSummary]
ReadPrec RecommendationSummary
Int -> ReadS RecommendationSummary
ReadS [RecommendationSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecommendationSummary]
$creadListPrec :: ReadPrec [RecommendationSummary]
readPrec :: ReadPrec RecommendationSummary
$creadPrec :: ReadPrec RecommendationSummary
readList :: ReadS [RecommendationSummary]
$creadList :: ReadS [RecommendationSummary]
readsPrec :: Int -> ReadS RecommendationSummary
$creadsPrec :: Int -> ReadS RecommendationSummary
Prelude.Read, Int -> RecommendationSummary -> ShowS
[RecommendationSummary] -> ShowS
RecommendationSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecommendationSummary] -> ShowS
$cshowList :: [RecommendationSummary] -> ShowS
show :: RecommendationSummary -> String
$cshow :: RecommendationSummary -> String
showsPrec :: Int -> RecommendationSummary -> ShowS
$cshowsPrec :: Int -> RecommendationSummary -> ShowS
Prelude.Show, forall x. Rep RecommendationSummary x -> RecommendationSummary
forall x. RecommendationSummary -> Rep RecommendationSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecommendationSummary x -> RecommendationSummary
$cfrom :: forall x. RecommendationSummary -> Rep RecommendationSummary x
Prelude.Generic)

-- |
-- Create a value of 'RecommendationSummary' 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:
--
-- 'accountId', 'recommendationSummary_accountId' - The Amazon Web Services account ID of the recommendation summary.
--
-- 'currentPerformanceRiskRatings', 'recommendationSummary_currentPerformanceRiskRatings' - An object that describes the performance risk ratings for a given
-- resource type.
--
-- 'recommendationResourceType', 'recommendationSummary_recommendationResourceType' - The resource type that the recommendation summary applies to.
--
-- 'savingsOpportunity', 'recommendationSummary_savingsOpportunity' - An object that describes the savings opportunity for a given resource
-- type. Savings opportunity includes the estimated monthly savings amount
-- and percentage.
--
-- 'summaries', 'recommendationSummary_summaries' - An array of objects that describe a recommendation summary.
newRecommendationSummary ::
  RecommendationSummary
newRecommendationSummary :: RecommendationSummary
newRecommendationSummary =
  RecommendationSummary'
    { $sel:accountId:RecommendationSummary' :: Maybe Text
accountId = forall a. Maybe a
Prelude.Nothing,
      $sel:currentPerformanceRiskRatings:RecommendationSummary' :: Maybe CurrentPerformanceRiskRatings
currentPerformanceRiskRatings = forall a. Maybe a
Prelude.Nothing,
      $sel:recommendationResourceType:RecommendationSummary' :: Maybe RecommendationSourceType
recommendationResourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:savingsOpportunity:RecommendationSummary' :: Maybe SavingsOpportunity
savingsOpportunity = forall a. Maybe a
Prelude.Nothing,
      $sel:summaries:RecommendationSummary' :: Maybe [Summary]
summaries = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services account ID of the recommendation summary.
recommendationSummary_accountId :: Lens.Lens' RecommendationSummary (Prelude.Maybe Prelude.Text)
recommendationSummary_accountId :: Lens' RecommendationSummary (Maybe Text)
recommendationSummary_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationSummary' {Maybe Text
accountId :: Maybe Text
$sel:accountId:RecommendationSummary' :: RecommendationSummary -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: RecommendationSummary
s@RecommendationSummary' {} Maybe Text
a -> RecommendationSummary
s {$sel:accountId:RecommendationSummary' :: Maybe Text
accountId = Maybe Text
a} :: RecommendationSummary)

-- | An object that describes the performance risk ratings for a given
-- resource type.
recommendationSummary_currentPerformanceRiskRatings :: Lens.Lens' RecommendationSummary (Prelude.Maybe CurrentPerformanceRiskRatings)
recommendationSummary_currentPerformanceRiskRatings :: Lens' RecommendationSummary (Maybe CurrentPerformanceRiskRatings)
recommendationSummary_currentPerformanceRiskRatings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationSummary' {Maybe CurrentPerformanceRiskRatings
currentPerformanceRiskRatings :: Maybe CurrentPerformanceRiskRatings
$sel:currentPerformanceRiskRatings:RecommendationSummary' :: RecommendationSummary -> Maybe CurrentPerformanceRiskRatings
currentPerformanceRiskRatings} -> Maybe CurrentPerformanceRiskRatings
currentPerformanceRiskRatings) (\s :: RecommendationSummary
s@RecommendationSummary' {} Maybe CurrentPerformanceRiskRatings
a -> RecommendationSummary
s {$sel:currentPerformanceRiskRatings:RecommendationSummary' :: Maybe CurrentPerformanceRiskRatings
currentPerformanceRiskRatings = Maybe CurrentPerformanceRiskRatings
a} :: RecommendationSummary)

-- | The resource type that the recommendation summary applies to.
recommendationSummary_recommendationResourceType :: Lens.Lens' RecommendationSummary (Prelude.Maybe RecommendationSourceType)
recommendationSummary_recommendationResourceType :: Lens' RecommendationSummary (Maybe RecommendationSourceType)
recommendationSummary_recommendationResourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationSummary' {Maybe RecommendationSourceType
recommendationResourceType :: Maybe RecommendationSourceType
$sel:recommendationResourceType:RecommendationSummary' :: RecommendationSummary -> Maybe RecommendationSourceType
recommendationResourceType} -> Maybe RecommendationSourceType
recommendationResourceType) (\s :: RecommendationSummary
s@RecommendationSummary' {} Maybe RecommendationSourceType
a -> RecommendationSummary
s {$sel:recommendationResourceType:RecommendationSummary' :: Maybe RecommendationSourceType
recommendationResourceType = Maybe RecommendationSourceType
a} :: RecommendationSummary)

-- | An object that describes the savings opportunity for a given resource
-- type. Savings opportunity includes the estimated monthly savings amount
-- and percentage.
recommendationSummary_savingsOpportunity :: Lens.Lens' RecommendationSummary (Prelude.Maybe SavingsOpportunity)
recommendationSummary_savingsOpportunity :: Lens' RecommendationSummary (Maybe SavingsOpportunity)
recommendationSummary_savingsOpportunity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationSummary' {Maybe SavingsOpportunity
savingsOpportunity :: Maybe SavingsOpportunity
$sel:savingsOpportunity:RecommendationSummary' :: RecommendationSummary -> Maybe SavingsOpportunity
savingsOpportunity} -> Maybe SavingsOpportunity
savingsOpportunity) (\s :: RecommendationSummary
s@RecommendationSummary' {} Maybe SavingsOpportunity
a -> RecommendationSummary
s {$sel:savingsOpportunity:RecommendationSummary' :: Maybe SavingsOpportunity
savingsOpportunity = Maybe SavingsOpportunity
a} :: RecommendationSummary)

-- | An array of objects that describe a recommendation summary.
recommendationSummary_summaries :: Lens.Lens' RecommendationSummary (Prelude.Maybe [Summary])
recommendationSummary_summaries :: Lens' RecommendationSummary (Maybe [Summary])
recommendationSummary_summaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationSummary' {Maybe [Summary]
summaries :: Maybe [Summary]
$sel:summaries:RecommendationSummary' :: RecommendationSummary -> Maybe [Summary]
summaries} -> Maybe [Summary]
summaries) (\s :: RecommendationSummary
s@RecommendationSummary' {} Maybe [Summary]
a -> RecommendationSummary
s {$sel:summaries:RecommendationSummary' :: Maybe [Summary]
summaries = Maybe [Summary]
a} :: RecommendationSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON RecommendationSummary where
  parseJSON :: Value -> Parser RecommendationSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RecommendationSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe CurrentPerformanceRiskRatings
-> Maybe RecommendationSourceType
-> Maybe SavingsOpportunity
-> Maybe [Summary]
-> RecommendationSummary
RecommendationSummary'
            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
"accountId")
            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
"currentPerformanceRiskRatings")
            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
"recommendationResourceType")
            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
"savingsOpportunity")
            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
"summaries" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable RecommendationSummary where
  hashWithSalt :: Int -> RecommendationSummary -> Int
hashWithSalt Int
_salt RecommendationSummary' {Maybe [Summary]
Maybe Text
Maybe CurrentPerformanceRiskRatings
Maybe RecommendationSourceType
Maybe SavingsOpportunity
summaries :: Maybe [Summary]
savingsOpportunity :: Maybe SavingsOpportunity
recommendationResourceType :: Maybe RecommendationSourceType
currentPerformanceRiskRatings :: Maybe CurrentPerformanceRiskRatings
accountId :: Maybe Text
$sel:summaries:RecommendationSummary' :: RecommendationSummary -> Maybe [Summary]
$sel:savingsOpportunity:RecommendationSummary' :: RecommendationSummary -> Maybe SavingsOpportunity
$sel:recommendationResourceType:RecommendationSummary' :: RecommendationSummary -> Maybe RecommendationSourceType
$sel:currentPerformanceRiskRatings:RecommendationSummary' :: RecommendationSummary -> Maybe CurrentPerformanceRiskRatings
$sel:accountId:RecommendationSummary' :: RecommendationSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CurrentPerformanceRiskRatings
currentPerformanceRiskRatings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RecommendationSourceType
recommendationResourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SavingsOpportunity
savingsOpportunity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Summary]
summaries

instance Prelude.NFData RecommendationSummary where
  rnf :: RecommendationSummary -> ()
rnf RecommendationSummary' {Maybe [Summary]
Maybe Text
Maybe CurrentPerformanceRiskRatings
Maybe RecommendationSourceType
Maybe SavingsOpportunity
summaries :: Maybe [Summary]
savingsOpportunity :: Maybe SavingsOpportunity
recommendationResourceType :: Maybe RecommendationSourceType
currentPerformanceRiskRatings :: Maybe CurrentPerformanceRiskRatings
accountId :: Maybe Text
$sel:summaries:RecommendationSummary' :: RecommendationSummary -> Maybe [Summary]
$sel:savingsOpportunity:RecommendationSummary' :: RecommendationSummary -> Maybe SavingsOpportunity
$sel:recommendationResourceType:RecommendationSummary' :: RecommendationSummary -> Maybe RecommendationSourceType
$sel:currentPerformanceRiskRatings:RecommendationSummary' :: RecommendationSummary -> Maybe CurrentPerformanceRiskRatings
$sel:accountId:RecommendationSummary' :: RecommendationSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CurrentPerformanceRiskRatings
currentPerformanceRiskRatings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RecommendationSourceType
recommendationResourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SavingsOpportunity
savingsOpportunity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Summary]
summaries