# Google Cloud Network Connectivity V1 Client - Class Filter (2.5.3)

2.5.3 (latest) 2.5.2 2.4.0 2.3.0 2.2.2 2.1.2 2.0.2 1.5.5 1.4.2 1.3.0 1.2.0 1.1.1 1.0.5 Reference documentation and code samples for the Google Cloud Network Connectivity V1 Client class Filter.

Filter matches L4 traffic.

Generated from protobuf message `google.cloud.networkconnectivity.v1.PolicyBasedRoute.Filter`

## Namespace

Google \\ Cloud \\ NetworkConnectivity \\ V1 \\ PolicyBasedRoute

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ ip_protocol` | `string` Optional. The IP protocol that this policy-based route applies to. Valid values are 'TCP', 'UDP', and 'ALL'. Default is 'ALL'. |
| `↳ src_range` | `string` Optional. The source IP range of outgoing packets that this policy-based route applies to. Default is "0.0.0.0/0" if protocol version is IPv4. |
| `↳ dest_range` | `string` Optional. The destination IP range of outgoing packets that this policy-based route applies to. Default is "0.0.0.0/0" if protocol version is IPv4. |
| `↳ protocol_version` | `int` Required. Internet protocol versions this policy-based route applies to. For this version, only IPV4 is supported. IPV6 is supported in preview. |

### getIpProtocol

Optional. The IP protocol that this policy-based route applies to. Valid
values are 'TCP', 'UDP', and 'ALL'. Default is 'ALL'.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setIpProtocol

Optional. The IP protocol that this policy-based route applies to. Valid
values are 'TCP', 'UDP', and 'ALL'. Default is 'ALL'.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSrcRange

Optional. The source IP range of outgoing packets that this policy-based
route applies to. Default is "0.0.0.0/0" if protocol version is IPv4.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setSrcRange

Optional. The source IP range of outgoing packets that this policy-based
route applies to. Default is "0.0.0.0/0" if protocol version is IPv4.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDestRange

Optional. The destination IP range of outgoing packets that this
policy-based route applies to. Default is "0.0.0.0/0" if protocol version
is IPv4.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDestRange

Optional. The destination IP range of outgoing packets that this
policy-based route applies to. Default is "0.0.0.0/0" if protocol version
is IPv4.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getProtocolVersion

Required. Internet protocol versions this policy-based route applies to.

For this version, only IPV4 is supported. IPV6 is supported in preview.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [ProtocolVersion](https://docs.cloud.google.com/php/docs/reference/cloud-network-connectivity/latest/V1.PolicyBasedRoute.Filter.ProtocolVersion). |

### setProtocolVersion

Required. Internet protocol versions this policy-based route applies to.

For this version, only IPV4 is supported. IPV6 is supported in preview.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [ProtocolVersion](https://docs.cloud.google.com/php/docs/reference/cloud-network-connectivity/latest/V1.PolicyBasedRoute.Filter.ProtocolVersion). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |