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

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

-- | When updating an output configuration using the
-- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_UpdateApplication.html UpdateApplication>
-- operation, provides information about an AWS Lambda function configured
-- as the destination.
--
-- /See:/ 'newLambdaOutputUpdate' smart constructor.
data LambdaOutputUpdate = LambdaOutputUpdate'
  { -- | ARN of the IAM role that Amazon Kinesis Analytics can assume to write to
    -- the destination function on your behalf. You need to grant the necessary
    -- permissions to this role.
    LambdaOutputUpdate -> Maybe Text
roleARNUpdate :: Prelude.Maybe Prelude.Text,
    -- | Amazon Resource Name (ARN) of the destination Lambda function.
    --
    -- 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
    -- </general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-lambda Example ARNs: AWS Lambda>
    LambdaOutputUpdate -> Maybe Text
resourceARNUpdate :: Prelude.Maybe Prelude.Text
  }
  deriving (LambdaOutputUpdate -> LambdaOutputUpdate -> Bool
(LambdaOutputUpdate -> LambdaOutputUpdate -> Bool)
-> (LambdaOutputUpdate -> LambdaOutputUpdate -> Bool)
-> Eq LambdaOutputUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaOutputUpdate -> LambdaOutputUpdate -> Bool
$c/= :: LambdaOutputUpdate -> LambdaOutputUpdate -> Bool
== :: LambdaOutputUpdate -> LambdaOutputUpdate -> Bool
$c== :: LambdaOutputUpdate -> LambdaOutputUpdate -> Bool
Prelude.Eq, ReadPrec [LambdaOutputUpdate]
ReadPrec LambdaOutputUpdate
Int -> ReadS LambdaOutputUpdate
ReadS [LambdaOutputUpdate]
(Int -> ReadS LambdaOutputUpdate)
-> ReadS [LambdaOutputUpdate]
-> ReadPrec LambdaOutputUpdate
-> ReadPrec [LambdaOutputUpdate]
-> Read LambdaOutputUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LambdaOutputUpdate]
$creadListPrec :: ReadPrec [LambdaOutputUpdate]
readPrec :: ReadPrec LambdaOutputUpdate
$creadPrec :: ReadPrec LambdaOutputUpdate
readList :: ReadS [LambdaOutputUpdate]
$creadList :: ReadS [LambdaOutputUpdate]
readsPrec :: Int -> ReadS LambdaOutputUpdate
$creadsPrec :: Int -> ReadS LambdaOutputUpdate
Prelude.Read, Int -> LambdaOutputUpdate -> ShowS
[LambdaOutputUpdate] -> ShowS
LambdaOutputUpdate -> String
(Int -> LambdaOutputUpdate -> ShowS)
-> (LambdaOutputUpdate -> String)
-> ([LambdaOutputUpdate] -> ShowS)
-> Show LambdaOutputUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaOutputUpdate] -> ShowS
$cshowList :: [LambdaOutputUpdate] -> ShowS
show :: LambdaOutputUpdate -> String
$cshow :: LambdaOutputUpdate -> String
showsPrec :: Int -> LambdaOutputUpdate -> ShowS
$cshowsPrec :: Int -> LambdaOutputUpdate -> ShowS
Prelude.Show, (forall x. LambdaOutputUpdate -> Rep LambdaOutputUpdate x)
-> (forall x. Rep LambdaOutputUpdate x -> LambdaOutputUpdate)
-> Generic LambdaOutputUpdate
forall x. Rep LambdaOutputUpdate x -> LambdaOutputUpdate
forall x. LambdaOutputUpdate -> Rep LambdaOutputUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LambdaOutputUpdate x -> LambdaOutputUpdate
$cfrom :: forall x. LambdaOutputUpdate -> Rep LambdaOutputUpdate x
Prelude.Generic)

-- |
-- Create a value of 'LambdaOutputUpdate' 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:
--
-- 'roleARNUpdate', 'lambdaOutputUpdate_roleARNUpdate' - ARN of the IAM role that Amazon Kinesis Analytics can assume to write to
-- the destination function on your behalf. You need to grant the necessary
-- permissions to this role.
--
-- 'resourceARNUpdate', 'lambdaOutputUpdate_resourceARNUpdate' - Amazon Resource Name (ARN) of the destination Lambda function.
--
-- 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
-- </general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-lambda Example ARNs: AWS Lambda>
newLambdaOutputUpdate ::
  LambdaOutputUpdate
newLambdaOutputUpdate :: LambdaOutputUpdate
newLambdaOutputUpdate =
  LambdaOutputUpdate' :: Maybe Text -> Maybe Text -> LambdaOutputUpdate
LambdaOutputUpdate'
    { $sel:roleARNUpdate:LambdaOutputUpdate' :: Maybe Text
roleARNUpdate =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceARNUpdate:LambdaOutputUpdate' :: Maybe Text
resourceARNUpdate = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | ARN of the IAM role that Amazon Kinesis Analytics can assume to write to
-- the destination function on your behalf. You need to grant the necessary
-- permissions to this role.
lambdaOutputUpdate_roleARNUpdate :: Lens.Lens' LambdaOutputUpdate (Prelude.Maybe Prelude.Text)
lambdaOutputUpdate_roleARNUpdate :: (Maybe Text -> f (Maybe Text))
-> LambdaOutputUpdate -> f LambdaOutputUpdate
lambdaOutputUpdate_roleARNUpdate = (LambdaOutputUpdate -> Maybe Text)
-> (LambdaOutputUpdate -> Maybe Text -> LambdaOutputUpdate)
-> Lens
     LambdaOutputUpdate LambdaOutputUpdate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaOutputUpdate' {Maybe Text
roleARNUpdate :: Maybe Text
$sel:roleARNUpdate:LambdaOutputUpdate' :: LambdaOutputUpdate -> Maybe Text
roleARNUpdate} -> Maybe Text
roleARNUpdate) (\s :: LambdaOutputUpdate
s@LambdaOutputUpdate' {} Maybe Text
a -> LambdaOutputUpdate
s {$sel:roleARNUpdate:LambdaOutputUpdate' :: Maybe Text
roleARNUpdate = Maybe Text
a} :: LambdaOutputUpdate)

-- | Amazon Resource Name (ARN) of the destination Lambda function.
--
-- 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
-- </general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-lambda Example ARNs: AWS Lambda>
lambdaOutputUpdate_resourceARNUpdate :: Lens.Lens' LambdaOutputUpdate (Prelude.Maybe Prelude.Text)
lambdaOutputUpdate_resourceARNUpdate :: (Maybe Text -> f (Maybe Text))
-> LambdaOutputUpdate -> f LambdaOutputUpdate
lambdaOutputUpdate_resourceARNUpdate = (LambdaOutputUpdate -> Maybe Text)
-> (LambdaOutputUpdate -> Maybe Text -> LambdaOutputUpdate)
-> Lens
     LambdaOutputUpdate LambdaOutputUpdate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaOutputUpdate' {Maybe Text
resourceARNUpdate :: Maybe Text
$sel:resourceARNUpdate:LambdaOutputUpdate' :: LambdaOutputUpdate -> Maybe Text
resourceARNUpdate} -> Maybe Text
resourceARNUpdate) (\s :: LambdaOutputUpdate
s@LambdaOutputUpdate' {} Maybe Text
a -> LambdaOutputUpdate
s {$sel:resourceARNUpdate:LambdaOutputUpdate' :: Maybe Text
resourceARNUpdate = Maybe Text
a} :: LambdaOutputUpdate)

instance Prelude.Hashable LambdaOutputUpdate

instance Prelude.NFData LambdaOutputUpdate

instance Core.ToJSON LambdaOutputUpdate where
  toJSON :: LambdaOutputUpdate -> Value
toJSON LambdaOutputUpdate' {Maybe Text
resourceARNUpdate :: Maybe Text
roleARNUpdate :: Maybe Text
$sel:resourceARNUpdate:LambdaOutputUpdate' :: LambdaOutputUpdate -> Maybe Text
$sel:roleARNUpdate:LambdaOutputUpdate' :: LambdaOutputUpdate -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RoleARNUpdate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roleARNUpdate,
            (Text
"ResourceARNUpdate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
resourceARNUpdate
          ]
      )