{-# 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.SSM.Types.MaintenanceWindowTaskInvocationParameters
-- 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.SSM.Types.MaintenanceWindowTaskInvocationParameters 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
import Amazonka.SSM.Types.MaintenanceWindowAutomationParameters
import Amazonka.SSM.Types.MaintenanceWindowLambdaParameters
import Amazonka.SSM.Types.MaintenanceWindowRunCommandParameters
import Amazonka.SSM.Types.MaintenanceWindowStepFunctionsParameters

-- | The parameters for task execution.
--
-- /See:/ 'newMaintenanceWindowTaskInvocationParameters' smart constructor.
data MaintenanceWindowTaskInvocationParameters = MaintenanceWindowTaskInvocationParameters'
  { -- | The parameters for an @AUTOMATION@ task type.
    MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowAutomationParameters
automation :: Prelude.Maybe MaintenanceWindowAutomationParameters,
    -- | The parameters for a @LAMBDA@ task type.
    MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowLambdaParameters
lambda :: Prelude.Maybe MaintenanceWindowLambdaParameters,
    -- | The parameters for a @RUN_COMMAND@ task type.
    MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowRunCommandParameters
runCommand :: Prelude.Maybe MaintenanceWindowRunCommandParameters,
    -- | The parameters for a @STEP_FUNCTIONS@ task type.
    MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowStepFunctionsParameters
stepFunctions :: Prelude.Maybe MaintenanceWindowStepFunctionsParameters
  }
  deriving (MaintenanceWindowTaskInvocationParameters
-> MaintenanceWindowTaskInvocationParameters -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MaintenanceWindowTaskInvocationParameters
-> MaintenanceWindowTaskInvocationParameters -> Bool
$c/= :: MaintenanceWindowTaskInvocationParameters
-> MaintenanceWindowTaskInvocationParameters -> Bool
== :: MaintenanceWindowTaskInvocationParameters
-> MaintenanceWindowTaskInvocationParameters -> Bool
$c== :: MaintenanceWindowTaskInvocationParameters
-> MaintenanceWindowTaskInvocationParameters -> Bool
Prelude.Eq, Int -> MaintenanceWindowTaskInvocationParameters -> ShowS
[MaintenanceWindowTaskInvocationParameters] -> ShowS
MaintenanceWindowTaskInvocationParameters -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MaintenanceWindowTaskInvocationParameters] -> ShowS
$cshowList :: [MaintenanceWindowTaskInvocationParameters] -> ShowS
show :: MaintenanceWindowTaskInvocationParameters -> String
$cshow :: MaintenanceWindowTaskInvocationParameters -> String
showsPrec :: Int -> MaintenanceWindowTaskInvocationParameters -> ShowS
$cshowsPrec :: Int -> MaintenanceWindowTaskInvocationParameters -> ShowS
Prelude.Show, forall x.
Rep MaintenanceWindowTaskInvocationParameters x
-> MaintenanceWindowTaskInvocationParameters
forall x.
MaintenanceWindowTaskInvocationParameters
-> Rep MaintenanceWindowTaskInvocationParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MaintenanceWindowTaskInvocationParameters x
-> MaintenanceWindowTaskInvocationParameters
$cfrom :: forall x.
MaintenanceWindowTaskInvocationParameters
-> Rep MaintenanceWindowTaskInvocationParameters x
Prelude.Generic)

-- |
-- Create a value of 'MaintenanceWindowTaskInvocationParameters' 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:
--
-- 'automation', 'maintenanceWindowTaskInvocationParameters_automation' - The parameters for an @AUTOMATION@ task type.
--
-- 'lambda', 'maintenanceWindowTaskInvocationParameters_lambda' - The parameters for a @LAMBDA@ task type.
--
-- 'runCommand', 'maintenanceWindowTaskInvocationParameters_runCommand' - The parameters for a @RUN_COMMAND@ task type.
--
-- 'stepFunctions', 'maintenanceWindowTaskInvocationParameters_stepFunctions' - The parameters for a @STEP_FUNCTIONS@ task type.
newMaintenanceWindowTaskInvocationParameters ::
  MaintenanceWindowTaskInvocationParameters
newMaintenanceWindowTaskInvocationParameters :: MaintenanceWindowTaskInvocationParameters
newMaintenanceWindowTaskInvocationParameters =
  MaintenanceWindowTaskInvocationParameters'
    { $sel:automation:MaintenanceWindowTaskInvocationParameters' :: Maybe MaintenanceWindowAutomationParameters
automation =
        forall a. Maybe a
Prelude.Nothing,
      $sel:lambda:MaintenanceWindowTaskInvocationParameters' :: Maybe MaintenanceWindowLambdaParameters
lambda = forall a. Maybe a
Prelude.Nothing,
      $sel:runCommand:MaintenanceWindowTaskInvocationParameters' :: Maybe MaintenanceWindowRunCommandParameters
runCommand = forall a. Maybe a
Prelude.Nothing,
      $sel:stepFunctions:MaintenanceWindowTaskInvocationParameters' :: Maybe MaintenanceWindowStepFunctionsParameters
stepFunctions = forall a. Maybe a
Prelude.Nothing
    }

-- | The parameters for an @AUTOMATION@ task type.
maintenanceWindowTaskInvocationParameters_automation :: Lens.Lens' MaintenanceWindowTaskInvocationParameters (Prelude.Maybe MaintenanceWindowAutomationParameters)
maintenanceWindowTaskInvocationParameters_automation :: Lens'
  MaintenanceWindowTaskInvocationParameters
  (Maybe MaintenanceWindowAutomationParameters)
maintenanceWindowTaskInvocationParameters_automation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceWindowTaskInvocationParameters' {Maybe MaintenanceWindowAutomationParameters
automation :: Maybe MaintenanceWindowAutomationParameters
$sel:automation:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowAutomationParameters
automation} -> Maybe MaintenanceWindowAutomationParameters
automation) (\s :: MaintenanceWindowTaskInvocationParameters
s@MaintenanceWindowTaskInvocationParameters' {} Maybe MaintenanceWindowAutomationParameters
a -> MaintenanceWindowTaskInvocationParameters
s {$sel:automation:MaintenanceWindowTaskInvocationParameters' :: Maybe MaintenanceWindowAutomationParameters
automation = Maybe MaintenanceWindowAutomationParameters
a} :: MaintenanceWindowTaskInvocationParameters)

-- | The parameters for a @LAMBDA@ task type.
maintenanceWindowTaskInvocationParameters_lambda :: Lens.Lens' MaintenanceWindowTaskInvocationParameters (Prelude.Maybe MaintenanceWindowLambdaParameters)
maintenanceWindowTaskInvocationParameters_lambda :: Lens'
  MaintenanceWindowTaskInvocationParameters
  (Maybe MaintenanceWindowLambdaParameters)
maintenanceWindowTaskInvocationParameters_lambda = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceWindowTaskInvocationParameters' {Maybe MaintenanceWindowLambdaParameters
lambda :: Maybe MaintenanceWindowLambdaParameters
$sel:lambda:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowLambdaParameters
lambda} -> Maybe MaintenanceWindowLambdaParameters
lambda) (\s :: MaintenanceWindowTaskInvocationParameters
s@MaintenanceWindowTaskInvocationParameters' {} Maybe MaintenanceWindowLambdaParameters
a -> MaintenanceWindowTaskInvocationParameters
s {$sel:lambda:MaintenanceWindowTaskInvocationParameters' :: Maybe MaintenanceWindowLambdaParameters
lambda = Maybe MaintenanceWindowLambdaParameters
a} :: MaintenanceWindowTaskInvocationParameters)

-- | The parameters for a @RUN_COMMAND@ task type.
maintenanceWindowTaskInvocationParameters_runCommand :: Lens.Lens' MaintenanceWindowTaskInvocationParameters (Prelude.Maybe MaintenanceWindowRunCommandParameters)
maintenanceWindowTaskInvocationParameters_runCommand :: Lens'
  MaintenanceWindowTaskInvocationParameters
  (Maybe MaintenanceWindowRunCommandParameters)
maintenanceWindowTaskInvocationParameters_runCommand = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceWindowTaskInvocationParameters' {Maybe MaintenanceWindowRunCommandParameters
runCommand :: Maybe MaintenanceWindowRunCommandParameters
$sel:runCommand:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowRunCommandParameters
runCommand} -> Maybe MaintenanceWindowRunCommandParameters
runCommand) (\s :: MaintenanceWindowTaskInvocationParameters
s@MaintenanceWindowTaskInvocationParameters' {} Maybe MaintenanceWindowRunCommandParameters
a -> MaintenanceWindowTaskInvocationParameters
s {$sel:runCommand:MaintenanceWindowTaskInvocationParameters' :: Maybe MaintenanceWindowRunCommandParameters
runCommand = Maybe MaintenanceWindowRunCommandParameters
a} :: MaintenanceWindowTaskInvocationParameters)

-- | The parameters for a @STEP_FUNCTIONS@ task type.
maintenanceWindowTaskInvocationParameters_stepFunctions :: Lens.Lens' MaintenanceWindowTaskInvocationParameters (Prelude.Maybe MaintenanceWindowStepFunctionsParameters)
maintenanceWindowTaskInvocationParameters_stepFunctions :: Lens'
  MaintenanceWindowTaskInvocationParameters
  (Maybe MaintenanceWindowStepFunctionsParameters)
maintenanceWindowTaskInvocationParameters_stepFunctions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceWindowTaskInvocationParameters' {Maybe MaintenanceWindowStepFunctionsParameters
stepFunctions :: Maybe MaintenanceWindowStepFunctionsParameters
$sel:stepFunctions:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowStepFunctionsParameters
stepFunctions} -> Maybe MaintenanceWindowStepFunctionsParameters
stepFunctions) (\s :: MaintenanceWindowTaskInvocationParameters
s@MaintenanceWindowTaskInvocationParameters' {} Maybe MaintenanceWindowStepFunctionsParameters
a -> MaintenanceWindowTaskInvocationParameters
s {$sel:stepFunctions:MaintenanceWindowTaskInvocationParameters' :: Maybe MaintenanceWindowStepFunctionsParameters
stepFunctions = Maybe MaintenanceWindowStepFunctionsParameters
a} :: MaintenanceWindowTaskInvocationParameters)

instance
  Data.FromJSON
    MaintenanceWindowTaskInvocationParameters
  where
  parseJSON :: Value -> Parser MaintenanceWindowTaskInvocationParameters
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MaintenanceWindowTaskInvocationParameters"
      ( \Object
x ->
          Maybe MaintenanceWindowAutomationParameters
-> Maybe MaintenanceWindowLambdaParameters
-> Maybe MaintenanceWindowRunCommandParameters
-> Maybe MaintenanceWindowStepFunctionsParameters
-> MaintenanceWindowTaskInvocationParameters
MaintenanceWindowTaskInvocationParameters'
            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
"Automation")
            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
"Lambda")
            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
"RunCommand")
            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
"StepFunctions")
      )

instance
  Prelude.Hashable
    MaintenanceWindowTaskInvocationParameters
  where
  hashWithSalt :: Int -> MaintenanceWindowTaskInvocationParameters -> Int
hashWithSalt
    Int
_salt
    MaintenanceWindowTaskInvocationParameters' {Maybe MaintenanceWindowAutomationParameters
Maybe MaintenanceWindowLambdaParameters
Maybe MaintenanceWindowStepFunctionsParameters
Maybe MaintenanceWindowRunCommandParameters
stepFunctions :: Maybe MaintenanceWindowStepFunctionsParameters
runCommand :: Maybe MaintenanceWindowRunCommandParameters
lambda :: Maybe MaintenanceWindowLambdaParameters
automation :: Maybe MaintenanceWindowAutomationParameters
$sel:stepFunctions:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowStepFunctionsParameters
$sel:runCommand:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowRunCommandParameters
$sel:lambda:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowLambdaParameters
$sel:automation:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowAutomationParameters
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MaintenanceWindowAutomationParameters
automation
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MaintenanceWindowLambdaParameters
lambda
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MaintenanceWindowRunCommandParameters
runCommand
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MaintenanceWindowStepFunctionsParameters
stepFunctions

instance
  Prelude.NFData
    MaintenanceWindowTaskInvocationParameters
  where
  rnf :: MaintenanceWindowTaskInvocationParameters -> ()
rnf MaintenanceWindowTaskInvocationParameters' {Maybe MaintenanceWindowAutomationParameters
Maybe MaintenanceWindowLambdaParameters
Maybe MaintenanceWindowStepFunctionsParameters
Maybe MaintenanceWindowRunCommandParameters
stepFunctions :: Maybe MaintenanceWindowStepFunctionsParameters
runCommand :: Maybe MaintenanceWindowRunCommandParameters
lambda :: Maybe MaintenanceWindowLambdaParameters
automation :: Maybe MaintenanceWindowAutomationParameters
$sel:stepFunctions:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowStepFunctionsParameters
$sel:runCommand:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowRunCommandParameters
$sel:lambda:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowLambdaParameters
$sel:automation:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowAutomationParameters
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe MaintenanceWindowAutomationParameters
automation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MaintenanceWindowLambdaParameters
lambda
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MaintenanceWindowRunCommandParameters
runCommand
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MaintenanceWindowStepFunctionsParameters
stepFunctions

instance
  Data.ToJSON
    MaintenanceWindowTaskInvocationParameters
  where
  toJSON :: MaintenanceWindowTaskInvocationParameters -> Value
toJSON MaintenanceWindowTaskInvocationParameters' {Maybe MaintenanceWindowAutomationParameters
Maybe MaintenanceWindowLambdaParameters
Maybe MaintenanceWindowStepFunctionsParameters
Maybe MaintenanceWindowRunCommandParameters
stepFunctions :: Maybe MaintenanceWindowStepFunctionsParameters
runCommand :: Maybe MaintenanceWindowRunCommandParameters
lambda :: Maybe MaintenanceWindowLambdaParameters
automation :: Maybe MaintenanceWindowAutomationParameters
$sel:stepFunctions:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowStepFunctionsParameters
$sel:runCommand:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowRunCommandParameters
$sel:lambda:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowLambdaParameters
$sel:automation:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowAutomationParameters
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Automation" 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 MaintenanceWindowAutomationParameters
automation,
            (Key
"Lambda" 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 MaintenanceWindowLambdaParameters
lambda,
            (Key
"RunCommand" 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 MaintenanceWindowRunCommandParameters
runCommand,
            (Key
"StepFunctions" 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 MaintenanceWindowStepFunctionsParameters
stepFunctions
          ]
      )