{-# 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.Firehose.Types.ProcessorParameter
-- 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.Firehose.Types.ProcessorParameter where

import qualified Amazonka.Core as Core
import Amazonka.Firehose.Types.ProcessorParameterName
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'ProcessorParameter' 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', 'processorParameter_parameterName' - The name of the parameter.
--
-- 'parameterValue', 'processorParameter_parameterValue' - The parameter value.
newProcessorParameter ::
  -- | 'parameterName'
  ProcessorParameterName ->
  -- | 'parameterValue'
  Prelude.Text ->
  ProcessorParameter
newProcessorParameter :: ProcessorParameterName -> Text -> ProcessorParameter
newProcessorParameter
  ProcessorParameterName
pParameterName_
  Text
pParameterValue_ =
    ProcessorParameter' :: ProcessorParameterName -> Text -> ProcessorParameter
ProcessorParameter'
      { $sel:parameterName:ProcessorParameter' :: ProcessorParameterName
parameterName =
          ProcessorParameterName
pParameterName_,
        $sel:parameterValue:ProcessorParameter' :: Text
parameterValue = Text
pParameterValue_
      }

-- | The name of the parameter.
processorParameter_parameterName :: Lens.Lens' ProcessorParameter ProcessorParameterName
processorParameter_parameterName :: (ProcessorParameterName -> f ProcessorParameterName)
-> ProcessorParameter -> f ProcessorParameter
processorParameter_parameterName = (ProcessorParameter -> ProcessorParameterName)
-> (ProcessorParameter
    -> ProcessorParameterName -> ProcessorParameter)
-> Lens
     ProcessorParameter
     ProcessorParameter
     ProcessorParameterName
     ProcessorParameterName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProcessorParameter' {ProcessorParameterName
parameterName :: ProcessorParameterName
$sel:parameterName:ProcessorParameter' :: ProcessorParameter -> ProcessorParameterName
parameterName} -> ProcessorParameterName
parameterName) (\s :: ProcessorParameter
s@ProcessorParameter' {} ProcessorParameterName
a -> ProcessorParameter
s {$sel:parameterName:ProcessorParameter' :: ProcessorParameterName
parameterName = ProcessorParameterName
a} :: ProcessorParameter)

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

instance Core.FromJSON ProcessorParameter where
  parseJSON :: Value -> Parser ProcessorParameter
parseJSON =
    String
-> (Object -> Parser ProcessorParameter)
-> Value
-> Parser ProcessorParameter
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProcessorParameter"
      ( \Object
x ->
          ProcessorParameterName -> Text -> ProcessorParameter
ProcessorParameter'
            (ProcessorParameterName -> Text -> ProcessorParameter)
-> Parser ProcessorParameterName
-> Parser (Text -> ProcessorParameter)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser ProcessorParameterName
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ParameterName")
            Parser (Text -> ProcessorParameter)
-> Parser Text -> Parser ProcessorParameter
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 ProcessorParameter

instance Prelude.NFData ProcessorParameter

instance Core.ToJSON ProcessorParameter where
  toJSON :: ProcessorParameter -> Value
toJSON ProcessorParameter' {Text
ProcessorParameterName
parameterValue :: Text
parameterName :: ProcessorParameterName
$sel:parameterValue:ProcessorParameter' :: ProcessorParameter -> Text
$sel:parameterName:ProcessorParameter' :: ProcessorParameter -> ProcessorParameterName
..} =
    [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 -> ProcessorParameterName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ProcessorParameterName
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)
          ]
      )