# Security Command Center V2 API - Class Google::Cloud::SecurityCenter::V2::IpRule (v1.8.0)

1.8.0 (latest) 1.7.1 1.6.0 1.5.1 1.4.0 1.3.0 1.2.0 1.1.1 1.0.0 0.6.0 0.5.0 0.4.1 0.3.0 0.2.0 0.1.0 Reference documentation and code samples for the Security Command Center V2 API class Google::Cloud::SecurityCenter::V2::IpRule.

IP rule information.

## Inherits

- [Object](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-security_center-v2/latest/Google-Cloud-SecurityCenter-V2-Kubernetes-Object)

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #port_ranges

    def port_ranges() -> ::Array<::Google::Cloud::SecurityCenter::V2::IpRule::PortRange>

**Returns**

- (::Array\<[::Google::Cloud::SecurityCenter::V2::IpRule::PortRange](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-security_center-v2/latest/Google-Cloud-SecurityCenter-V2-IpRule-PortRange)\>) --- Optional. An optional list of ports to which this rule applies. This field is only applicable for the UDP or (S)TCP protocols. Each entry must be either an integer or a range including a min and max port number.

### #port_ranges=

    def port_ranges=(value) -> ::Array<::Google::Cloud::SecurityCenter::V2::IpRule::PortRange>

**Parameter**

- **value** (::Array\<[::Google::Cloud::SecurityCenter::V2::IpRule::PortRange](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-security_center-v2/latest/Google-Cloud-SecurityCenter-V2-IpRule-PortRange)\>) --- Optional. An optional list of ports to which this rule applies. This field is only applicable for the UDP or (S)TCP protocols. Each entry must be either an integer or a range including a min and max port number.
**Returns**

- (::Array\<[::Google::Cloud::SecurityCenter::V2::IpRule::PortRange](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-security_center-v2/latest/Google-Cloud-SecurityCenter-V2-IpRule-PortRange)\>) --- Optional. An optional list of ports to which this rule applies. This field is only applicable for the UDP or (S)TCP protocols. Each entry must be either an integer or a range including a min and max port number.

### #protocol

    def protocol() -> ::String

**Returns**

- (::String) --- The IP protocol this rule applies to. This value can either be one of the following well known protocol strings (TCP, UDP, ICMP, ESP, AH, IPIP, SCTP) or a string representation of the integer value.

### #protocol=

    def protocol=(value) -> ::String

**Parameter**

- **value** (::String) --- The IP protocol this rule applies to. This value can either be one of the following well known protocol strings (TCP, UDP, ICMP, ESP, AH, IPIP, SCTP) or a string representation of the integer value.
**Returns**

- (::String) --- The IP protocol this rule applies to. This value can either be one of the following well known protocol strings (TCP, UDP, ICMP, ESP, AH, IPIP, SCTP) or a string representation of the integer value.