updateDomain method

Future<UpdateDomainResponse> updateDomain({
  1. required String domainId,
  2. required String name,
  3. required ServerSideEncryptionConfiguration serverSideEncryptionConfiguration,
  4. String? description,
})

Updates the specified domain. This API has clobber behavior, and clears and replaces all attributes. If an optional field, such as 'Description' is not provided, it is removed from the domain.

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

Parameter domainId : The identifier of the domain to be updated.

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. Changing the domain's associated KMS key immediately triggers an asynchronous process to remove dependency on the old KMS key, such that the domain's data can only be accessed using the new KMS key. The domain's ServerSideEncryptionUpdateDetails contains the details for this process.

Parameter description : A brief description about this domain.

Implementation

Future<UpdateDomainResponse> updateDomain({
  required String domainId,
  required String name,
  required ServerSideEncryptionConfiguration
      serverSideEncryptionConfiguration,
  String? description,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'VoiceID.UpdateDomain'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DomainId': domainId,
      'Name': name,
      'ServerSideEncryptionConfiguration': serverSideEncryptionConfiguration,
      if (description != null) 'Description': description,
    },
  );

  return UpdateDomainResponse.fromJson(jsonResponse.body);
}