Cancels a job.
Requires permission to access the CancelJob action.
Parameters:
-
job_id
(JobId)
–
The unique identifier you assigned to this job when it was created.
-
reason_code
(Optional[ReasonCode], default:
None
)
–
(Optional)A reason code string that explains why the job was canceled.
-
comment
(Optional[Comment], default:
None
)
–
An optional comment string describing why the job was canceled.
-
force
(Optional[ForceFlag], default:
None
)
–
(Optional) If true job executions with status "IN_PROGRESS" and "QUEUED" are canceled, otherwise only job executions with status "QUEUED" are canceled. The default is false.
Canceling a job which is "IN_PROGRESS", will cause a device which is executing the job to be unable to update the job execution status. Use caution and ensure that each device executing a job which is canceled is able to recover to a valid state.
Raises:
Source code in docs_src/capo_iot/_services/io_t.py
| def cancel_job(
self,
job_id: "capo_iot.types.job_id.JobId",
*,
config_overrides: Optional[IoTClientConfig] = None,
reason_code: Optional["capo_iot.types.reason_code.ReasonCode"] = None,
comment: Optional["capo_iot.types.comment.Comment"] = None,
force: Optional["capo_iot.types.force_flag.ForceFlag"] = None,
) -> "capo_iot.types.cancel_job_response.CancelJobResponse":
"""<p>Cancels a job.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">CancelJob</a> action.</p>
Args:
job_id: <p>The unique identifier you assigned to this job when it was created.</p>
reason_code: <p>(Optional)A reason code string that explains why the job was canceled.</p>
comment: <p>An optional comment string describing why the job was canceled.</p>
force: <p>(Optional) If <code>true</code> job executions with status "IN_PROGRESS" and "QUEUED" are canceled, otherwise only job executions with status "QUEUED" are canceled. The default is <code>false</code>.</p> <p>Canceling a job which is "IN_PROGRESS", will cause a device which is executing the job to be unable to update the job execution status. Use caution and ensure that each device executing a job which is canceled is able to recover to a valid state.</p>
Raises:
capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
capo_iot.errors.limit_exceeded_exception.LimitExceededException: <p>A limit has been exceeded.</p>
capo_iot.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
capo_iot.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_iot.types.cancel_job_request.CancelJobRequest]",
) -> OperationResponse["capo_iot.types.cancel_job_response.CancelJobResponse"]:
import capo_iot._operations.aws_iot_service.cancel_job
output, http_response = (
capo_iot._operations.aws_iot_service.cancel_job.cancel_job(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CancelJob")
)
input_: capo_iot.types.cancel_job_request.CancelJobRequest = {"job_id": job_id}
if reason_code is not None:
input_["reason_code"] = reason_code
if comment is not None:
input_["comment"] = comment
if force is not None:
input_["force"] = force
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|