Skip to content

modify_tenant_database async

modify_tenant_database(
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_instance_identifier: Optional[String] = None,
    tenant_db_name: Optional[String] = None,
    master_user_password: Optional[SensitiveString] = None,
    new_tenant_db_name: Optional[String] = None,
    manage_master_user_password: Optional[BooleanOptional] = None,
    rotate_master_user_password: Optional[BooleanOptional] = None,
    master_user_secret_kms_key_id: Optional[String] = None,
) -> ModifyTenantDatabaseResult

Modifies an existing tenant database in a DB instance. You can change the tenant database name or the master user password. This operation is supported only for RDS for Oracle CDB instances using the multi-tenant configuration.

Parameters:

  • db_instance_identifier (Optional[String], default: None ) –

    The identifier of the DB instance that contains the tenant database that you are modifying. This parameter isn't case-sensitive.

    Constraints:

    • Must match the identifier of an existing DB instance.

  • tenant_db_name (Optional[String], default: None ) –

    The user-supplied name of the tenant database that you want to modify. This parameter isn’t case-sensitive.

    Constraints:

    • Must match the identifier of an existing tenant database.

  • master_user_password (Optional[SensitiveString], default: None ) –

    The new password for the master user of the specified tenant database in your DB instance.

    Amazon RDS operations never return the password, so this action provides a way to regain access to a tenant database user if the password is lost. This includes restoring privileges that might have been accidentally revoked.

    Constraints:

    • Can include any printable ASCII character except /, " (double quote), @, & (ampersand), and ' (single quote).

    Length constraints:

    • Must contain between 8 and 30 characters.

  • new_tenant_db_name (Optional[String], default: None ) –

    The new name of the tenant database when renaming a tenant database. This parameter isn’t case-sensitive.

    Constraints:

    • Can't be the string null or any other reserved word.

    • Can't be longer than 8 characters.

  • manage_master_user_password (Optional[BooleanOptional], default: None ) –

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

    If the tenant database doesn't manage the master user password with Amazon Web Services Secrets Manager, you can turn on this management. In this case, you can't specify MasterUserPassword.

    If the tenant database already manages the master user password with Amazon Web Services Secrets Manager, and you specify that the master user password is not managed with Amazon Web Services Secrets Manager, then you must specify MasterUserPassword. In this case, Amazon RDS deletes the secret and uses the new password for the master user specified by MasterUserPassword.

    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.

  • rotate_master_user_password (Optional[BooleanOptional], default: None ) –

    Specifies whether to rotate the secret managed by Amazon Web Services Secrets Manager for the master user password.

    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 secret value contains the updated password.

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

    Constraints:

    • You must apply the change immediately when rotating the master user password.

  • master_user_secret_kms_key_id (Optional[String], default: None ) –

    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 both of the following conditions are met:

    • The tenant database doesn't manage the master user password in Amazon Web Services Secrets Manager.

      If the tenant database already manages the master user password in Amazon Web Services Secrets Manager, you can't change the KMS key used to encrypt the secret.

    • You're turning on ManageMasterUserPassword to manage the master user password in Amazon Web Services Secrets Manager.

      If you're turning on ManageMasterUserPassword and 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 self-managed KMS key.

    The Amazon Web Services KMS key identifier is any of the following:

    • Key ARN

    • Key ID

    • Alias ARN

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

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

Raises:

Source code in docs_src/capo_rds/_services/async_rds.py
async def modify_tenant_database(
    self,
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_instance_identifier: Optional["capo_rds.types.string.String"] = None,
    tenant_db_name: Optional["capo_rds.types.string.String"] = None,
    master_user_password: Optional[
        "capo_rds.types.sensitive_string.SensitiveString"
    ] = None,
    new_tenant_db_name: Optional["capo_rds.types.string.String"] = None,
    manage_master_user_password: Optional[
        "capo_rds.types.boolean_optional.BooleanOptional"
    ] = None,
    rotate_master_user_password: Optional[
        "capo_rds.types.boolean_optional.BooleanOptional"
    ] = None,
    master_user_secret_kms_key_id: Optional["capo_rds.types.string.String"] = None,
) -> "capo_rds.types.modify_tenant_database_result.ModifyTenantDatabaseResult":
    """<p>Modifies an existing tenant database in a DB instance. You can change the tenant database name or the master user password. This operation is supported only for RDS for Oracle CDB instances using the multi-tenant configuration.</p>

    Args:
        db_instance_identifier: <p>The identifier of the DB instance that contains the tenant database that you are modifying. This parameter isn't case-sensitive.</p> <p>Constraints:</p> <ul> <li> <p>Must match the identifier of an existing DB instance.</p> </li> </ul>
        tenant_db_name: <p>The user-supplied name of the tenant database that you want to modify. This parameter isn’t case-sensitive.</p> <p>Constraints:</p> <ul> <li> <p>Must match the identifier of an existing tenant database.</p> </li> </ul>
        master_user_password: <p>The new password for the master user of the specified tenant database in your DB instance.</p> <note> <p>Amazon RDS operations never return the password, so this action provides a way to regain access to a tenant database user if the password is lost. This includes restoring privileges that might have been accidentally revoked.</p> </note> <p>Constraints:</p> <ul> <li> <p>Can include any printable ASCII character except <code>/</code>, <code>"</code> (double quote), <code>@</code>, <code>&amp;</code> (ampersand), and <code>'</code> (single quote).</p> </li> </ul> <p>Length constraints:</p> <ul> <li> <p>Must contain between 8 and 30 characters. </p> </li> </ul>
        new_tenant_db_name: <p>The new name of the tenant database when renaming a tenant database. This parameter isn’t case-sensitive.</p> <p>Constraints:</p> <ul> <li> <p>Can't be the string null or any other reserved word.</p> </li> <li> <p>Can't be longer than 8 characters.</p> </li> </ul>
        manage_master_user_password: <p>Specifies whether to manage the master user password with Amazon Web Services Secrets Manager.</p> <p>If the tenant database doesn't manage the master user password with Amazon Web Services Secrets Manager, you can turn on this management. In this case, you can't specify <code>MasterUserPassword</code>.</p> <p>If the tenant database already manages the master user password with Amazon Web Services Secrets Manager, and you specify that the master user password is not managed with Amazon Web Services Secrets Manager, then you must specify <code>MasterUserPassword</code>. In this case, Amazon RDS deletes the secret and uses the new password for the master user specified by <code>MasterUserPassword</code>.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-secrets-manager.html">Password management with Amazon Web Services Secrets Manager</a> in the <i>Amazon RDS User Guide.</i> </p> <p>Constraints:</p> <ul> <li> <p>Can't manage the master user password with Amazon Web Services Secrets Manager if <code>MasterUserPassword</code> is specified.</p> </li> </ul>
        rotate_master_user_password: <p>Specifies whether to rotate the secret managed by Amazon Web Services Secrets Manager for the master user password.</p> <p>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 secret value contains the updated password.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-secrets-manager.html">Password management with Amazon Web Services Secrets Manager</a> in the <i>Amazon RDS User Guide.</i> </p> <p>Constraints:</p> <ul> <li> <p>You must apply the change immediately when rotating the master user password.</p> </li> </ul>
        master_user_secret_kms_key_id: <p>The Amazon Web Services KMS key identifier to encrypt a secret that is automatically generated and managed in Amazon Web Services Secrets Manager.</p> <p>This setting is valid only if both of the following conditions are met:</p> <ul> <li> <p>The tenant database doesn't manage the master user password in Amazon Web Services Secrets Manager.</p> <p>If the tenant database already manages the master user password in Amazon Web Services Secrets Manager, you can't change the KMS key used to encrypt the secret.</p> </li> <li> <p>You're turning on <code>ManageMasterUserPassword</code> to manage the master user password in Amazon Web Services Secrets Manager.</p> <p>If you're turning on <code>ManageMasterUserPassword</code> and don't specify <code>MasterUserSecretKmsKeyId</code>, then the <code>aws/secretsmanager</code> 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 <code>aws/secretsmanager</code> KMS key to encrypt the secret, and you must use a self-managed KMS key.</p> </li> </ul> <p>The Amazon Web Services KMS key identifier is any of the following:</p> <ul> <li> <p>Key ARN</p> </li> <li> <p>Key ID</p> </li> <li> <p>Alias ARN</p> </li> <li> <p>Alias name for the KMS key</p> </li> </ul> <p>To use a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN.</p> <p>A default KMS key exists for your Amazon Web Services account. Your Amazon Web Services account has a different default KMS key for each Amazon Web Services Region.</p>

    Raises:
        capo_rds.errors.db_instance_not_found_fault.DBInstanceNotFoundFault: <p> <code>DBInstanceIdentifier</code> doesn't refer to an existing DB instance.</p>
        capo_rds.errors.invalid_db_instance_state_fault.InvalidDBInstanceStateFault: <p>The DB instance isn't in a valid state.</p>
        capo_rds.errors.kms_key_not_accessible_fault.KMSKeyNotAccessibleFault: <p>An error occurred accessing an Amazon Web Services KMS key.</p>
        capo_rds.errors.tenant_database_already_exists_fault.TenantDatabaseAlreadyExistsFault: <p>You attempted to either create a tenant database that already exists or modify a tenant database to use the name of an existing tenant database.</p>
        capo_rds.errors.tenant_database_not_found_fault.TenantDatabaseNotFoundFault: <p>The specified tenant database wasn't found in the DB instance.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rds.types.modify_tenant_database_message.ModifyTenantDatabaseMessage]",
    ) -> AsyncOperationResponse[
        "capo_rds.types.modify_tenant_database_result.ModifyTenantDatabaseResult"
    ]:
        import capo_rds._operations.amazon_rd_sv19.modify_tenant_database

        (
            output,
            http_response,
        ) = await capo_rds._operations.amazon_rd_sv19.modify_tenant_database.async_modify_tenant_database(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_rds.types.modify_tenant_database_message.ModifyTenantDatabaseMessage",
    ) -> dict[str, Any]:
        import capo_rds.types.modify_tenant_database_message

        return capo_rds.types.modify_tenant_database_message.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_rds.types.modify_tenant_database_result.ModifyTenantDatabaseResult",
    ) -> dict[str, Any]:
        import capo_rds.types.modify_tenant_database_result

        return capo_rds.types.modify_tenant_database_result.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "ModifyTenantDatabase",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_rds.types.modify_tenant_database_message.ModifyTenantDatabaseMessage = {}
    if db_instance_identifier is not None:
        input_["db_instance_identifier"] = db_instance_identifier
    if tenant_db_name is not None:
        input_["tenant_db_name"] = tenant_db_name
    if master_user_password is not None:
        input_["master_user_password"] = master_user_password
    if new_tenant_db_name is not None:
        input_["new_tenant_db_name"] = new_tenant_db_name
    if manage_master_user_password is not None:
        input_["manage_master_user_password"] = manage_master_user_password
    if rotate_master_user_password is not None:
        input_["rotate_master_user_password"] = rotate_master_user_password
    if master_user_secret_kms_key_id is not None:
        input_["master_user_secret_kms_key_id"] = master_user_secret_kms_key_id

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output