startSpeakerEnrollmentJob method

Future<StartSpeakerEnrollmentJobResponse> startSpeakerEnrollmentJob({
  1. required String dataAccessRoleArn,
  2. required String domainId,
  3. required InputDataConfig inputDataConfig,
  4. required OutputDataConfig outputDataConfig,
  5. String? clientToken,
  6. EnrollmentConfig? enrollmentConfig,
  7. String? jobName,
})

Starts a new batch speaker enrollment job using specified details.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter dataAccessRoleArn : The IAM role Amazon Resource Name (ARN) that grants Voice ID permissions to access customer's buckets to read the input manifest file and write the job output file. Refer to Batch enrollment using audio data from prior calls for the permissions needed in this role.

Parameter domainId : The identifier of the domain that contains the speaker enrollment job and in which the speakers are enrolled.

Parameter inputDataConfig : The input data config containing the S3 location for the input manifest file that contains the list of speaker enrollment requests.

Parameter outputDataConfig : The output data config containing the S3 location where Voice ID writes the job output file; you must also include a KMS key ID to encrypt the file.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs.

Parameter enrollmentConfig : The enrollment config that contains details such as the action to take when a speaker is already enrolled in Voice ID or when a speaker is identified as a fraudster.

Parameter jobName : A name for your speaker enrollment job.

Implementation

Future<StartSpeakerEnrollmentJobResponse> startSpeakerEnrollmentJob({
  required String dataAccessRoleArn,
  required String domainId,
  required InputDataConfig inputDataConfig,
  required OutputDataConfig outputDataConfig,
  String? clientToken,
  EnrollmentConfig? enrollmentConfig,
  String? jobName,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'VoiceID.StartSpeakerEnrollmentJob'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DataAccessRoleArn': dataAccessRoleArn,
      'DomainId': domainId,
      'InputDataConfig': inputDataConfig,
      'OutputDataConfig': outputDataConfig,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (enrollmentConfig != null) 'EnrollmentConfig': enrollmentConfig,
      if (jobName != null) 'JobName': jobName,
    },
  );

  return StartSpeakerEnrollmentJobResponse.fromJson(jsonResponse.body);
}