{-# 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.LookoutMetrics.Types.DimensionNameValue
-- 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.LookoutMetrics.Types.DimensionNameValue 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

-- | A dimension name and value.
--
-- /See:/ 'newDimensionNameValue' smart constructor.
data DimensionNameValue = DimensionNameValue'
  { -- | The name of the dimension.
    DimensionNameValue -> Text
dimensionName :: Prelude.Text,
    -- | The value of the dimension.
    DimensionNameValue -> Text
dimensionValue :: Prelude.Text
  }
  deriving (DimensionNameValue -> DimensionNameValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DimensionNameValue -> DimensionNameValue -> Bool
$c/= :: DimensionNameValue -> DimensionNameValue -> Bool
== :: DimensionNameValue -> DimensionNameValue -> Bool
$c== :: DimensionNameValue -> DimensionNameValue -> Bool
Prelude.Eq, ReadPrec [DimensionNameValue]
ReadPrec DimensionNameValue
Int -> ReadS DimensionNameValue
ReadS [DimensionNameValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DimensionNameValue]
$creadListPrec :: ReadPrec [DimensionNameValue]
readPrec :: ReadPrec DimensionNameValue
$creadPrec :: ReadPrec DimensionNameValue
readList :: ReadS [DimensionNameValue]
$creadList :: ReadS [DimensionNameValue]
readsPrec :: Int -> ReadS DimensionNameValue
$creadsPrec :: Int -> ReadS DimensionNameValue
Prelude.Read, Int -> DimensionNameValue -> ShowS
[DimensionNameValue] -> ShowS
DimensionNameValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DimensionNameValue] -> ShowS
$cshowList :: [DimensionNameValue] -> ShowS
show :: DimensionNameValue -> String
$cshow :: DimensionNameValue -> String
showsPrec :: Int -> DimensionNameValue -> ShowS
$cshowsPrec :: Int -> DimensionNameValue -> ShowS
Prelude.Show, forall x. Rep DimensionNameValue x -> DimensionNameValue
forall x. DimensionNameValue -> Rep DimensionNameValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DimensionNameValue x -> DimensionNameValue
$cfrom :: forall x. DimensionNameValue -> Rep DimensionNameValue x
Prelude.Generic)

-- |
-- Create a value of 'DimensionNameValue' 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:
--
-- 'dimensionName', 'dimensionNameValue_dimensionName' - The name of the dimension.
--
-- 'dimensionValue', 'dimensionNameValue_dimensionValue' - The value of the dimension.
newDimensionNameValue ::
  -- | 'dimensionName'
  Prelude.Text ->
  -- | 'dimensionValue'
  Prelude.Text ->
  DimensionNameValue
newDimensionNameValue :: Text -> Text -> DimensionNameValue
newDimensionNameValue
  Text
pDimensionName_
  Text
pDimensionValue_ =
    DimensionNameValue'
      { $sel:dimensionName:DimensionNameValue' :: Text
dimensionName =
          Text
pDimensionName_,
        $sel:dimensionValue:DimensionNameValue' :: Text
dimensionValue = Text
pDimensionValue_
      }

-- | The name of the dimension.
dimensionNameValue_dimensionName :: Lens.Lens' DimensionNameValue Prelude.Text
dimensionNameValue_dimensionName :: Lens' DimensionNameValue Text
dimensionNameValue_dimensionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DimensionNameValue' {Text
dimensionName :: Text
$sel:dimensionName:DimensionNameValue' :: DimensionNameValue -> Text
dimensionName} -> Text
dimensionName) (\s :: DimensionNameValue
s@DimensionNameValue' {} Text
a -> DimensionNameValue
s {$sel:dimensionName:DimensionNameValue' :: Text
dimensionName = Text
a} :: DimensionNameValue)

-- | The value of the dimension.
dimensionNameValue_dimensionValue :: Lens.Lens' DimensionNameValue Prelude.Text
dimensionNameValue_dimensionValue :: Lens' DimensionNameValue Text
dimensionNameValue_dimensionValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DimensionNameValue' {Text
dimensionValue :: Text
$sel:dimensionValue:DimensionNameValue' :: DimensionNameValue -> Text
dimensionValue} -> Text
dimensionValue) (\s :: DimensionNameValue
s@DimensionNameValue' {} Text
a -> DimensionNameValue
s {$sel:dimensionValue:DimensionNameValue' :: Text
dimensionValue = Text
a} :: DimensionNameValue)

instance Data.FromJSON DimensionNameValue where
  parseJSON :: Value -> Parser DimensionNameValue
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DimensionNameValue"
      ( \Object
x ->
          Text -> Text -> DimensionNameValue
DimensionNameValue'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"DimensionName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"DimensionValue")
      )

instance Prelude.Hashable DimensionNameValue where
  hashWithSalt :: Int -> DimensionNameValue -> Int
hashWithSalt Int
_salt DimensionNameValue' {Text
dimensionValue :: Text
dimensionName :: Text
$sel:dimensionValue:DimensionNameValue' :: DimensionNameValue -> Text
$sel:dimensionName:DimensionNameValue' :: DimensionNameValue -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dimensionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dimensionValue

instance Prelude.NFData DimensionNameValue where
  rnf :: DimensionNameValue -> ()
rnf DimensionNameValue' {Text
dimensionValue :: Text
dimensionName :: Text
$sel:dimensionValue:DimensionNameValue' :: DimensionNameValue -> Text
$sel:dimensionName:DimensionNameValue' :: DimensionNameValue -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
dimensionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
dimensionValue