{-# 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.MigrationHubOrchestrator.Types.WorkflowStepAutomationConfiguration
-- 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.MigrationHubOrchestrator.Types.WorkflowStepAutomationConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MigrationHubOrchestrator.Types.PlatformCommand
import Amazonka.MigrationHubOrchestrator.Types.PlatformScriptKey
import Amazonka.MigrationHubOrchestrator.Types.RunEnvironment
import Amazonka.MigrationHubOrchestrator.Types.TargetType
import qualified Amazonka.Prelude as Prelude

-- | The custom script to run tests on source or target environments.
--
-- /See:/ 'newWorkflowStepAutomationConfiguration' smart constructor.
data WorkflowStepAutomationConfiguration = WorkflowStepAutomationConfiguration'
  { -- | The command required to run the script.
    WorkflowStepAutomationConfiguration -> Maybe PlatformCommand
command :: Prelude.Maybe PlatformCommand,
    -- | The source or target environment.
    WorkflowStepAutomationConfiguration -> Maybe RunEnvironment
runEnvironment :: Prelude.Maybe RunEnvironment,
    -- | The Amazon S3 bucket where the script is located.
    WorkflowStepAutomationConfiguration -> Maybe Text
scriptLocationS3Bucket :: Prelude.Maybe Prelude.Text,
    -- | The Amazon S3 key for the script location.
    WorkflowStepAutomationConfiguration -> Maybe PlatformScriptKey
scriptLocationS3Key :: Prelude.Maybe PlatformScriptKey,
    -- | The servers on which to run the script.
    WorkflowStepAutomationConfiguration -> Maybe TargetType
targetType :: Prelude.Maybe TargetType
  }
  deriving (WorkflowStepAutomationConfiguration
-> WorkflowStepAutomationConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowStepAutomationConfiguration
-> WorkflowStepAutomationConfiguration -> Bool
$c/= :: WorkflowStepAutomationConfiguration
-> WorkflowStepAutomationConfiguration -> Bool
== :: WorkflowStepAutomationConfiguration
-> WorkflowStepAutomationConfiguration -> Bool
$c== :: WorkflowStepAutomationConfiguration
-> WorkflowStepAutomationConfiguration -> Bool
Prelude.Eq, ReadPrec [WorkflowStepAutomationConfiguration]
ReadPrec WorkflowStepAutomationConfiguration
Int -> ReadS WorkflowStepAutomationConfiguration
ReadS [WorkflowStepAutomationConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowStepAutomationConfiguration]
$creadListPrec :: ReadPrec [WorkflowStepAutomationConfiguration]
readPrec :: ReadPrec WorkflowStepAutomationConfiguration
$creadPrec :: ReadPrec WorkflowStepAutomationConfiguration
readList :: ReadS [WorkflowStepAutomationConfiguration]
$creadList :: ReadS [WorkflowStepAutomationConfiguration]
readsPrec :: Int -> ReadS WorkflowStepAutomationConfiguration
$creadsPrec :: Int -> ReadS WorkflowStepAutomationConfiguration
Prelude.Read, Int -> WorkflowStepAutomationConfiguration -> ShowS
[WorkflowStepAutomationConfiguration] -> ShowS
WorkflowStepAutomationConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowStepAutomationConfiguration] -> ShowS
$cshowList :: [WorkflowStepAutomationConfiguration] -> ShowS
show :: WorkflowStepAutomationConfiguration -> String
$cshow :: WorkflowStepAutomationConfiguration -> String
showsPrec :: Int -> WorkflowStepAutomationConfiguration -> ShowS
$cshowsPrec :: Int -> WorkflowStepAutomationConfiguration -> ShowS
Prelude.Show, forall x.
Rep WorkflowStepAutomationConfiguration x
-> WorkflowStepAutomationConfiguration
forall x.
WorkflowStepAutomationConfiguration
-> Rep WorkflowStepAutomationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep WorkflowStepAutomationConfiguration x
-> WorkflowStepAutomationConfiguration
$cfrom :: forall x.
WorkflowStepAutomationConfiguration
-> Rep WorkflowStepAutomationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowStepAutomationConfiguration' 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:
--
-- 'command', 'workflowStepAutomationConfiguration_command' - The command required to run the script.
--
-- 'runEnvironment', 'workflowStepAutomationConfiguration_runEnvironment' - The source or target environment.
--
-- 'scriptLocationS3Bucket', 'workflowStepAutomationConfiguration_scriptLocationS3Bucket' - The Amazon S3 bucket where the script is located.
--
-- 'scriptLocationS3Key', 'workflowStepAutomationConfiguration_scriptLocationS3Key' - The Amazon S3 key for the script location.
--
-- 'targetType', 'workflowStepAutomationConfiguration_targetType' - The servers on which to run the script.
newWorkflowStepAutomationConfiguration ::
  WorkflowStepAutomationConfiguration
newWorkflowStepAutomationConfiguration :: WorkflowStepAutomationConfiguration
newWorkflowStepAutomationConfiguration =
  WorkflowStepAutomationConfiguration'
    { $sel:command:WorkflowStepAutomationConfiguration' :: Maybe PlatformCommand
command =
        forall a. Maybe a
Prelude.Nothing,
      $sel:runEnvironment:WorkflowStepAutomationConfiguration' :: Maybe RunEnvironment
runEnvironment = forall a. Maybe a
Prelude.Nothing,
      $sel:scriptLocationS3Bucket:WorkflowStepAutomationConfiguration' :: Maybe Text
scriptLocationS3Bucket =
        forall a. Maybe a
Prelude.Nothing,
      $sel:scriptLocationS3Key:WorkflowStepAutomationConfiguration' :: Maybe PlatformScriptKey
scriptLocationS3Key = forall a. Maybe a
Prelude.Nothing,
      $sel:targetType:WorkflowStepAutomationConfiguration' :: Maybe TargetType
targetType = forall a. Maybe a
Prelude.Nothing
    }

-- | The command required to run the script.
workflowStepAutomationConfiguration_command :: Lens.Lens' WorkflowStepAutomationConfiguration (Prelude.Maybe PlatformCommand)
workflowStepAutomationConfiguration_command :: Lens' WorkflowStepAutomationConfiguration (Maybe PlatformCommand)
workflowStepAutomationConfiguration_command = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowStepAutomationConfiguration' {Maybe PlatformCommand
command :: Maybe PlatformCommand
$sel:command:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe PlatformCommand
command} -> Maybe PlatformCommand
command) (\s :: WorkflowStepAutomationConfiguration
s@WorkflowStepAutomationConfiguration' {} Maybe PlatformCommand
a -> WorkflowStepAutomationConfiguration
s {$sel:command:WorkflowStepAutomationConfiguration' :: Maybe PlatformCommand
command = Maybe PlatformCommand
a} :: WorkflowStepAutomationConfiguration)

-- | The source or target environment.
workflowStepAutomationConfiguration_runEnvironment :: Lens.Lens' WorkflowStepAutomationConfiguration (Prelude.Maybe RunEnvironment)
workflowStepAutomationConfiguration_runEnvironment :: Lens' WorkflowStepAutomationConfiguration (Maybe RunEnvironment)
workflowStepAutomationConfiguration_runEnvironment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowStepAutomationConfiguration' {Maybe RunEnvironment
runEnvironment :: Maybe RunEnvironment
$sel:runEnvironment:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe RunEnvironment
runEnvironment} -> Maybe RunEnvironment
runEnvironment) (\s :: WorkflowStepAutomationConfiguration
s@WorkflowStepAutomationConfiguration' {} Maybe RunEnvironment
a -> WorkflowStepAutomationConfiguration
s {$sel:runEnvironment:WorkflowStepAutomationConfiguration' :: Maybe RunEnvironment
runEnvironment = Maybe RunEnvironment
a} :: WorkflowStepAutomationConfiguration)

-- | The Amazon S3 bucket where the script is located.
workflowStepAutomationConfiguration_scriptLocationS3Bucket :: Lens.Lens' WorkflowStepAutomationConfiguration (Prelude.Maybe Prelude.Text)
workflowStepAutomationConfiguration_scriptLocationS3Bucket :: Lens' WorkflowStepAutomationConfiguration (Maybe Text)
workflowStepAutomationConfiguration_scriptLocationS3Bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowStepAutomationConfiguration' {Maybe Text
scriptLocationS3Bucket :: Maybe Text
$sel:scriptLocationS3Bucket:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe Text
scriptLocationS3Bucket} -> Maybe Text
scriptLocationS3Bucket) (\s :: WorkflowStepAutomationConfiguration
s@WorkflowStepAutomationConfiguration' {} Maybe Text
a -> WorkflowStepAutomationConfiguration
s {$sel:scriptLocationS3Bucket:WorkflowStepAutomationConfiguration' :: Maybe Text
scriptLocationS3Bucket = Maybe Text
a} :: WorkflowStepAutomationConfiguration)

-- | The Amazon S3 key for the script location.
workflowStepAutomationConfiguration_scriptLocationS3Key :: Lens.Lens' WorkflowStepAutomationConfiguration (Prelude.Maybe PlatformScriptKey)
workflowStepAutomationConfiguration_scriptLocationS3Key :: Lens' WorkflowStepAutomationConfiguration (Maybe PlatformScriptKey)
workflowStepAutomationConfiguration_scriptLocationS3Key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowStepAutomationConfiguration' {Maybe PlatformScriptKey
scriptLocationS3Key :: Maybe PlatformScriptKey
$sel:scriptLocationS3Key:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe PlatformScriptKey
scriptLocationS3Key} -> Maybe PlatformScriptKey
scriptLocationS3Key) (\s :: WorkflowStepAutomationConfiguration
s@WorkflowStepAutomationConfiguration' {} Maybe PlatformScriptKey
a -> WorkflowStepAutomationConfiguration
s {$sel:scriptLocationS3Key:WorkflowStepAutomationConfiguration' :: Maybe PlatformScriptKey
scriptLocationS3Key = Maybe PlatformScriptKey
a} :: WorkflowStepAutomationConfiguration)

-- | The servers on which to run the script.
workflowStepAutomationConfiguration_targetType :: Lens.Lens' WorkflowStepAutomationConfiguration (Prelude.Maybe TargetType)
workflowStepAutomationConfiguration_targetType :: Lens' WorkflowStepAutomationConfiguration (Maybe TargetType)
workflowStepAutomationConfiguration_targetType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowStepAutomationConfiguration' {Maybe TargetType
targetType :: Maybe TargetType
$sel:targetType:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe TargetType
targetType} -> Maybe TargetType
targetType) (\s :: WorkflowStepAutomationConfiguration
s@WorkflowStepAutomationConfiguration' {} Maybe TargetType
a -> WorkflowStepAutomationConfiguration
s {$sel:targetType:WorkflowStepAutomationConfiguration' :: Maybe TargetType
targetType = Maybe TargetType
a} :: WorkflowStepAutomationConfiguration)

instance
  Data.FromJSON
    WorkflowStepAutomationConfiguration
  where
  parseJSON :: Value -> Parser WorkflowStepAutomationConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WorkflowStepAutomationConfiguration"
      ( \Object
x ->
          Maybe PlatformCommand
-> Maybe RunEnvironment
-> Maybe Text
-> Maybe PlatformScriptKey
-> Maybe TargetType
-> WorkflowStepAutomationConfiguration
WorkflowStepAutomationConfiguration'
            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
"command")
            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
"runEnvironment")
            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
"scriptLocationS3Bucket")
            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
"scriptLocationS3Key")
            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
"targetType")
      )

instance
  Prelude.Hashable
    WorkflowStepAutomationConfiguration
  where
  hashWithSalt :: Int -> WorkflowStepAutomationConfiguration -> Int
hashWithSalt
    Int
_salt
    WorkflowStepAutomationConfiguration' {Maybe Text
Maybe PlatformCommand
Maybe PlatformScriptKey
Maybe RunEnvironment
Maybe TargetType
targetType :: Maybe TargetType
scriptLocationS3Key :: Maybe PlatformScriptKey
scriptLocationS3Bucket :: Maybe Text
runEnvironment :: Maybe RunEnvironment
command :: Maybe PlatformCommand
$sel:targetType:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe TargetType
$sel:scriptLocationS3Key:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe PlatformScriptKey
$sel:scriptLocationS3Bucket:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe Text
$sel:runEnvironment:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe RunEnvironment
$sel:command:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe PlatformCommand
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PlatformCommand
command
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RunEnvironment
runEnvironment
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
scriptLocationS3Bucket
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PlatformScriptKey
scriptLocationS3Key
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TargetType
targetType

instance
  Prelude.NFData
    WorkflowStepAutomationConfiguration
  where
  rnf :: WorkflowStepAutomationConfiguration -> ()
rnf WorkflowStepAutomationConfiguration' {Maybe Text
Maybe PlatformCommand
Maybe PlatformScriptKey
Maybe RunEnvironment
Maybe TargetType
targetType :: Maybe TargetType
scriptLocationS3Key :: Maybe PlatformScriptKey
scriptLocationS3Bucket :: Maybe Text
runEnvironment :: Maybe RunEnvironment
command :: Maybe PlatformCommand
$sel:targetType:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe TargetType
$sel:scriptLocationS3Key:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe PlatformScriptKey
$sel:scriptLocationS3Bucket:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe Text
$sel:runEnvironment:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe RunEnvironment
$sel:command:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe PlatformCommand
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe PlatformCommand
command
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RunEnvironment
runEnvironment
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
scriptLocationS3Bucket
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PlatformScriptKey
scriptLocationS3Key
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TargetType
targetType

instance
  Data.ToJSON
    WorkflowStepAutomationConfiguration
  where
  toJSON :: WorkflowStepAutomationConfiguration -> Value
toJSON WorkflowStepAutomationConfiguration' {Maybe Text
Maybe PlatformCommand
Maybe PlatformScriptKey
Maybe RunEnvironment
Maybe TargetType
targetType :: Maybe TargetType
scriptLocationS3Key :: Maybe PlatformScriptKey
scriptLocationS3Bucket :: Maybe Text
runEnvironment :: Maybe RunEnvironment
command :: Maybe PlatformCommand
$sel:targetType:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe TargetType
$sel:scriptLocationS3Key:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe PlatformScriptKey
$sel:scriptLocationS3Bucket:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe Text
$sel:runEnvironment:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe RunEnvironment
$sel:command:WorkflowStepAutomationConfiguration' :: WorkflowStepAutomationConfiguration -> Maybe PlatformCommand
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"command" 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 PlatformCommand
command,
            (Key
"runEnvironment" 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 RunEnvironment
runEnvironment,
            (Key
"scriptLocationS3Bucket" 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 Text
scriptLocationS3Bucket,
            (Key
"scriptLocationS3Key" 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 PlatformScriptKey
scriptLocationS3Key,
            (Key
"targetType" 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 TargetType
targetType
          ]
      )