{-# 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.Config.Types.ConformancePackInputParameter
-- 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.Config.Types.ConformancePackInputParameter 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

-- | Input parameters in the form of key-value pairs for the conformance
-- pack, both of which you define. Keys can have a maximum character length
-- of 255 characters, and values can have a maximum length of 4096
-- characters.
--
-- /See:/ 'newConformancePackInputParameter' smart constructor.
data ConformancePackInputParameter = ConformancePackInputParameter'
  { -- | One part of a key-value pair.
    ConformancePackInputParameter -> Text
parameterName :: Prelude.Text,
    -- | Another part of the key-value pair.
    ConformancePackInputParameter -> Text
parameterValue :: Prelude.Text
  }
  deriving (ConformancePackInputParameter
-> ConformancePackInputParameter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConformancePackInputParameter
-> ConformancePackInputParameter -> Bool
$c/= :: ConformancePackInputParameter
-> ConformancePackInputParameter -> Bool
== :: ConformancePackInputParameter
-> ConformancePackInputParameter -> Bool
$c== :: ConformancePackInputParameter
-> ConformancePackInputParameter -> Bool
Prelude.Eq, ReadPrec [ConformancePackInputParameter]
ReadPrec ConformancePackInputParameter
Int -> ReadS ConformancePackInputParameter
ReadS [ConformancePackInputParameter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConformancePackInputParameter]
$creadListPrec :: ReadPrec [ConformancePackInputParameter]
readPrec :: ReadPrec ConformancePackInputParameter
$creadPrec :: ReadPrec ConformancePackInputParameter
readList :: ReadS [ConformancePackInputParameter]
$creadList :: ReadS [ConformancePackInputParameter]
readsPrec :: Int -> ReadS ConformancePackInputParameter
$creadsPrec :: Int -> ReadS ConformancePackInputParameter
Prelude.Read, Int -> ConformancePackInputParameter -> ShowS
[ConformancePackInputParameter] -> ShowS
ConformancePackInputParameter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConformancePackInputParameter] -> ShowS
$cshowList :: [ConformancePackInputParameter] -> ShowS
show :: ConformancePackInputParameter -> String
$cshow :: ConformancePackInputParameter -> String
showsPrec :: Int -> ConformancePackInputParameter -> ShowS
$cshowsPrec :: Int -> ConformancePackInputParameter -> ShowS
Prelude.Show, forall x.
Rep ConformancePackInputParameter x
-> ConformancePackInputParameter
forall x.
ConformancePackInputParameter
-> Rep ConformancePackInputParameter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConformancePackInputParameter x
-> ConformancePackInputParameter
$cfrom :: forall x.
ConformancePackInputParameter
-> Rep ConformancePackInputParameter x
Prelude.Generic)

-- |
-- Create a value of 'ConformancePackInputParameter' 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:
--
-- 'parameterName', 'conformancePackInputParameter_parameterName' - One part of a key-value pair.
--
-- 'parameterValue', 'conformancePackInputParameter_parameterValue' - Another part of the key-value pair.
newConformancePackInputParameter ::
  -- | 'parameterName'
  Prelude.Text ->
  -- | 'parameterValue'
  Prelude.Text ->
  ConformancePackInputParameter
newConformancePackInputParameter :: Text -> Text -> ConformancePackInputParameter
newConformancePackInputParameter
  Text
pParameterName_
  Text
pParameterValue_ =
    ConformancePackInputParameter'
      { $sel:parameterName:ConformancePackInputParameter' :: Text
parameterName =
          Text
pParameterName_,
        $sel:parameterValue:ConformancePackInputParameter' :: Text
parameterValue = Text
pParameterValue_
      }

-- | One part of a key-value pair.
conformancePackInputParameter_parameterName :: Lens.Lens' ConformancePackInputParameter Prelude.Text
conformancePackInputParameter_parameterName :: Lens' ConformancePackInputParameter Text
conformancePackInputParameter_parameterName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackInputParameter' {Text
parameterName :: Text
$sel:parameterName:ConformancePackInputParameter' :: ConformancePackInputParameter -> Text
parameterName} -> Text
parameterName) (\s :: ConformancePackInputParameter
s@ConformancePackInputParameter' {} Text
a -> ConformancePackInputParameter
s {$sel:parameterName:ConformancePackInputParameter' :: Text
parameterName = Text
a} :: ConformancePackInputParameter)

-- | Another part of the key-value pair.
conformancePackInputParameter_parameterValue :: Lens.Lens' ConformancePackInputParameter Prelude.Text
conformancePackInputParameter_parameterValue :: Lens' ConformancePackInputParameter Text
conformancePackInputParameter_parameterValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackInputParameter' {Text
parameterValue :: Text
$sel:parameterValue:ConformancePackInputParameter' :: ConformancePackInputParameter -> Text
parameterValue} -> Text
parameterValue) (\s :: ConformancePackInputParameter
s@ConformancePackInputParameter' {} Text
a -> ConformancePackInputParameter
s {$sel:parameterValue:ConformancePackInputParameter' :: Text
parameterValue = Text
a} :: ConformancePackInputParameter)

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

instance
  Prelude.Hashable
    ConformancePackInputParameter
  where
  hashWithSalt :: Int -> ConformancePackInputParameter -> Int
hashWithSalt Int
_salt ConformancePackInputParameter' {Text
parameterValue :: Text
parameterName :: Text
$sel:parameterValue:ConformancePackInputParameter' :: ConformancePackInputParameter -> Text
$sel:parameterName:ConformancePackInputParameter' :: ConformancePackInputParameter -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
parameterName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
parameterValue

instance Prelude.NFData ConformancePackInputParameter where
  rnf :: ConformancePackInputParameter -> ()
rnf ConformancePackInputParameter' {Text
parameterValue :: Text
parameterName :: Text
$sel:parameterValue:ConformancePackInputParameter' :: ConformancePackInputParameter -> Text
$sel:parameterName:ConformancePackInputParameter' :: ConformancePackInputParameter -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
parameterName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
parameterValue

instance Data.ToJSON ConformancePackInputParameter where
  toJSON :: ConformancePackInputParameter -> Value
toJSON ConformancePackInputParameter' {Text
parameterValue :: Text
parameterName :: Text
$sel:parameterValue:ConformancePackInputParameter' :: ConformancePackInputParameter -> Text
$sel:parameterName:ConformancePackInputParameter' :: ConformancePackInputParameter -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"ParameterName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
parameterName),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"ParameterValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
parameterValue)
          ]
      )