Skip to content

delete_db_subnet_group async

delete_db_subnet_group(
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_subnet_group_name: Optional[String] = None,
) -> None

Deletes a DB subnet group.

The specified database subnet group must not be associated with any DB instances.

Parameters:

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

    The name of the database subnet group to delete.

    You can't delete the default subnet group.

    Constraints: Must match the name of an existing DBSubnetGroup. Must not be default.

    Example: mydbsubnetgroup

Raises:

Examples:

To delete a DB subnet group The following example deletes the DB subnet group called mysubnetgroup.

>>> await client.delete_db_subnet_group(db_subnet_group_name='mysubnetgroup')
Source code in docs_src/capo_rds/_services/async_rds.py
async def delete_db_subnet_group(
    self,
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_subnet_group_name: Optional["capo_rds.types.string.String"] = None,
) -> None:
    """<p>Deletes a DB subnet group.</p> <note> <p>The specified database subnet group must not be associated with any DB instances.</p> </note>

    Args:
        db_subnet_group_name: <p>The name of the database subnet group to delete.</p> <note> <p>You can't delete the default subnet group.</p> </note> <p>Constraints: Must match the name of an existing DBSubnetGroup. Must not be default.</p> <p>Example: <code>mydbsubnetgroup</code> </p>

    Raises:
        capo_rds.errors.db_subnet_group_not_found_fault.DBSubnetGroupNotFoundFault: <p> <code>DBSubnetGroupName</code> doesn't refer to an existing DB subnet group.</p>
        capo_rds.errors.invalid_db_subnet_group_state_fault.InvalidDBSubnetGroupStateFault: <p>The DB subnet group cannot be deleted because it's in use.</p>
        capo_rds.errors.invalid_db_subnet_state_fault.InvalidDBSubnetStateFault: <p>The DB subnet isn't in the <i>available</i> state.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete a DB subnet group
        The following example deletes the DB subnet group called mysubnetgroup.

        >>> await client.delete_db_subnet_group(db_subnet_group_name='mysubnetgroup')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rds.types.delete_db_subnet_group_message.DeleteDBSubnetGroupMessage]",
    ) -> AsyncOperationResponse[None]:
        import capo_rds._operations.amazon_rd_sv19.delete_db_subnet_group

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteDBSubnetGroup")
    )
    input_: capo_rds.types.delete_db_subnet_group_message.DeleteDBSubnetGroupMessage = {}
    if db_subnet_group_name is not None:
        input_["db_subnet_group_name"] = db_subnet_group_name

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