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,
})

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

May throw InvalidRequestException. May throw TooManyRequestsException. May throw KmsKeyValidationException. May throw InternalServerException.

Parameter dataAccessRoleArn : The Amazon Resource Name (ARN) of the AWS Identity and Access Management (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.

Implementation

Future<StartEventsDetectionJobResponse> startEventsDetectionJob({
  required String dataAccessRoleArn,
  required InputDataConfig inputDataConfig,
  required LanguageCode languageCode,
  required OutputDataConfig outputDataConfig,
  required List<String> targetEventTypes,
  String? clientRequestToken,
  String? jobName,
}) async {
  ArgumentError.checkNotNull(dataAccessRoleArn, 'dataAccessRoleArn');
  _s.validateStringLength(
    'dataAccessRoleArn',
    dataAccessRoleArn,
    20,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(inputDataConfig, 'inputDataConfig');
  ArgumentError.checkNotNull(languageCode, 'languageCode');
  ArgumentError.checkNotNull(outputDataConfig, 'outputDataConfig');
  ArgumentError.checkNotNull(targetEventTypes, 'targetEventTypes');
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    1,
    64,
  );
  _s.validateStringLength(
    'jobName',
    jobName,
    1,
    256,
  );
  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.toValue(),
      'OutputDataConfig': outputDataConfig,
      'TargetEventTypes': targetEventTypes,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (jobName != null) 'JobName': jobName,
    },
  );

  return StartEventsDetectionJobResponse.fromJson(jsonResponse.body);
}