{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.StartAutomationExecution
-- 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)
--
-- Initiates execution of an Automation runbook.
module Amazonka.SSM.StartAutomationExecution
  ( -- * Creating a Request
    StartAutomationExecution (..),
    newStartAutomationExecution,

    -- * Request Lenses
    startAutomationExecution_targetParameterName,
    startAutomationExecution_targetLocations,
    startAutomationExecution_clientToken,
    startAutomationExecution_mode,
    startAutomationExecution_targetMaps,
    startAutomationExecution_maxErrors,
    startAutomationExecution_targets,
    startAutomationExecution_parameters,
    startAutomationExecution_documentVersion,
    startAutomationExecution_tags,
    startAutomationExecution_maxConcurrency,
    startAutomationExecution_documentName,

    -- * Destructuring the Response
    StartAutomationExecutionResponse (..),
    newStartAutomationExecutionResponse,

    -- * Response Lenses
    startAutomationExecutionResponse_automationExecutionId,
    startAutomationExecutionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SSM.Types

-- | /See:/ 'newStartAutomationExecution' smart constructor.
data StartAutomationExecution = StartAutomationExecution'
  { -- | The name of the parameter used as the target resource for the
    -- rate-controlled execution. Required if you specify targets.
    StartAutomationExecution -> Maybe Text
targetParameterName :: Prelude.Maybe Prelude.Text,
    -- | A location is a combination of Amazon Web Services Regions and\/or
    -- Amazon Web Services accounts where you want to run the automation. Use
    -- this operation to start an automation in multiple Amazon Web Services
    -- Regions and multiple Amazon Web Services accounts. For more information,
    -- see
    -- <https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-automation-multiple-accounts-and-regions.html Running Automation workflows in multiple Amazon Web Services Regions and Amazon Web Services accounts>
    -- in the /Amazon Web Services Systems Manager User Guide/.
    StartAutomationExecution -> Maybe (NonEmpty TargetLocation)
targetLocations :: Prelude.Maybe (Prelude.NonEmpty TargetLocation),
    -- | User-provided idempotency token. The token must be unique, is case
    -- insensitive, enforces the UUID format, and can\'t be reused.
    StartAutomationExecution -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The execution mode of the automation. Valid modes include the following:
    -- Auto and Interactive. The default mode is Auto.
    StartAutomationExecution -> Maybe ExecutionMode
mode :: Prelude.Maybe ExecutionMode,
    -- | A key-value mapping of document parameters to target resources. Both
    -- Targets and TargetMaps can\'t be specified together.
    StartAutomationExecution -> Maybe [HashMap Text [Text]]
targetMaps :: Prelude.Maybe [Prelude.HashMap Prelude.Text [Prelude.Text]],
    -- | The number of errors that are allowed before the system stops running
    -- the automation on additional targets. You can specify either an absolute
    -- number of errors, for example 10, or a percentage of the target set, for
    -- example 10%. If you specify 3, for example, the system stops running the
    -- automation when the fourth error is received. If you specify 0, then the
    -- system stops running the automation on additional targets after the
    -- first error result is returned. If you run an automation on 50 resources
    -- and set max-errors to 10%, then the system stops running the automation
    -- on additional targets when the sixth error is received.
    --
    -- Executions that are already running an automation when max-errors is
    -- reached are allowed to complete, but some of these executions may fail
    -- as well. If you need to ensure that there won\'t be more than max-errors
    -- failed executions, set max-concurrency to 1 so the executions proceed
    -- one at a time.
    StartAutomationExecution -> Maybe Text
maxErrors :: Prelude.Maybe Prelude.Text,
    -- | A key-value mapping to target resources. Required if you specify
    -- TargetParameterName.
    StartAutomationExecution -> Maybe [Target]
targets :: Prelude.Maybe [Target],
    -- | A key-value map of execution parameters, which match the declared
    -- parameters in the Automation runbook.
    StartAutomationExecution -> Maybe (HashMap Text [Text])
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
    -- | The version of the Automation runbook to use for this execution.
    StartAutomationExecution -> Maybe Text
documentVersion :: Prelude.Maybe Prelude.Text,
    -- | Optional metadata that you assign to a resource. You can specify a
    -- maximum of five tags for an automation. Tags enable you to categorize a
    -- resource in different ways, such as by purpose, owner, or environment.
    -- For example, you might want to tag an automation to identify an
    -- environment or operating system. In this case, you could specify the
    -- following key-value pairs:
    --
    -- -   @Key=environment,Value=test@
    --
    -- -   @Key=OS,Value=Windows@
    --
    -- To add tags to an existing patch baseline, use the AddTagsToResource
    -- operation.
    StartAutomationExecution -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The maximum number of targets allowed to run this task in parallel. You
    -- can specify a number, such as 10, or a percentage, such as 10%. The
    -- default value is @10@.
    StartAutomationExecution -> Maybe Text
maxConcurrency :: Prelude.Maybe Prelude.Text,
    -- | The name of the SSM document to run. This can be a public document or a
    -- custom document. To run a shared document belonging to another account,
    -- specify the document ARN. For more information about how to use shared
    -- documents, see
    -- <https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-using-shared.html Using shared SSM documents>
    -- in the /Amazon Web Services Systems Manager User Guide/.
    StartAutomationExecution -> Text
documentName :: Prelude.Text
  }
  deriving (StartAutomationExecution -> StartAutomationExecution -> Bool
(StartAutomationExecution -> StartAutomationExecution -> Bool)
-> (StartAutomationExecution -> StartAutomationExecution -> Bool)
-> Eq StartAutomationExecution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartAutomationExecution -> StartAutomationExecution -> Bool
$c/= :: StartAutomationExecution -> StartAutomationExecution -> Bool
== :: StartAutomationExecution -> StartAutomationExecution -> Bool
$c== :: StartAutomationExecution -> StartAutomationExecution -> Bool
Prelude.Eq, ReadPrec [StartAutomationExecution]
ReadPrec StartAutomationExecution
Int -> ReadS StartAutomationExecution
ReadS [StartAutomationExecution]
(Int -> ReadS StartAutomationExecution)
-> ReadS [StartAutomationExecution]
-> ReadPrec StartAutomationExecution
-> ReadPrec [StartAutomationExecution]
-> Read StartAutomationExecution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartAutomationExecution]
$creadListPrec :: ReadPrec [StartAutomationExecution]
readPrec :: ReadPrec StartAutomationExecution
$creadPrec :: ReadPrec StartAutomationExecution
readList :: ReadS [StartAutomationExecution]
$creadList :: ReadS [StartAutomationExecution]
readsPrec :: Int -> ReadS StartAutomationExecution
$creadsPrec :: Int -> ReadS StartAutomationExecution
Prelude.Read, Int -> StartAutomationExecution -> ShowS
[StartAutomationExecution] -> ShowS
StartAutomationExecution -> String
(Int -> StartAutomationExecution -> ShowS)
-> (StartAutomationExecution -> String)
-> ([StartAutomationExecution] -> ShowS)
-> Show StartAutomationExecution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartAutomationExecution] -> ShowS
$cshowList :: [StartAutomationExecution] -> ShowS
show :: StartAutomationExecution -> String
$cshow :: StartAutomationExecution -> String
showsPrec :: Int -> StartAutomationExecution -> ShowS
$cshowsPrec :: Int -> StartAutomationExecution -> ShowS
Prelude.Show, (forall x.
 StartAutomationExecution -> Rep StartAutomationExecution x)
-> (forall x.
    Rep StartAutomationExecution x -> StartAutomationExecution)
-> Generic StartAutomationExecution
forall x.
Rep StartAutomationExecution x -> StartAutomationExecution
forall x.
StartAutomationExecution -> Rep StartAutomationExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartAutomationExecution x -> StartAutomationExecution
$cfrom :: forall x.
StartAutomationExecution -> Rep StartAutomationExecution x
Prelude.Generic)

-- |
-- Create a value of 'StartAutomationExecution' 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:
--
-- 'targetParameterName', 'startAutomationExecution_targetParameterName' - The name of the parameter used as the target resource for the
-- rate-controlled execution. Required if you specify targets.
--
-- 'targetLocations', 'startAutomationExecution_targetLocations' - A location is a combination of Amazon Web Services Regions and\/or
-- Amazon Web Services accounts where you want to run the automation. Use
-- this operation to start an automation in multiple Amazon Web Services
-- Regions and multiple Amazon Web Services accounts. For more information,
-- see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-automation-multiple-accounts-and-regions.html Running Automation workflows in multiple Amazon Web Services Regions and Amazon Web Services accounts>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- 'clientToken', 'startAutomationExecution_clientToken' - User-provided idempotency token. The token must be unique, is case
-- insensitive, enforces the UUID format, and can\'t be reused.
--
-- 'mode', 'startAutomationExecution_mode' - The execution mode of the automation. Valid modes include the following:
-- Auto and Interactive. The default mode is Auto.
--
-- 'targetMaps', 'startAutomationExecution_targetMaps' - A key-value mapping of document parameters to target resources. Both
-- Targets and TargetMaps can\'t be specified together.
--
-- 'maxErrors', 'startAutomationExecution_maxErrors' - The number of errors that are allowed before the system stops running
-- the automation on additional targets. You can specify either an absolute
-- number of errors, for example 10, or a percentage of the target set, for
-- example 10%. If you specify 3, for example, the system stops running the
-- automation when the fourth error is received. If you specify 0, then the
-- system stops running the automation on additional targets after the
-- first error result is returned. If you run an automation on 50 resources
-- and set max-errors to 10%, then the system stops running the automation
-- on additional targets when the sixth error is received.
--
-- Executions that are already running an automation when max-errors is
-- reached are allowed to complete, but some of these executions may fail
-- as well. If you need to ensure that there won\'t be more than max-errors
-- failed executions, set max-concurrency to 1 so the executions proceed
-- one at a time.
--
-- 'targets', 'startAutomationExecution_targets' - A key-value mapping to target resources. Required if you specify
-- TargetParameterName.
--
-- 'parameters', 'startAutomationExecution_parameters' - A key-value map of execution parameters, which match the declared
-- parameters in the Automation runbook.
--
-- 'documentVersion', 'startAutomationExecution_documentVersion' - The version of the Automation runbook to use for this execution.
--
-- 'tags', 'startAutomationExecution_tags' - Optional metadata that you assign to a resource. You can specify a
-- maximum of five tags for an automation. Tags enable you to categorize a
-- resource in different ways, such as by purpose, owner, or environment.
-- For example, you might want to tag an automation to identify an
-- environment or operating system. In this case, you could specify the
-- following key-value pairs:
--
-- -   @Key=environment,Value=test@
--
-- -   @Key=OS,Value=Windows@
--
-- To add tags to an existing patch baseline, use the AddTagsToResource
-- operation.
--
-- 'maxConcurrency', 'startAutomationExecution_maxConcurrency' - The maximum number of targets allowed to run this task in parallel. You
-- can specify a number, such as 10, or a percentage, such as 10%. The
-- default value is @10@.
--
-- 'documentName', 'startAutomationExecution_documentName' - The name of the SSM document to run. This can be a public document or a
-- custom document. To run a shared document belonging to another account,
-- specify the document ARN. For more information about how to use shared
-- documents, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-using-shared.html Using shared SSM documents>
-- in the /Amazon Web Services Systems Manager User Guide/.
newStartAutomationExecution ::
  -- | 'documentName'
  Prelude.Text ->
  StartAutomationExecution
newStartAutomationExecution :: Text -> StartAutomationExecution
newStartAutomationExecution Text
pDocumentName_ =
  StartAutomationExecution' :: Maybe Text
-> Maybe (NonEmpty TargetLocation)
-> Maybe Text
-> Maybe ExecutionMode
-> Maybe [HashMap Text [Text]]
-> Maybe Text
-> Maybe [Target]
-> Maybe (HashMap Text [Text])
-> Maybe Text
-> Maybe [Tag]
-> Maybe Text
-> Text
-> StartAutomationExecution
StartAutomationExecution'
    { $sel:targetParameterName:StartAutomationExecution' :: Maybe Text
targetParameterName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:targetLocations:StartAutomationExecution' :: Maybe (NonEmpty TargetLocation)
targetLocations = Maybe (NonEmpty TargetLocation)
forall a. Maybe a
Prelude.Nothing,
      $sel:clientToken:StartAutomationExecution' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:mode:StartAutomationExecution' :: Maybe ExecutionMode
mode = Maybe ExecutionMode
forall a. Maybe a
Prelude.Nothing,
      $sel:targetMaps:StartAutomationExecution' :: Maybe [HashMap Text [Text]]
targetMaps = Maybe [HashMap Text [Text]]
forall a. Maybe a
Prelude.Nothing,
      $sel:maxErrors:StartAutomationExecution' :: Maybe Text
maxErrors = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:targets:StartAutomationExecution' :: Maybe [Target]
targets = Maybe [Target]
forall a. Maybe a
Prelude.Nothing,
      $sel:parameters:StartAutomationExecution' :: Maybe (HashMap Text [Text])
parameters = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
      $sel:documentVersion:StartAutomationExecution' :: Maybe Text
documentVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:StartAutomationExecution' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:maxConcurrency:StartAutomationExecution' :: Maybe Text
maxConcurrency = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:documentName:StartAutomationExecution' :: Text
documentName = Text
pDocumentName_
    }

-- | The name of the parameter used as the target resource for the
-- rate-controlled execution. Required if you specify targets.
startAutomationExecution_targetParameterName :: Lens.Lens' StartAutomationExecution (Prelude.Maybe Prelude.Text)
startAutomationExecution_targetParameterName :: (Maybe Text -> f (Maybe Text))
-> StartAutomationExecution -> f StartAutomationExecution
startAutomationExecution_targetParameterName = (StartAutomationExecution -> Maybe Text)
-> (StartAutomationExecution
    -> Maybe Text -> StartAutomationExecution)
-> Lens
     StartAutomationExecution
     StartAutomationExecution
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAutomationExecution' {Maybe Text
targetParameterName :: Maybe Text
$sel:targetParameterName:StartAutomationExecution' :: StartAutomationExecution -> Maybe Text
targetParameterName} -> Maybe Text
targetParameterName) (\s :: StartAutomationExecution
s@StartAutomationExecution' {} Maybe Text
a -> StartAutomationExecution
s {$sel:targetParameterName:StartAutomationExecution' :: Maybe Text
targetParameterName = Maybe Text
a} :: StartAutomationExecution)

-- | A location is a combination of Amazon Web Services Regions and\/or
-- Amazon Web Services accounts where you want to run the automation. Use
-- this operation to start an automation in multiple Amazon Web Services
-- Regions and multiple Amazon Web Services accounts. For more information,
-- see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-automation-multiple-accounts-and-regions.html Running Automation workflows in multiple Amazon Web Services Regions and Amazon Web Services accounts>
-- in the /Amazon Web Services Systems Manager User Guide/.
startAutomationExecution_targetLocations :: Lens.Lens' StartAutomationExecution (Prelude.Maybe (Prelude.NonEmpty TargetLocation))
startAutomationExecution_targetLocations :: (Maybe (NonEmpty TargetLocation)
 -> f (Maybe (NonEmpty TargetLocation)))
-> StartAutomationExecution -> f StartAutomationExecution
startAutomationExecution_targetLocations = (StartAutomationExecution -> Maybe (NonEmpty TargetLocation))
-> (StartAutomationExecution
    -> Maybe (NonEmpty TargetLocation) -> StartAutomationExecution)
-> Lens
     StartAutomationExecution
     StartAutomationExecution
     (Maybe (NonEmpty TargetLocation))
     (Maybe (NonEmpty TargetLocation))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAutomationExecution' {Maybe (NonEmpty TargetLocation)
targetLocations :: Maybe (NonEmpty TargetLocation)
$sel:targetLocations:StartAutomationExecution' :: StartAutomationExecution -> Maybe (NonEmpty TargetLocation)
targetLocations} -> Maybe (NonEmpty TargetLocation)
targetLocations) (\s :: StartAutomationExecution
s@StartAutomationExecution' {} Maybe (NonEmpty TargetLocation)
a -> StartAutomationExecution
s {$sel:targetLocations:StartAutomationExecution' :: Maybe (NonEmpty TargetLocation)
targetLocations = Maybe (NonEmpty TargetLocation)
a} :: StartAutomationExecution) ((Maybe (NonEmpty TargetLocation)
  -> f (Maybe (NonEmpty TargetLocation)))
 -> StartAutomationExecution -> f StartAutomationExecution)
-> ((Maybe (NonEmpty TargetLocation)
     -> f (Maybe (NonEmpty TargetLocation)))
    -> Maybe (NonEmpty TargetLocation)
    -> f (Maybe (NonEmpty TargetLocation)))
-> (Maybe (NonEmpty TargetLocation)
    -> f (Maybe (NonEmpty TargetLocation)))
-> StartAutomationExecution
-> f StartAutomationExecution
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty TargetLocation)
  (NonEmpty TargetLocation)
  (NonEmpty TargetLocation)
  (NonEmpty TargetLocation)
-> Iso
     (Maybe (NonEmpty TargetLocation))
     (Maybe (NonEmpty TargetLocation))
     (Maybe (NonEmpty TargetLocation))
     (Maybe (NonEmpty TargetLocation))
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
  (NonEmpty TargetLocation)
  (NonEmpty TargetLocation)
  (NonEmpty TargetLocation)
  (NonEmpty TargetLocation)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | User-provided idempotency token. The token must be unique, is case
-- insensitive, enforces the UUID format, and can\'t be reused.
startAutomationExecution_clientToken :: Lens.Lens' StartAutomationExecution (Prelude.Maybe Prelude.Text)
startAutomationExecution_clientToken :: (Maybe Text -> f (Maybe Text))
-> StartAutomationExecution -> f StartAutomationExecution
startAutomationExecution_clientToken = (StartAutomationExecution -> Maybe Text)
-> (StartAutomationExecution
    -> Maybe Text -> StartAutomationExecution)
-> Lens
     StartAutomationExecution
     StartAutomationExecution
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAutomationExecution' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:StartAutomationExecution' :: StartAutomationExecution -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: StartAutomationExecution
s@StartAutomationExecution' {} Maybe Text
a -> StartAutomationExecution
s {$sel:clientToken:StartAutomationExecution' :: Maybe Text
clientToken = Maybe Text
a} :: StartAutomationExecution)

-- | The execution mode of the automation. Valid modes include the following:
-- Auto and Interactive. The default mode is Auto.
startAutomationExecution_mode :: Lens.Lens' StartAutomationExecution (Prelude.Maybe ExecutionMode)
startAutomationExecution_mode :: (Maybe ExecutionMode -> f (Maybe ExecutionMode))
-> StartAutomationExecution -> f StartAutomationExecution
startAutomationExecution_mode = (StartAutomationExecution -> Maybe ExecutionMode)
-> (StartAutomationExecution
    -> Maybe ExecutionMode -> StartAutomationExecution)
-> Lens
     StartAutomationExecution
     StartAutomationExecution
     (Maybe ExecutionMode)
     (Maybe ExecutionMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAutomationExecution' {Maybe ExecutionMode
mode :: Maybe ExecutionMode
$sel:mode:StartAutomationExecution' :: StartAutomationExecution -> Maybe ExecutionMode
mode} -> Maybe ExecutionMode
mode) (\s :: StartAutomationExecution
s@StartAutomationExecution' {} Maybe ExecutionMode
a -> StartAutomationExecution
s {$sel:mode:StartAutomationExecution' :: Maybe ExecutionMode
mode = Maybe ExecutionMode
a} :: StartAutomationExecution)

-- | A key-value mapping of document parameters to target resources. Both
-- Targets and TargetMaps can\'t be specified together.
startAutomationExecution_targetMaps :: Lens.Lens' StartAutomationExecution (Prelude.Maybe [Prelude.HashMap Prelude.Text [Prelude.Text]])
startAutomationExecution_targetMaps :: (Maybe [HashMap Text [Text]] -> f (Maybe [HashMap Text [Text]]))
-> StartAutomationExecution -> f StartAutomationExecution
startAutomationExecution_targetMaps = (StartAutomationExecution -> Maybe [HashMap Text [Text]])
-> (StartAutomationExecution
    -> Maybe [HashMap Text [Text]] -> StartAutomationExecution)
-> Lens
     StartAutomationExecution
     StartAutomationExecution
     (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 (\StartAutomationExecution' {Maybe [HashMap Text [Text]]
targetMaps :: Maybe [HashMap Text [Text]]
$sel:targetMaps:StartAutomationExecution' :: StartAutomationExecution -> Maybe [HashMap Text [Text]]
targetMaps} -> Maybe [HashMap Text [Text]]
targetMaps) (\s :: StartAutomationExecution
s@StartAutomationExecution' {} Maybe [HashMap Text [Text]]
a -> StartAutomationExecution
s {$sel:targetMaps:StartAutomationExecution' :: Maybe [HashMap Text [Text]]
targetMaps = Maybe [HashMap Text [Text]]
a} :: StartAutomationExecution) ((Maybe [HashMap Text [Text]] -> f (Maybe [HashMap Text [Text]]))
 -> StartAutomationExecution -> f StartAutomationExecution)
-> ((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]]))
-> StartAutomationExecution
-> f StartAutomationExecution
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 number of errors that are allowed before the system stops running
-- the automation on additional targets. You can specify either an absolute
-- number of errors, for example 10, or a percentage of the target set, for
-- example 10%. If you specify 3, for example, the system stops running the
-- automation when the fourth error is received. If you specify 0, then the
-- system stops running the automation on additional targets after the
-- first error result is returned. If you run an automation on 50 resources
-- and set max-errors to 10%, then the system stops running the automation
-- on additional targets when the sixth error is received.
--
-- Executions that are already running an automation when max-errors is
-- reached are allowed to complete, but some of these executions may fail
-- as well. If you need to ensure that there won\'t be more than max-errors
-- failed executions, set max-concurrency to 1 so the executions proceed
-- one at a time.
startAutomationExecution_maxErrors :: Lens.Lens' StartAutomationExecution (Prelude.Maybe Prelude.Text)
startAutomationExecution_maxErrors :: (Maybe Text -> f (Maybe Text))
-> StartAutomationExecution -> f StartAutomationExecution
startAutomationExecution_maxErrors = (StartAutomationExecution -> Maybe Text)
-> (StartAutomationExecution
    -> Maybe Text -> StartAutomationExecution)
-> Lens
     StartAutomationExecution
     StartAutomationExecution
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAutomationExecution' {Maybe Text
maxErrors :: Maybe Text
$sel:maxErrors:StartAutomationExecution' :: StartAutomationExecution -> Maybe Text
maxErrors} -> Maybe Text
maxErrors) (\s :: StartAutomationExecution
s@StartAutomationExecution' {} Maybe Text
a -> StartAutomationExecution
s {$sel:maxErrors:StartAutomationExecution' :: Maybe Text
maxErrors = Maybe Text
a} :: StartAutomationExecution)

-- | A key-value mapping to target resources. Required if you specify
-- TargetParameterName.
startAutomationExecution_targets :: Lens.Lens' StartAutomationExecution (Prelude.Maybe [Target])
startAutomationExecution_targets :: (Maybe [Target] -> f (Maybe [Target]))
-> StartAutomationExecution -> f StartAutomationExecution
startAutomationExecution_targets = (StartAutomationExecution -> Maybe [Target])
-> (StartAutomationExecution
    -> Maybe [Target] -> StartAutomationExecution)
-> Lens
     StartAutomationExecution
     StartAutomationExecution
     (Maybe [Target])
     (Maybe [Target])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAutomationExecution' {Maybe [Target]
targets :: Maybe [Target]
$sel:targets:StartAutomationExecution' :: StartAutomationExecution -> Maybe [Target]
targets} -> Maybe [Target]
targets) (\s :: StartAutomationExecution
s@StartAutomationExecution' {} Maybe [Target]
a -> StartAutomationExecution
s {$sel:targets:StartAutomationExecution' :: Maybe [Target]
targets = Maybe [Target]
a} :: StartAutomationExecution) ((Maybe [Target] -> f (Maybe [Target]))
 -> StartAutomationExecution -> f StartAutomationExecution)
-> ((Maybe [Target] -> f (Maybe [Target]))
    -> Maybe [Target] -> f (Maybe [Target]))
-> (Maybe [Target] -> f (Maybe [Target]))
-> StartAutomationExecution
-> f StartAutomationExecution
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Target] [Target] [Target] [Target]
-> Iso
     (Maybe [Target]) (Maybe [Target]) (Maybe [Target]) (Maybe [Target])
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 [Target] [Target] [Target] [Target]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A key-value map of execution parameters, which match the declared
-- parameters in the Automation runbook.
startAutomationExecution_parameters :: Lens.Lens' StartAutomationExecution (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
startAutomationExecution_parameters :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> StartAutomationExecution -> f StartAutomationExecution
startAutomationExecution_parameters = (StartAutomationExecution -> Maybe (HashMap Text [Text]))
-> (StartAutomationExecution
    -> Maybe (HashMap Text [Text]) -> StartAutomationExecution)
-> Lens
     StartAutomationExecution
     StartAutomationExecution
     (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 (\StartAutomationExecution' {Maybe (HashMap Text [Text])
parameters :: Maybe (HashMap Text [Text])
$sel:parameters:StartAutomationExecution' :: StartAutomationExecution -> Maybe (HashMap Text [Text])
parameters} -> Maybe (HashMap Text [Text])
parameters) (\s :: StartAutomationExecution
s@StartAutomationExecution' {} Maybe (HashMap Text [Text])
a -> StartAutomationExecution
s {$sel:parameters:StartAutomationExecution' :: Maybe (HashMap Text [Text])
parameters = Maybe (HashMap Text [Text])
a} :: StartAutomationExecution) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
 -> StartAutomationExecution -> f StartAutomationExecution)
-> ((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])))
-> StartAutomationExecution
-> f StartAutomationExecution
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 the Automation runbook to use for this execution.
startAutomationExecution_documentVersion :: Lens.Lens' StartAutomationExecution (Prelude.Maybe Prelude.Text)
startAutomationExecution_documentVersion :: (Maybe Text -> f (Maybe Text))
-> StartAutomationExecution -> f StartAutomationExecution
startAutomationExecution_documentVersion = (StartAutomationExecution -> Maybe Text)
-> (StartAutomationExecution
    -> Maybe Text -> StartAutomationExecution)
-> Lens
     StartAutomationExecution
     StartAutomationExecution
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAutomationExecution' {Maybe Text
documentVersion :: Maybe Text
$sel:documentVersion:StartAutomationExecution' :: StartAutomationExecution -> Maybe Text
documentVersion} -> Maybe Text
documentVersion) (\s :: StartAutomationExecution
s@StartAutomationExecution' {} Maybe Text
a -> StartAutomationExecution
s {$sel:documentVersion:StartAutomationExecution' :: Maybe Text
documentVersion = Maybe Text
a} :: StartAutomationExecution)

-- | Optional metadata that you assign to a resource. You can specify a
-- maximum of five tags for an automation. Tags enable you to categorize a
-- resource in different ways, such as by purpose, owner, or environment.
-- For example, you might want to tag an automation to identify an
-- environment or operating system. In this case, you could specify the
-- following key-value pairs:
--
-- -   @Key=environment,Value=test@
--
-- -   @Key=OS,Value=Windows@
--
-- To add tags to an existing patch baseline, use the AddTagsToResource
-- operation.
startAutomationExecution_tags :: Lens.Lens' StartAutomationExecution (Prelude.Maybe [Tag])
startAutomationExecution_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> StartAutomationExecution -> f StartAutomationExecution
startAutomationExecution_tags = (StartAutomationExecution -> Maybe [Tag])
-> (StartAutomationExecution
    -> Maybe [Tag] -> StartAutomationExecution)
-> Lens
     StartAutomationExecution
     StartAutomationExecution
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAutomationExecution' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:StartAutomationExecution' :: StartAutomationExecution -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: StartAutomationExecution
s@StartAutomationExecution' {} Maybe [Tag]
a -> StartAutomationExecution
s {$sel:tags:StartAutomationExecution' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: StartAutomationExecution) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> StartAutomationExecution -> f StartAutomationExecution)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> StartAutomationExecution
-> f StartAutomationExecution
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of targets allowed to run this task in parallel. You
-- can specify a number, such as 10, or a percentage, such as 10%. The
-- default value is @10@.
startAutomationExecution_maxConcurrency :: Lens.Lens' StartAutomationExecution (Prelude.Maybe Prelude.Text)
startAutomationExecution_maxConcurrency :: (Maybe Text -> f (Maybe Text))
-> StartAutomationExecution -> f StartAutomationExecution
startAutomationExecution_maxConcurrency = (StartAutomationExecution -> Maybe Text)
-> (StartAutomationExecution
    -> Maybe Text -> StartAutomationExecution)
-> Lens
     StartAutomationExecution
     StartAutomationExecution
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAutomationExecution' {Maybe Text
maxConcurrency :: Maybe Text
$sel:maxConcurrency:StartAutomationExecution' :: StartAutomationExecution -> Maybe Text
maxConcurrency} -> Maybe Text
maxConcurrency) (\s :: StartAutomationExecution
s@StartAutomationExecution' {} Maybe Text
a -> StartAutomationExecution
s {$sel:maxConcurrency:StartAutomationExecution' :: Maybe Text
maxConcurrency = Maybe Text
a} :: StartAutomationExecution)

-- | The name of the SSM document to run. This can be a public document or a
-- custom document. To run a shared document belonging to another account,
-- specify the document ARN. For more information about how to use shared
-- documents, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-using-shared.html Using shared SSM documents>
-- in the /Amazon Web Services Systems Manager User Guide/.
startAutomationExecution_documentName :: Lens.Lens' StartAutomationExecution Prelude.Text
startAutomationExecution_documentName :: (Text -> f Text)
-> StartAutomationExecution -> f StartAutomationExecution
startAutomationExecution_documentName = (StartAutomationExecution -> Text)
-> (StartAutomationExecution -> Text -> StartAutomationExecution)
-> Lens StartAutomationExecution StartAutomationExecution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAutomationExecution' {Text
documentName :: Text
$sel:documentName:StartAutomationExecution' :: StartAutomationExecution -> Text
documentName} -> Text
documentName) (\s :: StartAutomationExecution
s@StartAutomationExecution' {} Text
a -> StartAutomationExecution
s {$sel:documentName:StartAutomationExecution' :: Text
documentName = Text
a} :: StartAutomationExecution)

instance Core.AWSRequest StartAutomationExecution where
  type
    AWSResponse StartAutomationExecution =
      StartAutomationExecutionResponse
  request :: StartAutomationExecution -> Request StartAutomationExecution
request = Service
-> StartAutomationExecution -> Request StartAutomationExecution
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartAutomationExecution
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartAutomationExecution)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StartAutomationExecution))
-> Logger
-> Service
-> Proxy StartAutomationExecution
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartAutomationExecution)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> StartAutomationExecutionResponse
StartAutomationExecutionResponse'
            (Maybe Text -> Int -> StartAutomationExecutionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartAutomationExecutionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AutomationExecutionId")
            Either String (Int -> StartAutomationExecutionResponse)
-> Either String Int
-> Either String StartAutomationExecutionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable StartAutomationExecution

instance Prelude.NFData StartAutomationExecution

instance Core.ToHeaders StartAutomationExecution where
  toHeaders :: StartAutomationExecution -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartAutomationExecution -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonSSM.StartAutomationExecution" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON StartAutomationExecution where
  toJSON :: StartAutomationExecution -> Value
toJSON StartAutomationExecution' {Maybe [HashMap Text [Text]]
Maybe [Tag]
Maybe [Target]
Maybe (NonEmpty TargetLocation)
Maybe Text
Maybe (HashMap Text [Text])
Maybe ExecutionMode
Text
documentName :: Text
maxConcurrency :: Maybe Text
tags :: Maybe [Tag]
documentVersion :: Maybe Text
parameters :: Maybe (HashMap Text [Text])
targets :: Maybe [Target]
maxErrors :: Maybe Text
targetMaps :: Maybe [HashMap Text [Text]]
mode :: Maybe ExecutionMode
clientToken :: Maybe Text
targetLocations :: Maybe (NonEmpty TargetLocation)
targetParameterName :: Maybe Text
$sel:documentName:StartAutomationExecution' :: StartAutomationExecution -> Text
$sel:maxConcurrency:StartAutomationExecution' :: StartAutomationExecution -> Maybe Text
$sel:tags:StartAutomationExecution' :: StartAutomationExecution -> Maybe [Tag]
$sel:documentVersion:StartAutomationExecution' :: StartAutomationExecution -> Maybe Text
$sel:parameters:StartAutomationExecution' :: StartAutomationExecution -> Maybe (HashMap Text [Text])
$sel:targets:StartAutomationExecution' :: StartAutomationExecution -> Maybe [Target]
$sel:maxErrors:StartAutomationExecution' :: StartAutomationExecution -> Maybe Text
$sel:targetMaps:StartAutomationExecution' :: StartAutomationExecution -> Maybe [HashMap Text [Text]]
$sel:mode:StartAutomationExecution' :: StartAutomationExecution -> Maybe ExecutionMode
$sel:clientToken:StartAutomationExecution' :: StartAutomationExecution -> Maybe Text
$sel:targetLocations:StartAutomationExecution' :: StartAutomationExecution -> Maybe (NonEmpty TargetLocation)
$sel:targetParameterName:StartAutomationExecution' :: StartAutomationExecution -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TargetParameterName" 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
targetParameterName,
            (Text
"TargetLocations" Text -> NonEmpty TargetLocation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty TargetLocation -> Pair)
-> Maybe (NonEmpty TargetLocation) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty TargetLocation)
targetLocations,
            (Text
"ClientToken" 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
clientToken,
            (Text
"Mode" Text -> ExecutionMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ExecutionMode -> Pair) -> Maybe ExecutionMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ExecutionMode
mode,
            (Text
"TargetMaps" 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]]
targetMaps,
            (Text
"MaxErrors" 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
maxErrors,
            (Text
"Targets" Text -> [Target] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Target] -> Pair) -> Maybe [Target] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Target]
targets,
            (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,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            (Text
"MaxConcurrency" 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
maxConcurrency,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DocumentName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
documentName)
          ]
      )

instance Core.ToPath StartAutomationExecution where
  toPath :: StartAutomationExecution -> ByteString
toPath = ByteString -> StartAutomationExecution -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery StartAutomationExecution where
  toQuery :: StartAutomationExecution -> QueryString
toQuery = QueryString -> StartAutomationExecution -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newStartAutomationExecutionResponse' smart constructor.
data StartAutomationExecutionResponse = StartAutomationExecutionResponse'
  { -- | The unique ID of a newly scheduled automation execution.
    StartAutomationExecutionResponse -> Maybe Text
automationExecutionId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StartAutomationExecutionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartAutomationExecutionResponse
-> StartAutomationExecutionResponse -> Bool
(StartAutomationExecutionResponse
 -> StartAutomationExecutionResponse -> Bool)
-> (StartAutomationExecutionResponse
    -> StartAutomationExecutionResponse -> Bool)
-> Eq StartAutomationExecutionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartAutomationExecutionResponse
-> StartAutomationExecutionResponse -> Bool
$c/= :: StartAutomationExecutionResponse
-> StartAutomationExecutionResponse -> Bool
== :: StartAutomationExecutionResponse
-> StartAutomationExecutionResponse -> Bool
$c== :: StartAutomationExecutionResponse
-> StartAutomationExecutionResponse -> Bool
Prelude.Eq, ReadPrec [StartAutomationExecutionResponse]
ReadPrec StartAutomationExecutionResponse
Int -> ReadS StartAutomationExecutionResponse
ReadS [StartAutomationExecutionResponse]
(Int -> ReadS StartAutomationExecutionResponse)
-> ReadS [StartAutomationExecutionResponse]
-> ReadPrec StartAutomationExecutionResponse
-> ReadPrec [StartAutomationExecutionResponse]
-> Read StartAutomationExecutionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartAutomationExecutionResponse]
$creadListPrec :: ReadPrec [StartAutomationExecutionResponse]
readPrec :: ReadPrec StartAutomationExecutionResponse
$creadPrec :: ReadPrec StartAutomationExecutionResponse
readList :: ReadS [StartAutomationExecutionResponse]
$creadList :: ReadS [StartAutomationExecutionResponse]
readsPrec :: Int -> ReadS StartAutomationExecutionResponse
$creadsPrec :: Int -> ReadS StartAutomationExecutionResponse
Prelude.Read, Int -> StartAutomationExecutionResponse -> ShowS
[StartAutomationExecutionResponse] -> ShowS
StartAutomationExecutionResponse -> String
(Int -> StartAutomationExecutionResponse -> ShowS)
-> (StartAutomationExecutionResponse -> String)
-> ([StartAutomationExecutionResponse] -> ShowS)
-> Show StartAutomationExecutionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartAutomationExecutionResponse] -> ShowS
$cshowList :: [StartAutomationExecutionResponse] -> ShowS
show :: StartAutomationExecutionResponse -> String
$cshow :: StartAutomationExecutionResponse -> String
showsPrec :: Int -> StartAutomationExecutionResponse -> ShowS
$cshowsPrec :: Int -> StartAutomationExecutionResponse -> ShowS
Prelude.Show, (forall x.
 StartAutomationExecutionResponse
 -> Rep StartAutomationExecutionResponse x)
-> (forall x.
    Rep StartAutomationExecutionResponse x
    -> StartAutomationExecutionResponse)
-> Generic StartAutomationExecutionResponse
forall x.
Rep StartAutomationExecutionResponse x
-> StartAutomationExecutionResponse
forall x.
StartAutomationExecutionResponse
-> Rep StartAutomationExecutionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartAutomationExecutionResponse x
-> StartAutomationExecutionResponse
$cfrom :: forall x.
StartAutomationExecutionResponse
-> Rep StartAutomationExecutionResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartAutomationExecutionResponse' 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:
--
-- 'automationExecutionId', 'startAutomationExecutionResponse_automationExecutionId' - The unique ID of a newly scheduled automation execution.
--
-- 'httpStatus', 'startAutomationExecutionResponse_httpStatus' - The response's http status code.
newStartAutomationExecutionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartAutomationExecutionResponse
newStartAutomationExecutionResponse :: Int -> StartAutomationExecutionResponse
newStartAutomationExecutionResponse Int
pHttpStatus_ =
  StartAutomationExecutionResponse' :: Maybe Text -> Int -> StartAutomationExecutionResponse
StartAutomationExecutionResponse'
    { $sel:automationExecutionId:StartAutomationExecutionResponse' :: Maybe Text
automationExecutionId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartAutomationExecutionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique ID of a newly scheduled automation execution.
startAutomationExecutionResponse_automationExecutionId :: Lens.Lens' StartAutomationExecutionResponse (Prelude.Maybe Prelude.Text)
startAutomationExecutionResponse_automationExecutionId :: (Maybe Text -> f (Maybe Text))
-> StartAutomationExecutionResponse
-> f StartAutomationExecutionResponse
startAutomationExecutionResponse_automationExecutionId = (StartAutomationExecutionResponse -> Maybe Text)
-> (StartAutomationExecutionResponse
    -> Maybe Text -> StartAutomationExecutionResponse)
-> Lens
     StartAutomationExecutionResponse
     StartAutomationExecutionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAutomationExecutionResponse' {Maybe Text
automationExecutionId :: Maybe Text
$sel:automationExecutionId:StartAutomationExecutionResponse' :: StartAutomationExecutionResponse -> Maybe Text
automationExecutionId} -> Maybe Text
automationExecutionId) (\s :: StartAutomationExecutionResponse
s@StartAutomationExecutionResponse' {} Maybe Text
a -> StartAutomationExecutionResponse
s {$sel:automationExecutionId:StartAutomationExecutionResponse' :: Maybe Text
automationExecutionId = Maybe Text
a} :: StartAutomationExecutionResponse)

-- | The response's http status code.
startAutomationExecutionResponse_httpStatus :: Lens.Lens' StartAutomationExecutionResponse Prelude.Int
startAutomationExecutionResponse_httpStatus :: (Int -> f Int)
-> StartAutomationExecutionResponse
-> f StartAutomationExecutionResponse
startAutomationExecutionResponse_httpStatus = (StartAutomationExecutionResponse -> Int)
-> (StartAutomationExecutionResponse
    -> Int -> StartAutomationExecutionResponse)
-> Lens
     StartAutomationExecutionResponse
     StartAutomationExecutionResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartAutomationExecutionResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartAutomationExecutionResponse' :: StartAutomationExecutionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartAutomationExecutionResponse
s@StartAutomationExecutionResponse' {} Int
a -> StartAutomationExecutionResponse
s {$sel:httpStatus:StartAutomationExecutionResponse' :: Int
httpStatus = Int
a} :: StartAutomationExecutionResponse)

instance
  Prelude.NFData
    StartAutomationExecutionResponse