startEntitiesDetectionV2Job method

Future<StartEntitiesDetectionV2JobResponse> startEntitiesDetectionV2Job({
  1. required String dataAccessRoleArn,
  2. required InputDataConfig inputDataConfig,
  3. required LanguageCode languageCode,
  4. required OutputDataConfig outputDataConfig,
  5. String? clientRequestToken,
  6. String? jobName,
  7. String? kMSKey,
})

Starts an asynchronous medical entity detection job for a collection of documents. Use the DescribeEntitiesDetectionV2Job operation to track the status of a job.

May throw InvalidRequestException. May throw TooManyRequestsException. May throw ResourceNotFoundException. May throw InternalServerException.

Parameter dataAccessRoleArn : The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that grants Amazon Comprehend Medical read access to your input data. For more information, see Role-Based Permissions Required for Asynchronous Operations.

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

Parameter languageCode : The language of the input documents. All documents must be in the same language.

Parameter outputDataConfig : Specifies where to send the output files.

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

Parameter jobName : The identifier of the job.

Parameter kMSKey : An AWS Key Management Service key to encrypt your output files. If you do not specify a key, the files are written in plain text.

Implementation

Future<StartEntitiesDetectionV2JobResponse> startEntitiesDetectionV2Job({
  required String dataAccessRoleArn,
  required InputDataConfig inputDataConfig,
  required LanguageCode languageCode,
  required OutputDataConfig outputDataConfig,
  String? clientRequestToken,
  String? jobName,
  String? kMSKey,
}) 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');
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    1,
    64,
  );
  _s.validateStringLength(
    'jobName',
    jobName,
    1,
    256,
  );
  _s.validateStringLength(
    'kMSKey',
    kMSKey,
    1,
    2048,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'ComprehendMedical_20181030.StartEntitiesDetectionV2Job'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DataAccessRoleArn': dataAccessRoleArn,
      'InputDataConfig': inputDataConfig,
      'LanguageCode': languageCode.toValue(),
      'OutputDataConfig': outputDataConfig,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (jobName != null) 'JobName': jobName,
      if (kMSKey != null) 'KMSKey': kMSKey,
    },
  );

  return StartEntitiesDetectionV2JobResponse.fromJson(jsonResponse.body);
}