Skip to content

list_command_executions async

list_command_executions(
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    max_results: Optional[CommandMaxResults] = None,
    next_token: Optional[NextToken] = None,
    namespace: Optional[CommandNamespace] = None,
    status: Optional[CommandExecutionStatus] = None,
    sort_order: Optional[SortOrder] = None,
    started_time_filter: Optional[TimeFilter] = None,
    completed_time_filter: Optional[TimeFilter] = None,
    target_arn: Optional[TargetArn] = None,
    command_arn: Optional[CommandArn] = None,
) -> ListCommandExecutionsResponse

List all command executions.

  • You must provide only the startedTimeFilter or the completedTimeFilter information. If you provide both time filters, the API will generate an error. You can use this information to retrieve a list of command executions within a specific timeframe.

  • You must provide only the commandArn or the thingArn information depending on whether you want to list executions for a specific command or an IoT thing. If you provide both fields, the API will generate an error.

For more information about considerations for using this API, see List command executions in your account (CLI).

Parameters:

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

    The maximum number of results to return in this operation.

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

    To retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results.

  • namespace (Optional[CommandNamespace], default: None ) –

    The namespace of the command.

  • status (Optional[CommandExecutionStatus], default: None ) –

    List all command executions for the device that have a particular status. For example, you can filter the list to display only command executions that have failed or timed out.

  • sort_order (Optional[SortOrder], default: None ) –

    Specify whether to list the command executions that were created in the ascending or descending order. By default, the API returns all commands in the descending order based on the start time or completion time of the executions, that are determined by the startTimeFilter and completeTimeFilter parameters.

  • started_time_filter (Optional[TimeFilter], default: None ) –

    List all command executions that started any time before or after the date and time that you specify. The date and time uses the format yyyy-MM-dd'T'HH:mm.

  • completed_time_filter (Optional[TimeFilter], default: None ) –

    List all command executions that completed any time before or after the date and time that you specify. The date and time uses the format yyyy-MM-dd'T'HH:mm.

  • target_arn (Optional[TargetArn], default: None ) –

    The Amazon Resource Number (ARN) of the target device. You can use this information to list all command executions for a particular device.

  • command_arn (Optional[CommandArn], default: None ) –

    The Amazon Resource Number (ARN) of the command. You can use this information to list all command executions for a particular command.

Raises:

Source code in docs_src/capo_iot/_services/async_io_t.py
async def list_command_executions(
    self,
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    max_results: Optional[
        "capo_iot.types.command_max_results.CommandMaxResults"
    ] = None,
    next_token: Optional["capo_iot.types.next_token.NextToken"] = None,
    namespace: Optional["capo_iot.types.command_namespace.CommandNamespace"] = None,
    status: Optional[
        "capo_iot.types.command_execution_status.CommandExecutionStatus"
    ] = None,
    sort_order: Optional["capo_iot.types.sort_order.SortOrder"] = None,
    started_time_filter: Optional["capo_iot.types.time_filter.TimeFilter"] = None,
    completed_time_filter: Optional["capo_iot.types.time_filter.TimeFilter"] = None,
    target_arn: Optional["capo_iot.types.target_arn.TargetArn"] = None,
    command_arn: Optional["capo_iot.types.command_arn.CommandArn"] = None,
) -> (
    "capo_iot.types.list_command_executions_response.ListCommandExecutionsResponse"
):
    """<p>List all command executions.</p> <important> <ul> <li> <p>You must provide only the <code>startedTimeFilter</code> or the <code>completedTimeFilter</code> information. If you provide both time filters, the API will generate an error. You can use this information to retrieve a list of command executions within a specific timeframe.</p> </li> <li> <p>You must provide only the <code>commandArn</code> or the <code>thingArn</code> information depending on whether you want to list executions for a specific command or an IoT thing. If you provide both fields, the API will generate an error.</p> </li> </ul> <p>For more information about considerations for using this API, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/iot-remote-command-execution-start-monitor.html#iot-remote-command-execution-list-cli">List command executions in your account (CLI)</a>.</p> </important>

    Args:
        max_results: <p>The maximum number of results to return in this operation.</p>
        next_token: <p>To retrieve the next set of results, the <code>nextToken</code> value from a previous response; otherwise <code>null</code> to receive the first set of results.</p>
        namespace: <p>The namespace of the command.</p>
        status: <p>List all command executions for the device that have a particular status. For example, you can filter the list to display only command executions that have failed or timed out.</p>
        sort_order: <p>Specify whether to list the command executions that were created in the ascending or descending order. By default, the API returns all commands in the descending order based on the start time or completion time of the executions, that are determined by the <code>startTimeFilter</code> and <code>completeTimeFilter</code> parameters.</p>
        started_time_filter: <p>List all command executions that started any time before or after the date and time that you specify. The date and time uses the format <code>yyyy-MM-dd'T'HH:mm</code>.</p>
        completed_time_filter: <p>List all command executions that completed any time before or after the date and time that you specify. The date and time uses the format <code>yyyy-MM-dd'T'HH:mm</code>.</p>
        target_arn: <p>The Amazon Resource Number (ARN) of the target device. You can use this information to list all command executions for a particular device.</p>
        command_arn: <p>The Amazon Resource Number (ARN) of the command. You can use this information to list all command executions for a particular command.</p>

    Raises:
        capo_iot.errors.internal_server_exception.InternalServerException: <p>Internal error from the service that indicates an unexpected error or that the service is unavailable.</p>
        capo_iot.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.validation_exception.ValidationException: <p>The request is not valid.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot.types.list_command_executions_request.ListCommandExecutionsRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot.types.list_command_executions_response.ListCommandExecutionsResponse"
    ]:
        import capo_iot._operations.aws_iot_service.list_command_executions

        (
            output,
            http_response,
        ) = await capo_iot._operations.aws_iot_service.list_command_executions.async_list_command_executions(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListCommandExecutions")
    )
    input_: capo_iot.types.list_command_executions_request.ListCommandExecutionsRequest = {}
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if namespace is not None:
        input_["namespace"] = namespace
    if status is not None:
        input_["status"] = status
    if sort_order is not None:
        input_["sort_order"] = sort_order
    if started_time_filter is not None:
        input_["started_time_filter"] = started_time_filter
    if completed_time_filter is not None:
        input_["completed_time_filter"] = completed_time_filter
    if target_arn is not None:
        input_["target_arn"] = target_arn
    if command_arn is not None:
        input_["command_arn"] = command_arn

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output