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

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

-- | The value of a dimension with a specific attribute.
dimensionValuesWithAttributes_value :: Lens.Lens' DimensionValuesWithAttributes (Prelude.Maybe Prelude.Text)
dimensionValuesWithAttributes_value :: Lens' DimensionValuesWithAttributes (Maybe Text)
dimensionValuesWithAttributes_value = 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)

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

instance
  Prelude.Hashable
    DimensionValuesWithAttributes
  where
  hashWithSalt :: Int -> DimensionValuesWithAttributes -> Int
hashWithSalt Int
_salt DimensionValuesWithAttributes' {Maybe Text
Maybe (HashMap Text Text)
value :: Maybe Text
attributes :: Maybe (HashMap Text Text)
$sel:value:DimensionValuesWithAttributes' :: DimensionValuesWithAttributes -> Maybe Text
$sel:attributes:DimensionValuesWithAttributes' :: DimensionValuesWithAttributes -> Maybe (HashMap Text Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
attributes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value

instance Prelude.NFData DimensionValuesWithAttributes where
  rnf :: DimensionValuesWithAttributes -> ()
rnf DimensionValuesWithAttributes' {Maybe Text
Maybe (HashMap Text Text)
value :: Maybe Text
attributes :: Maybe (HashMap Text Text)
$sel:value:DimensionValuesWithAttributes' :: DimensionValuesWithAttributes -> Maybe Text
$sel:attributes:DimensionValuesWithAttributes' :: DimensionValuesWithAttributes -> Maybe (HashMap Text Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
attributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value