createEnrichmentJob method
Creates an asynchronous enrichment job to analyze time-series sensor data. The operation returns immediately with job details while processing continues in the background.
Idempotency
Include a clientToken to make the operation idempotent. If you submit the same request with the same token within the idempotency window, you receive the original job details without creating a duplicate.Prerequisites
Before creating a job, ensure:- The workspace is in ACTIVE state (not being deleted)
- You have IAM permissions for the workspace, dataset, and time-series resources
- You have KMS Decrypt permission on the workspace's customer-managed encryption key
- No duplicate job (same workspace, dataset, property, and job type) is currently running
Workflow
- Submit the job with configuration specifying which video data to analyze and the time range
- Capture the jobId from the response
- Use DescribeEnrichmentJob to monitor progress and check job status
- When status reaches a terminal state (COMPLETED, FAILED, TIMED_OUT, CANCELLED), check results
- For COMPLETED jobs, query IoT SiteWise for semantic search on video events
Error Handling
- ConflictingOperationException: A duplicate job is already running for the same configuration
- InvalidRequestException: Invalid parameters (e.g., both timeSeriesId and propertyAlias specified)
- AccessDeniedException: Insufficient IAM or KMS permissions
- LimitExceededException: Too many concurrent jobs or requests
May throw AccessDeniedException.
May throw ConflictingOperationException.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw LimitExceededException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
Parameter jobConfiguration :
Configuration defining the type of enrichment analysis to perform and
which video data to analyze. Currently supports eventDetection for
generating embeddings from video data for semantic search.
Parameter workspaceName :
The name of the IoT SiteWise workspace containing the video data to
analyze.
Parameter clientToken :
Optional unique token that makes the operation idempotent. If you submit
the same request with the same token within the idempotency window, the
service returns the original job without creating a duplicate. Use a UUID
or timestamp-based token for each unique request.
Implementation
Future<CreateEnrichmentJobResponse> createEnrichmentJob({
required EnrichmentJobConfiguration jobConfiguration,
required String workspaceName,
String? clientToken,
}) async {
final $payload = <String, dynamic>{
'jobConfiguration': jobConfiguration,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/workspaces/${Uri.encodeComponent(workspaceName)}/enrichment-jobs',
hostPrefix: 'data.',
exceptionFnMap: _exceptionFns,
);
return CreateEnrichmentJobResponse.fromJson(response);
}