{-# 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.SendCommand
-- 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)
--
-- Runs commands on one or more managed instances.
module Amazonka.SSM.SendCommand
  ( -- * Creating a Request
    SendCommand (..),
    newSendCommand,

    -- * Request Lenses
    sendCommand_serviceRoleArn,
    sendCommand_notificationConfig,
    sendCommand_documentHashType,
    sendCommand_cloudWatchOutputConfig,
    sendCommand_outputS3KeyPrefix,
    sendCommand_maxErrors,
    sendCommand_instanceIds,
    sendCommand_outputS3Region,
    sendCommand_targets,
    sendCommand_parameters,
    sendCommand_documentHash,
    sendCommand_documentVersion,
    sendCommand_timeoutSeconds,
    sendCommand_comment,
    sendCommand_outputS3BucketName,
    sendCommand_maxConcurrency,
    sendCommand_documentName,

    -- * Destructuring the Response
    SendCommandResponse (..),
    newSendCommandResponse,

    -- * Response Lenses
    sendCommandResponse_command,
    sendCommandResponse_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:/ 'newSendCommand' smart constructor.
data SendCommand = SendCommand'
  { -- | The ARN of the Identity and Access Management (IAM) service role to use
    -- to publish Amazon Simple Notification Service (Amazon SNS) notifications
    -- for Run Command commands.
    SendCommand -> Maybe Text
serviceRoleArn :: Prelude.Maybe Prelude.Text,
    -- | Configurations for sending notifications.
    SendCommand -> Maybe NotificationConfig
notificationConfig :: Prelude.Maybe NotificationConfig,
    -- | Sha256 or Sha1.
    --
    -- Sha1 hashes have been deprecated.
    SendCommand -> Maybe DocumentHashType
documentHashType :: Prelude.Maybe DocumentHashType,
    -- | Enables Amazon Web Services Systems Manager to send Run Command output
    -- to Amazon CloudWatch Logs. Run Command is a capability of Amazon Web
    -- Services Systems Manager.
    SendCommand -> Maybe CloudWatchOutputConfig
cloudWatchOutputConfig :: Prelude.Maybe CloudWatchOutputConfig,
    -- | The directory structure within the S3 bucket where the responses should
    -- be stored.
    SendCommand -> Maybe Text
outputS3KeyPrefix :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of errors allowed without the command failing. When
    -- the command fails one more time beyond the value of @MaxErrors@, the
    -- systems stops sending the command to additional targets. You can specify
    -- a number like 10 or a percentage like 10%. The default value is @0@. For
    -- more information about how to use @MaxErrors@, see
    -- <https://docs.aws.amazon.com/systems-manager/latest/userguide/send-commands-multiple.html#send-commands-maxerrors Using error controls>
    -- in the /Amazon Web Services Systems Manager User Guide/.
    SendCommand -> Maybe Text
maxErrors :: Prelude.Maybe Prelude.Text,
    -- | The IDs of the instances where the command should run. Specifying
    -- instance IDs is most useful when you are targeting a limited number of
    -- instances, though you can specify up to 50 IDs.
    --
    -- To target a larger number of instances, or if you prefer not to list
    -- individual instance IDs, we recommend using the @Targets@ option
    -- instead. Using @Targets@, which accepts tag key-value pairs to identify
    -- the instances to send commands to, you can a send command to tens,
    -- hundreds, or thousands of instances at once.
    --
    -- For more information about how to use targets, see
    -- <https://docs.aws.amazon.com/systems-manager/latest/userguide/send-commands-multiple.html Using targets and rate controls to send commands to a fleet>
    -- in the /Amazon Web Services Systems Manager User Guide/.
    SendCommand -> Maybe [Text]
instanceIds :: Prelude.Maybe [Prelude.Text],
    -- | (Deprecated) You can no longer specify this parameter. The system
    -- ignores it. Instead, Systems Manager automatically determines the Amazon
    -- Web Services Region of the S3 bucket.
    SendCommand -> Maybe Text
outputS3Region :: Prelude.Maybe Prelude.Text,
    -- | An array of search criteria that targets instances using a @Key,Value@
    -- combination that you specify. Specifying targets is most useful when you
    -- want to send a command to a large number of instances at once. Using
    -- @Targets@, which accepts tag key-value pairs to identify instances, you
    -- can send a command to tens, hundreds, or thousands of instances at once.
    --
    -- To send a command to a smaller number of instances, you can use the
    -- @InstanceIds@ option instead.
    --
    -- For more information about how to use targets, see
    -- <https://docs.aws.amazon.com/systems-manager/latest/userguide/send-commands-multiple.html Sending commands to a fleet>
    -- in the /Amazon Web Services Systems Manager User Guide/.
    SendCommand -> Maybe [Target]
targets :: Prelude.Maybe [Target],
    -- | The required and optional parameters specified in the document being
    -- run.
    SendCommand -> Maybe (HashMap Text [Text])
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
    -- | The Sha256 or Sha1 hash created by the system when the document was
    -- created.
    --
    -- Sha1 hashes have been deprecated.
    SendCommand -> Maybe Text
documentHash :: Prelude.Maybe Prelude.Text,
    -- | The SSM document version to use in the request. You can specify
    -- \$DEFAULT, $LATEST, or a specific version number. If you run commands by
    -- using the Command Line Interface (Amazon Web Services CLI), then you
    -- must escape the first two options by using a backslash. If you specify a
    -- version number, then you don\'t need to use the backslash. For example:
    --
    -- --document-version \"\\$DEFAULT\"
    --
    -- --document-version \"\\$LATEST\"
    --
    -- --document-version \"3\"
    SendCommand -> Maybe Text
documentVersion :: Prelude.Maybe Prelude.Text,
    -- | If this time is reached and the command hasn\'t already started running,
    -- it won\'t run.
    SendCommand -> Maybe Natural
timeoutSeconds :: Prelude.Maybe Prelude.Natural,
    -- | User-specified information about the command, such as a brief
    -- description of what the command should do.
    SendCommand -> Maybe Text
comment :: Prelude.Maybe Prelude.Text,
    -- | The name of the S3 bucket where command execution responses should be
    -- stored.
    SendCommand -> Maybe Text
outputS3BucketName :: Prelude.Maybe Prelude.Text,
    -- | (Optional) The maximum number of instances that are allowed to run the
    -- command at the same time. You can specify a number such as 10 or a
    -- percentage such as 10%. The default value is @50@. For more information
    -- about how to use @MaxConcurrency@, see
    -- <https://docs.aws.amazon.com/systems-manager/latest/userguide/send-commands-multiple.html#send-commands-velocity Using concurrency controls>
    -- in the /Amazon Web Services Systems Manager User Guide/.
    SendCommand -> Maybe Text
maxConcurrency :: Prelude.Maybe Prelude.Text,
    -- | The name of the Amazon Web Services Systems Manager document (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
    -- Amazon Resource Name (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/.
    --
    -- If you specify a document name or ARN that hasn\'t been shared with your
    -- account, you receive an @InvalidDocument@ error.
    SendCommand -> Text
documentName :: Prelude.Text
  }
  deriving (SendCommand -> SendCommand -> Bool
(SendCommand -> SendCommand -> Bool)
-> (SendCommand -> SendCommand -> Bool) -> Eq SendCommand
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendCommand -> SendCommand -> Bool
$c/= :: SendCommand -> SendCommand -> Bool
== :: SendCommand -> SendCommand -> Bool
$c== :: SendCommand -> SendCommand -> Bool
Prelude.Eq, ReadPrec [SendCommand]
ReadPrec SendCommand
Int -> ReadS SendCommand
ReadS [SendCommand]
(Int -> ReadS SendCommand)
-> ReadS [SendCommand]
-> ReadPrec SendCommand
-> ReadPrec [SendCommand]
-> Read SendCommand
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendCommand]
$creadListPrec :: ReadPrec [SendCommand]
readPrec :: ReadPrec SendCommand
$creadPrec :: ReadPrec SendCommand
readList :: ReadS [SendCommand]
$creadList :: ReadS [SendCommand]
readsPrec :: Int -> ReadS SendCommand
$creadsPrec :: Int -> ReadS SendCommand
Prelude.Read, Int -> SendCommand -> ShowS
[SendCommand] -> ShowS
SendCommand -> String
(Int -> SendCommand -> ShowS)
-> (SendCommand -> String)
-> ([SendCommand] -> ShowS)
-> Show SendCommand
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendCommand] -> ShowS
$cshowList :: [SendCommand] -> ShowS
show :: SendCommand -> String
$cshow :: SendCommand -> String
showsPrec :: Int -> SendCommand -> ShowS
$cshowsPrec :: Int -> SendCommand -> ShowS
Prelude.Show, (forall x. SendCommand -> Rep SendCommand x)
-> (forall x. Rep SendCommand x -> SendCommand)
-> Generic SendCommand
forall x. Rep SendCommand x -> SendCommand
forall x. SendCommand -> Rep SendCommand x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendCommand x -> SendCommand
$cfrom :: forall x. SendCommand -> Rep SendCommand x
Prelude.Generic)

-- |
-- Create a value of 'SendCommand' 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:
--
-- 'serviceRoleArn', 'sendCommand_serviceRoleArn' - The ARN of the Identity and Access Management (IAM) service role to use
-- to publish Amazon Simple Notification Service (Amazon SNS) notifications
-- for Run Command commands.
--
-- 'notificationConfig', 'sendCommand_notificationConfig' - Configurations for sending notifications.
--
-- 'documentHashType', 'sendCommand_documentHashType' - Sha256 or Sha1.
--
-- Sha1 hashes have been deprecated.
--
-- 'cloudWatchOutputConfig', 'sendCommand_cloudWatchOutputConfig' - Enables Amazon Web Services Systems Manager to send Run Command output
-- to Amazon CloudWatch Logs. Run Command is a capability of Amazon Web
-- Services Systems Manager.
--
-- 'outputS3KeyPrefix', 'sendCommand_outputS3KeyPrefix' - The directory structure within the S3 bucket where the responses should
-- be stored.
--
-- 'maxErrors', 'sendCommand_maxErrors' - The maximum number of errors allowed without the command failing. When
-- the command fails one more time beyond the value of @MaxErrors@, the
-- systems stops sending the command to additional targets. You can specify
-- a number like 10 or a percentage like 10%. The default value is @0@. For
-- more information about how to use @MaxErrors@, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/send-commands-multiple.html#send-commands-maxerrors Using error controls>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- 'instanceIds', 'sendCommand_instanceIds' - The IDs of the instances where the command should run. Specifying
-- instance IDs is most useful when you are targeting a limited number of
-- instances, though you can specify up to 50 IDs.
--
-- To target a larger number of instances, or if you prefer not to list
-- individual instance IDs, we recommend using the @Targets@ option
-- instead. Using @Targets@, which accepts tag key-value pairs to identify
-- the instances to send commands to, you can a send command to tens,
-- hundreds, or thousands of instances at once.
--
-- For more information about how to use targets, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/send-commands-multiple.html Using targets and rate controls to send commands to a fleet>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- 'outputS3Region', 'sendCommand_outputS3Region' - (Deprecated) You can no longer specify this parameter. The system
-- ignores it. Instead, Systems Manager automatically determines the Amazon
-- Web Services Region of the S3 bucket.
--
-- 'targets', 'sendCommand_targets' - An array of search criteria that targets instances using a @Key,Value@
-- combination that you specify. Specifying targets is most useful when you
-- want to send a command to a large number of instances at once. Using
-- @Targets@, which accepts tag key-value pairs to identify instances, you
-- can send a command to tens, hundreds, or thousands of instances at once.
--
-- To send a command to a smaller number of instances, you can use the
-- @InstanceIds@ option instead.
--
-- For more information about how to use targets, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/send-commands-multiple.html Sending commands to a fleet>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- 'parameters', 'sendCommand_parameters' - The required and optional parameters specified in the document being
-- run.
--
-- 'documentHash', 'sendCommand_documentHash' - The Sha256 or Sha1 hash created by the system when the document was
-- created.
--
-- Sha1 hashes have been deprecated.
--
-- 'documentVersion', 'sendCommand_documentVersion' - The SSM document version to use in the request. You can specify
-- \$DEFAULT, $LATEST, or a specific version number. If you run commands by
-- using the Command Line Interface (Amazon Web Services CLI), then you
-- must escape the first two options by using a backslash. If you specify a
-- version number, then you don\'t need to use the backslash. For example:
--
-- --document-version \"\\$DEFAULT\"
--
-- --document-version \"\\$LATEST\"
--
-- --document-version \"3\"
--
-- 'timeoutSeconds', 'sendCommand_timeoutSeconds' - If this time is reached and the command hasn\'t already started running,
-- it won\'t run.
--
-- 'comment', 'sendCommand_comment' - User-specified information about the command, such as a brief
-- description of what the command should do.
--
-- 'outputS3BucketName', 'sendCommand_outputS3BucketName' - The name of the S3 bucket where command execution responses should be
-- stored.
--
-- 'maxConcurrency', 'sendCommand_maxConcurrency' - (Optional) The maximum number of instances that are allowed to run the
-- command at the same time. You can specify a number such as 10 or a
-- percentage such as 10%. The default value is @50@. For more information
-- about how to use @MaxConcurrency@, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/send-commands-multiple.html#send-commands-velocity Using concurrency controls>
-- in the /Amazon Web Services Systems Manager User Guide/.
--
-- 'documentName', 'sendCommand_documentName' - The name of the Amazon Web Services Systems Manager document (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
-- Amazon Resource Name (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/.
--
-- If you specify a document name or ARN that hasn\'t been shared with your
-- account, you receive an @InvalidDocument@ error.
newSendCommand ::
  -- | 'documentName'
  Prelude.Text ->
  SendCommand
newSendCommand :: Text -> SendCommand
newSendCommand Text
pDocumentName_ =
  SendCommand' :: Maybe Text
-> Maybe NotificationConfig
-> Maybe DocumentHashType
-> Maybe CloudWatchOutputConfig
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe [Target]
-> Maybe (HashMap Text [Text])
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> SendCommand
SendCommand'
    { $sel:serviceRoleArn:SendCommand' :: Maybe Text
serviceRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:notificationConfig:SendCommand' :: Maybe NotificationConfig
notificationConfig = Maybe NotificationConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:documentHashType:SendCommand' :: Maybe DocumentHashType
documentHashType = Maybe DocumentHashType
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchOutputConfig:SendCommand' :: Maybe CloudWatchOutputConfig
cloudWatchOutputConfig = Maybe CloudWatchOutputConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:outputS3KeyPrefix:SendCommand' :: Maybe Text
outputS3KeyPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxErrors:SendCommand' :: Maybe Text
maxErrors = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceIds:SendCommand' :: Maybe [Text]
instanceIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:outputS3Region:SendCommand' :: Maybe Text
outputS3Region = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:targets:SendCommand' :: Maybe [Target]
targets = Maybe [Target]
forall a. Maybe a
Prelude.Nothing,
      $sel:parameters:SendCommand' :: Maybe (HashMap Text [Text])
parameters = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
      $sel:documentHash:SendCommand' :: Maybe Text
documentHash = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:documentVersion:SendCommand' :: Maybe Text
documentVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:timeoutSeconds:SendCommand' :: Maybe Natural
timeoutSeconds = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:comment:SendCommand' :: Maybe Text
comment = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:outputS3BucketName:SendCommand' :: Maybe Text
outputS3BucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxConcurrency:SendCommand' :: Maybe Text
maxConcurrency = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:documentName:SendCommand' :: Text
documentName = Text
pDocumentName_
    }

-- | The ARN of the Identity and Access Management (IAM) service role to use
-- to publish Amazon Simple Notification Service (Amazon SNS) notifications
-- for Run Command commands.
sendCommand_serviceRoleArn :: Lens.Lens' SendCommand (Prelude.Maybe Prelude.Text)
sendCommand_serviceRoleArn :: (Maybe Text -> f (Maybe Text)) -> SendCommand -> f SendCommand
sendCommand_serviceRoleArn = (SendCommand -> Maybe Text)
-> (SendCommand -> Maybe Text -> SendCommand)
-> Lens SendCommand SendCommand (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe Text
serviceRoleArn :: Maybe Text
$sel:serviceRoleArn:SendCommand' :: SendCommand -> Maybe Text
serviceRoleArn} -> Maybe Text
serviceRoleArn) (\s :: SendCommand
s@SendCommand' {} Maybe Text
a -> SendCommand
s {$sel:serviceRoleArn:SendCommand' :: Maybe Text
serviceRoleArn = Maybe Text
a} :: SendCommand)

-- | Configurations for sending notifications.
sendCommand_notificationConfig :: Lens.Lens' SendCommand (Prelude.Maybe NotificationConfig)
sendCommand_notificationConfig :: (Maybe NotificationConfig -> f (Maybe NotificationConfig))
-> SendCommand -> f SendCommand
sendCommand_notificationConfig = (SendCommand -> Maybe NotificationConfig)
-> (SendCommand -> Maybe NotificationConfig -> SendCommand)
-> Lens
     SendCommand
     SendCommand
     (Maybe NotificationConfig)
     (Maybe NotificationConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe NotificationConfig
notificationConfig :: Maybe NotificationConfig
$sel:notificationConfig:SendCommand' :: SendCommand -> Maybe NotificationConfig
notificationConfig} -> Maybe NotificationConfig
notificationConfig) (\s :: SendCommand
s@SendCommand' {} Maybe NotificationConfig
a -> SendCommand
s {$sel:notificationConfig:SendCommand' :: Maybe NotificationConfig
notificationConfig = Maybe NotificationConfig
a} :: SendCommand)

-- | Sha256 or Sha1.
--
-- Sha1 hashes have been deprecated.
sendCommand_documentHashType :: Lens.Lens' SendCommand (Prelude.Maybe DocumentHashType)
sendCommand_documentHashType :: (Maybe DocumentHashType -> f (Maybe DocumentHashType))
-> SendCommand -> f SendCommand
sendCommand_documentHashType = (SendCommand -> Maybe DocumentHashType)
-> (SendCommand -> Maybe DocumentHashType -> SendCommand)
-> Lens
     SendCommand
     SendCommand
     (Maybe DocumentHashType)
     (Maybe DocumentHashType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe DocumentHashType
documentHashType :: Maybe DocumentHashType
$sel:documentHashType:SendCommand' :: SendCommand -> Maybe DocumentHashType
documentHashType} -> Maybe DocumentHashType
documentHashType) (\s :: SendCommand
s@SendCommand' {} Maybe DocumentHashType
a -> SendCommand
s {$sel:documentHashType:SendCommand' :: Maybe DocumentHashType
documentHashType = Maybe DocumentHashType
a} :: SendCommand)

-- | Enables Amazon Web Services Systems Manager to send Run Command output
-- to Amazon CloudWatch Logs. Run Command is a capability of Amazon Web
-- Services Systems Manager.
sendCommand_cloudWatchOutputConfig :: Lens.Lens' SendCommand (Prelude.Maybe CloudWatchOutputConfig)
sendCommand_cloudWatchOutputConfig :: (Maybe CloudWatchOutputConfig -> f (Maybe CloudWatchOutputConfig))
-> SendCommand -> f SendCommand
sendCommand_cloudWatchOutputConfig = (SendCommand -> Maybe CloudWatchOutputConfig)
-> (SendCommand -> Maybe CloudWatchOutputConfig -> SendCommand)
-> Lens
     SendCommand
     SendCommand
     (Maybe CloudWatchOutputConfig)
     (Maybe CloudWatchOutputConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe CloudWatchOutputConfig
cloudWatchOutputConfig :: Maybe CloudWatchOutputConfig
$sel:cloudWatchOutputConfig:SendCommand' :: SendCommand -> Maybe CloudWatchOutputConfig
cloudWatchOutputConfig} -> Maybe CloudWatchOutputConfig
cloudWatchOutputConfig) (\s :: SendCommand
s@SendCommand' {} Maybe CloudWatchOutputConfig
a -> SendCommand
s {$sel:cloudWatchOutputConfig:SendCommand' :: Maybe CloudWatchOutputConfig
cloudWatchOutputConfig = Maybe CloudWatchOutputConfig
a} :: SendCommand)

-- | The directory structure within the S3 bucket where the responses should
-- be stored.
sendCommand_outputS3KeyPrefix :: Lens.Lens' SendCommand (Prelude.Maybe Prelude.Text)
sendCommand_outputS3KeyPrefix :: (Maybe Text -> f (Maybe Text)) -> SendCommand -> f SendCommand
sendCommand_outputS3KeyPrefix = (SendCommand -> Maybe Text)
-> (SendCommand -> Maybe Text -> SendCommand)
-> Lens SendCommand SendCommand (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe Text
outputS3KeyPrefix :: Maybe Text
$sel:outputS3KeyPrefix:SendCommand' :: SendCommand -> Maybe Text
outputS3KeyPrefix} -> Maybe Text
outputS3KeyPrefix) (\s :: SendCommand
s@SendCommand' {} Maybe Text
a -> SendCommand
s {$sel:outputS3KeyPrefix:SendCommand' :: Maybe Text
outputS3KeyPrefix = Maybe Text
a} :: SendCommand)

-- | The maximum number of errors allowed without the command failing. When
-- the command fails one more time beyond the value of @MaxErrors@, the
-- systems stops sending the command to additional targets. You can specify
-- a number like 10 or a percentage like 10%. The default value is @0@. For
-- more information about how to use @MaxErrors@, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/send-commands-multiple.html#send-commands-maxerrors Using error controls>
-- in the /Amazon Web Services Systems Manager User Guide/.
sendCommand_maxErrors :: Lens.Lens' SendCommand (Prelude.Maybe Prelude.Text)
sendCommand_maxErrors :: (Maybe Text -> f (Maybe Text)) -> SendCommand -> f SendCommand
sendCommand_maxErrors = (SendCommand -> Maybe Text)
-> (SendCommand -> Maybe Text -> SendCommand)
-> Lens SendCommand SendCommand (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe Text
maxErrors :: Maybe Text
$sel:maxErrors:SendCommand' :: SendCommand -> Maybe Text
maxErrors} -> Maybe Text
maxErrors) (\s :: SendCommand
s@SendCommand' {} Maybe Text
a -> SendCommand
s {$sel:maxErrors:SendCommand' :: Maybe Text
maxErrors = Maybe Text
a} :: SendCommand)

-- | The IDs of the instances where the command should run. Specifying
-- instance IDs is most useful when you are targeting a limited number of
-- instances, though you can specify up to 50 IDs.
--
-- To target a larger number of instances, or if you prefer not to list
-- individual instance IDs, we recommend using the @Targets@ option
-- instead. Using @Targets@, which accepts tag key-value pairs to identify
-- the instances to send commands to, you can a send command to tens,
-- hundreds, or thousands of instances at once.
--
-- For more information about how to use targets, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/send-commands-multiple.html Using targets and rate controls to send commands to a fleet>
-- in the /Amazon Web Services Systems Manager User Guide/.
sendCommand_instanceIds :: Lens.Lens' SendCommand (Prelude.Maybe [Prelude.Text])
sendCommand_instanceIds :: (Maybe [Text] -> f (Maybe [Text])) -> SendCommand -> f SendCommand
sendCommand_instanceIds = (SendCommand -> Maybe [Text])
-> (SendCommand -> Maybe [Text] -> SendCommand)
-> Lens SendCommand SendCommand (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe [Text]
instanceIds :: Maybe [Text]
$sel:instanceIds:SendCommand' :: SendCommand -> Maybe [Text]
instanceIds} -> Maybe [Text]
instanceIds) (\s :: SendCommand
s@SendCommand' {} Maybe [Text]
a -> SendCommand
s {$sel:instanceIds:SendCommand' :: Maybe [Text]
instanceIds = Maybe [Text]
a} :: SendCommand) ((Maybe [Text] -> f (Maybe [Text]))
 -> SendCommand -> f SendCommand)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> SendCommand
-> f SendCommand
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | (Deprecated) You can no longer specify this parameter. The system
-- ignores it. Instead, Systems Manager automatically determines the Amazon
-- Web Services Region of the S3 bucket.
sendCommand_outputS3Region :: Lens.Lens' SendCommand (Prelude.Maybe Prelude.Text)
sendCommand_outputS3Region :: (Maybe Text -> f (Maybe Text)) -> SendCommand -> f SendCommand
sendCommand_outputS3Region = (SendCommand -> Maybe Text)
-> (SendCommand -> Maybe Text -> SendCommand)
-> Lens SendCommand SendCommand (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe Text
outputS3Region :: Maybe Text
$sel:outputS3Region:SendCommand' :: SendCommand -> Maybe Text
outputS3Region} -> Maybe Text
outputS3Region) (\s :: SendCommand
s@SendCommand' {} Maybe Text
a -> SendCommand
s {$sel:outputS3Region:SendCommand' :: Maybe Text
outputS3Region = Maybe Text
a} :: SendCommand)

-- | An array of search criteria that targets instances using a @Key,Value@
-- combination that you specify. Specifying targets is most useful when you
-- want to send a command to a large number of instances at once. Using
-- @Targets@, which accepts tag key-value pairs to identify instances, you
-- can send a command to tens, hundreds, or thousands of instances at once.
--
-- To send a command to a smaller number of instances, you can use the
-- @InstanceIds@ option instead.
--
-- For more information about how to use targets, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/send-commands-multiple.html Sending commands to a fleet>
-- in the /Amazon Web Services Systems Manager User Guide/.
sendCommand_targets :: Lens.Lens' SendCommand (Prelude.Maybe [Target])
sendCommand_targets :: (Maybe [Target] -> f (Maybe [Target]))
-> SendCommand -> f SendCommand
sendCommand_targets = (SendCommand -> Maybe [Target])
-> (SendCommand -> Maybe [Target] -> SendCommand)
-> Lens SendCommand SendCommand (Maybe [Target]) (Maybe [Target])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe [Target]
targets :: Maybe [Target]
$sel:targets:SendCommand' :: SendCommand -> Maybe [Target]
targets} -> Maybe [Target]
targets) (\s :: SendCommand
s@SendCommand' {} Maybe [Target]
a -> SendCommand
s {$sel:targets:SendCommand' :: Maybe [Target]
targets = Maybe [Target]
a} :: SendCommand) ((Maybe [Target] -> f (Maybe [Target]))
 -> SendCommand -> f SendCommand)
-> ((Maybe [Target] -> f (Maybe [Target]))
    -> Maybe [Target] -> f (Maybe [Target]))
-> (Maybe [Target] -> f (Maybe [Target]))
-> SendCommand
-> f SendCommand
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

-- | The required and optional parameters specified in the document being
-- run.
sendCommand_parameters :: Lens.Lens' SendCommand (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
sendCommand_parameters :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> SendCommand -> f SendCommand
sendCommand_parameters = (SendCommand -> Maybe (HashMap Text [Text]))
-> (SendCommand -> Maybe (HashMap Text [Text]) -> SendCommand)
-> Lens
     SendCommand
     SendCommand
     (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 (\SendCommand' {Maybe (HashMap Text [Text])
parameters :: Maybe (HashMap Text [Text])
$sel:parameters:SendCommand' :: SendCommand -> Maybe (HashMap Text [Text])
parameters} -> Maybe (HashMap Text [Text])
parameters) (\s :: SendCommand
s@SendCommand' {} Maybe (HashMap Text [Text])
a -> SendCommand
s {$sel:parameters:SendCommand' :: Maybe (HashMap Text [Text])
parameters = Maybe (HashMap Text [Text])
a} :: SendCommand) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
 -> SendCommand -> f SendCommand)
-> ((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])))
-> SendCommand
-> f SendCommand
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 Sha256 or Sha1 hash created by the system when the document was
-- created.
--
-- Sha1 hashes have been deprecated.
sendCommand_documentHash :: Lens.Lens' SendCommand (Prelude.Maybe Prelude.Text)
sendCommand_documentHash :: (Maybe Text -> f (Maybe Text)) -> SendCommand -> f SendCommand
sendCommand_documentHash = (SendCommand -> Maybe Text)
-> (SendCommand -> Maybe Text -> SendCommand)
-> Lens SendCommand SendCommand (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe Text
documentHash :: Maybe Text
$sel:documentHash:SendCommand' :: SendCommand -> Maybe Text
documentHash} -> Maybe Text
documentHash) (\s :: SendCommand
s@SendCommand' {} Maybe Text
a -> SendCommand
s {$sel:documentHash:SendCommand' :: Maybe Text
documentHash = Maybe Text
a} :: SendCommand)

-- | The SSM document version to use in the request. You can specify
-- \$DEFAULT, $LATEST, or a specific version number. If you run commands by
-- using the Command Line Interface (Amazon Web Services CLI), then you
-- must escape the first two options by using a backslash. If you specify a
-- version number, then you don\'t need to use the backslash. For example:
--
-- --document-version \"\\$DEFAULT\"
--
-- --document-version \"\\$LATEST\"
--
-- --document-version \"3\"
sendCommand_documentVersion :: Lens.Lens' SendCommand (Prelude.Maybe Prelude.Text)
sendCommand_documentVersion :: (Maybe Text -> f (Maybe Text)) -> SendCommand -> f SendCommand
sendCommand_documentVersion = (SendCommand -> Maybe Text)
-> (SendCommand -> Maybe Text -> SendCommand)
-> Lens SendCommand SendCommand (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe Text
documentVersion :: Maybe Text
$sel:documentVersion:SendCommand' :: SendCommand -> Maybe Text
documentVersion} -> Maybe Text
documentVersion) (\s :: SendCommand
s@SendCommand' {} Maybe Text
a -> SendCommand
s {$sel:documentVersion:SendCommand' :: Maybe Text
documentVersion = Maybe Text
a} :: SendCommand)

-- | If this time is reached and the command hasn\'t already started running,
-- it won\'t run.
sendCommand_timeoutSeconds :: Lens.Lens' SendCommand (Prelude.Maybe Prelude.Natural)
sendCommand_timeoutSeconds :: (Maybe Natural -> f (Maybe Natural))
-> SendCommand -> f SendCommand
sendCommand_timeoutSeconds = (SendCommand -> Maybe Natural)
-> (SendCommand -> Maybe Natural -> SendCommand)
-> Lens SendCommand SendCommand (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe Natural
timeoutSeconds :: Maybe Natural
$sel:timeoutSeconds:SendCommand' :: SendCommand -> Maybe Natural
timeoutSeconds} -> Maybe Natural
timeoutSeconds) (\s :: SendCommand
s@SendCommand' {} Maybe Natural
a -> SendCommand
s {$sel:timeoutSeconds:SendCommand' :: Maybe Natural
timeoutSeconds = Maybe Natural
a} :: SendCommand)

-- | User-specified information about the command, such as a brief
-- description of what the command should do.
sendCommand_comment :: Lens.Lens' SendCommand (Prelude.Maybe Prelude.Text)
sendCommand_comment :: (Maybe Text -> f (Maybe Text)) -> SendCommand -> f SendCommand
sendCommand_comment = (SendCommand -> Maybe Text)
-> (SendCommand -> Maybe Text -> SendCommand)
-> Lens SendCommand SendCommand (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe Text
comment :: Maybe Text
$sel:comment:SendCommand' :: SendCommand -> Maybe Text
comment} -> Maybe Text
comment) (\s :: SendCommand
s@SendCommand' {} Maybe Text
a -> SendCommand
s {$sel:comment:SendCommand' :: Maybe Text
comment = Maybe Text
a} :: SendCommand)

-- | The name of the S3 bucket where command execution responses should be
-- stored.
sendCommand_outputS3BucketName :: Lens.Lens' SendCommand (Prelude.Maybe Prelude.Text)
sendCommand_outputS3BucketName :: (Maybe Text -> f (Maybe Text)) -> SendCommand -> f SendCommand
sendCommand_outputS3BucketName = (SendCommand -> Maybe Text)
-> (SendCommand -> Maybe Text -> SendCommand)
-> Lens SendCommand SendCommand (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe Text
outputS3BucketName :: Maybe Text
$sel:outputS3BucketName:SendCommand' :: SendCommand -> Maybe Text
outputS3BucketName} -> Maybe Text
outputS3BucketName) (\s :: SendCommand
s@SendCommand' {} Maybe Text
a -> SendCommand
s {$sel:outputS3BucketName:SendCommand' :: Maybe Text
outputS3BucketName = Maybe Text
a} :: SendCommand)

-- | (Optional) The maximum number of instances that are allowed to run the
-- command at the same time. You can specify a number such as 10 or a
-- percentage such as 10%. The default value is @50@. For more information
-- about how to use @MaxConcurrency@, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/send-commands-multiple.html#send-commands-velocity Using concurrency controls>
-- in the /Amazon Web Services Systems Manager User Guide/.
sendCommand_maxConcurrency :: Lens.Lens' SendCommand (Prelude.Maybe Prelude.Text)
sendCommand_maxConcurrency :: (Maybe Text -> f (Maybe Text)) -> SendCommand -> f SendCommand
sendCommand_maxConcurrency = (SendCommand -> Maybe Text)
-> (SendCommand -> Maybe Text -> SendCommand)
-> Lens SendCommand SendCommand (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Maybe Text
maxConcurrency :: Maybe Text
$sel:maxConcurrency:SendCommand' :: SendCommand -> Maybe Text
maxConcurrency} -> Maybe Text
maxConcurrency) (\s :: SendCommand
s@SendCommand' {} Maybe Text
a -> SendCommand
s {$sel:maxConcurrency:SendCommand' :: Maybe Text
maxConcurrency = Maybe Text
a} :: SendCommand)

-- | The name of the Amazon Web Services Systems Manager document (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
-- Amazon Resource Name (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/.
--
-- If you specify a document name or ARN that hasn\'t been shared with your
-- account, you receive an @InvalidDocument@ error.
sendCommand_documentName :: Lens.Lens' SendCommand Prelude.Text
sendCommand_documentName :: (Text -> f Text) -> SendCommand -> f SendCommand
sendCommand_documentName = (SendCommand -> Text)
-> (SendCommand -> Text -> SendCommand)
-> Lens SendCommand SendCommand Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommand' {Text
documentName :: Text
$sel:documentName:SendCommand' :: SendCommand -> Text
documentName} -> Text
documentName) (\s :: SendCommand
s@SendCommand' {} Text
a -> SendCommand
s {$sel:documentName:SendCommand' :: Text
documentName = Text
a} :: SendCommand)

instance Core.AWSRequest SendCommand where
  type AWSResponse SendCommand = SendCommandResponse
  request :: SendCommand -> Request SendCommand
request = Service -> SendCommand -> Request SendCommand
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy SendCommand
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendCommand)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse SendCommand))
-> Logger
-> Service
-> Proxy SendCommand
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendCommand)))
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 Command -> Int -> SendCommandResponse
SendCommandResponse'
            (Maybe Command -> Int -> SendCommandResponse)
-> Either String (Maybe Command)
-> Either String (Int -> SendCommandResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Command)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Command")
            Either String (Int -> SendCommandResponse)
-> Either String Int -> Either String SendCommandResponse
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 SendCommand

instance Prelude.NFData SendCommand

instance Core.ToHeaders SendCommand where
  toHeaders :: SendCommand -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SendCommand -> 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.SendCommand" :: 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 SendCommand where
  toJSON :: SendCommand -> Value
toJSON SendCommand' {Maybe Natural
Maybe [Text]
Maybe [Target]
Maybe Text
Maybe (HashMap Text [Text])
Maybe CloudWatchOutputConfig
Maybe DocumentHashType
Maybe NotificationConfig
Text
documentName :: Text
maxConcurrency :: Maybe Text
outputS3BucketName :: Maybe Text
comment :: Maybe Text
timeoutSeconds :: Maybe Natural
documentVersion :: Maybe Text
documentHash :: Maybe Text
parameters :: Maybe (HashMap Text [Text])
targets :: Maybe [Target]
outputS3Region :: Maybe Text
instanceIds :: Maybe [Text]
maxErrors :: Maybe Text
outputS3KeyPrefix :: Maybe Text
cloudWatchOutputConfig :: Maybe CloudWatchOutputConfig
documentHashType :: Maybe DocumentHashType
notificationConfig :: Maybe NotificationConfig
serviceRoleArn :: Maybe Text
$sel:documentName:SendCommand' :: SendCommand -> Text
$sel:maxConcurrency:SendCommand' :: SendCommand -> Maybe Text
$sel:outputS3BucketName:SendCommand' :: SendCommand -> Maybe Text
$sel:comment:SendCommand' :: SendCommand -> Maybe Text
$sel:timeoutSeconds:SendCommand' :: SendCommand -> Maybe Natural
$sel:documentVersion:SendCommand' :: SendCommand -> Maybe Text
$sel:documentHash:SendCommand' :: SendCommand -> Maybe Text
$sel:parameters:SendCommand' :: SendCommand -> Maybe (HashMap Text [Text])
$sel:targets:SendCommand' :: SendCommand -> Maybe [Target]
$sel:outputS3Region:SendCommand' :: SendCommand -> Maybe Text
$sel:instanceIds:SendCommand' :: SendCommand -> Maybe [Text]
$sel:maxErrors:SendCommand' :: SendCommand -> Maybe Text
$sel:outputS3KeyPrefix:SendCommand' :: SendCommand -> Maybe Text
$sel:cloudWatchOutputConfig:SendCommand' :: SendCommand -> Maybe CloudWatchOutputConfig
$sel:documentHashType:SendCommand' :: SendCommand -> Maybe DocumentHashType
$sel:notificationConfig:SendCommand' :: SendCommand -> Maybe NotificationConfig
$sel:serviceRoleArn:SendCommand' :: SendCommand -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ServiceRoleArn" 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
serviceRoleArn,
            (Text
"NotificationConfig" Text -> NotificationConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NotificationConfig -> Pair)
-> Maybe NotificationConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NotificationConfig
notificationConfig,
            (Text
"DocumentHashType" Text -> DocumentHashType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DocumentHashType -> Pair) -> Maybe DocumentHashType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DocumentHashType
documentHashType,
            (Text
"CloudWatchOutputConfig" Text -> CloudWatchOutputConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CloudWatchOutputConfig -> Pair)
-> Maybe CloudWatchOutputConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CloudWatchOutputConfig
cloudWatchOutputConfig,
            (Text
"OutputS3KeyPrefix" 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
outputS3KeyPrefix,
            (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
"InstanceIds" 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]
instanceIds,
            (Text
"OutputS3Region" 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
outputS3Region,
            (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
"DocumentHash" 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
documentHash,
            (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
"TimeoutSeconds" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
timeoutSeconds,
            (Text
"Comment" 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
comment,
            (Text
"OutputS3BucketName" 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
outputS3BucketName,
            (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 SendCommand where
  toPath :: SendCommand -> ByteString
toPath = ByteString -> SendCommand -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newSendCommandResponse' smart constructor.
data SendCommandResponse = SendCommandResponse'
  { -- | The request as it was received by Systems Manager. Also provides the
    -- command ID which can be used future references to this request.
    SendCommandResponse -> Maybe Command
command :: Prelude.Maybe Command,
    -- | The response's http status code.
    SendCommandResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SendCommandResponse -> SendCommandResponse -> Bool
(SendCommandResponse -> SendCommandResponse -> Bool)
-> (SendCommandResponse -> SendCommandResponse -> Bool)
-> Eq SendCommandResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendCommandResponse -> SendCommandResponse -> Bool
$c/= :: SendCommandResponse -> SendCommandResponse -> Bool
== :: SendCommandResponse -> SendCommandResponse -> Bool
$c== :: SendCommandResponse -> SendCommandResponse -> Bool
Prelude.Eq, ReadPrec [SendCommandResponse]
ReadPrec SendCommandResponse
Int -> ReadS SendCommandResponse
ReadS [SendCommandResponse]
(Int -> ReadS SendCommandResponse)
-> ReadS [SendCommandResponse]
-> ReadPrec SendCommandResponse
-> ReadPrec [SendCommandResponse]
-> Read SendCommandResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendCommandResponse]
$creadListPrec :: ReadPrec [SendCommandResponse]
readPrec :: ReadPrec SendCommandResponse
$creadPrec :: ReadPrec SendCommandResponse
readList :: ReadS [SendCommandResponse]
$creadList :: ReadS [SendCommandResponse]
readsPrec :: Int -> ReadS SendCommandResponse
$creadsPrec :: Int -> ReadS SendCommandResponse
Prelude.Read, Int -> SendCommandResponse -> ShowS
[SendCommandResponse] -> ShowS
SendCommandResponse -> String
(Int -> SendCommandResponse -> ShowS)
-> (SendCommandResponse -> String)
-> ([SendCommandResponse] -> ShowS)
-> Show SendCommandResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendCommandResponse] -> ShowS
$cshowList :: [SendCommandResponse] -> ShowS
show :: SendCommandResponse -> String
$cshow :: SendCommandResponse -> String
showsPrec :: Int -> SendCommandResponse -> ShowS
$cshowsPrec :: Int -> SendCommandResponse -> ShowS
Prelude.Show, (forall x. SendCommandResponse -> Rep SendCommandResponse x)
-> (forall x. Rep SendCommandResponse x -> SendCommandResponse)
-> Generic SendCommandResponse
forall x. Rep SendCommandResponse x -> SendCommandResponse
forall x. SendCommandResponse -> Rep SendCommandResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendCommandResponse x -> SendCommandResponse
$cfrom :: forall x. SendCommandResponse -> Rep SendCommandResponse x
Prelude.Generic)

-- |
-- Create a value of 'SendCommandResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'command', 'sendCommandResponse_command' - The request as it was received by Systems Manager. Also provides the
-- command ID which can be used future references to this request.
--
-- 'httpStatus', 'sendCommandResponse_httpStatus' - The response's http status code.
newSendCommandResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SendCommandResponse
newSendCommandResponse :: Int -> SendCommandResponse
newSendCommandResponse Int
pHttpStatus_ =
  SendCommandResponse' :: Maybe Command -> Int -> SendCommandResponse
SendCommandResponse'
    { $sel:command:SendCommandResponse' :: Maybe Command
command = Maybe Command
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SendCommandResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The request as it was received by Systems Manager. Also provides the
-- command ID which can be used future references to this request.
sendCommandResponse_command :: Lens.Lens' SendCommandResponse (Prelude.Maybe Command)
sendCommandResponse_command :: (Maybe Command -> f (Maybe Command))
-> SendCommandResponse -> f SendCommandResponse
sendCommandResponse_command = (SendCommandResponse -> Maybe Command)
-> (SendCommandResponse -> Maybe Command -> SendCommandResponse)
-> Lens
     SendCommandResponse
     SendCommandResponse
     (Maybe Command)
     (Maybe Command)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendCommandResponse' {Maybe Command
command :: Maybe Command
$sel:command:SendCommandResponse' :: SendCommandResponse -> Maybe Command
command} -> Maybe Command
command) (\s :: SendCommandResponse
s@SendCommandResponse' {} Maybe Command
a -> SendCommandResponse
s {$sel:command:SendCommandResponse' :: Maybe Command
command = Maybe Command
a} :: SendCommandResponse)

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

instance Prelude.NFData SendCommandResponse