{-# 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.DAX.Types.ParameterNameValue
-- 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.DAX.Types.ParameterNameValue where

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

-- | An individual DAX parameter.
--
-- /See:/ 'newParameterNameValue' smart constructor.
data ParameterNameValue = ParameterNameValue'
  { -- | The value of the parameter.
    ParameterNameValue -> Maybe Text
parameterValue :: Prelude.Maybe Prelude.Text,
    -- | The name of the parameter.
    ParameterNameValue -> Maybe Text
parameterName :: Prelude.Maybe Prelude.Text
  }
  deriving (ParameterNameValue -> ParameterNameValue -> Bool
(ParameterNameValue -> ParameterNameValue -> Bool)
-> (ParameterNameValue -> ParameterNameValue -> Bool)
-> Eq ParameterNameValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParameterNameValue -> ParameterNameValue -> Bool
$c/= :: ParameterNameValue -> ParameterNameValue -> Bool
== :: ParameterNameValue -> ParameterNameValue -> Bool
$c== :: ParameterNameValue -> ParameterNameValue -> Bool
Prelude.Eq, ReadPrec [ParameterNameValue]
ReadPrec ParameterNameValue
Int -> ReadS ParameterNameValue
ReadS [ParameterNameValue]
(Int -> ReadS ParameterNameValue)
-> ReadS [ParameterNameValue]
-> ReadPrec ParameterNameValue
-> ReadPrec [ParameterNameValue]
-> Read ParameterNameValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParameterNameValue]
$creadListPrec :: ReadPrec [ParameterNameValue]
readPrec :: ReadPrec ParameterNameValue
$creadPrec :: ReadPrec ParameterNameValue
readList :: ReadS [ParameterNameValue]
$creadList :: ReadS [ParameterNameValue]
readsPrec :: Int -> ReadS ParameterNameValue
$creadsPrec :: Int -> ReadS ParameterNameValue
Prelude.Read, Int -> ParameterNameValue -> ShowS
[ParameterNameValue] -> ShowS
ParameterNameValue -> String
(Int -> ParameterNameValue -> ShowS)
-> (ParameterNameValue -> String)
-> ([ParameterNameValue] -> ShowS)
-> Show ParameterNameValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParameterNameValue] -> ShowS
$cshowList :: [ParameterNameValue] -> ShowS
show :: ParameterNameValue -> String
$cshow :: ParameterNameValue -> String
showsPrec :: Int -> ParameterNameValue -> ShowS
$cshowsPrec :: Int -> ParameterNameValue -> ShowS
Prelude.Show, (forall x. ParameterNameValue -> Rep ParameterNameValue x)
-> (forall x. Rep ParameterNameValue x -> ParameterNameValue)
-> Generic ParameterNameValue
forall x. Rep ParameterNameValue x -> ParameterNameValue
forall x. ParameterNameValue -> Rep ParameterNameValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ParameterNameValue x -> ParameterNameValue
$cfrom :: forall x. ParameterNameValue -> Rep ParameterNameValue x
Prelude.Generic)

-- |
-- Create a value of 'ParameterNameValue' 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:
--
-- 'parameterValue', 'parameterNameValue_parameterValue' - The value of the parameter.
--
-- 'parameterName', 'parameterNameValue_parameterName' - The name of the parameter.
newParameterNameValue ::
  ParameterNameValue
newParameterNameValue :: ParameterNameValue
newParameterNameValue =
  ParameterNameValue' :: Maybe Text -> Maybe Text -> ParameterNameValue
ParameterNameValue'
    { $sel:parameterValue:ParameterNameValue' :: Maybe Text
parameterValue =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:parameterName:ParameterNameValue' :: Maybe Text
parameterName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The value of the parameter.
parameterNameValue_parameterValue :: Lens.Lens' ParameterNameValue (Prelude.Maybe Prelude.Text)
parameterNameValue_parameterValue :: (Maybe Text -> f (Maybe Text))
-> ParameterNameValue -> f ParameterNameValue
parameterNameValue_parameterValue = (ParameterNameValue -> Maybe Text)
-> (ParameterNameValue -> Maybe Text -> ParameterNameValue)
-> Lens
     ParameterNameValue ParameterNameValue (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterNameValue' {Maybe Text
parameterValue :: Maybe Text
$sel:parameterValue:ParameterNameValue' :: ParameterNameValue -> Maybe Text
parameterValue} -> Maybe Text
parameterValue) (\s :: ParameterNameValue
s@ParameterNameValue' {} Maybe Text
a -> ParameterNameValue
s {$sel:parameterValue:ParameterNameValue' :: Maybe Text
parameterValue = Maybe Text
a} :: ParameterNameValue)

-- | The name of the parameter.
parameterNameValue_parameterName :: Lens.Lens' ParameterNameValue (Prelude.Maybe Prelude.Text)
parameterNameValue_parameterName :: (Maybe Text -> f (Maybe Text))
-> ParameterNameValue -> f ParameterNameValue
parameterNameValue_parameterName = (ParameterNameValue -> Maybe Text)
-> (ParameterNameValue -> Maybe Text -> ParameterNameValue)
-> Lens
     ParameterNameValue ParameterNameValue (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterNameValue' {Maybe Text
parameterName :: Maybe Text
$sel:parameterName:ParameterNameValue' :: ParameterNameValue -> Maybe Text
parameterName} -> Maybe Text
parameterName) (\s :: ParameterNameValue
s@ParameterNameValue' {} Maybe Text
a -> ParameterNameValue
s {$sel:parameterName:ParameterNameValue' :: Maybe Text
parameterName = Maybe Text
a} :: ParameterNameValue)

instance Prelude.Hashable ParameterNameValue

instance Prelude.NFData ParameterNameValue

instance Core.ToJSON ParameterNameValue where
  toJSON :: ParameterNameValue -> Value
toJSON ParameterNameValue' {Maybe Text
parameterName :: Maybe Text
parameterValue :: Maybe Text
$sel:parameterName:ParameterNameValue' :: ParameterNameValue -> Maybe Text
$sel:parameterValue:ParameterNameValue' :: ParameterNameValue -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ParameterValue" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
parameterValue,
            (Text
"ParameterName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
parameterName
          ]
      )