{-# 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.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.KinesisAnalytics.Types.LambdaOutputDescription where

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

-- | For an application output, describes the AWS Lambda function configured
-- as its destination.
--
-- /See:/ 'newLambdaOutputDescription' smart constructor.
data LambdaOutputDescription = LambdaOutputDescription'
  { -- | Amazon Resource Name (ARN) of the destination Lambda function.
    LambdaOutputDescription -> Maybe Text
resourceARN :: Prelude.Maybe Prelude.Text,
    -- | ARN of the IAM role that Amazon Kinesis Analytics can assume to write to
    -- the destination function.
    LambdaOutputDescription -> Maybe Text
roleARN :: Prelude.Maybe 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:
--
-- 'resourceARN', 'lambdaOutputDescription_resourceARN' - Amazon Resource Name (ARN) of the destination Lambda function.
--
-- 'roleARN', 'lambdaOutputDescription_roleARN' - ARN of the IAM role that Amazon Kinesis Analytics can assume to write to
-- the destination function.
newLambdaOutputDescription ::
  LambdaOutputDescription
newLambdaOutputDescription :: LambdaOutputDescription
newLambdaOutputDescription =
  LambdaOutputDescription' :: Maybe Text -> Maybe Text -> LambdaOutputDescription
LambdaOutputDescription'
    { $sel:resourceARN:LambdaOutputDescription' :: Maybe Text
resourceARN =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleARN:LambdaOutputDescription' :: Maybe Text
roleARN = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Amazon Resource Name (ARN) of the destination Lambda function.
lambdaOutputDescription_resourceARN :: Lens.Lens' LambdaOutputDescription (Prelude.Maybe Prelude.Text)
lambdaOutputDescription_resourceARN :: (Maybe Text -> f (Maybe Text))
-> LambdaOutputDescription -> f LambdaOutputDescription
lambdaOutputDescription_resourceARN = (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
resourceARN :: Maybe Text
$sel:resourceARN:LambdaOutputDescription' :: LambdaOutputDescription -> Maybe Text
resourceARN} -> Maybe Text
resourceARN) (\s :: LambdaOutputDescription
s@LambdaOutputDescription' {} Maybe Text
a -> LambdaOutputDescription
s {$sel:resourceARN:LambdaOutputDescription' :: Maybe Text
resourceARN = Maybe Text
a} :: LambdaOutputDescription)

-- | ARN of the IAM role that Amazon Kinesis Analytics can assume to write to
-- the destination function.
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)

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 -> Maybe Text -> LambdaOutputDescription
LambdaOutputDescription'
            (Maybe Text -> Maybe Text -> LambdaOutputDescription)
-> Parser (Maybe Text)
-> Parser (Maybe 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
"ResourceARN")
            Parser (Maybe Text -> LambdaOutputDescription)
-> Parser (Maybe Text) -> Parser LambdaOutputDescription
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 LambdaOutputDescription

instance Prelude.NFData LambdaOutputDescription