cancelEnrichmentJob method
Cancels a running or pending enrichment job. This is an idempotent operation—calling it multiple times with the same jobId is safe and returns the current status.
Behavior
- Jobs in PENDING or RUNNING status transition to CANCELLED
- Jobs in RUNNING state may not be cancellable once they have progressed to certain processing stages
- Jobs already in terminal states (COMPLETED, FAILED, TIMED_OUT) cannot be cancelled; the operation returns a ConflictingOperationException
- Cancelling an already-CANCELLED job is a no-op and returns the current status (idempotent behavior)
- The API responds immediately after recording the cancellation
- Cleanup of job resources happens asynchronously in the background
When to Cancel
Cancel a job when:- The job is taking longer than expected
- The job was created with incorrect parameters
- You no longer need the results
Idempotency
You can safely retry cancellation requests. Calling CancelEnrichmentJob multiple times for the same job returns the current status without error as long as the job is not in a terminal state other than CANCELLED.May throw AccessDeniedException.
May throw ConflictingOperationException.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw LimitExceededException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
Parameter jobId :
The unique identifier of the enrichment job to cancel. This is the jobId
returned by CreateEnrichmentJob.
Parameter workspaceName :
The name of the IoT SiteWise workspace containing the enrichment job to
cancel.
Implementation
Future<CancelEnrichmentJobResponse> cancelEnrichmentJob({
required String jobId,
required String workspaceName,
}) async {
final response = await _protocol.send(
payload: null,
method: 'POST',
requestUri:
'/workspaces/${Uri.encodeComponent(workspaceName)}/enrichment-jobs/${Uri.encodeComponent(jobId)}/cancel',
hostPrefix: 'data.',
exceptionFnMap: _exceptionFns,
);
return CancelEnrichmentJobResponse.fromJson(response);
}