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

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

-- | For a SQL-based Kinesis Data Analytics application, an object that
-- contains the Amazon Resource Name (ARN) of the Amazon Lambda function
-- that is used to preprocess records in the stream.
--
-- /See:/ 'newInputLambdaProcessorDescription' smart constructor.
data InputLambdaProcessorDescription = InputLambdaProcessorDescription'
  { -- | The ARN of the IAM role that is used to access the Amazon Lambda
    -- function.
    --
    -- Provided for backward compatibility. Applications that are created with
    -- the current API version have an application-level service execution role
    -- rather than a resource-level role.
    InputLambdaProcessorDescription -> Maybe Text
roleARN :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the Amazon Lambda function that is used to preprocess the
    -- 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
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-lambda Example ARNs: Amazon Lambda>
    InputLambdaProcessorDescription -> Text
resourceARN :: 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:
--
-- 'roleARN', 'inputLambdaProcessorDescription_roleARN' - The ARN of the IAM role that is used to access the Amazon Lambda
-- function.
--
-- Provided for backward compatibility. Applications that are created with
-- the current API version have an application-level service execution role
-- rather than a resource-level role.
--
-- 'resourceARN', 'inputLambdaProcessorDescription_resourceARN' - The ARN of the Amazon Lambda function that is used to preprocess the
-- 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
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-lambda Example ARNs: Amazon Lambda>
newInputLambdaProcessorDescription ::
  -- | 'resourceARN'
  Prelude.Text ->
  InputLambdaProcessorDescription
newInputLambdaProcessorDescription :: Text -> InputLambdaProcessorDescription
newInputLambdaProcessorDescription Text
pResourceARN_ =
  InputLambdaProcessorDescription' :: Maybe Text -> Text -> InputLambdaProcessorDescription
InputLambdaProcessorDescription'
    { $sel:roleARN:InputLambdaProcessorDescription' :: Maybe Text
roleARN =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceARN:InputLambdaProcessorDescription' :: Text
resourceARN = Text
pResourceARN_
    }

-- | The ARN of the IAM role that is used to access the Amazon Lambda
-- function.
--
-- Provided for backward compatibility. Applications that are created with
-- the current API version have an application-level service execution role
-- rather than a resource-level role.
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)

-- | The ARN of the Amazon Lambda function that is used to preprocess the
-- 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
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-lambda Example ARNs: Amazon Lambda>
inputLambdaProcessorDescription_resourceARN :: Lens.Lens' InputLambdaProcessorDescription Prelude.Text
inputLambdaProcessorDescription_resourceARN :: (Text -> f Text)
-> InputLambdaProcessorDescription
-> f InputLambdaProcessorDescription
inputLambdaProcessorDescription_resourceARN = (InputLambdaProcessorDescription -> Text)
-> (InputLambdaProcessorDescription
    -> Text -> InputLambdaProcessorDescription)
-> Lens
     InputLambdaProcessorDescription
     InputLambdaProcessorDescription
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputLambdaProcessorDescription' {Text
resourceARN :: Text
$sel:resourceARN:InputLambdaProcessorDescription' :: InputLambdaProcessorDescription -> Text
resourceARN} -> Text
resourceARN) (\s :: InputLambdaProcessorDescription
s@InputLambdaProcessorDescription' {} Text
a -> InputLambdaProcessorDescription
s {$sel:resourceARN:InputLambdaProcessorDescription' :: Text
resourceARN = 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 -> Text -> InputLambdaProcessorDescription
InputLambdaProcessorDescription'
            (Maybe Text -> Text -> InputLambdaProcessorDescription)
-> Parser (Maybe Text)
-> Parser (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
"RoleARN")
            Parser (Text -> InputLambdaProcessorDescription)
-> Parser Text -> Parser InputLambdaProcessorDescription
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
"ResourceARN")
      )

instance
  Prelude.Hashable
    InputLambdaProcessorDescription

instance
  Prelude.NFData
    InputLambdaProcessorDescription