createNamespace method

Future<CreateNamespaceResponse> createNamespace({
  1. required String namespaceName,
  2. String? adminPasswordSecretKmsKeyId,
  3. String? adminUserPassword,
  4. String? adminUsername,
  5. String? dbName,
  6. String? defaultIamRoleArn,
  7. List<String>? iamRoles,
  8. String? kmsKeyId,
  9. List<LogExport>? logExports,
  10. bool? manageAdminPassword,
  11. String? redshiftIdcApplicationArn,
  12. List<Tag>? tags,
})

Creates a namespace in Amazon Redshift Serverless.

May throw ConflictException. May throw InternalServerException. May throw TooManyTagsException. May throw ValidationException.

Parameter namespaceName : The name of the namespace.

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.

You can't use adminUserPassword if manageAdminPassword is true.

Parameter adminUsername : The username of the administrator for the first database created in the namespace.

Parameter dbName : The name of the first database created in the namespace.

Parameter defaultIamRoleArn : The Amazon Resource Name (ARN) of the IAM role to set as a default in the namespace.

Parameter iamRoles : A list of IAM roles to associate with the namespace.

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. Available 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.

Parameter redshiftIdcApplicationArn : The ARN for the Redshift application that integrates with IAM Identity Center.

Parameter tags : A list of tag instances.

Implementation

Future<CreateNamespaceResponse> createNamespace({
  required String namespaceName,
  String? adminPasswordSecretKmsKeyId,
  String? adminUserPassword,
  String? adminUsername,
  String? dbName,
  String? defaultIamRoleArn,
  List<String>? iamRoles,
  String? kmsKeyId,
  List<LogExport>? logExports,
  bool? manageAdminPassword,
  String? redshiftIdcApplicationArn,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'RedshiftServerless.CreateNamespace'
  };
  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 (dbName != null) 'dbName': dbName,
      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,
      if (redshiftIdcApplicationArn != null)
        'redshiftIdcApplicationArn': redshiftIdcApplicationArn,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateNamespaceResponse.fromJson(jsonResponse.body);
}