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

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

-- | The metadata of a specific type that you can use to filter and group
-- your results. You can use @GetDimensionValues@ to find specific values.
--
-- /See:/ 'newDimensionValuesWithAttributes' smart constructor.
data DimensionValuesWithAttributes = DimensionValuesWithAttributes'
  { -- | The value of a dimension with a specific attribute.
    DimensionValuesWithAttributes -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The attribute that applies to a specific @Dimension@.
    DimensionValuesWithAttributes -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (DimensionValuesWithAttributes
-> DimensionValuesWithAttributes -> Bool
(DimensionValuesWithAttributes
 -> DimensionValuesWithAttributes -> Bool)
-> (DimensionValuesWithAttributes
    -> DimensionValuesWithAttributes -> Bool)
-> Eq DimensionValuesWithAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DimensionValuesWithAttributes
-> DimensionValuesWithAttributes -> Bool
$c/= :: DimensionValuesWithAttributes
-> DimensionValuesWithAttributes -> Bool
== :: DimensionValuesWithAttributes
-> DimensionValuesWithAttributes -> Bool
$c== :: DimensionValuesWithAttributes
-> DimensionValuesWithAttributes -> Bool
Prelude.Eq, ReadPrec [DimensionValuesWithAttributes]
ReadPrec DimensionValuesWithAttributes
Int -> ReadS DimensionValuesWithAttributes
ReadS [DimensionValuesWithAttributes]
(Int -> ReadS DimensionValuesWithAttributes)
-> ReadS [DimensionValuesWithAttributes]
-> ReadPrec DimensionValuesWithAttributes
-> ReadPrec [DimensionValuesWithAttributes]
-> Read DimensionValuesWithAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DimensionValuesWithAttributes]
$creadListPrec :: ReadPrec [DimensionValuesWithAttributes]
readPrec :: ReadPrec DimensionValuesWithAttributes
$creadPrec :: ReadPrec DimensionValuesWithAttributes
readList :: ReadS [DimensionValuesWithAttributes]
$creadList :: ReadS [DimensionValuesWithAttributes]
readsPrec :: Int -> ReadS DimensionValuesWithAttributes
$creadsPrec :: Int -> ReadS DimensionValuesWithAttributes
Prelude.Read, Int -> DimensionValuesWithAttributes -> ShowS
[DimensionValuesWithAttributes] -> ShowS
DimensionValuesWithAttributes -> String
(Int -> DimensionValuesWithAttributes -> ShowS)
-> (DimensionValuesWithAttributes -> String)
-> ([DimensionValuesWithAttributes] -> ShowS)
-> Show DimensionValuesWithAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DimensionValuesWithAttributes] -> ShowS
$cshowList :: [DimensionValuesWithAttributes] -> ShowS
show :: DimensionValuesWithAttributes -> String
$cshow :: DimensionValuesWithAttributes -> String
showsPrec :: Int -> DimensionValuesWithAttributes -> ShowS
$cshowsPrec :: Int -> DimensionValuesWithAttributes -> ShowS
Prelude.Show, (forall x.
 DimensionValuesWithAttributes
 -> Rep DimensionValuesWithAttributes x)
-> (forall x.
    Rep DimensionValuesWithAttributes x
    -> DimensionValuesWithAttributes)
-> Generic DimensionValuesWithAttributes
forall x.
Rep DimensionValuesWithAttributes x
-> DimensionValuesWithAttributes
forall x.
DimensionValuesWithAttributes
-> Rep DimensionValuesWithAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DimensionValuesWithAttributes x
-> DimensionValuesWithAttributes
$cfrom :: forall x.
DimensionValuesWithAttributes
-> Rep DimensionValuesWithAttributes x
Prelude.Generic)

-- |
-- Create a value of 'DimensionValuesWithAttributes' 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', 'dimensionValuesWithAttributes_value' - The value of a dimension with a specific attribute.
--
-- 'attributes', 'dimensionValuesWithAttributes_attributes' - The attribute that applies to a specific @Dimension@.
newDimensionValuesWithAttributes ::
  DimensionValuesWithAttributes
newDimensionValuesWithAttributes :: DimensionValuesWithAttributes
newDimensionValuesWithAttributes =
  DimensionValuesWithAttributes' :: Maybe Text
-> Maybe (HashMap Text Text) -> DimensionValuesWithAttributes
DimensionValuesWithAttributes'
    { $sel:value:DimensionValuesWithAttributes' :: Maybe Text
value =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:attributes:DimensionValuesWithAttributes' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The value of a dimension with a specific attribute.
dimensionValuesWithAttributes_value :: Lens.Lens' DimensionValuesWithAttributes (Prelude.Maybe Prelude.Text)
dimensionValuesWithAttributes_value :: (Maybe Text -> f (Maybe Text))
-> DimensionValuesWithAttributes -> f DimensionValuesWithAttributes
dimensionValuesWithAttributes_value = (DimensionValuesWithAttributes -> Maybe Text)
-> (DimensionValuesWithAttributes
    -> Maybe Text -> DimensionValuesWithAttributes)
-> Lens
     DimensionValuesWithAttributes
     DimensionValuesWithAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DimensionValuesWithAttributes' {Maybe Text
value :: Maybe Text
$sel:value:DimensionValuesWithAttributes' :: DimensionValuesWithAttributes -> Maybe Text
value} -> Maybe Text
value) (\s :: DimensionValuesWithAttributes
s@DimensionValuesWithAttributes' {} Maybe Text
a -> DimensionValuesWithAttributes
s {$sel:value:DimensionValuesWithAttributes' :: Maybe Text
value = Maybe Text
a} :: DimensionValuesWithAttributes)

-- | The attribute that applies to a specific @Dimension@.
dimensionValuesWithAttributes_attributes :: Lens.Lens' DimensionValuesWithAttributes (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
dimensionValuesWithAttributes_attributes :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DimensionValuesWithAttributes -> f DimensionValuesWithAttributes
dimensionValuesWithAttributes_attributes = (DimensionValuesWithAttributes -> Maybe (HashMap Text Text))
-> (DimensionValuesWithAttributes
    -> Maybe (HashMap Text Text) -> DimensionValuesWithAttributes)
-> Lens
     DimensionValuesWithAttributes
     DimensionValuesWithAttributes
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DimensionValuesWithAttributes' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:DimensionValuesWithAttributes' :: DimensionValuesWithAttributes -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: DimensionValuesWithAttributes
s@DimensionValuesWithAttributes' {} Maybe (HashMap Text Text)
a -> DimensionValuesWithAttributes
s {$sel:attributes:DimensionValuesWithAttributes' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: DimensionValuesWithAttributes) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> DimensionValuesWithAttributes
 -> f DimensionValuesWithAttributes)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> DimensionValuesWithAttributes
-> f DimensionValuesWithAttributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON DimensionValuesWithAttributes where
  parseJSON :: Value -> Parser DimensionValuesWithAttributes
parseJSON =
    String
-> (Object -> Parser DimensionValuesWithAttributes)
-> Value
-> Parser DimensionValuesWithAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DimensionValuesWithAttributes"
      ( \Object
x ->
          Maybe Text
-> Maybe (HashMap Text Text) -> DimensionValuesWithAttributes
DimensionValuesWithAttributes'
            (Maybe Text
 -> Maybe (HashMap Text Text) -> DimensionValuesWithAttributes)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text) -> DimensionValuesWithAttributes)
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 (HashMap Text Text) -> DimensionValuesWithAttributes)
-> Parser (Maybe (HashMap Text Text))
-> Parser DimensionValuesWithAttributes
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Attributes" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    DimensionValuesWithAttributes

instance Prelude.NFData DimensionValuesWithAttributes