Skip to content

revoke_db_security_group_ingress async

revoke_db_security_group_ingress(
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_security_group_name: Optional[String] = None,
    cidrip: Optional[String] = None,
    ec2_security_group_name: Optional[String] = None,
    ec2_security_group_id: Optional[String] = None,
    ec2_security_group_owner_id: Optional[String] = None,
) -> RevokeDBSecurityGroupIngressResult

Revokes ingress from a DBSecurityGroup for previously authorized IP ranges or EC2 or VPC security groups. Required parameters for this API are one of CIDRIP, EC2SecurityGroupId for VPC, or (EC2SecurityGroupOwnerId and either EC2SecurityGroupName or EC2SecurityGroupId).

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 revoke ingress from.

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

    The IP range to revoke access from. Must be a valid CIDR range. If CIDRIP is specified, EC2SecurityGroupName, EC2SecurityGroupId and EC2SecurityGroupOwnerId can't be provided.

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

    The name of the EC2 security group to revoke access from. For VPC DB security groups, EC2SecurityGroupId must be provided. Otherwise, EC2SecurityGroupOwnerId and either EC2SecurityGroupName or EC2SecurityGroupId must be provided.

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

    The id of the EC2 security group to revoke access from. For VPC DB security groups, EC2SecurityGroupId must be provided. Otherwise, EC2SecurityGroupOwnerId and either EC2SecurityGroupName or EC2SecurityGroupId must be provided.

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

    The Amazon Web Services account number of the owner of the EC2 security group specified in the EC2SecurityGroupName parameter. The Amazon Web Services access key ID isn't an acceptable value. For VPC DB security groups, EC2SecurityGroupId must be provided. Otherwise, EC2SecurityGroupOwnerId and either EC2SecurityGroupName or EC2SecurityGroupId must be provided.

Raises:

Examples:

To revoke ingress for a DB security group This example revokes ingress for the specified CIDR block associated with the specified DB security group.

>>> await client.revoke_db_security_group_ingress(db_security_group_name='mydbsecuritygroup', cidrip='203.0.113.5/32')
Source code in docs_src/capo_rds/_services/async_rds.py
async def revoke_db_security_group_ingress(
    self,
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_security_group_name: Optional["capo_rds.types.string.String"] = None,
    cidrip: Optional["capo_rds.types.string.String"] = None,
    ec2_security_group_name: Optional["capo_rds.types.string.String"] = None,
    ec2_security_group_id: Optional["capo_rds.types.string.String"] = None,
    ec2_security_group_owner_id: Optional["capo_rds.types.string.String"] = None,
) -> "capo_rds.types.revoke_db_security_group_ingress_result.RevokeDBSecurityGroupIngressResult":
    """<p>Revokes ingress from a DBSecurityGroup for previously authorized IP ranges or EC2 or VPC security groups. Required parameters for this API are one of CIDRIP, EC2SecurityGroupId for VPC, or (EC2SecurityGroupOwnerId and either EC2SecurityGroupName or EC2SecurityGroupId).</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 revoke ingress from.</p>
        cidrip: <p>The IP range to revoke access from. Must be a valid CIDR range. If <code>CIDRIP</code> is specified, <code>EC2SecurityGroupName</code>, <code>EC2SecurityGroupId</code> and <code>EC2SecurityGroupOwnerId</code> can't be provided.</p>
        ec2_security_group_name: <p>The name of the EC2 security group to revoke access from. For VPC DB security groups, <code>EC2SecurityGroupId</code> must be provided. Otherwise, EC2SecurityGroupOwnerId and either <code>EC2SecurityGroupName</code> or <code>EC2SecurityGroupId</code> must be provided.</p>
        ec2_security_group_id: <p>The id of the EC2 security group to revoke access from. For VPC DB security groups, <code>EC2SecurityGroupId</code> must be provided. Otherwise, EC2SecurityGroupOwnerId and either <code>EC2SecurityGroupName</code> or <code>EC2SecurityGroupId</code> must be provided.</p>
        ec2_security_group_owner_id: <p>The Amazon Web Services account number of the owner of the EC2 security group specified in the <code>EC2SecurityGroupName</code> parameter. The Amazon Web Services access key ID isn't an acceptable value. For VPC DB security groups, <code>EC2SecurityGroupId</code> must be provided. Otherwise, EC2SecurityGroupOwnerId and either <code>EC2SecurityGroupName</code> or <code>EC2SecurityGroupId</code> must be provided.</p>

    Raises:
        capo_rds.errors.authorization_not_found_fault.AuthorizationNotFoundFault: <p>The specified CIDR IP range or Amazon EC2 security group might not be authorized for the specified DB security group.</p> <p>Or, RDS might not be authorized to perform necessary actions using IAM on your behalf.</p>
        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 revoke ingress for a DB security group
        This example revokes ingress for the specified CIDR block associated with the specified DB security group.

        >>> await client.revoke_db_security_group_ingress(db_security_group_name='mydbsecuritygroup', cidrip='203.0.113.5/32')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rds.types.revoke_db_security_group_ingress_message.RevokeDBSecurityGroupIngressMessage]",
    ) -> AsyncOperationResponse[
        "capo_rds.types.revoke_db_security_group_ingress_result.RevokeDBSecurityGroupIngressResult"
    ]:
        import capo_rds._operations.amazon_rd_sv19.revoke_db_security_group_ingress

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RevokeDBSecurityGroupIngress")
    )
    input_: capo_rds.types.revoke_db_security_group_ingress_message.RevokeDBSecurityGroupIngressMessage = {}
    if db_security_group_name is not None:
        input_["db_security_group_name"] = db_security_group_name
    if cidrip is not None:
        input_["cidrip"] = cidrip
    if ec2_security_group_name is not None:
        input_["ec2_security_group_name"] = ec2_security_group_name
    if ec2_security_group_id is not None:
        input_["ec2_security_group_id"] = ec2_security_group_id
    if ec2_security_group_owner_id is not None:
        input_["ec2_security_group_owner_id"] = ec2_security_group_owner_id

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