{-# 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.KinesisAnalyticsV2.Types.InputProcessingConfiguration
-- 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.KinesisAnalyticsV2.Types.InputProcessingConfiguration where

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types.InputLambdaProcessor
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | For a SQL-based Kinesis Data Analytics application, describes a
-- processor that is used to preprocess the records in the stream before
-- being processed by your application code. Currently, the only input
-- processor available is
-- <https://docs.aws.amazon.com/lambda/ Amazon Lambda>.
--
-- /See:/ 'newInputProcessingConfiguration' smart constructor.
data InputProcessingConfiguration = InputProcessingConfiguration'
  { -- | The InputLambdaProcessor that is used to preprocess the records in the
    -- stream before being processed by your application code.
    InputProcessingConfiguration -> InputLambdaProcessor
inputLambdaProcessor :: InputLambdaProcessor
  }
  deriving (InputProcessingConfiguration
-> InputProcessingConfiguration -> Bool
(InputProcessingConfiguration
 -> InputProcessingConfiguration -> Bool)
-> (InputProcessingConfiguration
    -> InputProcessingConfiguration -> Bool)
-> Eq InputProcessingConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputProcessingConfiguration
-> InputProcessingConfiguration -> Bool
$c/= :: InputProcessingConfiguration
-> InputProcessingConfiguration -> Bool
== :: InputProcessingConfiguration
-> InputProcessingConfiguration -> Bool
$c== :: InputProcessingConfiguration
-> InputProcessingConfiguration -> Bool
Prelude.Eq, ReadPrec [InputProcessingConfiguration]
ReadPrec InputProcessingConfiguration
Int -> ReadS InputProcessingConfiguration
ReadS [InputProcessingConfiguration]
(Int -> ReadS InputProcessingConfiguration)
-> ReadS [InputProcessingConfiguration]
-> ReadPrec InputProcessingConfiguration
-> ReadPrec [InputProcessingConfiguration]
-> Read InputProcessingConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputProcessingConfiguration]
$creadListPrec :: ReadPrec [InputProcessingConfiguration]
readPrec :: ReadPrec InputProcessingConfiguration
$creadPrec :: ReadPrec InputProcessingConfiguration
readList :: ReadS [InputProcessingConfiguration]
$creadList :: ReadS [InputProcessingConfiguration]
readsPrec :: Int -> ReadS InputProcessingConfiguration
$creadsPrec :: Int -> ReadS InputProcessingConfiguration
Prelude.Read, Int -> InputProcessingConfiguration -> ShowS
[InputProcessingConfiguration] -> ShowS
InputProcessingConfiguration -> String
(Int -> InputProcessingConfiguration -> ShowS)
-> (InputProcessingConfiguration -> String)
-> ([InputProcessingConfiguration] -> ShowS)
-> Show InputProcessingConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputProcessingConfiguration] -> ShowS
$cshowList :: [InputProcessingConfiguration] -> ShowS
show :: InputProcessingConfiguration -> String
$cshow :: InputProcessingConfiguration -> String
showsPrec :: Int -> InputProcessingConfiguration -> ShowS
$cshowsPrec :: Int -> InputProcessingConfiguration -> ShowS
Prelude.Show, (forall x.
 InputProcessingConfiguration -> Rep InputProcessingConfiguration x)
-> (forall x.
    Rep InputProcessingConfiguration x -> InputProcessingConfiguration)
-> Generic InputProcessingConfiguration
forall x.
Rep InputProcessingConfiguration x -> InputProcessingConfiguration
forall x.
InputProcessingConfiguration -> Rep InputProcessingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InputProcessingConfiguration x -> InputProcessingConfiguration
$cfrom :: forall x.
InputProcessingConfiguration -> Rep InputProcessingConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'InputProcessingConfiguration' 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:
--
-- 'inputLambdaProcessor', 'inputProcessingConfiguration_inputLambdaProcessor' - The InputLambdaProcessor that is used to preprocess the records in the
-- stream before being processed by your application code.
newInputProcessingConfiguration ::
  -- | 'inputLambdaProcessor'
  InputLambdaProcessor ->
  InputProcessingConfiguration
newInputProcessingConfiguration :: InputLambdaProcessor -> InputProcessingConfiguration
newInputProcessingConfiguration
  InputLambdaProcessor
pInputLambdaProcessor_ =
    InputProcessingConfiguration' :: InputLambdaProcessor -> InputProcessingConfiguration
InputProcessingConfiguration'
      { $sel:inputLambdaProcessor:InputProcessingConfiguration' :: InputLambdaProcessor
inputLambdaProcessor =
          InputLambdaProcessor
pInputLambdaProcessor_
      }

-- | The InputLambdaProcessor that is used to preprocess the records in the
-- stream before being processed by your application code.
inputProcessingConfiguration_inputLambdaProcessor :: Lens.Lens' InputProcessingConfiguration InputLambdaProcessor
inputProcessingConfiguration_inputLambdaProcessor :: (InputLambdaProcessor -> f InputLambdaProcessor)
-> InputProcessingConfiguration -> f InputProcessingConfiguration
inputProcessingConfiguration_inputLambdaProcessor = (InputProcessingConfiguration -> InputLambdaProcessor)
-> (InputProcessingConfiguration
    -> InputLambdaProcessor -> InputProcessingConfiguration)
-> Lens
     InputProcessingConfiguration
     InputProcessingConfiguration
     InputLambdaProcessor
     InputLambdaProcessor
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputProcessingConfiguration' {InputLambdaProcessor
inputLambdaProcessor :: InputLambdaProcessor
$sel:inputLambdaProcessor:InputProcessingConfiguration' :: InputProcessingConfiguration -> InputLambdaProcessor
inputLambdaProcessor} -> InputLambdaProcessor
inputLambdaProcessor) (\s :: InputProcessingConfiguration
s@InputProcessingConfiguration' {} InputLambdaProcessor
a -> InputProcessingConfiguration
s {$sel:inputLambdaProcessor:InputProcessingConfiguration' :: InputLambdaProcessor
inputLambdaProcessor = InputLambdaProcessor
a} :: InputProcessingConfiguration)

instance
  Prelude.Hashable
    InputProcessingConfiguration

instance Prelude.NFData InputProcessingConfiguration

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