{-# 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.LambdaOutputDescription
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.KinesisAnalyticsV2.Types.LambdaOutputDescription where

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

-- | For a SQL-based Kinesis Data Analytics application\'s output, describes
-- the Amazon Lambda function that is configured as its destination.
--
-- /See:/ 'newLambdaOutputDescription' smart constructor.
data LambdaOutputDescription = LambdaOutputDescription'
  { -- | The ARN of the IAM role that Kinesis Data Analytics can assume to write
    -- to the destination 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.
    LambdaOutputDescription -> Maybe Text
roleARN :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the destination Lambda function.
    LambdaOutputDescription -> Text
resourceARN :: Prelude.Text
  }
  deriving (LambdaOutputDescription -> LambdaOutputDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaOutputDescription -> LambdaOutputDescription -> Bool
$c/= :: LambdaOutputDescription -> LambdaOutputDescription -> Bool
== :: LambdaOutputDescription -> LambdaOutputDescription -> Bool
$c== :: LambdaOutputDescription -> LambdaOutputDescription -> Bool
Prelude.Eq, ReadPrec [LambdaOutputDescription]
ReadPrec LambdaOutputDescription
Int -> ReadS LambdaOutputDescription
ReadS [LambdaOutputDescription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LambdaOutputDescription]
$creadListPrec :: ReadPrec [LambdaOutputDescription]
readPrec :: ReadPrec LambdaOutputDescription
$creadPrec :: ReadPrec LambdaOutputDescription
readList :: ReadS [LambdaOutputDescription]
$creadList :: ReadS [LambdaOutputDescription]
readsPrec :: Int -> ReadS LambdaOutputDescription
$creadsPrec :: Int -> ReadS LambdaOutputDescription
Prelude.Read, Int -> LambdaOutputDescription -> ShowS
[LambdaOutputDescription] -> ShowS
LambdaOutputDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaOutputDescription] -> ShowS
$cshowList :: [LambdaOutputDescription] -> ShowS
show :: LambdaOutputDescription -> String
$cshow :: LambdaOutputDescription -> String
showsPrec :: Int -> LambdaOutputDescription -> ShowS
$cshowsPrec :: Int -> LambdaOutputDescription -> ShowS
Prelude.Show, forall x. Rep LambdaOutputDescription x -> LambdaOutputDescription
forall x. LambdaOutputDescription -> Rep LambdaOutputDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LambdaOutputDescription x -> LambdaOutputDescription
$cfrom :: forall x. LambdaOutputDescription -> Rep LambdaOutputDescription x
Prelude.Generic)

-- |
-- Create a value of 'LambdaOutputDescription' 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', 'lambdaOutputDescription_roleARN' - The ARN of the IAM role that Kinesis Data Analytics can assume to write
-- to the destination 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', 'lambdaOutputDescription_resourceARN' - The Amazon Resource Name (ARN) of the destination Lambda function.
newLambdaOutputDescription ::
  -- | 'resourceARN'
  Prelude.Text ->
  LambdaOutputDescription
newLambdaOutputDescription :: Text -> LambdaOutputDescription
newLambdaOutputDescription Text
pResourceARN_ =
  LambdaOutputDescription'
    { $sel:roleARN:LambdaOutputDescription' :: Maybe Text
roleARN = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceARN:LambdaOutputDescription' :: Text
resourceARN = Text
pResourceARN_
    }

-- | The ARN of the IAM role that Kinesis Data Analytics can assume to write
-- to the destination 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.
lambdaOutputDescription_roleARN :: Lens.Lens' LambdaOutputDescription (Prelude.Maybe Prelude.Text)
lambdaOutputDescription_roleARN :: Lens' LambdaOutputDescription (Maybe Text)
lambdaOutputDescription_roleARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaOutputDescription' {Maybe Text
roleARN :: Maybe Text
$sel:roleARN:LambdaOutputDescription' :: LambdaOutputDescription -> Maybe Text
roleARN} -> Maybe Text
roleARN) (\s :: LambdaOutputDescription
s@LambdaOutputDescription' {} Maybe Text
a -> LambdaOutputDescription
s {$sel:roleARN:LambdaOutputDescription' :: Maybe Text
roleARN = Maybe Text
a} :: LambdaOutputDescription)

-- | The Amazon Resource Name (ARN) of the destination Lambda function.
lambdaOutputDescription_resourceARN :: Lens.Lens' LambdaOutputDescription Prelude.Text
lambdaOutputDescription_resourceARN :: Lens' LambdaOutputDescription Text
lambdaOutputDescription_resourceARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaOutputDescription' {Text
resourceARN :: Text
$sel:resourceARN:LambdaOutputDescription' :: LambdaOutputDescription -> Text
resourceARN} -> Text
resourceARN) (\s :: LambdaOutputDescription
s@LambdaOutputDescription' {} Text
a -> LambdaOutputDescription
s {$sel:resourceARN:LambdaOutputDescription' :: Text
resourceARN = Text
a} :: LambdaOutputDescription)

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

instance Prelude.Hashable LambdaOutputDescription where
  hashWithSalt :: Int -> LambdaOutputDescription -> Int
hashWithSalt Int
_salt LambdaOutputDescription' {Maybe Text
Text
resourceARN :: Text
roleARN :: Maybe Text
$sel:resourceARN:LambdaOutputDescription' :: LambdaOutputDescription -> Text
$sel:roleARN:LambdaOutputDescription' :: LambdaOutputDescription -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleARN
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceARN

instance Prelude.NFData LambdaOutputDescription where
  rnf :: LambdaOutputDescription -> ()
rnf LambdaOutputDescription' {Maybe Text
Text
resourceARN :: Text
roleARN :: Maybe Text
$sel:resourceARN:LambdaOutputDescription' :: LambdaOutputDescription -> Text
$sel:roleARN:LambdaOutputDescription' :: LambdaOutputDescription -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceARN