{-# 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-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.LambdaOutputDescription 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\'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
(LambdaOutputDescription -> LambdaOutputDescription -> Bool)
-> (LambdaOutputDescription -> LambdaOutputDescription -> Bool)
-> Eq LambdaOutputDescription
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]
(Int -> ReadS LambdaOutputDescription)
-> ReadS [LambdaOutputDescription]
-> ReadPrec LambdaOutputDescription
-> ReadPrec [LambdaOutputDescription]
-> Read 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
(Int -> LambdaOutputDescription -> ShowS)
-> (LambdaOutputDescription -> String)
-> ([LambdaOutputDescription] -> ShowS)
-> Show LambdaOutputDescription
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.
 LambdaOutputDescription -> Rep LambdaOutputDescription x)
-> (forall x.
    Rep LambdaOutputDescription x -> LambdaOutputDescription)
-> Generic LambdaOutputDescription
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' :: Maybe Text -> Text -> LambdaOutputDescription
LambdaOutputDescription'
    { $sel:roleARN:LambdaOutputDescription' :: Maybe Text
roleARN = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> LambdaOutputDescription -> f LambdaOutputDescription
lambdaOutputDescription_roleARN = (LambdaOutputDescription -> Maybe Text)
-> (LambdaOutputDescription
    -> Maybe Text -> LambdaOutputDescription)
-> Lens
     LambdaOutputDescription
     LambdaOutputDescription
     (Maybe Text)
     (Maybe Text)
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 :: (Text -> f Text)
-> LambdaOutputDescription -> f LambdaOutputDescription
lambdaOutputDescription_resourceARN = (LambdaOutputDescription -> Text)
-> (LambdaOutputDescription -> Text -> LambdaOutputDescription)
-> Lens LambdaOutputDescription LambdaOutputDescription Text Text
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 Core.FromJSON LambdaOutputDescription where
  parseJSON :: Value -> Parser LambdaOutputDescription
parseJSON =
    String
-> (Object -> Parser LambdaOutputDescription)
-> Value
-> Parser LambdaOutputDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LambdaOutputDescription"
      ( \Object
x ->
          Maybe Text -> Text -> LambdaOutputDescription
LambdaOutputDescription'
            (Maybe Text -> Text -> LambdaOutputDescription)
-> Parser (Maybe Text) -> Parser (Text -> LambdaOutputDescription)
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 -> LambdaOutputDescription)
-> Parser Text -> Parser LambdaOutputDescription
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 LambdaOutputDescription

instance Prelude.NFData LambdaOutputDescription