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

import Amazonka.CodePipeline.Types.JobWorkerExecutorConfiguration
import Amazonka.CodePipeline.Types.LambdaExecutorConfiguration
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

-- | The action engine, or executor, related to the supported integration
-- model used to create and update the action type. The available executor
-- types are @Lambda@ and @JobWorker@.
--
-- /See:/ 'newExecutorConfiguration' smart constructor.
data ExecutorConfiguration = ExecutorConfiguration'
  { -- | Details about the @JobWorker@ executor of the action type.
    ExecutorConfiguration -> Maybe JobWorkerExecutorConfiguration
jobWorkerExecutorConfiguration :: Prelude.Maybe JobWorkerExecutorConfiguration,
    -- | Details about the @Lambda@ executor of the action type.
    ExecutorConfiguration -> Maybe LambdaExecutorConfiguration
lambdaExecutorConfiguration :: Prelude.Maybe LambdaExecutorConfiguration
  }
  deriving (ExecutorConfiguration -> ExecutorConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExecutorConfiguration -> ExecutorConfiguration -> Bool
$c/= :: ExecutorConfiguration -> ExecutorConfiguration -> Bool
== :: ExecutorConfiguration -> ExecutorConfiguration -> Bool
$c== :: ExecutorConfiguration -> ExecutorConfiguration -> Bool
Prelude.Eq, ReadPrec [ExecutorConfiguration]
ReadPrec ExecutorConfiguration
Int -> ReadS ExecutorConfiguration
ReadS [ExecutorConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExecutorConfiguration]
$creadListPrec :: ReadPrec [ExecutorConfiguration]
readPrec :: ReadPrec ExecutorConfiguration
$creadPrec :: ReadPrec ExecutorConfiguration
readList :: ReadS [ExecutorConfiguration]
$creadList :: ReadS [ExecutorConfiguration]
readsPrec :: Int -> ReadS ExecutorConfiguration
$creadsPrec :: Int -> ReadS ExecutorConfiguration
Prelude.Read, Int -> ExecutorConfiguration -> ShowS
[ExecutorConfiguration] -> ShowS
ExecutorConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExecutorConfiguration] -> ShowS
$cshowList :: [ExecutorConfiguration] -> ShowS
show :: ExecutorConfiguration -> String
$cshow :: ExecutorConfiguration -> String
showsPrec :: Int -> ExecutorConfiguration -> ShowS
$cshowsPrec :: Int -> ExecutorConfiguration -> ShowS
Prelude.Show, forall x. Rep ExecutorConfiguration x -> ExecutorConfiguration
forall x. ExecutorConfiguration -> Rep ExecutorConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExecutorConfiguration x -> ExecutorConfiguration
$cfrom :: forall x. ExecutorConfiguration -> Rep ExecutorConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ExecutorConfiguration' 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:
--
-- 'jobWorkerExecutorConfiguration', 'executorConfiguration_jobWorkerExecutorConfiguration' - Details about the @JobWorker@ executor of the action type.
--
-- 'lambdaExecutorConfiguration', 'executorConfiguration_lambdaExecutorConfiguration' - Details about the @Lambda@ executor of the action type.
newExecutorConfiguration ::
  ExecutorConfiguration
newExecutorConfiguration :: ExecutorConfiguration
newExecutorConfiguration =
  ExecutorConfiguration'
    { $sel:jobWorkerExecutorConfiguration:ExecutorConfiguration' :: Maybe JobWorkerExecutorConfiguration
jobWorkerExecutorConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:lambdaExecutorConfiguration:ExecutorConfiguration' :: Maybe LambdaExecutorConfiguration
lambdaExecutorConfiguration = forall a. Maybe a
Prelude.Nothing
    }

-- | Details about the @JobWorker@ executor of the action type.
executorConfiguration_jobWorkerExecutorConfiguration :: Lens.Lens' ExecutorConfiguration (Prelude.Maybe JobWorkerExecutorConfiguration)
executorConfiguration_jobWorkerExecutorConfiguration :: Lens' ExecutorConfiguration (Maybe JobWorkerExecutorConfiguration)
executorConfiguration_jobWorkerExecutorConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutorConfiguration' {Maybe JobWorkerExecutorConfiguration
jobWorkerExecutorConfiguration :: Maybe JobWorkerExecutorConfiguration
$sel:jobWorkerExecutorConfiguration:ExecutorConfiguration' :: ExecutorConfiguration -> Maybe JobWorkerExecutorConfiguration
jobWorkerExecutorConfiguration} -> Maybe JobWorkerExecutorConfiguration
jobWorkerExecutorConfiguration) (\s :: ExecutorConfiguration
s@ExecutorConfiguration' {} Maybe JobWorkerExecutorConfiguration
a -> ExecutorConfiguration
s {$sel:jobWorkerExecutorConfiguration:ExecutorConfiguration' :: Maybe JobWorkerExecutorConfiguration
jobWorkerExecutorConfiguration = Maybe JobWorkerExecutorConfiguration
a} :: ExecutorConfiguration)

-- | Details about the @Lambda@ executor of the action type.
executorConfiguration_lambdaExecutorConfiguration :: Lens.Lens' ExecutorConfiguration (Prelude.Maybe LambdaExecutorConfiguration)
executorConfiguration_lambdaExecutorConfiguration :: Lens' ExecutorConfiguration (Maybe LambdaExecutorConfiguration)
executorConfiguration_lambdaExecutorConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutorConfiguration' {Maybe LambdaExecutorConfiguration
lambdaExecutorConfiguration :: Maybe LambdaExecutorConfiguration
$sel:lambdaExecutorConfiguration:ExecutorConfiguration' :: ExecutorConfiguration -> Maybe LambdaExecutorConfiguration
lambdaExecutorConfiguration} -> Maybe LambdaExecutorConfiguration
lambdaExecutorConfiguration) (\s :: ExecutorConfiguration
s@ExecutorConfiguration' {} Maybe LambdaExecutorConfiguration
a -> ExecutorConfiguration
s {$sel:lambdaExecutorConfiguration:ExecutorConfiguration' :: Maybe LambdaExecutorConfiguration
lambdaExecutorConfiguration = Maybe LambdaExecutorConfiguration
a} :: ExecutorConfiguration)

instance Data.FromJSON ExecutorConfiguration where
  parseJSON :: Value -> Parser ExecutorConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ExecutorConfiguration"
      ( \Object
x ->
          Maybe JobWorkerExecutorConfiguration
-> Maybe LambdaExecutorConfiguration -> ExecutorConfiguration
ExecutorConfiguration'
            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
"jobWorkerExecutorConfiguration")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"lambdaExecutorConfiguration")
      )

instance Prelude.Hashable ExecutorConfiguration where
  hashWithSalt :: Int -> ExecutorConfiguration -> Int
hashWithSalt Int
_salt ExecutorConfiguration' {Maybe JobWorkerExecutorConfiguration
Maybe LambdaExecutorConfiguration
lambdaExecutorConfiguration :: Maybe LambdaExecutorConfiguration
jobWorkerExecutorConfiguration :: Maybe JobWorkerExecutorConfiguration
$sel:lambdaExecutorConfiguration:ExecutorConfiguration' :: ExecutorConfiguration -> Maybe LambdaExecutorConfiguration
$sel:jobWorkerExecutorConfiguration:ExecutorConfiguration' :: ExecutorConfiguration -> Maybe JobWorkerExecutorConfiguration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe JobWorkerExecutorConfiguration
jobWorkerExecutorConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LambdaExecutorConfiguration
lambdaExecutorConfiguration

instance Prelude.NFData ExecutorConfiguration where
  rnf :: ExecutorConfiguration -> ()
rnf ExecutorConfiguration' {Maybe JobWorkerExecutorConfiguration
Maybe LambdaExecutorConfiguration
lambdaExecutorConfiguration :: Maybe LambdaExecutorConfiguration
jobWorkerExecutorConfiguration :: Maybe JobWorkerExecutorConfiguration
$sel:lambdaExecutorConfiguration:ExecutorConfiguration' :: ExecutorConfiguration -> Maybe LambdaExecutorConfiguration
$sel:jobWorkerExecutorConfiguration:ExecutorConfiguration' :: ExecutorConfiguration -> Maybe JobWorkerExecutorConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe JobWorkerExecutorConfiguration
jobWorkerExecutorConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LambdaExecutorConfiguration
lambdaExecutorConfiguration

instance Data.ToJSON ExecutorConfiguration where
  toJSON :: ExecutorConfiguration -> Value
toJSON ExecutorConfiguration' {Maybe JobWorkerExecutorConfiguration
Maybe LambdaExecutorConfiguration
lambdaExecutorConfiguration :: Maybe LambdaExecutorConfiguration
jobWorkerExecutorConfiguration :: Maybe JobWorkerExecutorConfiguration
$sel:lambdaExecutorConfiguration:ExecutorConfiguration' :: ExecutorConfiguration -> Maybe LambdaExecutorConfiguration
$sel:jobWorkerExecutorConfiguration:ExecutorConfiguration' :: ExecutorConfiguration -> Maybe JobWorkerExecutorConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"jobWorkerExecutorConfiguration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe JobWorkerExecutorConfiguration
jobWorkerExecutorConfiguration,
            (Key
"lambdaExecutorConfiguration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LambdaExecutorConfiguration
lambdaExecutorConfiguration
          ]
      )