createDomain method

Future<CreateDomainResponse> createDomain({
  1. required String name,
  2. required ServerSideEncryptionConfiguration serverSideEncryptionConfiguration,
  3. String? clientToken,
  4. String? description,
  5. List<Tag>? tags,
})

Creates a domain that contains all Amazon Connect Voice ID data, such as speakers, fraudsters, customer audio, and voiceprints. Every domain is created with a default watchlist that fraudsters can be a part of.

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

Parameter name : The name of the domain.

Parameter serverSideEncryptionConfiguration : The configuration, containing the KMS key identifier, to be used by Voice ID for the server-side encryption of your data. Refer to Amazon Connect Voice ID encryption at rest for more details on how the KMS key is used.

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 description : A brief description of this domain.

Parameter tags : A list of tags you want added to the domain.

Implementation

Future<CreateDomainResponse> createDomain({
  required String name,
  required ServerSideEncryptionConfiguration
      serverSideEncryptionConfiguration,
  String? clientToken,
  String? description,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'VoiceID.CreateDomain'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      'ServerSideEncryptionConfiguration': serverSideEncryptionConfiguration,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (description != null) 'Description': description,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateDomainResponse.fromJson(jsonResponse.body);
}