startEventsDetectionJob method

Future<StartEventsDetectionJobResponse> startEventsDetectionJob({
  1. required String dataAccessRoleArn,
  2. required InputDataConfig inputDataConfig,
  3. required LanguageCode languageCode,
  4. required OutputDataConfig outputDataConfig,
  5. required List<String> targetEventTypes,
  6. String? clientRequestToken,
  7. String? jobName,
  8. List<Tag>? tags,
})

Starts an asynchronous event detection job for a collection of documents.

May throw InternalServerException. May throw InvalidRequestException. May throw KmsKeyValidationException. May throw ResourceInUseException. May throw TooManyRequestsException. May throw TooManyTagsException.

Parameter dataAccessRoleArn : The Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend read access to your input data.

Parameter inputDataConfig : Specifies the format and location of the input data for the job.

Parameter languageCode : The language code of the input documents.

Parameter outputDataConfig : Specifies where to send the output files.

Parameter targetEventTypes : The types of events to detect in the input documents.

Parameter clientRequestToken : An unique identifier for the request. If you don't set the client request token, Amazon Comprehend generates one.

Parameter jobName : The identifier of the events detection job.

Parameter tags : Tags to associate with the events detection job. A tag is a key-value pair that adds metadata to a resource used by Amazon Comprehend. For example, a tag with "Sales" as the key might be added to a resource to indicate its use by the sales department.

Implementation

Future<StartEventsDetectionJobResponse> startEventsDetectionJob({
  required String dataAccessRoleArn,
  required InputDataConfig inputDataConfig,
  required LanguageCode languageCode,
  required OutputDataConfig outputDataConfig,
  required List<String> targetEventTypes,
  String? clientRequestToken,
  String? jobName,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Comprehend_20171127.StartEventsDetectionJob'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DataAccessRoleArn': dataAccessRoleArn,
      'InputDataConfig': inputDataConfig,
      'LanguageCode': languageCode.value,
      'OutputDataConfig': outputDataConfig,
      'TargetEventTypes': targetEventTypes,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (jobName != null) 'JobName': jobName,
      if (tags != null) 'Tags': tags,
    },
  );

  return StartEventsDetectionJobResponse.fromJson(jsonResponse.body);
}