listCommandExecutions method

Future<ListCommandExecutionsResponse> listCommandExecutions({
  1. String? commandArn,
  2. TimeFilter? completedTimeFilter,
  3. int? maxResults,
  4. CommandNamespace? namespace,
  5. String? nextToken,
  6. SortOrder? sortOrder,
  7. TimeFilter? startedTimeFilter,
  8. CommandExecutionStatus? status,
  9. String? targetArn,
})

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).

May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

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

Parameter completedTimeFilter : 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.

Parameter maxResults : The maximum number of results to return in this operation.

Parameter namespace : The namespace of the command.

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

Parameter sortOrder : 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.

Parameter startedTimeFilter : 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.

Parameter status : 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.

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

Implementation

Future<ListCommandExecutionsResponse> listCommandExecutions({
  String? commandArn,
  TimeFilter? completedTimeFilter,
  int? maxResults,
  CommandNamespace? namespace,
  String? nextToken,
  SortOrder? sortOrder,
  TimeFilter? startedTimeFilter,
  CommandExecutionStatus? status,
  String? targetArn,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final $payload = <String, dynamic>{
    if (commandArn != null) 'commandArn': commandArn,
    if (completedTimeFilter != null)
      'completedTimeFilter': completedTimeFilter,
    if (namespace != null) 'namespace': namespace.value,
    if (sortOrder != null) 'sortOrder': sortOrder.value,
    if (startedTimeFilter != null) 'startedTimeFilter': startedTimeFilter,
    if (status != null) 'status': status.value,
    if (targetArn != null) 'targetArn': targetArn,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/command-executions',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListCommandExecutionsResponse.fromJson(response);
}