{-# 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.InputLambdaProcessorDescription
-- 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.InputLambdaProcessorDescription 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 expression.
--
-- /See:/ 'newInputLambdaProcessorDescription' smart constructor.
data InputLambdaProcessorDescription = InputLambdaProcessorDescription'
  { -- | The ARN of the <https://docs.aws.amazon.com/lambda/ AWS Lambda> function
    -- that is used to preprocess the records in the stream.
    InputLambdaProcessorDescription -> Maybe Text
resourceARN :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the IAM role that is used to access the AWS Lambda function.
    InputLambdaProcessorDescription -> Maybe Text
roleARN :: Prelude.Maybe Prelude.Text
  }
  deriving (InputLambdaProcessorDescription
-> InputLambdaProcessorDescription -> Bool
(InputLambdaProcessorDescription
 -> InputLambdaProcessorDescription -> Bool)
-> (InputLambdaProcessorDescription
    -> InputLambdaProcessorDescription -> Bool)
-> Eq InputLambdaProcessorDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputLambdaProcessorDescription
-> InputLambdaProcessorDescription -> Bool
$c/= :: InputLambdaProcessorDescription
-> InputLambdaProcessorDescription -> Bool
== :: InputLambdaProcessorDescription
-> InputLambdaProcessorDescription -> Bool
$c== :: InputLambdaProcessorDescription
-> InputLambdaProcessorDescription -> Bool
Prelude.Eq, ReadPrec [InputLambdaProcessorDescription]
ReadPrec InputLambdaProcessorDescription
Int -> ReadS InputLambdaProcessorDescription
ReadS [InputLambdaProcessorDescription]
(Int -> ReadS InputLambdaProcessorDescription)
-> ReadS [InputLambdaProcessorDescription]
-> ReadPrec InputLambdaProcessorDescription
-> ReadPrec [InputLambdaProcessorDescription]
-> Read InputLambdaProcessorDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputLambdaProcessorDescription]
$creadListPrec :: ReadPrec [InputLambdaProcessorDescription]
readPrec :: ReadPrec InputLambdaProcessorDescription
$creadPrec :: ReadPrec InputLambdaProcessorDescription
readList :: ReadS [InputLambdaProcessorDescription]
$creadList :: ReadS [InputLambdaProcessorDescription]
readsPrec :: Int -> ReadS InputLambdaProcessorDescription
$creadsPrec :: Int -> ReadS InputLambdaProcessorDescription
Prelude.Read, Int -> InputLambdaProcessorDescription -> ShowS
[InputLambdaProcessorDescription] -> ShowS
InputLambdaProcessorDescription -> String
(Int -> InputLambdaProcessorDescription -> ShowS)
-> (InputLambdaProcessorDescription -> String)
-> ([InputLambdaProcessorDescription] -> ShowS)
-> Show InputLambdaProcessorDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputLambdaProcessorDescription] -> ShowS
$cshowList :: [InputLambdaProcessorDescription] -> ShowS
show :: InputLambdaProcessorDescription -> String
$cshow :: InputLambdaProcessorDescription -> String
showsPrec :: Int -> InputLambdaProcessorDescription -> ShowS
$cshowsPrec :: Int -> InputLambdaProcessorDescription -> ShowS
Prelude.Show, (forall x.
 InputLambdaProcessorDescription
 -> Rep InputLambdaProcessorDescription x)
-> (forall x.
    Rep InputLambdaProcessorDescription x
    -> InputLambdaProcessorDescription)
-> Generic InputLambdaProcessorDescription
forall x.
Rep InputLambdaProcessorDescription x
-> InputLambdaProcessorDescription
forall x.
InputLambdaProcessorDescription
-> Rep InputLambdaProcessorDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InputLambdaProcessorDescription x
-> InputLambdaProcessorDescription
$cfrom :: forall x.
InputLambdaProcessorDescription
-> Rep InputLambdaProcessorDescription x
Prelude.Generic)

-- |
-- Create a value of 'InputLambdaProcessorDescription' 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', 'inputLambdaProcessorDescription_resourceARN' - The ARN of the <https://docs.aws.amazon.com/lambda/ AWS Lambda> function
-- that is used to preprocess the records in the stream.
--
-- 'roleARN', 'inputLambdaProcessorDescription_roleARN' - The ARN of the IAM role that is used to access the AWS Lambda function.
newInputLambdaProcessorDescription ::
  InputLambdaProcessorDescription
newInputLambdaProcessorDescription :: InputLambdaProcessorDescription
newInputLambdaProcessorDescription =
  InputLambdaProcessorDescription' :: Maybe Text -> Maybe Text -> InputLambdaProcessorDescription
InputLambdaProcessorDescription'
    { $sel:resourceARN:InputLambdaProcessorDescription' :: Maybe Text
resourceARN =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleARN:InputLambdaProcessorDescription' :: Maybe Text
roleARN = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the <https://docs.aws.amazon.com/lambda/ AWS Lambda> function
-- that is used to preprocess the records in the stream.
inputLambdaProcessorDescription_resourceARN :: Lens.Lens' InputLambdaProcessorDescription (Prelude.Maybe Prelude.Text)
inputLambdaProcessorDescription_resourceARN :: (Maybe Text -> f (Maybe Text))
-> InputLambdaProcessorDescription
-> f InputLambdaProcessorDescription
inputLambdaProcessorDescription_resourceARN = (InputLambdaProcessorDescription -> Maybe Text)
-> (InputLambdaProcessorDescription
    -> Maybe Text -> InputLambdaProcessorDescription)
-> Lens
     InputLambdaProcessorDescription
     InputLambdaProcessorDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputLambdaProcessorDescription' {Maybe Text
resourceARN :: Maybe Text
$sel:resourceARN:InputLambdaProcessorDescription' :: InputLambdaProcessorDescription -> Maybe Text
resourceARN} -> Maybe Text
resourceARN) (\s :: InputLambdaProcessorDescription
s@InputLambdaProcessorDescription' {} Maybe Text
a -> InputLambdaProcessorDescription
s {$sel:resourceARN:InputLambdaProcessorDescription' :: Maybe Text
resourceARN = Maybe Text
a} :: InputLambdaProcessorDescription)

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

instance
  Core.FromJSON
    InputLambdaProcessorDescription
  where
  parseJSON :: Value -> Parser InputLambdaProcessorDescription
parseJSON =
    String
-> (Object -> Parser InputLambdaProcessorDescription)
-> Value
-> Parser InputLambdaProcessorDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InputLambdaProcessorDescription"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> InputLambdaProcessorDescription
InputLambdaProcessorDescription'
            (Maybe Text -> Maybe Text -> InputLambdaProcessorDescription)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> InputLambdaProcessorDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResourceARN")
            Parser (Maybe Text -> InputLambdaProcessorDescription)
-> Parser (Maybe Text) -> Parser InputLambdaProcessorDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RoleARN")
      )

instance
  Prelude.Hashable
    InputLambdaProcessorDescription

instance
  Prelude.NFData
    InputLambdaProcessorDescription