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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(ConformancePackInputParameter
 -> ConformancePackInputParameter -> Bool)
-> (ConformancePackInputParameter
    -> ConformancePackInputParameter -> Bool)
-> Eq ConformancePackInputParameter
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]
(Int -> ReadS ConformancePackInputParameter)
-> ReadS [ConformancePackInputParameter]
-> ReadPrec ConformancePackInputParameter
-> ReadPrec [ConformancePackInputParameter]
-> Read 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
(Int -> ConformancePackInputParameter -> ShowS)
-> (ConformancePackInputParameter -> String)
-> ([ConformancePackInputParameter] -> ShowS)
-> Show ConformancePackInputParameter
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.
 ConformancePackInputParameter
 -> Rep ConformancePackInputParameter x)
-> (forall x.
    Rep ConformancePackInputParameter x
    -> ConformancePackInputParameter)
-> Generic ConformancePackInputParameter
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' :: Text -> Text -> ConformancePackInputParameter
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 :: (Text -> f Text)
-> ConformancePackInputParameter -> f ConformancePackInputParameter
conformancePackInputParameter_parameterName = (ConformancePackInputParameter -> Text)
-> (ConformancePackInputParameter
    -> Text -> ConformancePackInputParameter)
-> Lens
     ConformancePackInputParameter
     ConformancePackInputParameter
     Text
     Text
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 :: (Text -> f Text)
-> ConformancePackInputParameter -> f ConformancePackInputParameter
conformancePackInputParameter_parameterValue = (ConformancePackInputParameter -> Text)
-> (ConformancePackInputParameter
    -> Text -> ConformancePackInputParameter)
-> Lens
     ConformancePackInputParameter
     ConformancePackInputParameter
     Text
     Text
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 Core.FromJSON ConformancePackInputParameter where
  parseJSON :: Value -> Parser ConformancePackInputParameter
parseJSON =
    String
-> (Object -> Parser ConformancePackInputParameter)
-> Value
-> Parser ConformancePackInputParameter
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ConformancePackInputParameter"
      ( \Object
x ->
          Text -> Text -> ConformancePackInputParameter
ConformancePackInputParameter'
            (Text -> Text -> ConformancePackInputParameter)
-> Parser Text -> Parser (Text -> ConformancePackInputParameter)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ParameterName")
            Parser (Text -> ConformancePackInputParameter)
-> Parser Text -> Parser ConformancePackInputParameter
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ParameterValue")
      )

instance
  Prelude.Hashable
    ConformancePackInputParameter

instance Prelude.NFData ConformancePackInputParameter

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ParameterName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
parameterName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ParameterValue" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
parameterValue)
          ]
      )