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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The parameters for an @AUTOMATION@ task type.
--
-- /See:/ 'newMaintenanceWindowAutomationParameters' smart constructor.
data MaintenanceWindowAutomationParameters = MaintenanceWindowAutomationParameters'
  { -- | The parameters for the @AUTOMATION@ task.
    --
    -- For information about specifying and updating task parameters, see
    -- RegisterTaskWithMaintenanceWindow and UpdateMaintenanceWindowTask.
    --
    -- @LoggingInfo@ has been deprecated. To specify an Amazon Simple Storage
    -- Service (Amazon S3) bucket to contain logs, instead use the
    -- @OutputS3BucketName@ and @OutputS3KeyPrefix@ options in the
    -- @TaskInvocationParameters@ structure. For information about how Amazon
    -- Web Services Systems Manager handles these options for the supported
    -- maintenance window task types, see
    -- MaintenanceWindowTaskInvocationParameters.
    --
    -- @TaskParameters@ has been deprecated. To specify parameters to pass to a
    -- task when it runs, instead use the @Parameters@ option in the
    -- @TaskInvocationParameters@ structure. For information about how Systems
    -- Manager handles these options for the supported maintenance window task
    -- types, see MaintenanceWindowTaskInvocationParameters.
    --
    -- For @AUTOMATION@ task types, Amazon Web Services Systems Manager ignores
    -- any values specified for these parameters.
    MaintenanceWindowAutomationParameters
-> Maybe (HashMap Text [Text])
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
    -- | The version of an Automation runbook to use during task execution.
    MaintenanceWindowAutomationParameters -> Maybe Text
documentVersion :: Prelude.Maybe Prelude.Text
  }
  deriving (MaintenanceWindowAutomationParameters
-> MaintenanceWindowAutomationParameters -> Bool
(MaintenanceWindowAutomationParameters
 -> MaintenanceWindowAutomationParameters -> Bool)
-> (MaintenanceWindowAutomationParameters
    -> MaintenanceWindowAutomationParameters -> Bool)
-> Eq MaintenanceWindowAutomationParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MaintenanceWindowAutomationParameters
-> MaintenanceWindowAutomationParameters -> Bool
$c/= :: MaintenanceWindowAutomationParameters
-> MaintenanceWindowAutomationParameters -> Bool
== :: MaintenanceWindowAutomationParameters
-> MaintenanceWindowAutomationParameters -> Bool
$c== :: MaintenanceWindowAutomationParameters
-> MaintenanceWindowAutomationParameters -> Bool
Prelude.Eq, ReadPrec [MaintenanceWindowAutomationParameters]
ReadPrec MaintenanceWindowAutomationParameters
Int -> ReadS MaintenanceWindowAutomationParameters
ReadS [MaintenanceWindowAutomationParameters]
(Int -> ReadS MaintenanceWindowAutomationParameters)
-> ReadS [MaintenanceWindowAutomationParameters]
-> ReadPrec MaintenanceWindowAutomationParameters
-> ReadPrec [MaintenanceWindowAutomationParameters]
-> Read MaintenanceWindowAutomationParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MaintenanceWindowAutomationParameters]
$creadListPrec :: ReadPrec [MaintenanceWindowAutomationParameters]
readPrec :: ReadPrec MaintenanceWindowAutomationParameters
$creadPrec :: ReadPrec MaintenanceWindowAutomationParameters
readList :: ReadS [MaintenanceWindowAutomationParameters]
$creadList :: ReadS [MaintenanceWindowAutomationParameters]
readsPrec :: Int -> ReadS MaintenanceWindowAutomationParameters
$creadsPrec :: Int -> ReadS MaintenanceWindowAutomationParameters
Prelude.Read, Int -> MaintenanceWindowAutomationParameters -> ShowS
[MaintenanceWindowAutomationParameters] -> ShowS
MaintenanceWindowAutomationParameters -> String
(Int -> MaintenanceWindowAutomationParameters -> ShowS)
-> (MaintenanceWindowAutomationParameters -> String)
-> ([MaintenanceWindowAutomationParameters] -> ShowS)
-> Show MaintenanceWindowAutomationParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MaintenanceWindowAutomationParameters] -> ShowS
$cshowList :: [MaintenanceWindowAutomationParameters] -> ShowS
show :: MaintenanceWindowAutomationParameters -> String
$cshow :: MaintenanceWindowAutomationParameters -> String
showsPrec :: Int -> MaintenanceWindowAutomationParameters -> ShowS
$cshowsPrec :: Int -> MaintenanceWindowAutomationParameters -> ShowS
Prelude.Show, (forall x.
 MaintenanceWindowAutomationParameters
 -> Rep MaintenanceWindowAutomationParameters x)
-> (forall x.
    Rep MaintenanceWindowAutomationParameters x
    -> MaintenanceWindowAutomationParameters)
-> Generic MaintenanceWindowAutomationParameters
forall x.
Rep MaintenanceWindowAutomationParameters x
-> MaintenanceWindowAutomationParameters
forall x.
MaintenanceWindowAutomationParameters
-> Rep MaintenanceWindowAutomationParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MaintenanceWindowAutomationParameters x
-> MaintenanceWindowAutomationParameters
$cfrom :: forall x.
MaintenanceWindowAutomationParameters
-> Rep MaintenanceWindowAutomationParameters x
Prelude.Generic)

-- |
-- Create a value of 'MaintenanceWindowAutomationParameters' 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:
--
-- 'parameters', 'maintenanceWindowAutomationParameters_parameters' - The parameters for the @AUTOMATION@ task.
--
-- For information about specifying and updating task parameters, see
-- RegisterTaskWithMaintenanceWindow and UpdateMaintenanceWindowTask.
--
-- @LoggingInfo@ has been deprecated. To specify an Amazon Simple Storage
-- Service (Amazon S3) bucket to contain logs, instead use the
-- @OutputS3BucketName@ and @OutputS3KeyPrefix@ options in the
-- @TaskInvocationParameters@ structure. For information about how Amazon
-- Web Services Systems Manager handles these options for the supported
-- maintenance window task types, see
-- MaintenanceWindowTaskInvocationParameters.
--
-- @TaskParameters@ has been deprecated. To specify parameters to pass to a
-- task when it runs, instead use the @Parameters@ option in the
-- @TaskInvocationParameters@ structure. For information about how Systems
-- Manager handles these options for the supported maintenance window task
-- types, see MaintenanceWindowTaskInvocationParameters.
--
-- For @AUTOMATION@ task types, Amazon Web Services Systems Manager ignores
-- any values specified for these parameters.
--
-- 'documentVersion', 'maintenanceWindowAutomationParameters_documentVersion' - The version of an Automation runbook to use during task execution.
newMaintenanceWindowAutomationParameters ::
  MaintenanceWindowAutomationParameters
newMaintenanceWindowAutomationParameters :: MaintenanceWindowAutomationParameters
newMaintenanceWindowAutomationParameters =
  MaintenanceWindowAutomationParameters' :: Maybe (HashMap Text [Text])
-> Maybe Text -> MaintenanceWindowAutomationParameters
MaintenanceWindowAutomationParameters'
    { $sel:parameters:MaintenanceWindowAutomationParameters' :: Maybe (HashMap Text [Text])
parameters =
        Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
      $sel:documentVersion:MaintenanceWindowAutomationParameters' :: Maybe Text
documentVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The parameters for the @AUTOMATION@ task.
--
-- For information about specifying and updating task parameters, see
-- RegisterTaskWithMaintenanceWindow and UpdateMaintenanceWindowTask.
--
-- @LoggingInfo@ has been deprecated. To specify an Amazon Simple Storage
-- Service (Amazon S3) bucket to contain logs, instead use the
-- @OutputS3BucketName@ and @OutputS3KeyPrefix@ options in the
-- @TaskInvocationParameters@ structure. For information about how Amazon
-- Web Services Systems Manager handles these options for the supported
-- maintenance window task types, see
-- MaintenanceWindowTaskInvocationParameters.
--
-- @TaskParameters@ has been deprecated. To specify parameters to pass to a
-- task when it runs, instead use the @Parameters@ option in the
-- @TaskInvocationParameters@ structure. For information about how Systems
-- Manager handles these options for the supported maintenance window task
-- types, see MaintenanceWindowTaskInvocationParameters.
--
-- For @AUTOMATION@ task types, Amazon Web Services Systems Manager ignores
-- any values specified for these parameters.
maintenanceWindowAutomationParameters_parameters :: Lens.Lens' MaintenanceWindowAutomationParameters (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
maintenanceWindowAutomationParameters_parameters :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> MaintenanceWindowAutomationParameters
-> f MaintenanceWindowAutomationParameters
maintenanceWindowAutomationParameters_parameters = (MaintenanceWindowAutomationParameters
 -> Maybe (HashMap Text [Text]))
-> (MaintenanceWindowAutomationParameters
    -> Maybe (HashMap Text [Text])
    -> MaintenanceWindowAutomationParameters)
-> Lens
     MaintenanceWindowAutomationParameters
     MaintenanceWindowAutomationParameters
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [Text]))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceWindowAutomationParameters' {Maybe (HashMap Text [Text])
parameters :: Maybe (HashMap Text [Text])
$sel:parameters:MaintenanceWindowAutomationParameters' :: MaintenanceWindowAutomationParameters
-> Maybe (HashMap Text [Text])
parameters} -> Maybe (HashMap Text [Text])
parameters) (\s :: MaintenanceWindowAutomationParameters
s@MaintenanceWindowAutomationParameters' {} Maybe (HashMap Text [Text])
a -> MaintenanceWindowAutomationParameters
s {$sel:parameters:MaintenanceWindowAutomationParameters' :: Maybe (HashMap Text [Text])
parameters = Maybe (HashMap Text [Text])
a} :: MaintenanceWindowAutomationParameters) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
 -> MaintenanceWindowAutomationParameters
 -> f MaintenanceWindowAutomationParameters)
-> ((Maybe (HashMap Text [Text])
     -> f (Maybe (HashMap Text [Text])))
    -> Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> MaintenanceWindowAutomationParameters
-> f MaintenanceWindowAutomationParameters
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
-> Iso
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [Text]))
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 AnIso
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The version of an Automation runbook to use during task execution.
maintenanceWindowAutomationParameters_documentVersion :: Lens.Lens' MaintenanceWindowAutomationParameters (Prelude.Maybe Prelude.Text)
maintenanceWindowAutomationParameters_documentVersion :: (Maybe Text -> f (Maybe Text))
-> MaintenanceWindowAutomationParameters
-> f MaintenanceWindowAutomationParameters
maintenanceWindowAutomationParameters_documentVersion = (MaintenanceWindowAutomationParameters -> Maybe Text)
-> (MaintenanceWindowAutomationParameters
    -> Maybe Text -> MaintenanceWindowAutomationParameters)
-> Lens
     MaintenanceWindowAutomationParameters
     MaintenanceWindowAutomationParameters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceWindowAutomationParameters' {Maybe Text
documentVersion :: Maybe Text
$sel:documentVersion:MaintenanceWindowAutomationParameters' :: MaintenanceWindowAutomationParameters -> Maybe Text
documentVersion} -> Maybe Text
documentVersion) (\s :: MaintenanceWindowAutomationParameters
s@MaintenanceWindowAutomationParameters' {} Maybe Text
a -> MaintenanceWindowAutomationParameters
s {$sel:documentVersion:MaintenanceWindowAutomationParameters' :: Maybe Text
documentVersion = Maybe Text
a} :: MaintenanceWindowAutomationParameters)

instance
  Core.FromJSON
    MaintenanceWindowAutomationParameters
  where
  parseJSON :: Value -> Parser MaintenanceWindowAutomationParameters
parseJSON =
    String
-> (Object -> Parser MaintenanceWindowAutomationParameters)
-> Value
-> Parser MaintenanceWindowAutomationParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MaintenanceWindowAutomationParameters"
      ( \Object
x ->
          Maybe (HashMap Text [Text])
-> Maybe Text -> MaintenanceWindowAutomationParameters
MaintenanceWindowAutomationParameters'
            (Maybe (HashMap Text [Text])
 -> Maybe Text -> MaintenanceWindowAutomationParameters)
-> Parser (Maybe (HashMap Text [Text]))
-> Parser (Maybe Text -> MaintenanceWindowAutomationParameters)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text [Text])))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Parameters" Parser (Maybe (Maybe (HashMap Text [Text])))
-> Maybe (HashMap Text [Text])
-> Parser (Maybe (HashMap Text [Text]))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text [Text])
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> MaintenanceWindowAutomationParameters)
-> Parser (Maybe Text)
-> Parser MaintenanceWindowAutomationParameters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DocumentVersion")
      )

instance
  Prelude.Hashable
    MaintenanceWindowAutomationParameters

instance
  Prelude.NFData
    MaintenanceWindowAutomationParameters

instance
  Core.ToJSON
    MaintenanceWindowAutomationParameters
  where
  toJSON :: MaintenanceWindowAutomationParameters -> Value
toJSON MaintenanceWindowAutomationParameters' {Maybe Text
Maybe (HashMap Text [Text])
documentVersion :: Maybe Text
parameters :: Maybe (HashMap Text [Text])
$sel:documentVersion:MaintenanceWindowAutomationParameters' :: MaintenanceWindowAutomationParameters -> Maybe Text
$sel:parameters:MaintenanceWindowAutomationParameters' :: MaintenanceWindowAutomationParameters
-> Maybe (HashMap Text [Text])
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Parameters" Text -> HashMap Text [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text [Text] -> Pair)
-> Maybe (HashMap Text [Text]) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text [Text])
parameters,
            (Text
"DocumentVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
documentVersion
          ]
      )