updateNamespace method

Future<UpdateNamespaceResponse> updateNamespace({
  1. required String namespaceName,
  2. String? adminPasswordSecretKmsKeyId,
  3. String? adminUserPassword,
  4. String? adminUsername,
  5. String? defaultIamRoleArn,
  6. List<String>? iamRoles,
  7. String? kmsKeyId,
  8. List<LogExport>? logExports,
  9. bool? manageAdminPassword,
})

Updates a namespace with the specified settings. Unless required, you can't update multiple parameters in one request. For example, you must specify both adminUsername and adminUserPassword to update either field, but you can't update both kmsKeyId and logExports in a single request.

May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter namespaceName : The name of the namespace to update. You can't update the name of a namespace once it is created.

Parameter adminPasswordSecretKmsKeyId : The ID of the Key Management Service (KMS) key used to encrypt and store the namespace's admin credentials secret. You can only use this parameter if manageAdminPassword is true.

Parameter adminUserPassword : The password of the administrator for the first database created in the namespace. This parameter must be updated together with adminUsername.

You can't use adminUserPassword if manageAdminPassword is true.

Parameter adminUsername : The username of the administrator for the first database created in the namespace. This parameter must be updated together with adminUserPassword.

Parameter defaultIamRoleArn : The Amazon Resource Name (ARN) of the IAM role to set as a default in the namespace. This parameter must be updated together with iamRoles.

Parameter iamRoles : A list of IAM roles to associate with the namespace. This parameter must be updated together with defaultIamRoleArn.

Parameter kmsKeyId : The ID of the Amazon Web Services Key Management Service key used to encrypt your data.

Parameter logExports : The types of logs the namespace can export. The export types are userlog, connectionlog, and useractivitylog.

Parameter manageAdminPassword : If true, Amazon Redshift uses Secrets Manager to manage the namespace's admin credentials. You can't use adminUserPassword if manageAdminPassword is true. If manageAdminPassword is false or not set, Amazon Redshift uses adminUserPassword for the admin user account's password.

Implementation

Future<UpdateNamespaceResponse> updateNamespace({
  required String namespaceName,
  String? adminPasswordSecretKmsKeyId,
  String? adminUserPassword,
  String? adminUsername,
  String? defaultIamRoleArn,
  List<String>? iamRoles,
  String? kmsKeyId,
  List<LogExport>? logExports,
  bool? manageAdminPassword,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'RedshiftServerless.UpdateNamespace'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'namespaceName': namespaceName,
      if (adminPasswordSecretKmsKeyId != null)
        'adminPasswordSecretKmsKeyId': adminPasswordSecretKmsKeyId,
      if (adminUserPassword != null) 'adminUserPassword': adminUserPassword,
      if (adminUsername != null) 'adminUsername': adminUsername,
      if (defaultIamRoleArn != null) 'defaultIamRoleArn': defaultIamRoleArn,
      if (iamRoles != null) 'iamRoles': iamRoles,
      if (kmsKeyId != null) 'kmsKeyId': kmsKeyId,
      if (logExports != null)
        'logExports': logExports.map((e) => e.value).toList(),
      if (manageAdminPassword != null)
        'manageAdminPassword': manageAdminPassword,
    },
  );

  return UpdateNamespaceResponse.fromJson(jsonResponse.body);
}