{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SSM.Types.MaintenanceWindowTaskInvocationParameters where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 @STEP_FUNCTIONS@ task type.
    MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowStepFunctionsParameters
stepFunctions :: Prelude.Maybe MaintenanceWindowStepFunctionsParameters,
    -- | The parameters for a @RUN_COMMAND@ task type.
    MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowRunCommandParameters
runCommand :: Prelude.Maybe MaintenanceWindowRunCommandParameters,
    -- | The parameters for a @LAMBDA@ task type.
    MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowLambdaParameters
lambda :: Prelude.Maybe MaintenanceWindowLambdaParameters
  }
  deriving (MaintenanceWindowTaskInvocationParameters
-> MaintenanceWindowTaskInvocationParameters -> Bool
(MaintenanceWindowTaskInvocationParameters
 -> MaintenanceWindowTaskInvocationParameters -> Bool)
-> (MaintenanceWindowTaskInvocationParameters
    -> MaintenanceWindowTaskInvocationParameters -> Bool)
-> Eq MaintenanceWindowTaskInvocationParameters
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
(Int -> MaintenanceWindowTaskInvocationParameters -> ShowS)
-> (MaintenanceWindowTaskInvocationParameters -> String)
-> ([MaintenanceWindowTaskInvocationParameters] -> ShowS)
-> Show MaintenanceWindowTaskInvocationParameters
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.
 MaintenanceWindowTaskInvocationParameters
 -> Rep MaintenanceWindowTaskInvocationParameters x)
-> (forall x.
    Rep MaintenanceWindowTaskInvocationParameters x
    -> MaintenanceWindowTaskInvocationParameters)
-> Generic MaintenanceWindowTaskInvocationParameters
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.
--
-- 'stepFunctions', 'maintenanceWindowTaskInvocationParameters_stepFunctions' - The parameters for a @STEP_FUNCTIONS@ task type.
--
-- 'runCommand', 'maintenanceWindowTaskInvocationParameters_runCommand' - The parameters for a @RUN_COMMAND@ task type.
--
-- 'lambda', 'maintenanceWindowTaskInvocationParameters_lambda' - The parameters for a @LAMBDA@ task type.
newMaintenanceWindowTaskInvocationParameters ::
  MaintenanceWindowTaskInvocationParameters
newMaintenanceWindowTaskInvocationParameters :: MaintenanceWindowTaskInvocationParameters
newMaintenanceWindowTaskInvocationParameters =
  MaintenanceWindowTaskInvocationParameters' :: Maybe MaintenanceWindowAutomationParameters
-> Maybe MaintenanceWindowStepFunctionsParameters
-> Maybe MaintenanceWindowRunCommandParameters
-> Maybe MaintenanceWindowLambdaParameters
-> MaintenanceWindowTaskInvocationParameters
MaintenanceWindowTaskInvocationParameters'
    { $sel:automation:MaintenanceWindowTaskInvocationParameters' :: Maybe MaintenanceWindowAutomationParameters
automation =
        Maybe MaintenanceWindowAutomationParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:stepFunctions:MaintenanceWindowTaskInvocationParameters' :: Maybe MaintenanceWindowStepFunctionsParameters
stepFunctions = Maybe MaintenanceWindowStepFunctionsParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:runCommand:MaintenanceWindowTaskInvocationParameters' :: Maybe MaintenanceWindowRunCommandParameters
runCommand = Maybe MaintenanceWindowRunCommandParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:lambda:MaintenanceWindowTaskInvocationParameters' :: Maybe MaintenanceWindowLambdaParameters
lambda = Maybe MaintenanceWindowLambdaParameters
forall a. Maybe a
Prelude.Nothing
    }

-- | The parameters for an @AUTOMATION@ task type.
maintenanceWindowTaskInvocationParameters_automation :: Lens.Lens' MaintenanceWindowTaskInvocationParameters (Prelude.Maybe MaintenanceWindowAutomationParameters)
maintenanceWindowTaskInvocationParameters_automation :: (Maybe MaintenanceWindowAutomationParameters
 -> f (Maybe MaintenanceWindowAutomationParameters))
-> MaintenanceWindowTaskInvocationParameters
-> f MaintenanceWindowTaskInvocationParameters
maintenanceWindowTaskInvocationParameters_automation = (MaintenanceWindowTaskInvocationParameters
 -> Maybe MaintenanceWindowAutomationParameters)
-> (MaintenanceWindowTaskInvocationParameters
    -> Maybe MaintenanceWindowAutomationParameters
    -> MaintenanceWindowTaskInvocationParameters)
-> Lens
     MaintenanceWindowTaskInvocationParameters
     MaintenanceWindowTaskInvocationParameters
     (Maybe MaintenanceWindowAutomationParameters)
     (Maybe MaintenanceWindowAutomationParameters)
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 @STEP_FUNCTIONS@ task type.
maintenanceWindowTaskInvocationParameters_stepFunctions :: Lens.Lens' MaintenanceWindowTaskInvocationParameters (Prelude.Maybe MaintenanceWindowStepFunctionsParameters)
maintenanceWindowTaskInvocationParameters_stepFunctions :: (Maybe MaintenanceWindowStepFunctionsParameters
 -> f (Maybe MaintenanceWindowStepFunctionsParameters))
-> MaintenanceWindowTaskInvocationParameters
-> f MaintenanceWindowTaskInvocationParameters
maintenanceWindowTaskInvocationParameters_stepFunctions = (MaintenanceWindowTaskInvocationParameters
 -> Maybe MaintenanceWindowStepFunctionsParameters)
-> (MaintenanceWindowTaskInvocationParameters
    -> Maybe MaintenanceWindowStepFunctionsParameters
    -> MaintenanceWindowTaskInvocationParameters)
-> Lens
     MaintenanceWindowTaskInvocationParameters
     MaintenanceWindowTaskInvocationParameters
     (Maybe MaintenanceWindowStepFunctionsParameters)
     (Maybe MaintenanceWindowStepFunctionsParameters)
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)

-- | The parameters for a @RUN_COMMAND@ task type.
maintenanceWindowTaskInvocationParameters_runCommand :: Lens.Lens' MaintenanceWindowTaskInvocationParameters (Prelude.Maybe MaintenanceWindowRunCommandParameters)
maintenanceWindowTaskInvocationParameters_runCommand :: (Maybe MaintenanceWindowRunCommandParameters
 -> f (Maybe MaintenanceWindowRunCommandParameters))
-> MaintenanceWindowTaskInvocationParameters
-> f MaintenanceWindowTaskInvocationParameters
maintenanceWindowTaskInvocationParameters_runCommand = (MaintenanceWindowTaskInvocationParameters
 -> Maybe MaintenanceWindowRunCommandParameters)
-> (MaintenanceWindowTaskInvocationParameters
    -> Maybe MaintenanceWindowRunCommandParameters
    -> MaintenanceWindowTaskInvocationParameters)
-> Lens
     MaintenanceWindowTaskInvocationParameters
     MaintenanceWindowTaskInvocationParameters
     (Maybe MaintenanceWindowRunCommandParameters)
     (Maybe MaintenanceWindowRunCommandParameters)
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 @LAMBDA@ task type.
maintenanceWindowTaskInvocationParameters_lambda :: Lens.Lens' MaintenanceWindowTaskInvocationParameters (Prelude.Maybe MaintenanceWindowLambdaParameters)
maintenanceWindowTaskInvocationParameters_lambda :: (Maybe MaintenanceWindowLambdaParameters
 -> f (Maybe MaintenanceWindowLambdaParameters))
-> MaintenanceWindowTaskInvocationParameters
-> f MaintenanceWindowTaskInvocationParameters
maintenanceWindowTaskInvocationParameters_lambda = (MaintenanceWindowTaskInvocationParameters
 -> Maybe MaintenanceWindowLambdaParameters)
-> (MaintenanceWindowTaskInvocationParameters
    -> Maybe MaintenanceWindowLambdaParameters
    -> MaintenanceWindowTaskInvocationParameters)
-> Lens
     MaintenanceWindowTaskInvocationParameters
     MaintenanceWindowTaskInvocationParameters
     (Maybe MaintenanceWindowLambdaParameters)
     (Maybe MaintenanceWindowLambdaParameters)
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)

instance
  Core.FromJSON
    MaintenanceWindowTaskInvocationParameters
  where
  parseJSON :: Value -> Parser MaintenanceWindowTaskInvocationParameters
parseJSON =
    String
-> (Object -> Parser MaintenanceWindowTaskInvocationParameters)
-> Value
-> Parser MaintenanceWindowTaskInvocationParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MaintenanceWindowTaskInvocationParameters"
      ( \Object
x ->
          Maybe MaintenanceWindowAutomationParameters
-> Maybe MaintenanceWindowStepFunctionsParameters
-> Maybe MaintenanceWindowRunCommandParameters
-> Maybe MaintenanceWindowLambdaParameters
-> MaintenanceWindowTaskInvocationParameters
MaintenanceWindowTaskInvocationParameters'
            (Maybe MaintenanceWindowAutomationParameters
 -> Maybe MaintenanceWindowStepFunctionsParameters
 -> Maybe MaintenanceWindowRunCommandParameters
 -> Maybe MaintenanceWindowLambdaParameters
 -> MaintenanceWindowTaskInvocationParameters)
-> Parser (Maybe MaintenanceWindowAutomationParameters)
-> Parser
     (Maybe MaintenanceWindowStepFunctionsParameters
      -> Maybe MaintenanceWindowRunCommandParameters
      -> Maybe MaintenanceWindowLambdaParameters
      -> MaintenanceWindowTaskInvocationParameters)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe MaintenanceWindowAutomationParameters)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Automation")
              Parser
  (Maybe MaintenanceWindowStepFunctionsParameters
   -> Maybe MaintenanceWindowRunCommandParameters
   -> Maybe MaintenanceWindowLambdaParameters
   -> MaintenanceWindowTaskInvocationParameters)
-> Parser (Maybe MaintenanceWindowStepFunctionsParameters)
-> Parser
     (Maybe MaintenanceWindowRunCommandParameters
      -> Maybe MaintenanceWindowLambdaParameters
      -> MaintenanceWindowTaskInvocationParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe MaintenanceWindowStepFunctionsParameters)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StepFunctions")
              Parser
  (Maybe MaintenanceWindowRunCommandParameters
   -> Maybe MaintenanceWindowLambdaParameters
   -> MaintenanceWindowTaskInvocationParameters)
-> Parser (Maybe MaintenanceWindowRunCommandParameters)
-> Parser
     (Maybe MaintenanceWindowLambdaParameters
      -> MaintenanceWindowTaskInvocationParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe MaintenanceWindowRunCommandParameters)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RunCommand")
              Parser
  (Maybe MaintenanceWindowLambdaParameters
   -> MaintenanceWindowTaskInvocationParameters)
-> Parser (Maybe MaintenanceWindowLambdaParameters)
-> Parser MaintenanceWindowTaskInvocationParameters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MaintenanceWindowLambdaParameters)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Lambda")
      )

instance
  Prelude.Hashable
    MaintenanceWindowTaskInvocationParameters

instance
  Prelude.NFData
    MaintenanceWindowTaskInvocationParameters

instance
  Core.ToJSON
    MaintenanceWindowTaskInvocationParameters
  where
  toJSON :: MaintenanceWindowTaskInvocationParameters -> Value
toJSON MaintenanceWindowTaskInvocationParameters' {Maybe MaintenanceWindowAutomationParameters
Maybe MaintenanceWindowLambdaParameters
Maybe MaintenanceWindowStepFunctionsParameters
Maybe MaintenanceWindowRunCommandParameters
lambda :: Maybe MaintenanceWindowLambdaParameters
runCommand :: Maybe MaintenanceWindowRunCommandParameters
stepFunctions :: Maybe MaintenanceWindowStepFunctionsParameters
automation :: Maybe MaintenanceWindowAutomationParameters
$sel:lambda:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowLambdaParameters
$sel:runCommand:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowRunCommandParameters
$sel:stepFunctions:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowStepFunctionsParameters
$sel:automation:MaintenanceWindowTaskInvocationParameters' :: MaintenanceWindowTaskInvocationParameters
-> Maybe MaintenanceWindowAutomationParameters
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Automation" Text -> MaintenanceWindowAutomationParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MaintenanceWindowAutomationParameters -> Pair)
-> Maybe MaintenanceWindowAutomationParameters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MaintenanceWindowAutomationParameters
automation,
            (Text
"StepFunctions" Text -> MaintenanceWindowStepFunctionsParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MaintenanceWindowStepFunctionsParameters -> Pair)
-> Maybe MaintenanceWindowStepFunctionsParameters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MaintenanceWindowStepFunctionsParameters
stepFunctions,
            (Text
"RunCommand" Text -> MaintenanceWindowRunCommandParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MaintenanceWindowRunCommandParameters -> Pair)
-> Maybe MaintenanceWindowRunCommandParameters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MaintenanceWindowRunCommandParameters
runCommand,
            (Text
"Lambda" Text -> MaintenanceWindowLambdaParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MaintenanceWindowLambdaParameters -> Pair)
-> Maybe MaintenanceWindowLambdaParameters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MaintenanceWindowLambdaParameters
lambda
          ]
      )