Skip to content

list_command_invocations

list_command_invocations(
    *,
    config_overrides: Optional[SSMClientConfig] = None,
    command_id: Optional[CommandId] = None,
    instance_id: Optional[InstanceId] = None,
    max_results: Optional[CommandMaxResults] = None,
    next_token: Optional[NextToken] = None,
    filters: Optional[CommandFilterList] = None,
    details: Optional[Boolean] = None,
) -> ListCommandInvocationsResult

An invocation is copy of a command sent to a specific managed node. A command can apply to one or more managed nodes. A command invocation applies to one managed node. For example, if a user runs SendCommand against three managed nodes, then a command invocation is created for each requested managed node ID. ListCommandInvocations provide status about command execution.

Parameters:

  • command_id (Optional[CommandId], default: None ) –

    (Optional) The invocations for a specific command ID.

  • instance_id (Optional[InstanceId], default: None ) –

    (Optional) The command execution details for a specific managed node ID.

  • max_results (Optional[CommandMaxResults], default: None ) –

    (Optional) The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.

  • next_token (Optional[NextToken], default: None ) –

    (Optional) The token for the next set of items to return. (You received this token from a previous call.)

  • filters (Optional[CommandFilterList], default: None ) –

    (Optional) One or more filters. Use a filter to return a more specific list of results.

  • details (Optional[Boolean], default: None ) –

    (Optional) If set this returns the response of the command executions and any command output. The default value is false.

Raises:

  • InternalServerError –

    An error occurred on the server side.

  • InvalidCommandId –

    The specified command ID isn't valid. Verify the ID and try again.

  • InvalidFilterKey –

    The specified key isn't valid.

  • InvalidInstanceId –

    The following problems can cause this exception:

    • You don't have permission to access the managed node.

    • Amazon Web Services Systems Manager Agent (SSM Agent) isn't running. Verify that SSM Agent is running.

    • SSM Agent isn't registered with the SSM endpoint. Try reinstalling SSM Agent.

    • The managed node isn't in a valid state. Valid states are: Running, Pending, Stopped, and Stopping. Invalid states are: Shutting-down and Terminated.

  • InvalidNextToken –

    The specified token isn't valid.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_ssm/_services/ssm.py
def list_command_invocations(
    self,
    *,
    config_overrides: Optional[SSMClientConfig] = None,
    command_id: Optional["capo_ssm.types.command_id.CommandId"] = None,
    instance_id: Optional["capo_ssm.types.instance_id.InstanceId"] = None,
    max_results: Optional[
        "capo_ssm.types.command_max_results.CommandMaxResults"
    ] = None,
    next_token: Optional["capo_ssm.types.next_token.NextToken"] = None,
    filters: Optional[
        "capo_ssm.types.command_filter_list.CommandFilterList"
    ] = None,
    details: Optional["capo_ssm.types.boolean.Boolean"] = None,
) -> "capo_ssm.types.list_command_invocations_result.ListCommandInvocationsResult":
    """<p>An invocation is copy of a command sent to a specific managed node. A command can apply to one or more managed nodes. A command invocation applies to one managed node. For example, if a user runs <code>SendCommand</code> against three managed nodes, then a command invocation is created for each requested managed node ID. <code>ListCommandInvocations</code> provide status about command execution.</p>

    Args:
        command_id: <p>(Optional) The invocations for a specific command ID.</p>
        instance_id: <p>(Optional) The command execution details for a specific managed node ID.</p>
        max_results: <p>(Optional) The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.</p>
        next_token: <p>(Optional) The token for the next set of items to return. (You received this token from a previous call.)</p>
        filters: <p>(Optional) One or more filters. Use a filter to return a more specific list of results.</p>
        details: <p>(Optional) If set this returns the response of the command executions and any command output. The default value is <code>false</code>. </p>

    Raises:
        capo_ssm.errors.internal_server_error.InternalServerError: <p>An error occurred on the server side.</p>
        capo_ssm.errors.invalid_command_id.InvalidCommandId: <p>The specified command ID isn't valid. Verify the ID and try again.</p>
        capo_ssm.errors.invalid_filter_key.InvalidFilterKey: <p>The specified key isn't valid.</p>
        capo_ssm.errors.invalid_instance_id.InvalidInstanceId: <p>The following problems can cause this exception:</p> <ul> <li> <p>You don't have permission to access the managed node.</p> </li> <li> <p>Amazon Web Services Systems Manager Agent (SSM Agent) isn't running. Verify that SSM Agent is running.</p> </li> <li> <p>SSM Agent isn't registered with the SSM endpoint. Try reinstalling SSM Agent.</p> </li> <li> <p>The managed node isn't in a valid state. Valid states are: <code>Running</code>, <code>Pending</code>, <code>Stopped</code>, and <code>Stopping</code>. Invalid states are: <code>Shutting-down</code> and <code>Terminated</code>.</p> </li> </ul>
        capo_ssm.errors.invalid_next_token.InvalidNextToken: <p>The specified token isn't valid.</p>
        capo_ssm.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ssm.types.list_command_invocations_request.ListCommandInvocationsRequest]",
    ) -> OperationResponse[
        "capo_ssm.types.list_command_invocations_result.ListCommandInvocationsResult"
    ]:
        import capo_ssm._operations.amazon_ssm.list_command_invocations

        output, http_response = (
            capo_ssm._operations.amazon_ssm.list_command_invocations.list_command_invocations(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListCommandInvocations")
    )
    input_: capo_ssm.types.list_command_invocations_request.ListCommandInvocationsRequest = {}
    if command_id is not None:
        input_["command_id"] = command_id
    if instance_id is not None:
        input_["instance_id"] = instance_id
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if filters is not None:
        input_["filters"] = filters
    if details is not None:
        input_["details"] = details

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output