{-# 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.SavingsPlansDetails
-- 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.SavingsPlansDetails 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 attribute details on a specific Savings Plan.
--
-- /See:/ 'newSavingsPlansDetails' smart constructor.
data SavingsPlansDetails = SavingsPlansDetails'
  { -- | A group of instance types that Savings Plans applies to.
    SavingsPlansDetails -> Maybe Text
instanceFamily :: Prelude.Maybe Prelude.Text,
    -- | The unique ID that\'s used to distinguish Savings Plans from one
    -- another.
    SavingsPlansDetails -> Maybe Text
offeringId :: Prelude.Maybe Prelude.Text,
    -- | A collection of Amazon Web Services resources in a geographic area. Each
    -- Amazon Web Services Region is isolated and independent of the other
    -- Regions.
    SavingsPlansDetails -> Maybe Text
region :: Prelude.Maybe Prelude.Text
  }
  deriving (SavingsPlansDetails -> SavingsPlansDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SavingsPlansDetails -> SavingsPlansDetails -> Bool
$c/= :: SavingsPlansDetails -> SavingsPlansDetails -> Bool
== :: SavingsPlansDetails -> SavingsPlansDetails -> Bool
$c== :: SavingsPlansDetails -> SavingsPlansDetails -> Bool
Prelude.Eq, ReadPrec [SavingsPlansDetails]
ReadPrec SavingsPlansDetails
Int -> ReadS SavingsPlansDetails
ReadS [SavingsPlansDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SavingsPlansDetails]
$creadListPrec :: ReadPrec [SavingsPlansDetails]
readPrec :: ReadPrec SavingsPlansDetails
$creadPrec :: ReadPrec SavingsPlansDetails
readList :: ReadS [SavingsPlansDetails]
$creadList :: ReadS [SavingsPlansDetails]
readsPrec :: Int -> ReadS SavingsPlansDetails
$creadsPrec :: Int -> ReadS SavingsPlansDetails
Prelude.Read, Int -> SavingsPlansDetails -> ShowS
[SavingsPlansDetails] -> ShowS
SavingsPlansDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SavingsPlansDetails] -> ShowS
$cshowList :: [SavingsPlansDetails] -> ShowS
show :: SavingsPlansDetails -> String
$cshow :: SavingsPlansDetails -> String
showsPrec :: Int -> SavingsPlansDetails -> ShowS
$cshowsPrec :: Int -> SavingsPlansDetails -> ShowS
Prelude.Show, forall x. Rep SavingsPlansDetails x -> SavingsPlansDetails
forall x. SavingsPlansDetails -> Rep SavingsPlansDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SavingsPlansDetails x -> SavingsPlansDetails
$cfrom :: forall x. SavingsPlansDetails -> Rep SavingsPlansDetails x
Prelude.Generic)

-- |
-- Create a value of 'SavingsPlansDetails' 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:
--
-- 'instanceFamily', 'savingsPlansDetails_instanceFamily' - A group of instance types that Savings Plans applies to.
--
-- 'offeringId', 'savingsPlansDetails_offeringId' - The unique ID that\'s used to distinguish Savings Plans from one
-- another.
--
-- 'region', 'savingsPlansDetails_region' - A collection of Amazon Web Services resources in a geographic area. Each
-- Amazon Web Services Region is isolated and independent of the other
-- Regions.
newSavingsPlansDetails ::
  SavingsPlansDetails
newSavingsPlansDetails :: SavingsPlansDetails
newSavingsPlansDetails =
  SavingsPlansDetails'
    { $sel:instanceFamily:SavingsPlansDetails' :: Maybe Text
instanceFamily =
        forall a. Maybe a
Prelude.Nothing,
      $sel:offeringId:SavingsPlansDetails' :: Maybe Text
offeringId = forall a. Maybe a
Prelude.Nothing,
      $sel:region:SavingsPlansDetails' :: Maybe Text
region = forall a. Maybe a
Prelude.Nothing
    }

-- | A group of instance types that Savings Plans applies to.
savingsPlansDetails_instanceFamily :: Lens.Lens' SavingsPlansDetails (Prelude.Maybe Prelude.Text)
savingsPlansDetails_instanceFamily :: Lens' SavingsPlansDetails (Maybe Text)
savingsPlansDetails_instanceFamily = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlansDetails' {Maybe Text
instanceFamily :: Maybe Text
$sel:instanceFamily:SavingsPlansDetails' :: SavingsPlansDetails -> Maybe Text
instanceFamily} -> Maybe Text
instanceFamily) (\s :: SavingsPlansDetails
s@SavingsPlansDetails' {} Maybe Text
a -> SavingsPlansDetails
s {$sel:instanceFamily:SavingsPlansDetails' :: Maybe Text
instanceFamily = Maybe Text
a} :: SavingsPlansDetails)

-- | The unique ID that\'s used to distinguish Savings Plans from one
-- another.
savingsPlansDetails_offeringId :: Lens.Lens' SavingsPlansDetails (Prelude.Maybe Prelude.Text)
savingsPlansDetails_offeringId :: Lens' SavingsPlansDetails (Maybe Text)
savingsPlansDetails_offeringId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlansDetails' {Maybe Text
offeringId :: Maybe Text
$sel:offeringId:SavingsPlansDetails' :: SavingsPlansDetails -> Maybe Text
offeringId} -> Maybe Text
offeringId) (\s :: SavingsPlansDetails
s@SavingsPlansDetails' {} Maybe Text
a -> SavingsPlansDetails
s {$sel:offeringId:SavingsPlansDetails' :: Maybe Text
offeringId = Maybe Text
a} :: SavingsPlansDetails)

-- | A collection of Amazon Web Services resources in a geographic area. Each
-- Amazon Web Services Region is isolated and independent of the other
-- Regions.
savingsPlansDetails_region :: Lens.Lens' SavingsPlansDetails (Prelude.Maybe Prelude.Text)
savingsPlansDetails_region :: Lens' SavingsPlansDetails (Maybe Text)
savingsPlansDetails_region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlansDetails' {Maybe Text
region :: Maybe Text
$sel:region:SavingsPlansDetails' :: SavingsPlansDetails -> Maybe Text
region} -> Maybe Text
region) (\s :: SavingsPlansDetails
s@SavingsPlansDetails' {} Maybe Text
a -> SavingsPlansDetails
s {$sel:region:SavingsPlansDetails' :: Maybe Text
region = Maybe Text
a} :: SavingsPlansDetails)

instance Data.FromJSON SavingsPlansDetails where
  parseJSON :: Value -> Parser SavingsPlansDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SavingsPlansDetails"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> SavingsPlansDetails
SavingsPlansDetails'
            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
"InstanceFamily")
            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
"OfferingId")
            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
"Region")
      )

instance Prelude.Hashable SavingsPlansDetails where
  hashWithSalt :: Int -> SavingsPlansDetails -> Int
hashWithSalt Int
_salt SavingsPlansDetails' {Maybe Text
region :: Maybe Text
offeringId :: Maybe Text
instanceFamily :: Maybe Text
$sel:region:SavingsPlansDetails' :: SavingsPlansDetails -> Maybe Text
$sel:offeringId:SavingsPlansDetails' :: SavingsPlansDetails -> Maybe Text
$sel:instanceFamily:SavingsPlansDetails' :: SavingsPlansDetails -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
instanceFamily
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
offeringId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
region

instance Prelude.NFData SavingsPlansDetails where
  rnf :: SavingsPlansDetails -> ()
rnf SavingsPlansDetails' {Maybe Text
region :: Maybe Text
offeringId :: Maybe Text
instanceFamily :: Maybe Text
$sel:region:SavingsPlansDetails' :: SavingsPlansDetails -> Maybe Text
$sel:offeringId:SavingsPlansDetails' :: SavingsPlansDetails -> Maybe Text
$sel:instanceFamily:SavingsPlansDetails' :: SavingsPlansDetails -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
instanceFamily
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
offeringId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
region