{-# 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.LambdaOutput
-- 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.LambdaOutput where

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

-- | When you configure a SQL-based Kinesis Data Analytics application\'s
-- output, identifies an Amazon Lambda function as the destination. You
-- provide the function Amazon Resource Name (ARN) of the Lambda function.
--
-- /See:/ 'newLambdaOutput' smart constructor.
data LambdaOutput = LambdaOutput'
  { -- | The Amazon Resource Name (ARN) of the destination Lambda function to
    -- write to.
    --
    -- 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>
    LambdaOutput -> Text
resourceARN :: Prelude.Text
  }
  deriving (LambdaOutput -> LambdaOutput -> Bool
(LambdaOutput -> LambdaOutput -> Bool)
-> (LambdaOutput -> LambdaOutput -> Bool) -> Eq LambdaOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaOutput -> LambdaOutput -> Bool
$c/= :: LambdaOutput -> LambdaOutput -> Bool
== :: LambdaOutput -> LambdaOutput -> Bool
$c== :: LambdaOutput -> LambdaOutput -> Bool
Prelude.Eq, ReadPrec [LambdaOutput]
ReadPrec LambdaOutput
Int -> ReadS LambdaOutput
ReadS [LambdaOutput]
(Int -> ReadS LambdaOutput)
-> ReadS [LambdaOutput]
-> ReadPrec LambdaOutput
-> ReadPrec [LambdaOutput]
-> Read LambdaOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LambdaOutput]
$creadListPrec :: ReadPrec [LambdaOutput]
readPrec :: ReadPrec LambdaOutput
$creadPrec :: ReadPrec LambdaOutput
readList :: ReadS [LambdaOutput]
$creadList :: ReadS [LambdaOutput]
readsPrec :: Int -> ReadS LambdaOutput
$creadsPrec :: Int -> ReadS LambdaOutput
Prelude.Read, Int -> LambdaOutput -> ShowS
[LambdaOutput] -> ShowS
LambdaOutput -> String
(Int -> LambdaOutput -> ShowS)
-> (LambdaOutput -> String)
-> ([LambdaOutput] -> ShowS)
-> Show LambdaOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaOutput] -> ShowS
$cshowList :: [LambdaOutput] -> ShowS
show :: LambdaOutput -> String
$cshow :: LambdaOutput -> String
showsPrec :: Int -> LambdaOutput -> ShowS
$cshowsPrec :: Int -> LambdaOutput -> ShowS
Prelude.Show, (forall x. LambdaOutput -> Rep LambdaOutput x)
-> (forall x. Rep LambdaOutput x -> LambdaOutput)
-> Generic LambdaOutput
forall x. Rep LambdaOutput x -> LambdaOutput
forall x. LambdaOutput -> Rep LambdaOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LambdaOutput x -> LambdaOutput
$cfrom :: forall x. LambdaOutput -> Rep LambdaOutput x
Prelude.Generic)

-- |
-- Create a value of 'LambdaOutput' 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', 'lambdaOutput_resourceARN' - The Amazon Resource Name (ARN) of the destination Lambda function to
-- write to.
--
-- 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>
newLambdaOutput ::
  -- | 'resourceARN'
  Prelude.Text ->
  LambdaOutput
newLambdaOutput :: Text -> LambdaOutput
newLambdaOutput Text
pResourceARN_ =
  LambdaOutput' :: Text -> LambdaOutput
LambdaOutput' {$sel:resourceARN:LambdaOutput' :: Text
resourceARN = Text
pResourceARN_}

-- | The Amazon Resource Name (ARN) of the destination Lambda function to
-- write to.
--
-- 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>
lambdaOutput_resourceARN :: Lens.Lens' LambdaOutput Prelude.Text
lambdaOutput_resourceARN :: (Text -> f Text) -> LambdaOutput -> f LambdaOutput
lambdaOutput_resourceARN = (LambdaOutput -> Text)
-> (LambdaOutput -> Text -> LambdaOutput)
-> Lens LambdaOutput LambdaOutput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaOutput' {Text
resourceARN :: Text
$sel:resourceARN:LambdaOutput' :: LambdaOutput -> Text
resourceARN} -> Text
resourceARN) (\s :: LambdaOutput
s@LambdaOutput' {} Text
a -> LambdaOutput
s {$sel:resourceARN:LambdaOutput' :: Text
resourceARN = Text
a} :: LambdaOutput)

instance Prelude.Hashable LambdaOutput

instance Prelude.NFData LambdaOutput

instance Core.ToJSON LambdaOutput where
  toJSON :: LambdaOutput -> Value
toJSON LambdaOutput' {Text
resourceARN :: Text
$sel:resourceARN:LambdaOutput' :: LambdaOutput -> 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)]
      )