# openstack.network.v2.security_group_rule

## The SecurityGroupRule Class

The `SecurityGroupRule` class inherits from `Resource`.

class openstack.network.v2.security_group_rule.SecurityGroupRule(_synchronized=False, connection=None, **attrs)

  The base resource

  Parameters:

    - _synchronized (bool) – This is not intended to be used directly. See `new()` and `existing()`.

    - connection (openstack.connection.Connection) – Reference to the Connection being used. Defaults to None to allow Resource objects to be used without an active Connection, such as in unit tests. Use of `self._connection` in Resource code should protect itself with a check for None.

  resource_key = 'security_group_rule'

    Singular form of key for resource.

  resources_key = 'security_group_rules'

    Plural form of key for resource.

  base_path = '/security-group-rules'

    The base part of the URI for this resource.

  allow_create = True

    Allow create operation for this resource.

  allow_fetch = True

    Allow get operation for this resource.

  allow_commit = False

    Allow update operation for this resource.

  allow_delete = True

    Allow delete operation for this resource.

  allow_list = True

    Allow list operation for this resource.

  created_at

    Timestamp when the security group rule was created.

  description

    The security group rule description.

  direction

    `ingress` or `egress`: The direction in which the security group rule is applied. For a compute instance, an ingress security group rule is applied to incoming ingress traffic for that instance. An egress rule is applied to traffic leaving the instance.

  ether_type

    Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress or egress rules.

  port_range_max

    The maximum port number in the range that is matched by the security group rule. The port_range_min attribute constrains the port_range_max attribute. If the protocol is ICMP, this value must be an ICMP type.

  port_range_min

    The minimum port number in the range that is matched by the security group rule. If the protocol is TCP or UDP, this value must be less than or equal to the value of the port_range_max attribute. If the protocol is ICMP, this value must be an ICMP type.

  project_id

    The ID of the project this security group rule is associated with.

  protocol

    The protocol that is matched by the security group rule. Valid values are `null`, `tcp`, `udp`, and `icmp`.

  remote_group_id

    The remote security group ID to be associated with this security group rule. You can specify either `remote_group_id` or `remote_address_group_id` or `remote_ip_prefix`.

  remote_address_group_id

    The remote address group ID to be associated with this security group rule. You can specify either `remote_group_id` or `remote_address_group_id` or `remote_ip_prefix`.

  remote_ip_prefix

    The remote IP prefix to be associated with this security group rule. You can specify either `remote_group_id` or `remote_address_group_id` or `remote_ip_prefix`. This attribute matches the specified IP prefix as the source or destination IP address of the IP packet depending on direction.

  security_group_id

    The security group ID to associate with this security group rule.

  tenant_id

    The ID of the project this security group rule is associated with.

  updated_at

    Timestamp when the security group rule was last updated.

this page last updated: 2026-01-16 23:06:19

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.