{-# 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.Pricing.Types.AttributeValue
-- 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.Pricing.Types.AttributeValue where

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

-- | The values of a given attribute, such as @Throughput Optimized HDD@ or
-- @Provisioned IOPS@ for the @Amazon EC2@ @volumeType@ attribute.
--
-- /See:/ 'newAttributeValue' smart constructor.
data AttributeValue = AttributeValue'
  { -- | The specific value of an @attributeName@.
    AttributeValue -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (AttributeValue -> AttributeValue -> Bool
(AttributeValue -> AttributeValue -> Bool)
-> (AttributeValue -> AttributeValue -> Bool) -> Eq AttributeValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttributeValue -> AttributeValue -> Bool
$c/= :: AttributeValue -> AttributeValue -> Bool
== :: AttributeValue -> AttributeValue -> Bool
$c== :: AttributeValue -> AttributeValue -> Bool
Prelude.Eq, ReadPrec [AttributeValue]
ReadPrec AttributeValue
Int -> ReadS AttributeValue
ReadS [AttributeValue]
(Int -> ReadS AttributeValue)
-> ReadS [AttributeValue]
-> ReadPrec AttributeValue
-> ReadPrec [AttributeValue]
-> Read AttributeValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttributeValue]
$creadListPrec :: ReadPrec [AttributeValue]
readPrec :: ReadPrec AttributeValue
$creadPrec :: ReadPrec AttributeValue
readList :: ReadS [AttributeValue]
$creadList :: ReadS [AttributeValue]
readsPrec :: Int -> ReadS AttributeValue
$creadsPrec :: Int -> ReadS AttributeValue
Prelude.Read, Int -> AttributeValue -> ShowS
[AttributeValue] -> ShowS
AttributeValue -> String
(Int -> AttributeValue -> ShowS)
-> (AttributeValue -> String)
-> ([AttributeValue] -> ShowS)
-> Show AttributeValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttributeValue] -> ShowS
$cshowList :: [AttributeValue] -> ShowS
show :: AttributeValue -> String
$cshow :: AttributeValue -> String
showsPrec :: Int -> AttributeValue -> ShowS
$cshowsPrec :: Int -> AttributeValue -> ShowS
Prelude.Show, (forall x. AttributeValue -> Rep AttributeValue x)
-> (forall x. Rep AttributeValue x -> AttributeValue)
-> Generic AttributeValue
forall x. Rep AttributeValue x -> AttributeValue
forall x. AttributeValue -> Rep AttributeValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttributeValue x -> AttributeValue
$cfrom :: forall x. AttributeValue -> Rep AttributeValue x
Prelude.Generic)

-- |
-- Create a value of 'AttributeValue' 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', 'attributeValue_value' - The specific value of an @attributeName@.
newAttributeValue ::
  AttributeValue
newAttributeValue :: AttributeValue
newAttributeValue =
  AttributeValue' :: Maybe Text -> AttributeValue
AttributeValue' {$sel:value:AttributeValue' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The specific value of an @attributeName@.
attributeValue_value :: Lens.Lens' AttributeValue (Prelude.Maybe Prelude.Text)
attributeValue_value :: (Maybe Text -> f (Maybe Text))
-> AttributeValue -> f AttributeValue
attributeValue_value = (AttributeValue -> Maybe Text)
-> (AttributeValue -> Maybe Text -> AttributeValue)
-> Lens AttributeValue AttributeValue (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttributeValue' {Maybe Text
value :: Maybe Text
$sel:value:AttributeValue' :: AttributeValue -> Maybe Text
value} -> Maybe Text
value) (\s :: AttributeValue
s@AttributeValue' {} Maybe Text
a -> AttributeValue
s {$sel:value:AttributeValue' :: Maybe Text
value = Maybe Text
a} :: AttributeValue)

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

instance Prelude.Hashable AttributeValue

instance Prelude.NFData AttributeValue