Skip to content

list_commands

list_commands(
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    max_results: Optional[CommandMaxResults] = None,
    next_token: Optional[NextToken] = None,
    namespace: Optional[CommandNamespace] = None,
    command_parameter_name: Optional[CommandParameterName] = None,
    sort_order: Optional[SortOrder] = None,
) -> ListCommandsResponse

List all commands in your account.

Parameters:

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

    The maximum number of results to return in this operation. By default, the API returns up to a maximum of 25 results. You can override this default value to return up to a maximum of 100 results for 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. By default, the API returns all commands that have been created for both AWS-IoT and AWS-IoT-FleetWise namespaces. You can override this default value if you want to return all commands that have been created only for a specific namespace.

  • command_parameter_name (Optional[CommandParameterName], default: None ) –

    A filter that can be used to display the list of commands that have a specific command parameter name.

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

    Specify whether to list the commands that you have created in the ascending or descending order. By default, the API returns all commands in the descending order based on the time that they were created.

Raises:

Source code in docs_src/capo_iot/_services/io_t.py
def list_commands(
    self,
    *,
    config_overrides: Optional[IoTClientConfig] = 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,
    command_parameter_name: Optional[
        "capo_iot.types.command_parameter_name.CommandParameterName"
    ] = None,
    sort_order: Optional["capo_iot.types.sort_order.SortOrder"] = None,
) -> "capo_iot.types.list_commands_response.ListCommandsResponse":
    """<p>List all commands in your account.</p>

    Args:
        max_results: <p>The maximum number of results to return in this operation. By default, the API returns up to a maximum of 25 results. You can override this default value to return up to a maximum of 100 results for 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. By default, the API returns all commands that have been created for both <code>AWS-IoT</code> and <code>AWS-IoT-FleetWise</code> namespaces. You can override this default value if you want to return all commands that have been created only for a specific namespace.</p>
        command_parameter_name: <p>A filter that can be used to display the list of commands that have a specific command parameter name.</p>
        sort_order: <p>Specify whether to list the commands that you have created in the ascending or descending order. By default, the API returns all commands in the descending order based on the time that they were created.</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.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.
    """

    def _handler(
        req: "OperationRequest[capo_iot.types.list_commands_request.ListCommandsRequest]",
    ) -> OperationResponse[
        "capo_iot.types.list_commands_response.ListCommandsResponse"
    ]:
        import capo_iot._operations.aws_iot_service.list_commands

        output, http_response = (
            capo_iot._operations.aws_iot_service.list_commands.list_commands(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListCommands")
    )
    input_: capo_iot.types.list_commands_request.ListCommandsRequest = {}
    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 command_parameter_name is not None:
        input_["command_parameter_name"] = command_parameter_name
    if sort_order is not None:
        input_["sort_order"] = sort_order

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