Skip to content

start_command_execution

start_command_execution(
    target_arn: TargetArn,
    command_arn: CommandArn,
    *,
    config_overrides: Optional[IoTJobsDataPlaneClientConfig] = None,
    parameters: Optional[CommandExecutionParameterMap] = None,
    execution_timeout_seconds: Optional[CommandExecutionTimeoutInSeconds] = None,
    client_token: Optional[ClientRequestTokenV2] = None,
) -> StartCommandExecutionResponse

Using the command created with the CreateCommand API, start a command execution on a specific device.

Parameters:

  • target_arn (TargetArn) –

    The Amazon Resource Number (ARN) of the device where the command execution is occurring.

  • command_arn (CommandArn) –

    The Amazon Resource Number (ARN) of the command. For example, arn:aws:iot:::command/

  • parameters (Optional[CommandExecutionParameterMap], default: None ) –

    A list of parameters that are required by the StartCommandExecution API when performing the command on a device.

  • execution_timeout_seconds (Optional[CommandExecutionTimeoutInSeconds], default: None ) –

    Specifies the amount of time in second the device has to finish the command execution. A timer is started as soon as the command execution is created. If the command execution status is not set to another terminal state before the timer expires, it will automatically update to TIMED_OUT.

  • client_token (Optional[ClientRequestTokenV2], default: None ) –

    The client token is used to implement idempotency. It ensures that the request completes no more than one time. If you retry a request with the same token and the same parameters, the request will complete successfully. However, if you retry the request using the same token but different parameters, an HTTP 409 conflict occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.

Raises:

Source code in docs_src/capo_iot_jobs_data_plane/_services/io_t_jobs_data_plane.py
def start_command_execution(
    self,
    target_arn: "capo_iot_jobs_data_plane.types.target_arn.TargetArn",
    command_arn: "capo_iot_jobs_data_plane.types.command_arn.CommandArn",
    *,
    config_overrides: Optional[IoTJobsDataPlaneClientConfig] = None,
    parameters: Optional[
        "capo_iot_jobs_data_plane.types.command_execution_parameter_map.CommandExecutionParameterMap"
    ] = None,
    execution_timeout_seconds: Optional[
        "capo_iot_jobs_data_plane.types.command_execution_timeout_in_seconds.CommandExecutionTimeoutInSeconds"
    ] = None,
    client_token: Optional[
        "capo_iot_jobs_data_plane.types.client_request_token_v2.ClientRequestTokenV2"
    ] = None,
) -> "capo_iot_jobs_data_plane.types.start_command_execution_response.StartCommandExecutionResponse":
    """<p>Using the command created with the <code>CreateCommand</code> API, start a command execution on a specific device.</p>

    Args:
        target_arn: <p>The Amazon Resource Number (ARN) of the device where the command execution is occurring.</p>
        command_arn: <p>The Amazon Resource Number (ARN) of the command. For example, <code>arn:aws:iot:<region>:<accountid>:command/<commandName></code> </p>
        parameters: <p>A list of parameters that are required by the <code>StartCommandExecution</code> API when performing the command on a device.</p>
        execution_timeout_seconds: <p>Specifies the amount of time in second the device has to finish the command execution. A timer is started as soon as the command execution is created. If the command execution status is not set to another terminal state before the timer expires, it will automatically update to <code>TIMED_OUT</code>.</p>
        client_token: <p>The client token is used to implement idempotency. It ensures that the request completes no more than one time. If you retry a request with the same token and the same parameters, the request will complete successfully. However, if you retry the request using the same token but different parameters, an HTTP 409 conflict occurs. If you omit this value, Amazon Web Services SDKs will automatically generate a unique client request.</p>

    Raises:
        capo_iot_jobs_data_plane.errors.conflict_exception.ConflictException: <p>A conflict has occurred when performing the API request.</p>
        capo_iot_jobs_data_plane.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred when performing the API request.</p>
        capo_iot_jobs_data_plane.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_iot_jobs_data_plane.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The service quota has been exceeded for this request.</p>
        capo_iot_jobs_data_plane.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot_jobs_data_plane.errors.validation_exception.ValidationException: <p>A validation error occurred when performing the API request.</p>
        capo_iot_jobs_data_plane.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_iot_jobs_data_plane.types.start_command_execution_request.StartCommandExecutionRequest]",
    ) -> OperationResponse[
        "capo_iot_jobs_data_plane.types.start_command_execution_response.StartCommandExecutionResponse"
    ]:
        import capo_iot_jobs_data_plane._operations.iot_laser_thing_job_manager_external_service.start_command_execution

        output, http_response = (
            capo_iot_jobs_data_plane._operations.iot_laser_thing_job_manager_external_service.start_command_execution.start_command_execution(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartCommandExecution")
    )
    input_: capo_iot_jobs_data_plane.types.start_command_execution_request.StartCommandExecutionRequest = {
        "target_arn": target_arn,
        "command_arn": command_arn,
    }
    if parameters is not None:
        input_["parameters"] = parameters
    if execution_timeout_seconds is not None:
        input_["execution_timeout_seconds"] = execution_timeout_seconds
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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