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

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

-- | Specific coverage percentage, On-Demand costs, and spend covered by
-- Savings Plans, and total Savings Plans costs for an account.
--
-- /See:/ 'newSavingsPlansCoverageData' smart constructor.
data SavingsPlansCoverageData = SavingsPlansCoverageData'
  { -- | The cost of your Amazon Web Services usage at the public On-Demand rate.
    SavingsPlansCoverageData -> Maybe Text
onDemandCost :: Prelude.Maybe Prelude.Text,
    -- | The amount of your Amazon Web Services usage that is covered by a
    -- Savings Plans.
    SavingsPlansCoverageData -> Maybe Text
spendCoveredBySavingsPlans :: Prelude.Maybe Prelude.Text,
    -- | The percentage of your existing Savings Plans covered usage, divided by
    -- all of your eligible Savings Plans usage in an account (or set of
    -- accounts).
    SavingsPlansCoverageData -> Maybe Text
coveragePercentage :: Prelude.Maybe Prelude.Text,
    -- | The total cost of your Amazon Web Services usage, regardless of your
    -- purchase option.
    SavingsPlansCoverageData -> Maybe Text
totalCost :: Prelude.Maybe Prelude.Text
  }
  deriving (SavingsPlansCoverageData -> SavingsPlansCoverageData -> Bool
(SavingsPlansCoverageData -> SavingsPlansCoverageData -> Bool)
-> (SavingsPlansCoverageData -> SavingsPlansCoverageData -> Bool)
-> Eq SavingsPlansCoverageData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SavingsPlansCoverageData -> SavingsPlansCoverageData -> Bool
$c/= :: SavingsPlansCoverageData -> SavingsPlansCoverageData -> Bool
== :: SavingsPlansCoverageData -> SavingsPlansCoverageData -> Bool
$c== :: SavingsPlansCoverageData -> SavingsPlansCoverageData -> Bool
Prelude.Eq, ReadPrec [SavingsPlansCoverageData]
ReadPrec SavingsPlansCoverageData
Int -> ReadS SavingsPlansCoverageData
ReadS [SavingsPlansCoverageData]
(Int -> ReadS SavingsPlansCoverageData)
-> ReadS [SavingsPlansCoverageData]
-> ReadPrec SavingsPlansCoverageData
-> ReadPrec [SavingsPlansCoverageData]
-> Read SavingsPlansCoverageData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SavingsPlansCoverageData]
$creadListPrec :: ReadPrec [SavingsPlansCoverageData]
readPrec :: ReadPrec SavingsPlansCoverageData
$creadPrec :: ReadPrec SavingsPlansCoverageData
readList :: ReadS [SavingsPlansCoverageData]
$creadList :: ReadS [SavingsPlansCoverageData]
readsPrec :: Int -> ReadS SavingsPlansCoverageData
$creadsPrec :: Int -> ReadS SavingsPlansCoverageData
Prelude.Read, Int -> SavingsPlansCoverageData -> ShowS
[SavingsPlansCoverageData] -> ShowS
SavingsPlansCoverageData -> String
(Int -> SavingsPlansCoverageData -> ShowS)
-> (SavingsPlansCoverageData -> String)
-> ([SavingsPlansCoverageData] -> ShowS)
-> Show SavingsPlansCoverageData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SavingsPlansCoverageData] -> ShowS
$cshowList :: [SavingsPlansCoverageData] -> ShowS
show :: SavingsPlansCoverageData -> String
$cshow :: SavingsPlansCoverageData -> String
showsPrec :: Int -> SavingsPlansCoverageData -> ShowS
$cshowsPrec :: Int -> SavingsPlansCoverageData -> ShowS
Prelude.Show, (forall x.
 SavingsPlansCoverageData -> Rep SavingsPlansCoverageData x)
-> (forall x.
    Rep SavingsPlansCoverageData x -> SavingsPlansCoverageData)
-> Generic SavingsPlansCoverageData
forall x.
Rep SavingsPlansCoverageData x -> SavingsPlansCoverageData
forall x.
SavingsPlansCoverageData -> Rep SavingsPlansCoverageData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SavingsPlansCoverageData x -> SavingsPlansCoverageData
$cfrom :: forall x.
SavingsPlansCoverageData -> Rep SavingsPlansCoverageData x
Prelude.Generic)

-- |
-- Create a value of 'SavingsPlansCoverageData' 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:
--
-- 'onDemandCost', 'savingsPlansCoverageData_onDemandCost' - The cost of your Amazon Web Services usage at the public On-Demand rate.
--
-- 'spendCoveredBySavingsPlans', 'savingsPlansCoverageData_spendCoveredBySavingsPlans' - The amount of your Amazon Web Services usage that is covered by a
-- Savings Plans.
--
-- 'coveragePercentage', 'savingsPlansCoverageData_coveragePercentage' - The percentage of your existing Savings Plans covered usage, divided by
-- all of your eligible Savings Plans usage in an account (or set of
-- accounts).
--
-- 'totalCost', 'savingsPlansCoverageData_totalCost' - The total cost of your Amazon Web Services usage, regardless of your
-- purchase option.
newSavingsPlansCoverageData ::
  SavingsPlansCoverageData
newSavingsPlansCoverageData :: SavingsPlansCoverageData
newSavingsPlansCoverageData =
  SavingsPlansCoverageData' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> SavingsPlansCoverageData
SavingsPlansCoverageData'
    { $sel:onDemandCost:SavingsPlansCoverageData' :: Maybe Text
onDemandCost =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:spendCoveredBySavingsPlans:SavingsPlansCoverageData' :: Maybe Text
spendCoveredBySavingsPlans = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:coveragePercentage:SavingsPlansCoverageData' :: Maybe Text
coveragePercentage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:totalCost:SavingsPlansCoverageData' :: Maybe Text
totalCost = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The cost of your Amazon Web Services usage at the public On-Demand rate.
savingsPlansCoverageData_onDemandCost :: Lens.Lens' SavingsPlansCoverageData (Prelude.Maybe Prelude.Text)
savingsPlansCoverageData_onDemandCost :: (Maybe Text -> f (Maybe Text))
-> SavingsPlansCoverageData -> f SavingsPlansCoverageData
savingsPlansCoverageData_onDemandCost = (SavingsPlansCoverageData -> Maybe Text)
-> (SavingsPlansCoverageData
    -> Maybe Text -> SavingsPlansCoverageData)
-> Lens
     SavingsPlansCoverageData
     SavingsPlansCoverageData
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlansCoverageData' {Maybe Text
onDemandCost :: Maybe Text
$sel:onDemandCost:SavingsPlansCoverageData' :: SavingsPlansCoverageData -> Maybe Text
onDemandCost} -> Maybe Text
onDemandCost) (\s :: SavingsPlansCoverageData
s@SavingsPlansCoverageData' {} Maybe Text
a -> SavingsPlansCoverageData
s {$sel:onDemandCost:SavingsPlansCoverageData' :: Maybe Text
onDemandCost = Maybe Text
a} :: SavingsPlansCoverageData)

-- | The amount of your Amazon Web Services usage that is covered by a
-- Savings Plans.
savingsPlansCoverageData_spendCoveredBySavingsPlans :: Lens.Lens' SavingsPlansCoverageData (Prelude.Maybe Prelude.Text)
savingsPlansCoverageData_spendCoveredBySavingsPlans :: (Maybe Text -> f (Maybe Text))
-> SavingsPlansCoverageData -> f SavingsPlansCoverageData
savingsPlansCoverageData_spendCoveredBySavingsPlans = (SavingsPlansCoverageData -> Maybe Text)
-> (SavingsPlansCoverageData
    -> Maybe Text -> SavingsPlansCoverageData)
-> Lens
     SavingsPlansCoverageData
     SavingsPlansCoverageData
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlansCoverageData' {Maybe Text
spendCoveredBySavingsPlans :: Maybe Text
$sel:spendCoveredBySavingsPlans:SavingsPlansCoverageData' :: SavingsPlansCoverageData -> Maybe Text
spendCoveredBySavingsPlans} -> Maybe Text
spendCoveredBySavingsPlans) (\s :: SavingsPlansCoverageData
s@SavingsPlansCoverageData' {} Maybe Text
a -> SavingsPlansCoverageData
s {$sel:spendCoveredBySavingsPlans:SavingsPlansCoverageData' :: Maybe Text
spendCoveredBySavingsPlans = Maybe Text
a} :: SavingsPlansCoverageData)

-- | The percentage of your existing Savings Plans covered usage, divided by
-- all of your eligible Savings Plans usage in an account (or set of
-- accounts).
savingsPlansCoverageData_coveragePercentage :: Lens.Lens' SavingsPlansCoverageData (Prelude.Maybe Prelude.Text)
savingsPlansCoverageData_coveragePercentage :: (Maybe Text -> f (Maybe Text))
-> SavingsPlansCoverageData -> f SavingsPlansCoverageData
savingsPlansCoverageData_coveragePercentage = (SavingsPlansCoverageData -> Maybe Text)
-> (SavingsPlansCoverageData
    -> Maybe Text -> SavingsPlansCoverageData)
-> Lens
     SavingsPlansCoverageData
     SavingsPlansCoverageData
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlansCoverageData' {Maybe Text
coveragePercentage :: Maybe Text
$sel:coveragePercentage:SavingsPlansCoverageData' :: SavingsPlansCoverageData -> Maybe Text
coveragePercentage} -> Maybe Text
coveragePercentage) (\s :: SavingsPlansCoverageData
s@SavingsPlansCoverageData' {} Maybe Text
a -> SavingsPlansCoverageData
s {$sel:coveragePercentage:SavingsPlansCoverageData' :: Maybe Text
coveragePercentage = Maybe Text
a} :: SavingsPlansCoverageData)

-- | The total cost of your Amazon Web Services usage, regardless of your
-- purchase option.
savingsPlansCoverageData_totalCost :: Lens.Lens' SavingsPlansCoverageData (Prelude.Maybe Prelude.Text)
savingsPlansCoverageData_totalCost :: (Maybe Text -> f (Maybe Text))
-> SavingsPlansCoverageData -> f SavingsPlansCoverageData
savingsPlansCoverageData_totalCost = (SavingsPlansCoverageData -> Maybe Text)
-> (SavingsPlansCoverageData
    -> Maybe Text -> SavingsPlansCoverageData)
-> Lens
     SavingsPlansCoverageData
     SavingsPlansCoverageData
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlansCoverageData' {Maybe Text
totalCost :: Maybe Text
$sel:totalCost:SavingsPlansCoverageData' :: SavingsPlansCoverageData -> Maybe Text
totalCost} -> Maybe Text
totalCost) (\s :: SavingsPlansCoverageData
s@SavingsPlansCoverageData' {} Maybe Text
a -> SavingsPlansCoverageData
s {$sel:totalCost:SavingsPlansCoverageData' :: Maybe Text
totalCost = Maybe Text
a} :: SavingsPlansCoverageData)

instance Core.FromJSON SavingsPlansCoverageData where
  parseJSON :: Value -> Parser SavingsPlansCoverageData
parseJSON =
    String
-> (Object -> Parser SavingsPlansCoverageData)
-> Value
-> Parser SavingsPlansCoverageData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SavingsPlansCoverageData"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> SavingsPlansCoverageData
SavingsPlansCoverageData'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> SavingsPlansCoverageData)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> SavingsPlansCoverageData)
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
"OnDemandCost")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> SavingsPlansCoverageData)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> SavingsPlansCoverageData)
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
"SpendCoveredBySavingsPlans")
            Parser (Maybe Text -> Maybe Text -> SavingsPlansCoverageData)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> SavingsPlansCoverageData)
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
"CoveragePercentage")
            Parser (Maybe Text -> SavingsPlansCoverageData)
-> Parser (Maybe Text) -> Parser SavingsPlansCoverageData
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
"TotalCost")
      )

instance Prelude.Hashable SavingsPlansCoverageData

instance Prelude.NFData SavingsPlansCoverageData