startPiiEntitiesDetectionJob method

Future<StartPiiEntitiesDetectionJobResponse> startPiiEntitiesDetectionJob({
  1. required String dataAccessRoleArn,
  2. required InputDataConfig inputDataConfig,
  3. required LanguageCode languageCode,
  4. required PiiEntitiesDetectionMode mode,
  5. required OutputDataConfig outputDataConfig,
  6. String? clientRequestToken,
  7. String? jobName,
  8. RedactionConfig? redactionConfig,
  9. List<Tag>? tags,
})

Starts an asynchronous PII entity 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 : The input properties for a PII entities detection job.

Parameter languageCode : The language of the input documents. Enter the language code for English (en) or Spanish (es).

Parameter mode : Specifies whether the output provides the locations (offsets) of PII entities or a file in which PII entities are redacted.

Parameter outputDataConfig : Provides configuration parameters for the output of PII entity detection jobs.

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

Parameter jobName : The identifier of the job.

Parameter redactionConfig : Provides configuration parameters for PII entity redaction.

This parameter is required if you set the Mode parameter to ONLY_REDACTION. In that case, you must provide a RedactionConfig definition that includes the PiiEntityTypes parameter.

Parameter tags : Tags to associate with the PII entities 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<StartPiiEntitiesDetectionJobResponse> startPiiEntitiesDetectionJob({
  required String dataAccessRoleArn,
  required InputDataConfig inputDataConfig,
  required LanguageCode languageCode,
  required PiiEntitiesDetectionMode mode,
  required OutputDataConfig outputDataConfig,
  String? clientRequestToken,
  String? jobName,
  RedactionConfig? redactionConfig,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Comprehend_20171127.StartPiiEntitiesDetectionJob'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DataAccessRoleArn': dataAccessRoleArn,
      'InputDataConfig': inputDataConfig,
      'LanguageCode': languageCode.value,
      'Mode': mode.value,
      'OutputDataConfig': outputDataConfig,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (jobName != null) 'JobName': jobName,
      if (redactionConfig != null) 'RedactionConfig': redactionConfig,
      if (tags != null) 'Tags': tags,
    },
  );

  return StartPiiEntitiesDetectionJobResponse.fromJson(jsonResponse.body);
}