Skip to content

delete_db_security_group async

delete_db_security_group(
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_security_group_name: Optional[String] = None,
) -> None

Deletes a DB security group.

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

EC2-Classic was retired on August 15, 2022. If you haven't migrated from EC2-Classic to a VPC, we recommend that you migrate as soon as possible. For more information, see Migrate from EC2-Classic to a VPC in the Amazon EC2 User Guide, the blog EC2-Classic Networking is Retiring – Here’s How to Prepare, and Moving a DB instance not in a VPC into a VPC in the Amazon RDS User Guide.

Parameters:

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

    The name of the DB security group to delete.

    You can't delete the default DB security group.

    Constraints:

    • Must be 1 to 255 letters, numbers, or hyphens.

    • First character must be a letter

    • Can't end with a hyphen or contain two consecutive hyphens

    • Must not be "Default"

Raises:

Examples:

To delete a DB security group The following example deletes a DB security group.

>>> await client.delete_db_security_group(db_security_group_name='mysecgroup')
Source code in docs_src/capo_rds/_services/async_rds.py
async def delete_db_security_group(
    self,
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_security_group_name: Optional["capo_rds.types.string.String"] = None,
) -> None:
    """<p>Deletes a DB security group.</p> <p>The specified DB security group must not be associated with any DB instances.</p> <note> <p>EC2-Classic was retired on August 15, 2022. If you haven't migrated from EC2-Classic to a VPC, we recommend that you migrate as soon as possible. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-migrate.html">Migrate from EC2-Classic to a VPC</a> in the <i>Amazon EC2 User Guide</i>, the blog <a href="http://aws.amazon.com/blogs/aws/ec2-classic-is-retiring-heres-how-to-prepare/">EC2-Classic Networking is Retiring – Here’s How to Prepare</a>, and <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.Non-VPC2VPC.html">Moving a DB instance not in a VPC into a VPC</a> in the <i>Amazon RDS User Guide</i>.</p> </note>

    Args:
        db_security_group_name: <p>The name of the DB security group to delete.</p> <note> <p>You can't delete the default DB security group.</p> </note> <p>Constraints:</p> <ul> <li> <p>Must be 1 to 255 letters, numbers, or hyphens.</p> </li> <li> <p>First character must be a letter</p> </li> <li> <p>Can't end with a hyphen or contain two consecutive hyphens</p> </li> <li> <p>Must not be "Default"</p> </li> </ul>

    Raises:
        capo_rds.errors.db_security_group_not_found_fault.DBSecurityGroupNotFoundFault: <p> <code>DBSecurityGroupName</code> doesn't refer to an existing DB security group.</p>
        capo_rds.errors.invalid_db_security_group_state_fault.InvalidDBSecurityGroupStateFault: <p>The state of the DB security group doesn't allow deletion.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete a DB security group
        The following example deletes a DB security group.

        >>> await client.delete_db_security_group(db_security_group_name='mysecgroup')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rds.types.delete_db_security_group_message.DeleteDBSecurityGroupMessage]",
    ) -> AsyncOperationResponse[None]:
        import capo_rds._operations.amazon_rd_sv19.delete_db_security_group

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteDBSecurityGroup")
    )
    input_: capo_rds.types.delete_db_security_group_message.DeleteDBSecurityGroupMessage = {}
    if db_security_group_name is not None:
        input_["db_security_group_name"] = db_security_group_name

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