{-# 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.CodePipeline.Types.LambdaExecutorConfiguration
-- 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.CodePipeline.Types.LambdaExecutorConfiguration where

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

-- | Details about the configuration for the @Lambda@ action engine, or
-- executor.
--
-- /See:/ 'newLambdaExecutorConfiguration' smart constructor.
data LambdaExecutorConfiguration = LambdaExecutorConfiguration'
  { -- | The ARN of the Lambda function used by the action engine.
    LambdaExecutorConfiguration -> Text
lambdaFunctionArn :: Prelude.Text
  }
  deriving (LambdaExecutorConfiguration -> LambdaExecutorConfiguration -> Bool
(LambdaExecutorConfiguration
 -> LambdaExecutorConfiguration -> Bool)
-> (LambdaExecutorConfiguration
    -> LambdaExecutorConfiguration -> Bool)
-> Eq LambdaExecutorConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaExecutorConfiguration -> LambdaExecutorConfiguration -> Bool
$c/= :: LambdaExecutorConfiguration -> LambdaExecutorConfiguration -> Bool
== :: LambdaExecutorConfiguration -> LambdaExecutorConfiguration -> Bool
$c== :: LambdaExecutorConfiguration -> LambdaExecutorConfiguration -> Bool
Prelude.Eq, ReadPrec [LambdaExecutorConfiguration]
ReadPrec LambdaExecutorConfiguration
Int -> ReadS LambdaExecutorConfiguration
ReadS [LambdaExecutorConfiguration]
(Int -> ReadS LambdaExecutorConfiguration)
-> ReadS [LambdaExecutorConfiguration]
-> ReadPrec LambdaExecutorConfiguration
-> ReadPrec [LambdaExecutorConfiguration]
-> Read LambdaExecutorConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LambdaExecutorConfiguration]
$creadListPrec :: ReadPrec [LambdaExecutorConfiguration]
readPrec :: ReadPrec LambdaExecutorConfiguration
$creadPrec :: ReadPrec LambdaExecutorConfiguration
readList :: ReadS [LambdaExecutorConfiguration]
$creadList :: ReadS [LambdaExecutorConfiguration]
readsPrec :: Int -> ReadS LambdaExecutorConfiguration
$creadsPrec :: Int -> ReadS LambdaExecutorConfiguration
Prelude.Read, Int -> LambdaExecutorConfiguration -> ShowS
[LambdaExecutorConfiguration] -> ShowS
LambdaExecutorConfiguration -> String
(Int -> LambdaExecutorConfiguration -> ShowS)
-> (LambdaExecutorConfiguration -> String)
-> ([LambdaExecutorConfiguration] -> ShowS)
-> Show LambdaExecutorConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaExecutorConfiguration] -> ShowS
$cshowList :: [LambdaExecutorConfiguration] -> ShowS
show :: LambdaExecutorConfiguration -> String
$cshow :: LambdaExecutorConfiguration -> String
showsPrec :: Int -> LambdaExecutorConfiguration -> ShowS
$cshowsPrec :: Int -> LambdaExecutorConfiguration -> ShowS
Prelude.Show, (forall x.
 LambdaExecutorConfiguration -> Rep LambdaExecutorConfiguration x)
-> (forall x.
    Rep LambdaExecutorConfiguration x -> LambdaExecutorConfiguration)
-> Generic LambdaExecutorConfiguration
forall x.
Rep LambdaExecutorConfiguration x -> LambdaExecutorConfiguration
forall x.
LambdaExecutorConfiguration -> Rep LambdaExecutorConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LambdaExecutorConfiguration x -> LambdaExecutorConfiguration
$cfrom :: forall x.
LambdaExecutorConfiguration -> Rep LambdaExecutorConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'LambdaExecutorConfiguration' 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:
--
-- 'lambdaFunctionArn', 'lambdaExecutorConfiguration_lambdaFunctionArn' - The ARN of the Lambda function used by the action engine.
newLambdaExecutorConfiguration ::
  -- | 'lambdaFunctionArn'
  Prelude.Text ->
  LambdaExecutorConfiguration
newLambdaExecutorConfiguration :: Text -> LambdaExecutorConfiguration
newLambdaExecutorConfiguration Text
pLambdaFunctionArn_ =
  LambdaExecutorConfiguration' :: Text -> LambdaExecutorConfiguration
LambdaExecutorConfiguration'
    { $sel:lambdaFunctionArn:LambdaExecutorConfiguration' :: Text
lambdaFunctionArn =
        Text
pLambdaFunctionArn_
    }

-- | The ARN of the Lambda function used by the action engine.
lambdaExecutorConfiguration_lambdaFunctionArn :: Lens.Lens' LambdaExecutorConfiguration Prelude.Text
lambdaExecutorConfiguration_lambdaFunctionArn :: (Text -> f Text)
-> LambdaExecutorConfiguration -> f LambdaExecutorConfiguration
lambdaExecutorConfiguration_lambdaFunctionArn = (LambdaExecutorConfiguration -> Text)
-> (LambdaExecutorConfiguration
    -> Text -> LambdaExecutorConfiguration)
-> Lens
     LambdaExecutorConfiguration LambdaExecutorConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaExecutorConfiguration' {Text
lambdaFunctionArn :: Text
$sel:lambdaFunctionArn:LambdaExecutorConfiguration' :: LambdaExecutorConfiguration -> Text
lambdaFunctionArn} -> Text
lambdaFunctionArn) (\s :: LambdaExecutorConfiguration
s@LambdaExecutorConfiguration' {} Text
a -> LambdaExecutorConfiguration
s {$sel:lambdaFunctionArn:LambdaExecutorConfiguration' :: Text
lambdaFunctionArn = Text
a} :: LambdaExecutorConfiguration)

instance Core.FromJSON LambdaExecutorConfiguration where
  parseJSON :: Value -> Parser LambdaExecutorConfiguration
parseJSON =
    String
-> (Object -> Parser LambdaExecutorConfiguration)
-> Value
-> Parser LambdaExecutorConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LambdaExecutorConfiguration"
      ( \Object
x ->
          Text -> LambdaExecutorConfiguration
LambdaExecutorConfiguration'
            (Text -> LambdaExecutorConfiguration)
-> Parser Text -> Parser LambdaExecutorConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"lambdaFunctionArn")
      )

instance Prelude.Hashable LambdaExecutorConfiguration

instance Prelude.NFData LambdaExecutorConfiguration

instance Core.ToJSON LambdaExecutorConfiguration where
  toJSON :: LambdaExecutorConfiguration -> Value
toJSON LambdaExecutorConfiguration' {Text
lambdaFunctionArn :: Text
$sel:lambdaFunctionArn:LambdaExecutorConfiguration' :: LambdaExecutorConfiguration -> 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
"lambdaFunctionArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
lambdaFunctionArn)
          ]
      )