createTenantDatabase method

Future<CreateTenantDatabaseResult> createTenantDatabase({
  1. required String dBInstanceIdentifier,
  2. required String masterUsername,
  3. required String tenantDBName,
  4. String? characterSetName,
  5. bool? manageMasterUserPassword,
  6. String? masterUserPassword,
  7. String? masterUserSecretKmsKeyId,
  8. String? ncharCharacterSetName,
  9. List<Tag>? tags,
})

Creates a tenant database in a DB instance that uses the multi-tenant configuration. Only RDS for Oracle container database (CDB) instances are supported.

May throw DBInstanceNotFoundFault. May throw InvalidDBInstanceStateFault. May throw KMSKeyNotAccessibleFault. May throw TenantDatabaseAlreadyExistsFault. May throw TenantDatabaseQuotaExceededFault.

Parameter dBInstanceIdentifier : The user-supplied DB instance identifier. RDS creates your tenant database in this DB instance. This parameter isn't case-sensitive.

Parameter masterUsername : The name for the master user account in your tenant database. RDS creates this user account in the tenant database and grants privileges to the master user. This parameter is case-sensitive.

Constraints:

  • Must be 1 to 16 letters, numbers, or underscores.
  • First character must be a letter.
  • Can't be a reserved word for the chosen database engine.

Parameter tenantDBName : The user-supplied name of the tenant database that you want to create in your DB instance. This parameter has the same constraints as DBName in CreateDBInstance.

Parameter characterSetName : The character set for your tenant database. If you don't specify a value, the character set name defaults to AL32UTF8.

Parameter manageMasterUserPassword : Specifies whether to manage the master user password with Amazon Web Services Secrets Manager.

For more information, see Password management with Amazon Web Services Secrets Manager in the Amazon RDS User Guide.

Constraints:

  • Can't manage the master user password with Amazon Web Services Secrets Manager if MasterUserPassword is specified.

Parameter masterUserPassword : The password for the master user in your tenant database.

Constraints:

  • Must be 8 to 30 characters.
  • Can include any printable ASCII character except forward slash (/), double quote ("), at symbol (@), ampersand (&), or single quote (').
  • Can't be specified when ManageMasterUserPassword is enabled.

Parameter masterUserSecretKmsKeyId : The Amazon Web Services KMS key identifier to encrypt a secret that is automatically generated and managed in Amazon Web Services Secrets Manager.

This setting is valid only if the master user password is managed by RDS in Amazon Web Services Secrets Manager for the DB instance.

The Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. To use a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN.

If you don't specify MasterUserSecretKmsKeyId, then the aws/secretsmanager KMS key is used to encrypt the secret. If the secret is in a different Amazon Web Services account, then you can't use the aws/secretsmanager KMS key to encrypt the secret, and you must use a customer managed KMS key.

There is a default KMS key for your Amazon Web Services account. Your Amazon Web Services account has a different default KMS key for each Amazon Web Services Region.

Parameter ncharCharacterSetName : The NCHAR value for the tenant database.

Implementation

Future<CreateTenantDatabaseResult> createTenantDatabase({
  required String dBInstanceIdentifier,
  required String masterUsername,
  required String tenantDBName,
  String? characterSetName,
  bool? manageMasterUserPassword,
  String? masterUserPassword,
  String? masterUserSecretKmsKeyId,
  String? ncharCharacterSetName,
  List<Tag>? tags,
}) async {
  final $request = <String, String>{
    'DBInstanceIdentifier': dBInstanceIdentifier,
    'MasterUsername': masterUsername,
    'TenantDBName': tenantDBName,
    if (characterSetName != null) 'CharacterSetName': characterSetName,
    if (manageMasterUserPassword != null)
      'ManageMasterUserPassword': manageMasterUserPassword.toString(),
    if (masterUserPassword != null) 'MasterUserPassword': masterUserPassword,
    if (masterUserSecretKmsKeyId != null)
      'MasterUserSecretKmsKeyId': masterUserSecretKmsKeyId,
    if (ncharCharacterSetName != null)
      'NcharCharacterSetName': ncharCharacterSetName,
    if (tags != null)
      if (tags.isEmpty)
        'Tags': ''
      else
        for (var i1 = 0; i1 < tags.length; i1++)
          for (var e3 in tags[i1].toQueryMap().entries)
            'Tags.Tag.${i1 + 1}.${e3.key}': e3.value,
  };
  final $result = await _protocol.send(
    $request,
    action: 'CreateTenantDatabase',
    version: '2014-10-31',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'CreateTenantDatabaseResult',
  );
  return CreateTenantDatabaseResult.fromXml($result);
}