{-# 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.KinesisAnalytics.Types.InputLambdaProcessor
-- 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.KinesisAnalytics.Types.InputLambdaProcessor where

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

-- | An object that contains the Amazon Resource Name (ARN) of the
-- <https://docs.aws.amazon.com/lambda/ AWS Lambda> function that is used
-- to preprocess records in the stream, and the ARN of the IAM role that is
-- used to access the AWS Lambda function.
--
-- /See:/ 'newInputLambdaProcessor' smart constructor.
data InputLambdaProcessor = InputLambdaProcessor'
  { -- | The ARN of the <https://docs.aws.amazon.com/lambda/ AWS Lambda> function
    -- that operates on records in the stream.
    --
    -- To specify an earlier version of the Lambda function than the latest,
    -- include the Lambda function version in the Lambda function ARN. For more
    -- information about Lambda ARNs, see
    -- </general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-lambda Example ARNs: AWS Lambda>
    InputLambdaProcessor -> Text
resourceARN :: Prelude.Text,
    -- | The ARN of the IAM role that is used to access the AWS Lambda function.
    InputLambdaProcessor -> Text
roleARN :: Prelude.Text
  }
  deriving (InputLambdaProcessor -> InputLambdaProcessor -> Bool
(InputLambdaProcessor -> InputLambdaProcessor -> Bool)
-> (InputLambdaProcessor -> InputLambdaProcessor -> Bool)
-> Eq InputLambdaProcessor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputLambdaProcessor -> InputLambdaProcessor -> Bool
$c/= :: InputLambdaProcessor -> InputLambdaProcessor -> Bool
== :: InputLambdaProcessor -> InputLambdaProcessor -> Bool
$c== :: InputLambdaProcessor -> InputLambdaProcessor -> Bool
Prelude.Eq, ReadPrec [InputLambdaProcessor]
ReadPrec InputLambdaProcessor
Int -> ReadS InputLambdaProcessor
ReadS [InputLambdaProcessor]
(Int -> ReadS InputLambdaProcessor)
-> ReadS [InputLambdaProcessor]
-> ReadPrec InputLambdaProcessor
-> ReadPrec [InputLambdaProcessor]
-> Read InputLambdaProcessor
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputLambdaProcessor]
$creadListPrec :: ReadPrec [InputLambdaProcessor]
readPrec :: ReadPrec InputLambdaProcessor
$creadPrec :: ReadPrec InputLambdaProcessor
readList :: ReadS [InputLambdaProcessor]
$creadList :: ReadS [InputLambdaProcessor]
readsPrec :: Int -> ReadS InputLambdaProcessor
$creadsPrec :: Int -> ReadS InputLambdaProcessor
Prelude.Read, Int -> InputLambdaProcessor -> ShowS
[InputLambdaProcessor] -> ShowS
InputLambdaProcessor -> String
(Int -> InputLambdaProcessor -> ShowS)
-> (InputLambdaProcessor -> String)
-> ([InputLambdaProcessor] -> ShowS)
-> Show InputLambdaProcessor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputLambdaProcessor] -> ShowS
$cshowList :: [InputLambdaProcessor] -> ShowS
show :: InputLambdaProcessor -> String
$cshow :: InputLambdaProcessor -> String
showsPrec :: Int -> InputLambdaProcessor -> ShowS
$cshowsPrec :: Int -> InputLambdaProcessor -> ShowS
Prelude.Show, (forall x. InputLambdaProcessor -> Rep InputLambdaProcessor x)
-> (forall x. Rep InputLambdaProcessor x -> InputLambdaProcessor)
-> Generic InputLambdaProcessor
forall x. Rep InputLambdaProcessor x -> InputLambdaProcessor
forall x. InputLambdaProcessor -> Rep InputLambdaProcessor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputLambdaProcessor x -> InputLambdaProcessor
$cfrom :: forall x. InputLambdaProcessor -> Rep InputLambdaProcessor x
Prelude.Generic)

-- |
-- Create a value of 'InputLambdaProcessor' 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:
--
-- 'resourceARN', 'inputLambdaProcessor_resourceARN' - The ARN of the <https://docs.aws.amazon.com/lambda/ AWS Lambda> function
-- that operates on records in the stream.
--
-- To specify an earlier version of the Lambda function than the latest,
-- include the Lambda function version in the Lambda function ARN. For more
-- information about Lambda ARNs, see
-- </general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-lambda Example ARNs: AWS Lambda>
--
-- 'roleARN', 'inputLambdaProcessor_roleARN' - The ARN of the IAM role that is used to access the AWS Lambda function.
newInputLambdaProcessor ::
  -- | 'resourceARN'
  Prelude.Text ->
  -- | 'roleARN'
  Prelude.Text ->
  InputLambdaProcessor
newInputLambdaProcessor :: Text -> Text -> InputLambdaProcessor
newInputLambdaProcessor Text
pResourceARN_ Text
pRoleARN_ =
  InputLambdaProcessor' :: Text -> Text -> InputLambdaProcessor
InputLambdaProcessor'
    { $sel:resourceARN:InputLambdaProcessor' :: Text
resourceARN = Text
pResourceARN_,
      $sel:roleARN:InputLambdaProcessor' :: Text
roleARN = Text
pRoleARN_
    }

-- | The ARN of the <https://docs.aws.amazon.com/lambda/ AWS Lambda> function
-- that operates on records in the stream.
--
-- To specify an earlier version of the Lambda function than the latest,
-- include the Lambda function version in the Lambda function ARN. For more
-- information about Lambda ARNs, see
-- </general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-lambda Example ARNs: AWS Lambda>
inputLambdaProcessor_resourceARN :: Lens.Lens' InputLambdaProcessor Prelude.Text
inputLambdaProcessor_resourceARN :: (Text -> f Text) -> InputLambdaProcessor -> f InputLambdaProcessor
inputLambdaProcessor_resourceARN = (InputLambdaProcessor -> Text)
-> (InputLambdaProcessor -> Text -> InputLambdaProcessor)
-> Lens InputLambdaProcessor InputLambdaProcessor Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputLambdaProcessor' {Text
resourceARN :: Text
$sel:resourceARN:InputLambdaProcessor' :: InputLambdaProcessor -> Text
resourceARN} -> Text
resourceARN) (\s :: InputLambdaProcessor
s@InputLambdaProcessor' {} Text
a -> InputLambdaProcessor
s {$sel:resourceARN:InputLambdaProcessor' :: Text
resourceARN = Text
a} :: InputLambdaProcessor)

-- | The ARN of the IAM role that is used to access the AWS Lambda function.
inputLambdaProcessor_roleARN :: Lens.Lens' InputLambdaProcessor Prelude.Text
inputLambdaProcessor_roleARN :: (Text -> f Text) -> InputLambdaProcessor -> f InputLambdaProcessor
inputLambdaProcessor_roleARN = (InputLambdaProcessor -> Text)
-> (InputLambdaProcessor -> Text -> InputLambdaProcessor)
-> Lens InputLambdaProcessor InputLambdaProcessor Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputLambdaProcessor' {Text
roleARN :: Text
$sel:roleARN:InputLambdaProcessor' :: InputLambdaProcessor -> Text
roleARN} -> Text
roleARN) (\s :: InputLambdaProcessor
s@InputLambdaProcessor' {} Text
a -> InputLambdaProcessor
s {$sel:roleARN:InputLambdaProcessor' :: Text
roleARN = Text
a} :: InputLambdaProcessor)

instance Prelude.Hashable InputLambdaProcessor

instance Prelude.NFData InputLambdaProcessor

instance Core.ToJSON InputLambdaProcessor where
  toJSON :: InputLambdaProcessor -> Value
toJSON InputLambdaProcessor' {Text
roleARN :: Text
resourceARN :: Text
$sel:roleARN:InputLambdaProcessor' :: InputLambdaProcessor -> Text
$sel:resourceARN:InputLambdaProcessor' :: InputLambdaProcessor -> 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
"ResourceARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceARN),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RoleARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleARN)
          ]
      )