{-# 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.SavingsPlans.Types.SavingsPlanOfferingRateProperty
-- 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.SavingsPlans.Types.SavingsPlanOfferingRateProperty where

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

-- | Information about a property.
--
-- /See:/ 'newSavingsPlanOfferingRateProperty' smart constructor.
data SavingsPlanOfferingRateProperty = SavingsPlanOfferingRateProperty'
  { -- | The property value.
    SavingsPlanOfferingRateProperty -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The property name.
    SavingsPlanOfferingRateProperty -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (SavingsPlanOfferingRateProperty
-> SavingsPlanOfferingRateProperty -> Bool
(SavingsPlanOfferingRateProperty
 -> SavingsPlanOfferingRateProperty -> Bool)
-> (SavingsPlanOfferingRateProperty
    -> SavingsPlanOfferingRateProperty -> Bool)
-> Eq SavingsPlanOfferingRateProperty
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SavingsPlanOfferingRateProperty
-> SavingsPlanOfferingRateProperty -> Bool
$c/= :: SavingsPlanOfferingRateProperty
-> SavingsPlanOfferingRateProperty -> Bool
== :: SavingsPlanOfferingRateProperty
-> SavingsPlanOfferingRateProperty -> Bool
$c== :: SavingsPlanOfferingRateProperty
-> SavingsPlanOfferingRateProperty -> Bool
Prelude.Eq, ReadPrec [SavingsPlanOfferingRateProperty]
ReadPrec SavingsPlanOfferingRateProperty
Int -> ReadS SavingsPlanOfferingRateProperty
ReadS [SavingsPlanOfferingRateProperty]
(Int -> ReadS SavingsPlanOfferingRateProperty)
-> ReadS [SavingsPlanOfferingRateProperty]
-> ReadPrec SavingsPlanOfferingRateProperty
-> ReadPrec [SavingsPlanOfferingRateProperty]
-> Read SavingsPlanOfferingRateProperty
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SavingsPlanOfferingRateProperty]
$creadListPrec :: ReadPrec [SavingsPlanOfferingRateProperty]
readPrec :: ReadPrec SavingsPlanOfferingRateProperty
$creadPrec :: ReadPrec SavingsPlanOfferingRateProperty
readList :: ReadS [SavingsPlanOfferingRateProperty]
$creadList :: ReadS [SavingsPlanOfferingRateProperty]
readsPrec :: Int -> ReadS SavingsPlanOfferingRateProperty
$creadsPrec :: Int -> ReadS SavingsPlanOfferingRateProperty
Prelude.Read, Int -> SavingsPlanOfferingRateProperty -> ShowS
[SavingsPlanOfferingRateProperty] -> ShowS
SavingsPlanOfferingRateProperty -> String
(Int -> SavingsPlanOfferingRateProperty -> ShowS)
-> (SavingsPlanOfferingRateProperty -> String)
-> ([SavingsPlanOfferingRateProperty] -> ShowS)
-> Show SavingsPlanOfferingRateProperty
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SavingsPlanOfferingRateProperty] -> ShowS
$cshowList :: [SavingsPlanOfferingRateProperty] -> ShowS
show :: SavingsPlanOfferingRateProperty -> String
$cshow :: SavingsPlanOfferingRateProperty -> String
showsPrec :: Int -> SavingsPlanOfferingRateProperty -> ShowS
$cshowsPrec :: Int -> SavingsPlanOfferingRateProperty -> ShowS
Prelude.Show, (forall x.
 SavingsPlanOfferingRateProperty
 -> Rep SavingsPlanOfferingRateProperty x)
-> (forall x.
    Rep SavingsPlanOfferingRateProperty x
    -> SavingsPlanOfferingRateProperty)
-> Generic SavingsPlanOfferingRateProperty
forall x.
Rep SavingsPlanOfferingRateProperty x
-> SavingsPlanOfferingRateProperty
forall x.
SavingsPlanOfferingRateProperty
-> Rep SavingsPlanOfferingRateProperty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SavingsPlanOfferingRateProperty x
-> SavingsPlanOfferingRateProperty
$cfrom :: forall x.
SavingsPlanOfferingRateProperty
-> Rep SavingsPlanOfferingRateProperty x
Prelude.Generic)

-- |
-- Create a value of 'SavingsPlanOfferingRateProperty' 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:
--
-- 'value', 'savingsPlanOfferingRateProperty_value' - The property value.
--
-- 'name', 'savingsPlanOfferingRateProperty_name' - The property name.
newSavingsPlanOfferingRateProperty ::
  SavingsPlanOfferingRateProperty
newSavingsPlanOfferingRateProperty :: SavingsPlanOfferingRateProperty
newSavingsPlanOfferingRateProperty =
  SavingsPlanOfferingRateProperty' :: Maybe Text -> Maybe Text -> SavingsPlanOfferingRateProperty
SavingsPlanOfferingRateProperty'
    { $sel:value:SavingsPlanOfferingRateProperty' :: Maybe Text
value =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:SavingsPlanOfferingRateProperty' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The property value.
savingsPlanOfferingRateProperty_value :: Lens.Lens' SavingsPlanOfferingRateProperty (Prelude.Maybe Prelude.Text)
savingsPlanOfferingRateProperty_value :: (Maybe Text -> f (Maybe Text))
-> SavingsPlanOfferingRateProperty
-> f SavingsPlanOfferingRateProperty
savingsPlanOfferingRateProperty_value = (SavingsPlanOfferingRateProperty -> Maybe Text)
-> (SavingsPlanOfferingRateProperty
    -> Maybe Text -> SavingsPlanOfferingRateProperty)
-> Lens
     SavingsPlanOfferingRateProperty
     SavingsPlanOfferingRateProperty
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlanOfferingRateProperty' {Maybe Text
value :: Maybe Text
$sel:value:SavingsPlanOfferingRateProperty' :: SavingsPlanOfferingRateProperty -> Maybe Text
value} -> Maybe Text
value) (\s :: SavingsPlanOfferingRateProperty
s@SavingsPlanOfferingRateProperty' {} Maybe Text
a -> SavingsPlanOfferingRateProperty
s {$sel:value:SavingsPlanOfferingRateProperty' :: Maybe Text
value = Maybe Text
a} :: SavingsPlanOfferingRateProperty)

-- | The property name.
savingsPlanOfferingRateProperty_name :: Lens.Lens' SavingsPlanOfferingRateProperty (Prelude.Maybe Prelude.Text)
savingsPlanOfferingRateProperty_name :: (Maybe Text -> f (Maybe Text))
-> SavingsPlanOfferingRateProperty
-> f SavingsPlanOfferingRateProperty
savingsPlanOfferingRateProperty_name = (SavingsPlanOfferingRateProperty -> Maybe Text)
-> (SavingsPlanOfferingRateProperty
    -> Maybe Text -> SavingsPlanOfferingRateProperty)
-> Lens
     SavingsPlanOfferingRateProperty
     SavingsPlanOfferingRateProperty
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SavingsPlanOfferingRateProperty' {Maybe Text
name :: Maybe Text
$sel:name:SavingsPlanOfferingRateProperty' :: SavingsPlanOfferingRateProperty -> Maybe Text
name} -> Maybe Text
name) (\s :: SavingsPlanOfferingRateProperty
s@SavingsPlanOfferingRateProperty' {} Maybe Text
a -> SavingsPlanOfferingRateProperty
s {$sel:name:SavingsPlanOfferingRateProperty' :: Maybe Text
name = Maybe Text
a} :: SavingsPlanOfferingRateProperty)

instance
  Core.FromJSON
    SavingsPlanOfferingRateProperty
  where
  parseJSON :: Value -> Parser SavingsPlanOfferingRateProperty
parseJSON =
    String
-> (Object -> Parser SavingsPlanOfferingRateProperty)
-> Value
-> Parser SavingsPlanOfferingRateProperty
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SavingsPlanOfferingRateProperty"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> SavingsPlanOfferingRateProperty
SavingsPlanOfferingRateProperty'
            (Maybe Text -> Maybe Text -> SavingsPlanOfferingRateProperty)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> SavingsPlanOfferingRateProperty)
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
"value") Parser (Maybe Text -> SavingsPlanOfferingRateProperty)
-> Parser (Maybe Text) -> Parser SavingsPlanOfferingRateProperty
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
"name")
      )

instance
  Prelude.Hashable
    SavingsPlanOfferingRateProperty

instance
  Prelude.NFData
    SavingsPlanOfferingRateProperty