{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SSM.Types.CommandPlugin
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SSM.Types.CommandPlugin where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.CommandPluginStatus

-- | Describes plugin details.
--
-- /See:/ 'newCommandPlugin' smart constructor.
data CommandPlugin = CommandPlugin'
  { -- | The status of this plugin. You can run a document with multiple plugins.
    CommandPlugin -> Maybe CommandPluginStatus
status :: Prelude.Maybe CommandPluginStatus,
    -- | The time the plugin started running.
    CommandPlugin -> Maybe POSIX
responseStartDateTime :: Prelude.Maybe Core.POSIX,
    -- | The S3 directory path inside the bucket where the responses to the
    -- command executions should be stored. This was requested when issuing the
    -- command. For example, in the following response:
    --
    -- @doc-example-bucket\/ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix\/i-02573cafcfEXAMPLE\/awsrunShellScript@
    --
    -- @doc-example-bucket@ is the name of the S3 bucket;
    --
    -- @ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix@ is the name of the S3 prefix;
    --
    -- @i-02573cafcfEXAMPLE@ is the instance ID;
    --
    -- @awsrunShellScript@ is the name of the plugin.
    CommandPlugin -> Maybe Text
outputS3KeyPrefix :: Prelude.Maybe Prelude.Text,
    -- | The URL for the complete text written by the plugin to stderr. If
    -- execution isn\'t yet complete, then this string is empty.
    CommandPlugin -> Maybe Text
standardErrorUrl :: Prelude.Maybe Prelude.Text,
    -- | A numeric response code generated after running the plugin.
    CommandPlugin -> Maybe Int
responseCode :: Prelude.Maybe Prelude.Int,
    -- | A detailed status of the plugin execution. @StatusDetails@ includes more
    -- information than Status because it includes states resulting from error
    -- and concurrency control parameters. StatusDetails can show different
    -- results than Status. For more information about these statuses, see
    -- <https://docs.aws.amazon.com/systems-manager/latest/userguide/monitor-commands.html Understanding command statuses>
    -- in the /Amazon Web Services Systems Manager User Guide/. StatusDetails
    -- can be one of the following values:
    --
    -- -   Pending: The command hasn\'t been sent to the instance.
    --
    -- -   In Progress: The command has been sent to the instance but hasn\'t
    --     reached a terminal state.
    --
    -- -   Success: The execution of the command or plugin was successfully
    --     completed. This is a terminal state.
    --
    -- -   Delivery Timed Out: The command wasn\'t delivered to the instance
    --     before the delivery timeout expired. Delivery timeouts don\'t count
    --     against the parent command\'s @MaxErrors@ limit, but they do
    --     contribute to whether the parent command status is Success or
    --     Incomplete. This is a terminal state.
    --
    -- -   Execution Timed Out: Command execution started on the instance, but
    --     the execution wasn\'t complete before the execution timeout expired.
    --     Execution timeouts count against the @MaxErrors@ limit of the parent
    --     command. This is a terminal state.
    --
    -- -   Failed: The command wasn\'t successful on the instance. For a
    --     plugin, this indicates that the result code wasn\'t zero. For a
    --     command invocation, this indicates that the result code for one or
    --     more plugins wasn\'t zero. Invocation failures count against the
    --     MaxErrors limit of the parent command. This is a terminal state.
    --
    -- -   Canceled: The command was terminated before it was completed. This
    --     is a terminal state.
    --
    -- -   Undeliverable: The command can\'t be delivered to the instance. The
    --     instance might not exist, or it might not be responding.
    --     Undeliverable invocations don\'t count against the parent command\'s
    --     MaxErrors limit, and they don\'t contribute to whether the parent
    --     command status is Success or Incomplete. This is a terminal state.
    --
    -- -   Terminated: The parent command exceeded its MaxErrors limit and
    --     subsequent command invocations were canceled by the system. This is
    --     a terminal state.
    CommandPlugin -> Maybe Text
statusDetails :: Prelude.Maybe Prelude.Text,
    -- | Output of the plugin execution.
    CommandPlugin -> Maybe Text
output :: Prelude.Maybe Prelude.Text,
    -- | The URL for the complete text written by the plugin to stdout in Amazon
    -- S3. If the S3 bucket for the command wasn\'t specified, then this string
    -- is empty.
    CommandPlugin -> Maybe Text
standardOutputUrl :: Prelude.Maybe Prelude.Text,
    -- | The name of the plugin. Must be one of the following: @aws:updateAgent@,
    -- @aws:domainjoin@, @aws:applications@, @aws:runPowerShellScript@,
    -- @aws:psmodule@, @aws:cloudWatch@, @aws:runShellScript@, or
    -- @aws:updateSSMAgent@.
    CommandPlugin -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | (Deprecated) You can no longer specify this parameter. The system
    -- ignores it. Instead, Amazon Web Services Systems Manager automatically
    -- determines the S3 bucket region.
    CommandPlugin -> Maybe Text
outputS3Region :: Prelude.Maybe Prelude.Text,
    -- | The S3 bucket where the responses to the command executions should be
    -- stored. This was requested when issuing the command. For example, in the
    -- following response:
    --
    -- @doc-example-bucket\/ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix\/i-02573cafcfEXAMPLE\/awsrunShellScript@
    --
    -- @doc-example-bucket@ is the name of the S3 bucket;
    --
    -- @ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix@ is the name of the S3 prefix;
    --
    -- @i-02573cafcfEXAMPLE@ is the instance ID;
    --
    -- @awsrunShellScript@ is the name of the plugin.
    CommandPlugin -> Maybe Text
outputS3BucketName :: Prelude.Maybe Prelude.Text,
    -- | The time the plugin stopped running. Could stop prematurely if, for
    -- example, a cancel command was sent.
    CommandPlugin -> Maybe POSIX
responseFinishDateTime :: Prelude.Maybe Core.POSIX
  }
  deriving (CommandPlugin -> CommandPlugin -> Bool
(CommandPlugin -> CommandPlugin -> Bool)
-> (CommandPlugin -> CommandPlugin -> Bool) -> Eq CommandPlugin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CommandPlugin -> CommandPlugin -> Bool
$c/= :: CommandPlugin -> CommandPlugin -> Bool
== :: CommandPlugin -> CommandPlugin -> Bool
$c== :: CommandPlugin -> CommandPlugin -> Bool
Prelude.Eq, ReadPrec [CommandPlugin]
ReadPrec CommandPlugin
Int -> ReadS CommandPlugin
ReadS [CommandPlugin]
(Int -> ReadS CommandPlugin)
-> ReadS [CommandPlugin]
-> ReadPrec CommandPlugin
-> ReadPrec [CommandPlugin]
-> Read CommandPlugin
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CommandPlugin]
$creadListPrec :: ReadPrec [CommandPlugin]
readPrec :: ReadPrec CommandPlugin
$creadPrec :: ReadPrec CommandPlugin
readList :: ReadS [CommandPlugin]
$creadList :: ReadS [CommandPlugin]
readsPrec :: Int -> ReadS CommandPlugin
$creadsPrec :: Int -> ReadS CommandPlugin
Prelude.Read, Int -> CommandPlugin -> ShowS
[CommandPlugin] -> ShowS
CommandPlugin -> String
(Int -> CommandPlugin -> ShowS)
-> (CommandPlugin -> String)
-> ([CommandPlugin] -> ShowS)
-> Show CommandPlugin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CommandPlugin] -> ShowS
$cshowList :: [CommandPlugin] -> ShowS
show :: CommandPlugin -> String
$cshow :: CommandPlugin -> String
showsPrec :: Int -> CommandPlugin -> ShowS
$cshowsPrec :: Int -> CommandPlugin -> ShowS
Prelude.Show, (forall x. CommandPlugin -> Rep CommandPlugin x)
-> (forall x. Rep CommandPlugin x -> CommandPlugin)
-> Generic CommandPlugin
forall x. Rep CommandPlugin x -> CommandPlugin
forall x. CommandPlugin -> Rep CommandPlugin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CommandPlugin x -> CommandPlugin
$cfrom :: forall x. CommandPlugin -> Rep CommandPlugin x
Prelude.Generic)

-- |
-- Create a value of 'CommandPlugin' 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:
--
-- 'status', 'commandPlugin_status' - The status of this plugin. You can run a document with multiple plugins.
--
-- 'responseStartDateTime', 'commandPlugin_responseStartDateTime' - The time the plugin started running.
--
-- 'outputS3KeyPrefix', 'commandPlugin_outputS3KeyPrefix' - The S3 directory path inside the bucket where the responses to the
-- command executions should be stored. This was requested when issuing the
-- command. For example, in the following response:
--
-- @doc-example-bucket\/ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix\/i-02573cafcfEXAMPLE\/awsrunShellScript@
--
-- @doc-example-bucket@ is the name of the S3 bucket;
--
-- @ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix@ is the name of the S3 prefix;
--
-- @i-02573cafcfEXAMPLE@ is the instance ID;
--
-- @awsrunShellScript@ is the name of the plugin.
--
-- 'standardErrorUrl', 'commandPlugin_standardErrorUrl' - The URL for the complete text written by the plugin to stderr. If
-- execution isn\'t yet complete, then this string is empty.
--
-- 'responseCode', 'commandPlugin_responseCode' - A numeric response code generated after running the plugin.
--
-- 'statusDetails', 'commandPlugin_statusDetails' - A detailed status of the plugin execution. @StatusDetails@ includes more
-- information than Status because it includes states resulting from error
-- and concurrency control parameters. StatusDetails can show different
-- results than Status. For more information about these statuses, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/monitor-commands.html Understanding command statuses>
-- in the /Amazon Web Services Systems Manager User Guide/. StatusDetails
-- can be one of the following values:
--
-- -   Pending: The command hasn\'t been sent to the instance.
--
-- -   In Progress: The command has been sent to the instance but hasn\'t
--     reached a terminal state.
--
-- -   Success: The execution of the command or plugin was successfully
--     completed. This is a terminal state.
--
-- -   Delivery Timed Out: The command wasn\'t delivered to the instance
--     before the delivery timeout expired. Delivery timeouts don\'t count
--     against the parent command\'s @MaxErrors@ limit, but they do
--     contribute to whether the parent command status is Success or
--     Incomplete. This is a terminal state.
--
-- -   Execution Timed Out: Command execution started on the instance, but
--     the execution wasn\'t complete before the execution timeout expired.
--     Execution timeouts count against the @MaxErrors@ limit of the parent
--     command. This is a terminal state.
--
-- -   Failed: The command wasn\'t successful on the instance. For a
--     plugin, this indicates that the result code wasn\'t zero. For a
--     command invocation, this indicates that the result code for one or
--     more plugins wasn\'t zero. Invocation failures count against the
--     MaxErrors limit of the parent command. This is a terminal state.
--
-- -   Canceled: The command was terminated before it was completed. This
--     is a terminal state.
--
-- -   Undeliverable: The command can\'t be delivered to the instance. The
--     instance might not exist, or it might not be responding.
--     Undeliverable invocations don\'t count against the parent command\'s
--     MaxErrors limit, and they don\'t contribute to whether the parent
--     command status is Success or Incomplete. This is a terminal state.
--
-- -   Terminated: The parent command exceeded its MaxErrors limit and
--     subsequent command invocations were canceled by the system. This is
--     a terminal state.
--
-- 'output', 'commandPlugin_output' - Output of the plugin execution.
--
-- 'standardOutputUrl', 'commandPlugin_standardOutputUrl' - The URL for the complete text written by the plugin to stdout in Amazon
-- S3. If the S3 bucket for the command wasn\'t specified, then this string
-- is empty.
--
-- 'name', 'commandPlugin_name' - The name of the plugin. Must be one of the following: @aws:updateAgent@,
-- @aws:domainjoin@, @aws:applications@, @aws:runPowerShellScript@,
-- @aws:psmodule@, @aws:cloudWatch@, @aws:runShellScript@, or
-- @aws:updateSSMAgent@.
--
-- 'outputS3Region', 'commandPlugin_outputS3Region' - (Deprecated) You can no longer specify this parameter. The system
-- ignores it. Instead, Amazon Web Services Systems Manager automatically
-- determines the S3 bucket region.
--
-- 'outputS3BucketName', 'commandPlugin_outputS3BucketName' - The S3 bucket where the responses to the command executions should be
-- stored. This was requested when issuing the command. For example, in the
-- following response:
--
-- @doc-example-bucket\/ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix\/i-02573cafcfEXAMPLE\/awsrunShellScript@
--
-- @doc-example-bucket@ is the name of the S3 bucket;
--
-- @ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix@ is the name of the S3 prefix;
--
-- @i-02573cafcfEXAMPLE@ is the instance ID;
--
-- @awsrunShellScript@ is the name of the plugin.
--
-- 'responseFinishDateTime', 'commandPlugin_responseFinishDateTime' - The time the plugin stopped running. Could stop prematurely if, for
-- example, a cancel command was sent.
newCommandPlugin ::
  CommandPlugin
newCommandPlugin :: CommandPlugin
newCommandPlugin =
  CommandPlugin' :: Maybe CommandPluginStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> CommandPlugin
CommandPlugin'
    { $sel:status:CommandPlugin' :: Maybe CommandPluginStatus
status = Maybe CommandPluginStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:responseStartDateTime:CommandPlugin' :: Maybe POSIX
responseStartDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:outputS3KeyPrefix:CommandPlugin' :: Maybe Text
outputS3KeyPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:standardErrorUrl:CommandPlugin' :: Maybe Text
standardErrorUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:responseCode:CommandPlugin' :: Maybe Int
responseCode = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:statusDetails:CommandPlugin' :: Maybe Text
statusDetails = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:output:CommandPlugin' :: Maybe Text
output = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:standardOutputUrl:CommandPlugin' :: Maybe Text
standardOutputUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CommandPlugin' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:outputS3Region:CommandPlugin' :: Maybe Text
outputS3Region = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:outputS3BucketName:CommandPlugin' :: Maybe Text
outputS3BucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:responseFinishDateTime:CommandPlugin' :: Maybe POSIX
responseFinishDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of this plugin. You can run a document with multiple plugins.
commandPlugin_status :: Lens.Lens' CommandPlugin (Prelude.Maybe CommandPluginStatus)
commandPlugin_status :: (Maybe CommandPluginStatus -> f (Maybe CommandPluginStatus))
-> CommandPlugin -> f CommandPlugin
commandPlugin_status = (CommandPlugin -> Maybe CommandPluginStatus)
-> (CommandPlugin -> Maybe CommandPluginStatus -> CommandPlugin)
-> Lens
     CommandPlugin
     CommandPlugin
     (Maybe CommandPluginStatus)
     (Maybe CommandPluginStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommandPlugin' {Maybe CommandPluginStatus
status :: Maybe CommandPluginStatus
$sel:status:CommandPlugin' :: CommandPlugin -> Maybe CommandPluginStatus
status} -> Maybe CommandPluginStatus
status) (\s :: CommandPlugin
s@CommandPlugin' {} Maybe CommandPluginStatus
a -> CommandPlugin
s {$sel:status:CommandPlugin' :: Maybe CommandPluginStatus
status = Maybe CommandPluginStatus
a} :: CommandPlugin)

-- | The time the plugin started running.
commandPlugin_responseStartDateTime :: Lens.Lens' CommandPlugin (Prelude.Maybe Prelude.UTCTime)
commandPlugin_responseStartDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CommandPlugin -> f CommandPlugin
commandPlugin_responseStartDateTime = (CommandPlugin -> Maybe POSIX)
-> (CommandPlugin -> Maybe POSIX -> CommandPlugin)
-> Lens CommandPlugin CommandPlugin (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommandPlugin' {Maybe POSIX
responseStartDateTime :: Maybe POSIX
$sel:responseStartDateTime:CommandPlugin' :: CommandPlugin -> Maybe POSIX
responseStartDateTime} -> Maybe POSIX
responseStartDateTime) (\s :: CommandPlugin
s@CommandPlugin' {} Maybe POSIX
a -> CommandPlugin
s {$sel:responseStartDateTime:CommandPlugin' :: Maybe POSIX
responseStartDateTime = Maybe POSIX
a} :: CommandPlugin) ((Maybe POSIX -> f (Maybe POSIX))
 -> CommandPlugin -> f CommandPlugin)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CommandPlugin
-> f CommandPlugin
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The S3 directory path inside the bucket where the responses to the
-- command executions should be stored. This was requested when issuing the
-- command. For example, in the following response:
--
-- @doc-example-bucket\/ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix\/i-02573cafcfEXAMPLE\/awsrunShellScript@
--
-- @doc-example-bucket@ is the name of the S3 bucket;
--
-- @ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix@ is the name of the S3 prefix;
--
-- @i-02573cafcfEXAMPLE@ is the instance ID;
--
-- @awsrunShellScript@ is the name of the plugin.
commandPlugin_outputS3KeyPrefix :: Lens.Lens' CommandPlugin (Prelude.Maybe Prelude.Text)
commandPlugin_outputS3KeyPrefix :: (Maybe Text -> f (Maybe Text)) -> CommandPlugin -> f CommandPlugin
commandPlugin_outputS3KeyPrefix = (CommandPlugin -> Maybe Text)
-> (CommandPlugin -> Maybe Text -> CommandPlugin)
-> Lens CommandPlugin CommandPlugin (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommandPlugin' {Maybe Text
outputS3KeyPrefix :: Maybe Text
$sel:outputS3KeyPrefix:CommandPlugin' :: CommandPlugin -> Maybe Text
outputS3KeyPrefix} -> Maybe Text
outputS3KeyPrefix) (\s :: CommandPlugin
s@CommandPlugin' {} Maybe Text
a -> CommandPlugin
s {$sel:outputS3KeyPrefix:CommandPlugin' :: Maybe Text
outputS3KeyPrefix = Maybe Text
a} :: CommandPlugin)

-- | The URL for the complete text written by the plugin to stderr. If
-- execution isn\'t yet complete, then this string is empty.
commandPlugin_standardErrorUrl :: Lens.Lens' CommandPlugin (Prelude.Maybe Prelude.Text)
commandPlugin_standardErrorUrl :: (Maybe Text -> f (Maybe Text)) -> CommandPlugin -> f CommandPlugin
commandPlugin_standardErrorUrl = (CommandPlugin -> Maybe Text)
-> (CommandPlugin -> Maybe Text -> CommandPlugin)
-> Lens CommandPlugin CommandPlugin (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommandPlugin' {Maybe Text
standardErrorUrl :: Maybe Text
$sel:standardErrorUrl:CommandPlugin' :: CommandPlugin -> Maybe Text
standardErrorUrl} -> Maybe Text
standardErrorUrl) (\s :: CommandPlugin
s@CommandPlugin' {} Maybe Text
a -> CommandPlugin
s {$sel:standardErrorUrl:CommandPlugin' :: Maybe Text
standardErrorUrl = Maybe Text
a} :: CommandPlugin)

-- | A numeric response code generated after running the plugin.
commandPlugin_responseCode :: Lens.Lens' CommandPlugin (Prelude.Maybe Prelude.Int)
commandPlugin_responseCode :: (Maybe Int -> f (Maybe Int)) -> CommandPlugin -> f CommandPlugin
commandPlugin_responseCode = (CommandPlugin -> Maybe Int)
-> (CommandPlugin -> Maybe Int -> CommandPlugin)
-> Lens CommandPlugin CommandPlugin (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommandPlugin' {Maybe Int
responseCode :: Maybe Int
$sel:responseCode:CommandPlugin' :: CommandPlugin -> Maybe Int
responseCode} -> Maybe Int
responseCode) (\s :: CommandPlugin
s@CommandPlugin' {} Maybe Int
a -> CommandPlugin
s {$sel:responseCode:CommandPlugin' :: Maybe Int
responseCode = Maybe Int
a} :: CommandPlugin)

-- | A detailed status of the plugin execution. @StatusDetails@ includes more
-- information than Status because it includes states resulting from error
-- and concurrency control parameters. StatusDetails can show different
-- results than Status. For more information about these statuses, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/monitor-commands.html Understanding command statuses>
-- in the /Amazon Web Services Systems Manager User Guide/. StatusDetails
-- can be one of the following values:
--
-- -   Pending: The command hasn\'t been sent to the instance.
--
-- -   In Progress: The command has been sent to the instance but hasn\'t
--     reached a terminal state.
--
-- -   Success: The execution of the command or plugin was successfully
--     completed. This is a terminal state.
--
-- -   Delivery Timed Out: The command wasn\'t delivered to the instance
--     before the delivery timeout expired. Delivery timeouts don\'t count
--     against the parent command\'s @MaxErrors@ limit, but they do
--     contribute to whether the parent command status is Success or
--     Incomplete. This is a terminal state.
--
-- -   Execution Timed Out: Command execution started on the instance, but
--     the execution wasn\'t complete before the execution timeout expired.
--     Execution timeouts count against the @MaxErrors@ limit of the parent
--     command. This is a terminal state.
--
-- -   Failed: The command wasn\'t successful on the instance. For a
--     plugin, this indicates that the result code wasn\'t zero. For a
--     command invocation, this indicates that the result code for one or
--     more plugins wasn\'t zero. Invocation failures count against the
--     MaxErrors limit of the parent command. This is a terminal state.
--
-- -   Canceled: The command was terminated before it was completed. This
--     is a terminal state.
--
-- -   Undeliverable: The command can\'t be delivered to the instance. The
--     instance might not exist, or it might not be responding.
--     Undeliverable invocations don\'t count against the parent command\'s
--     MaxErrors limit, and they don\'t contribute to whether the parent
--     command status is Success or Incomplete. This is a terminal state.
--
-- -   Terminated: The parent command exceeded its MaxErrors limit and
--     subsequent command invocations were canceled by the system. This is
--     a terminal state.
commandPlugin_statusDetails :: Lens.Lens' CommandPlugin (Prelude.Maybe Prelude.Text)
commandPlugin_statusDetails :: (Maybe Text -> f (Maybe Text)) -> CommandPlugin -> f CommandPlugin
commandPlugin_statusDetails = (CommandPlugin -> Maybe Text)
-> (CommandPlugin -> Maybe Text -> CommandPlugin)
-> Lens CommandPlugin CommandPlugin (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommandPlugin' {Maybe Text
statusDetails :: Maybe Text
$sel:statusDetails:CommandPlugin' :: CommandPlugin -> Maybe Text
statusDetails} -> Maybe Text
statusDetails) (\s :: CommandPlugin
s@CommandPlugin' {} Maybe Text
a -> CommandPlugin
s {$sel:statusDetails:CommandPlugin' :: Maybe Text
statusDetails = Maybe Text
a} :: CommandPlugin)

-- | Output of the plugin execution.
commandPlugin_output :: Lens.Lens' CommandPlugin (Prelude.Maybe Prelude.Text)
commandPlugin_output :: (Maybe Text -> f (Maybe Text)) -> CommandPlugin -> f CommandPlugin
commandPlugin_output = (CommandPlugin -> Maybe Text)
-> (CommandPlugin -> Maybe Text -> CommandPlugin)
-> Lens CommandPlugin CommandPlugin (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommandPlugin' {Maybe Text
output :: Maybe Text
$sel:output:CommandPlugin' :: CommandPlugin -> Maybe Text
output} -> Maybe Text
output) (\s :: CommandPlugin
s@CommandPlugin' {} Maybe Text
a -> CommandPlugin
s {$sel:output:CommandPlugin' :: Maybe Text
output = Maybe Text
a} :: CommandPlugin)

-- | The URL for the complete text written by the plugin to stdout in Amazon
-- S3. If the S3 bucket for the command wasn\'t specified, then this string
-- is empty.
commandPlugin_standardOutputUrl :: Lens.Lens' CommandPlugin (Prelude.Maybe Prelude.Text)
commandPlugin_standardOutputUrl :: (Maybe Text -> f (Maybe Text)) -> CommandPlugin -> f CommandPlugin
commandPlugin_standardOutputUrl = (CommandPlugin -> Maybe Text)
-> (CommandPlugin -> Maybe Text -> CommandPlugin)
-> Lens CommandPlugin CommandPlugin (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommandPlugin' {Maybe Text
standardOutputUrl :: Maybe Text
$sel:standardOutputUrl:CommandPlugin' :: CommandPlugin -> Maybe Text
standardOutputUrl} -> Maybe Text
standardOutputUrl) (\s :: CommandPlugin
s@CommandPlugin' {} Maybe Text
a -> CommandPlugin
s {$sel:standardOutputUrl:CommandPlugin' :: Maybe Text
standardOutputUrl = Maybe Text
a} :: CommandPlugin)

-- | The name of the plugin. Must be one of the following: @aws:updateAgent@,
-- @aws:domainjoin@, @aws:applications@, @aws:runPowerShellScript@,
-- @aws:psmodule@, @aws:cloudWatch@, @aws:runShellScript@, or
-- @aws:updateSSMAgent@.
commandPlugin_name :: Lens.Lens' CommandPlugin (Prelude.Maybe Prelude.Text)
commandPlugin_name :: (Maybe Text -> f (Maybe Text)) -> CommandPlugin -> f CommandPlugin
commandPlugin_name = (CommandPlugin -> Maybe Text)
-> (CommandPlugin -> Maybe Text -> CommandPlugin)
-> Lens CommandPlugin CommandPlugin (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommandPlugin' {Maybe Text
name :: Maybe Text
$sel:name:CommandPlugin' :: CommandPlugin -> Maybe Text
name} -> Maybe Text
name) (\s :: CommandPlugin
s@CommandPlugin' {} Maybe Text
a -> CommandPlugin
s {$sel:name:CommandPlugin' :: Maybe Text
name = Maybe Text
a} :: CommandPlugin)

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

-- | The S3 bucket where the responses to the command executions should be
-- stored. This was requested when issuing the command. For example, in the
-- following response:
--
-- @doc-example-bucket\/ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix\/i-02573cafcfEXAMPLE\/awsrunShellScript@
--
-- @doc-example-bucket@ is the name of the S3 bucket;
--
-- @ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix@ is the name of the S3 prefix;
--
-- @i-02573cafcfEXAMPLE@ is the instance ID;
--
-- @awsrunShellScript@ is the name of the plugin.
commandPlugin_outputS3BucketName :: Lens.Lens' CommandPlugin (Prelude.Maybe Prelude.Text)
commandPlugin_outputS3BucketName :: (Maybe Text -> f (Maybe Text)) -> CommandPlugin -> f CommandPlugin
commandPlugin_outputS3BucketName = (CommandPlugin -> Maybe Text)
-> (CommandPlugin -> Maybe Text -> CommandPlugin)
-> Lens CommandPlugin CommandPlugin (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommandPlugin' {Maybe Text
outputS3BucketName :: Maybe Text
$sel:outputS3BucketName:CommandPlugin' :: CommandPlugin -> Maybe Text
outputS3BucketName} -> Maybe Text
outputS3BucketName) (\s :: CommandPlugin
s@CommandPlugin' {} Maybe Text
a -> CommandPlugin
s {$sel:outputS3BucketName:CommandPlugin' :: Maybe Text
outputS3BucketName = Maybe Text
a} :: CommandPlugin)

-- | The time the plugin stopped running. Could stop prematurely if, for
-- example, a cancel command was sent.
commandPlugin_responseFinishDateTime :: Lens.Lens' CommandPlugin (Prelude.Maybe Prelude.UTCTime)
commandPlugin_responseFinishDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CommandPlugin -> f CommandPlugin
commandPlugin_responseFinishDateTime = (CommandPlugin -> Maybe POSIX)
-> (CommandPlugin -> Maybe POSIX -> CommandPlugin)
-> Lens CommandPlugin CommandPlugin (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CommandPlugin' {Maybe POSIX
responseFinishDateTime :: Maybe POSIX
$sel:responseFinishDateTime:CommandPlugin' :: CommandPlugin -> Maybe POSIX
responseFinishDateTime} -> Maybe POSIX
responseFinishDateTime) (\s :: CommandPlugin
s@CommandPlugin' {} Maybe POSIX
a -> CommandPlugin
s {$sel:responseFinishDateTime:CommandPlugin' :: Maybe POSIX
responseFinishDateTime = Maybe POSIX
a} :: CommandPlugin) ((Maybe POSIX -> f (Maybe POSIX))
 -> CommandPlugin -> f CommandPlugin)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CommandPlugin
-> f CommandPlugin
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON CommandPlugin where
  parseJSON :: Value -> Parser CommandPlugin
parseJSON =
    String
-> (Object -> Parser CommandPlugin)
-> Value
-> Parser CommandPlugin
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CommandPlugin"
      ( \Object
x ->
          Maybe CommandPluginStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> CommandPlugin
CommandPlugin'
            (Maybe CommandPluginStatus
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> CommandPlugin)
-> Parser (Maybe CommandPluginStatus)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> CommandPlugin)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CommandPluginStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> CommandPlugin)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> CommandPlugin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResponseStartDateTime")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> CommandPlugin)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> CommandPlugin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OutputS3KeyPrefix")
            Parser
  (Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> CommandPlugin)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> CommandPlugin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StandardErrorUrl")
            Parser
  (Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> CommandPlugin)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> CommandPlugin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResponseCode")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> CommandPlugin)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> CommandPlugin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatusDetails")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> CommandPlugin)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> CommandPlugin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Output")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> CommandPlugin)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe POSIX -> CommandPlugin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StandardOutputUrl")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe POSIX -> CommandPlugin)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe POSIX -> CommandPlugin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser (Maybe Text -> Maybe Text -> Maybe POSIX -> CommandPlugin)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> CommandPlugin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OutputS3Region")
            Parser (Maybe Text -> Maybe POSIX -> CommandPlugin)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> CommandPlugin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OutputS3BucketName")
            Parser (Maybe POSIX -> CommandPlugin)
-> Parser (Maybe POSIX) -> Parser CommandPlugin
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResponseFinishDateTime")
      )

instance Prelude.Hashable CommandPlugin

instance Prelude.NFData CommandPlugin