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

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

-- | Details about the polling configuration for the @JobWorker@ action
-- engine, or executor.
--
-- /See:/ 'newJobWorkerExecutorConfiguration' smart constructor.
data JobWorkerExecutorConfiguration = JobWorkerExecutorConfiguration'
  { -- | The accounts in which the job worker is configured and might poll for
    -- jobs as part of the action execution.
    JobWorkerExecutorConfiguration -> Maybe (NonEmpty Text)
pollingAccounts :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The service Principals in which the job worker is configured and might
    -- poll for jobs as part of the action execution.
    JobWorkerExecutorConfiguration -> Maybe (NonEmpty Text)
pollingServicePrincipals :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text)
  }
  deriving (JobWorkerExecutorConfiguration
-> JobWorkerExecutorConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobWorkerExecutorConfiguration
-> JobWorkerExecutorConfiguration -> Bool
$c/= :: JobWorkerExecutorConfiguration
-> JobWorkerExecutorConfiguration -> Bool
== :: JobWorkerExecutorConfiguration
-> JobWorkerExecutorConfiguration -> Bool
$c== :: JobWorkerExecutorConfiguration
-> JobWorkerExecutorConfiguration -> Bool
Prelude.Eq, ReadPrec [JobWorkerExecutorConfiguration]
ReadPrec JobWorkerExecutorConfiguration
Int -> ReadS JobWorkerExecutorConfiguration
ReadS [JobWorkerExecutorConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobWorkerExecutorConfiguration]
$creadListPrec :: ReadPrec [JobWorkerExecutorConfiguration]
readPrec :: ReadPrec JobWorkerExecutorConfiguration
$creadPrec :: ReadPrec JobWorkerExecutorConfiguration
readList :: ReadS [JobWorkerExecutorConfiguration]
$creadList :: ReadS [JobWorkerExecutorConfiguration]
readsPrec :: Int -> ReadS JobWorkerExecutorConfiguration
$creadsPrec :: Int -> ReadS JobWorkerExecutorConfiguration
Prelude.Read, Int -> JobWorkerExecutorConfiguration -> ShowS
[JobWorkerExecutorConfiguration] -> ShowS
JobWorkerExecutorConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobWorkerExecutorConfiguration] -> ShowS
$cshowList :: [JobWorkerExecutorConfiguration] -> ShowS
show :: JobWorkerExecutorConfiguration -> String
$cshow :: JobWorkerExecutorConfiguration -> String
showsPrec :: Int -> JobWorkerExecutorConfiguration -> ShowS
$cshowsPrec :: Int -> JobWorkerExecutorConfiguration -> ShowS
Prelude.Show, forall x.
Rep JobWorkerExecutorConfiguration x
-> JobWorkerExecutorConfiguration
forall x.
JobWorkerExecutorConfiguration
-> Rep JobWorkerExecutorConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep JobWorkerExecutorConfiguration x
-> JobWorkerExecutorConfiguration
$cfrom :: forall x.
JobWorkerExecutorConfiguration
-> Rep JobWorkerExecutorConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'JobWorkerExecutorConfiguration' 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:
--
-- 'pollingAccounts', 'jobWorkerExecutorConfiguration_pollingAccounts' - The accounts in which the job worker is configured and might poll for
-- jobs as part of the action execution.
--
-- 'pollingServicePrincipals', 'jobWorkerExecutorConfiguration_pollingServicePrincipals' - The service Principals in which the job worker is configured and might
-- poll for jobs as part of the action execution.
newJobWorkerExecutorConfiguration ::
  JobWorkerExecutorConfiguration
newJobWorkerExecutorConfiguration :: JobWorkerExecutorConfiguration
newJobWorkerExecutorConfiguration =
  JobWorkerExecutorConfiguration'
    { $sel:pollingAccounts:JobWorkerExecutorConfiguration' :: Maybe (NonEmpty Text)
pollingAccounts =
        forall a. Maybe a
Prelude.Nothing,
      $sel:pollingServicePrincipals:JobWorkerExecutorConfiguration' :: Maybe (NonEmpty Text)
pollingServicePrincipals = forall a. Maybe a
Prelude.Nothing
    }

-- | The accounts in which the job worker is configured and might poll for
-- jobs as part of the action execution.
jobWorkerExecutorConfiguration_pollingAccounts :: Lens.Lens' JobWorkerExecutorConfiguration (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
jobWorkerExecutorConfiguration_pollingAccounts :: Lens' JobWorkerExecutorConfiguration (Maybe (NonEmpty Text))
jobWorkerExecutorConfiguration_pollingAccounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobWorkerExecutorConfiguration' {Maybe (NonEmpty Text)
pollingAccounts :: Maybe (NonEmpty Text)
$sel:pollingAccounts:JobWorkerExecutorConfiguration' :: JobWorkerExecutorConfiguration -> Maybe (NonEmpty Text)
pollingAccounts} -> Maybe (NonEmpty Text)
pollingAccounts) (\s :: JobWorkerExecutorConfiguration
s@JobWorkerExecutorConfiguration' {} Maybe (NonEmpty Text)
a -> JobWorkerExecutorConfiguration
s {$sel:pollingAccounts:JobWorkerExecutorConfiguration' :: Maybe (NonEmpty Text)
pollingAccounts = Maybe (NonEmpty Text)
a} :: JobWorkerExecutorConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The service Principals in which the job worker is configured and might
-- poll for jobs as part of the action execution.
jobWorkerExecutorConfiguration_pollingServicePrincipals :: Lens.Lens' JobWorkerExecutorConfiguration (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
jobWorkerExecutorConfiguration_pollingServicePrincipals :: Lens' JobWorkerExecutorConfiguration (Maybe (NonEmpty Text))
jobWorkerExecutorConfiguration_pollingServicePrincipals = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobWorkerExecutorConfiguration' {Maybe (NonEmpty Text)
pollingServicePrincipals :: Maybe (NonEmpty Text)
$sel:pollingServicePrincipals:JobWorkerExecutorConfiguration' :: JobWorkerExecutorConfiguration -> Maybe (NonEmpty Text)
pollingServicePrincipals} -> Maybe (NonEmpty Text)
pollingServicePrincipals) (\s :: JobWorkerExecutorConfiguration
s@JobWorkerExecutorConfiguration' {} Maybe (NonEmpty Text)
a -> JobWorkerExecutorConfiguration
s {$sel:pollingServicePrincipals:JobWorkerExecutorConfiguration' :: Maybe (NonEmpty Text)
pollingServicePrincipals = Maybe (NonEmpty Text)
a} :: JobWorkerExecutorConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON JobWorkerExecutorConfiguration where
  parseJSON :: Value -> Parser JobWorkerExecutorConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"JobWorkerExecutorConfiguration"
      ( \Object
x ->
          Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text) -> JobWorkerExecutorConfiguration
JobWorkerExecutorConfiguration'
            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
"pollingAccounts")
            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
"pollingServicePrincipals")
      )

instance
  Prelude.Hashable
    JobWorkerExecutorConfiguration
  where
  hashWithSalt :: Int -> JobWorkerExecutorConfiguration -> Int
hashWithSalt
    Int
_salt
    JobWorkerExecutorConfiguration' {Maybe (NonEmpty Text)
pollingServicePrincipals :: Maybe (NonEmpty Text)
pollingAccounts :: Maybe (NonEmpty Text)
$sel:pollingServicePrincipals:JobWorkerExecutorConfiguration' :: JobWorkerExecutorConfiguration -> Maybe (NonEmpty Text)
$sel:pollingAccounts:JobWorkerExecutorConfiguration' :: JobWorkerExecutorConfiguration -> Maybe (NonEmpty Text)
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
pollingAccounts
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
pollingServicePrincipals

instance
  Prelude.NFData
    JobWorkerExecutorConfiguration
  where
  rnf :: JobWorkerExecutorConfiguration -> ()
rnf JobWorkerExecutorConfiguration' {Maybe (NonEmpty Text)
pollingServicePrincipals :: Maybe (NonEmpty Text)
pollingAccounts :: Maybe (NonEmpty Text)
$sel:pollingServicePrincipals:JobWorkerExecutorConfiguration' :: JobWorkerExecutorConfiguration -> Maybe (NonEmpty Text)
$sel:pollingAccounts:JobWorkerExecutorConfiguration' :: JobWorkerExecutorConfiguration -> Maybe (NonEmpty Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
pollingAccounts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
pollingServicePrincipals

instance Data.ToJSON JobWorkerExecutorConfiguration where
  toJSON :: JobWorkerExecutorConfiguration -> Value
toJSON JobWorkerExecutorConfiguration' {Maybe (NonEmpty Text)
pollingServicePrincipals :: Maybe (NonEmpty Text)
pollingAccounts :: Maybe (NonEmpty Text)
$sel:pollingServicePrincipals:JobWorkerExecutorConfiguration' :: JobWorkerExecutorConfiguration -> Maybe (NonEmpty Text)
$sel:pollingAccounts:JobWorkerExecutorConfiguration' :: JobWorkerExecutorConfiguration -> Maybe (NonEmpty Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"pollingAccounts" 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 (NonEmpty Text)
pollingAccounts,
            (Key
"pollingServicePrincipals" 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 (NonEmpty Text)
pollingServicePrincipals
          ]
      )