Skip to content

revoke_security_group_egress async

revoke_security_group_egress(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    security_group_rule_ids: Optional[SecurityGroupRuleIdList] = None,
    dry_run: Optional[Boolean] = None,
    group_id: Optional[SecurityGroupId] = None,
    source_security_group_name: Optional[String] = None,
    source_security_group_owner_id: Optional[String] = None,
    ip_protocol: Optional[String] = None,
    from_port: Optional[Integer] = None,
    to_port: Optional[Integer] = None,
    cidr_ip: Optional[String] = None,
    ip_permissions: Optional[IpPermissionList] = None,
) -> RevokeSecurityGroupEgressResult

Removes the specified outbound (egress) rules from the specified security group.

You can specify rules using either rule IDs or security group rule properties. If you use rule properties, the values that you specify (for example, ports) must match the existing rule's values exactly. Each rule has a protocol, from and to ports, and destination (CIDR range, security group, or prefix list). For the TCP and UDP protocols, you must also specify the destination port or range of ports. For the ICMP protocol, you must also specify the ICMP type and code. If the security group rule has a description, you do not need to specify the description to revoke the rule.

For a default VPC, if the values you specify do not match the existing rule's values, no error is returned, and the output describes the security group rules that were not revoked.

Amazon Web Services recommends that you describe the security group to verify that the rules were removed.

Rule changes are propagated to instances within the security group as quickly as possible. However, a small delay might occur.

Parameters:

  • security_group_rule_ids (Optional[SecurityGroupRuleIdList], default: None ) –

    The IDs of the security group rules.

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • group_id (Optional[SecurityGroupId], default: None ) –

    The ID of the security group.

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

    Not supported. Use a set of IP permissions to specify a destination security group.

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

    Not supported. Use a set of IP permissions to specify a destination security group.

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

    Not supported. Use a set of IP permissions to specify the protocol name or number.

  • from_port (Optional[Integer], default: None ) –

    Not supported. Use a set of IP permissions to specify the port.

  • to_port (Optional[Integer], default: None ) –

    Not supported. Use a set of IP permissions to specify the port.

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

    Not supported. Use a set of IP permissions to specify the CIDR.

  • ip_permissions (Optional[IpPermissionList], default: None ) –

    The sets of IP permissions. You can't specify a destination security group and a CIDR IP address range in the same set of permissions.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def revoke_security_group_egress(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    security_group_rule_ids: Optional[
        "capo_ec2.types.security_group_rule_id_list.SecurityGroupRuleIdList"
    ] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    group_id: Optional["capo_ec2.types.security_group_id.SecurityGroupId"] = None,
    source_security_group_name: Optional["capo_ec2.types.string.String"] = None,
    source_security_group_owner_id: Optional["capo_ec2.types.string.String"] = None,
    ip_protocol: Optional["capo_ec2.types.string.String"] = None,
    from_port: Optional["capo_ec2.types.integer.Integer"] = None,
    to_port: Optional["capo_ec2.types.integer.Integer"] = None,
    cidr_ip: Optional["capo_ec2.types.string.String"] = None,
    ip_permissions: Optional[
        "capo_ec2.types.ip_permission_list.IpPermissionList"
    ] = None,
) -> "capo_ec2.types.revoke_security_group_egress_result.RevokeSecurityGroupEgressResult":
    """<p>Removes the specified outbound (egress) rules from the specified security group.</p> <p>You can specify rules using either rule IDs or security group rule properties. If you use rule properties, the values that you specify (for example, ports) must match the existing rule's values exactly. Each rule has a protocol, from and to ports, and destination (CIDR range, security group, or prefix list). For the TCP and UDP protocols, you must also specify the destination port or range of ports. For the ICMP protocol, you must also specify the ICMP type and code. If the security group rule has a description, you do not need to specify the description to revoke the rule.</p> <p>For a default VPC, if the values you specify do not match the existing rule's values, no error is returned, and the output describes the security group rules that were not revoked.</p> <p>Amazon Web Services recommends that you describe the security group to verify that the rules were removed.</p> <p>Rule changes are propagated to instances within the security group as quickly as possible. However, a small delay might occur.</p>

    Args:
        security_group_rule_ids: <p>The IDs of the security group rules.</p>
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
        group_id: <p>The ID of the security group.</p>
        source_security_group_name: <p>Not supported. Use a set of IP permissions to specify a destination security group.</p>
        source_security_group_owner_id: <p>Not supported. Use a set of IP permissions to specify a destination security group.</p>
        ip_protocol: <p>Not supported. Use a set of IP permissions to specify the protocol name or number.</p>
        from_port: <p>Not supported. Use a set of IP permissions to specify the port.</p>
        to_port: <p>Not supported. Use a set of IP permissions to specify the port.</p>
        cidr_ip: <p>Not supported. Use a set of IP permissions to specify the CIDR.</p>
        ip_permissions: <p>The sets of IP permissions. You can't specify a destination security group and a CIDR IP address range in the same set of permissions.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.revoke_security_group_egress_request.RevokeSecurityGroupEgressRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.revoke_security_group_egress_result.RevokeSecurityGroupEgressResult"
    ]:
        import capo_ec2._operations.amazon_ec2.revoke_security_group_egress

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.revoke_security_group_egress.async_revoke_security_group_egress(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RevokeSecurityGroupEgress")
    )
    input_: capo_ec2.types.revoke_security_group_egress_request.RevokeSecurityGroupEgressRequest = {}
    if security_group_rule_ids is not None:
        input_["security_group_rule_ids"] = security_group_rule_ids
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if group_id is not None:
        input_["group_id"] = group_id
    if source_security_group_name is not None:
        input_["source_security_group_name"] = source_security_group_name
    if source_security_group_owner_id is not None:
        input_["source_security_group_owner_id"] = source_security_group_owner_id
    if ip_protocol is not None:
        input_["ip_protocol"] = ip_protocol
    if from_port is not None:
        input_["from_port"] = from_port
    if to_port is not None:
        input_["to_port"] = to_port
    if cidr_ip is not None:
        input_["cidr_ip"] = cidr_ip
    if ip_permissions is not None:
        input_["ip_permissions"] = ip_permissions

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