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

-- |
-- Create a value of 'StepAutomationConfiguration' 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', 'stepAutomationConfiguration_command' - The command to run the script.
--
-- 'runEnvironment', 'stepAutomationConfiguration_runEnvironment' - The source or target environment.
--
-- 'scriptLocationS3Bucket', 'stepAutomationConfiguration_scriptLocationS3Bucket' - The Amazon S3 bucket where the script is located.
--
-- 'scriptLocationS3Key', 'stepAutomationConfiguration_scriptLocationS3Key' - The Amazon S3 key for the script location.
--
-- 'targetType', 'stepAutomationConfiguration_targetType' - The servers on which to run the script.
newStepAutomationConfiguration ::
  StepAutomationConfiguration
newStepAutomationConfiguration :: StepAutomationConfiguration
newStepAutomationConfiguration =
  StepAutomationConfiguration'
    { $sel:command:StepAutomationConfiguration' :: Maybe PlatformCommand
command =
        forall a. Maybe a
Prelude.Nothing,
      $sel:runEnvironment:StepAutomationConfiguration' :: Maybe RunEnvironment
runEnvironment = forall a. Maybe a
Prelude.Nothing,
      $sel:scriptLocationS3Bucket:StepAutomationConfiguration' :: Maybe Text
scriptLocationS3Bucket = forall a. Maybe a
Prelude.Nothing,
      $sel:scriptLocationS3Key:StepAutomationConfiguration' :: Maybe PlatformScriptKey
scriptLocationS3Key = forall a. Maybe a
Prelude.Nothing,
      $sel:targetType:StepAutomationConfiguration' :: Maybe TargetType
targetType = forall a. Maybe a
Prelude.Nothing
    }

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

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

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

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

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

instance Data.FromJSON StepAutomationConfiguration where
  parseJSON :: Value -> Parser StepAutomationConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StepAutomationConfiguration"
      ( \Object
x ->
          Maybe PlatformCommand
-> Maybe RunEnvironment
-> Maybe Text
-> Maybe PlatformScriptKey
-> Maybe TargetType
-> StepAutomationConfiguration
StepAutomationConfiguration'
            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 StepAutomationConfiguration where
  hashWithSalt :: Int -> StepAutomationConfiguration -> Int
hashWithSalt Int
_salt StepAutomationConfiguration' {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:StepAutomationConfiguration' :: StepAutomationConfiguration -> Maybe TargetType
$sel:scriptLocationS3Key:StepAutomationConfiguration' :: StepAutomationConfiguration -> Maybe PlatformScriptKey
$sel:scriptLocationS3Bucket:StepAutomationConfiguration' :: StepAutomationConfiguration -> Maybe Text
$sel:runEnvironment:StepAutomationConfiguration' :: StepAutomationConfiguration -> Maybe RunEnvironment
$sel:command:StepAutomationConfiguration' :: StepAutomationConfiguration -> 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 StepAutomationConfiguration where
  rnf :: StepAutomationConfiguration -> ()
rnf StepAutomationConfiguration' {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:StepAutomationConfiguration' :: StepAutomationConfiguration -> Maybe TargetType
$sel:scriptLocationS3Key:StepAutomationConfiguration' :: StepAutomationConfiguration -> Maybe PlatformScriptKey
$sel:scriptLocationS3Bucket:StepAutomationConfiguration' :: StepAutomationConfiguration -> Maybe Text
$sel:runEnvironment:StepAutomationConfiguration' :: StepAutomationConfiguration -> Maybe RunEnvironment
$sel:command:StepAutomationConfiguration' :: StepAutomationConfiguration -> 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