# Google Cloud Network Connectivity V1 Client - Class PolicyBasedRoute (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 PolicyBasedRoute.

Policy-based routes route L4 network traffic based on not just destination IP
address, but also source IP address, protocol, and more. If a policy-based
route conflicts with other types of routes, the policy-based route always
takes precedence.

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

## Namespace

Google \\ Cloud \\ NetworkConnectivity \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ virtual_machine` | `https://docs.cloud.google.com/php/docs/reference/cloud-network-connectivity/latest/V1.PolicyBasedRoute.VirtualMachine` Optional. VM instances that this policy-based route applies to. |
| `↳ interconnect_attachment` | `https://docs.cloud.google.com/php/docs/reference/cloud-network-connectivity/latest/V1.PolicyBasedRoute.InterconnectAttachment` Optional. The interconnect attachments that this policy-based route applies to. |
| `↳ next_hop_ilb_ip` | `string` Optional. The IP address of a global-access-enabled L4 ILB that is the next hop for matching packets. For this version, only nextHopIlbIp is supported. |
| `↳ next_hop_other_routes` | `int` Optional. Other routes that will be referenced to determine the next hop of the packet. |
| `↳ name` | `string` Immutable. A unique name of the resource in the form of `projects/{project_number}/locations/global/PolicyBasedRoutes/{policy_based_route_id}` |
| `↳ create_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. Time when the policy-based route was created. |
| `↳ update_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. Time when the policy-based route was updated. |
| `↳ labels` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` User-defined labels. |
| `↳ description` | `string` Optional. An optional description of this resource. Provide this field when you create the resource. |
| `↳ network` | `string` Required. Fully-qualified URL of the network that this route applies to, for example: projects/my-project/global/networks/my-network. |
| `↳ filter` | `https://docs.cloud.google.com/php/docs/reference/cloud-network-connectivity/latest/V1.PolicyBasedRoute.Filter` Required. The filter to match L4 traffic. |
| `↳ priority` | `int` Optional. The priority of this policy-based route. Priority is used to break ties in cases where there are more than one matching policy-based routes found. In cases where multiple policy-based routes are matched, the one with the lowest-numbered priority value wins. The default value is 1000. The priority value must be from 1 to 65535, inclusive. |
| `↳ warnings` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-network-connectivity/latest/V1.PolicyBasedRoute.Warnings>` Output only. If potential misconfigurations are detected for this route, this field will be populated with warning messages. |
| `↳ self_link` | `string` Output only. Server-defined fully-qualified URL for this resource. |
| `↳ kind` | `string` Output only. Type of this resource. Always networkconnectivity#policyBasedRoute for policy-based Route resources. |

### getVirtualMachine

Optional. VM instances that this policy-based route applies to.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-network-connectivity/latest/V1.PolicyBasedRoute.VirtualMachine|null` |   |

### hasVirtualMachine

### setVirtualMachine

Optional. VM instances that this policy-based route applies to.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-network-connectivity/latest/V1.PolicyBasedRoute.VirtualMachine` |

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

### getInterconnectAttachment

Optional. The interconnect attachments that this policy-based route
applies to.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-network-connectivity/latest/V1.PolicyBasedRoute.InterconnectAttachment|null` |   |

### hasInterconnectAttachment

### setInterconnectAttachment

Optional. The interconnect attachments that this policy-based route
applies to.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-network-connectivity/latest/V1.PolicyBasedRoute.InterconnectAttachment` |

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

### getNextHopIlbIp

Optional. The IP address of a global-access-enabled L4 ILB that is the
next hop for matching packets. For this version, only nextHopIlbIp is
supported.

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

### hasNextHopIlbIp

### setNextHopIlbIp

Optional. The IP address of a global-access-enabled L4 ILB that is the
next hop for matching packets. For this version, only nextHopIlbIp is
supported.

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

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

### getNextHopOtherRoutes

Optional. Other routes that will be referenced to determine the next hop
of the packet.

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

### hasNextHopOtherRoutes

### setNextHopOtherRoutes

Optional. Other routes that will be referenced to determine the next hop
of the packet.

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

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

### getName

Immutable. A unique name of the resource in the form of
`projects/{project_number}/locations/global/PolicyBasedRoutes/{policy_based_route_id}`

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

### setName

Immutable. A unique name of the resource in the form of
`projects/{project_number}/locations/global/PolicyBasedRoutes/{policy_based_route_id}`

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

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

### getCreateTime

Output only. Time when the policy-based route was created.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasCreateTime

### clearCreateTime

### setCreateTime

Output only. Time when the policy-based route was created.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

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

### getUpdateTime

Output only. Time when the policy-based route was updated.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasUpdateTime

### clearUpdateTime

### setUpdateTime

Output only. Time when the policy-based route was updated.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

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

### getLabels

User-defined labels.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setLabels

User-defined labels.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

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

### getDescription

Optional. An optional description of this resource. Provide this field when
you create the resource.

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

### setDescription

Optional. An optional description of this resource. Provide this field when
you create the resource.

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

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

### getNetwork

Required. Fully-qualified URL of the network that this route applies to,
for example: projects/my-project/global/networks/my-network.

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

### setNetwork

Required. Fully-qualified URL of the network that this route applies to,
for example: projects/my-project/global/networks/my-network.

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

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

### getFilter

Required. The filter to match L4 traffic.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-network-connectivity/latest/V1.PolicyBasedRoute.Filter|null` |   |

### hasFilter

### clearFilter

### setFilter

Required. The filter to match L4 traffic.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-network-connectivity/latest/V1.PolicyBasedRoute.Filter` |

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

### getPriority

Optional. The priority of this policy-based route. Priority is used to
break ties in cases where there are more than one matching policy-based
routes found. In cases where multiple policy-based routes are matched, the
one with the lowest-numbered priority value wins. The default value is

1. The priority value must be from 1 to 65535, inclusive.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setPriority

Optional. The priority of this policy-based route. Priority is used to
break ties in cases where there are more than one matching policy-based
routes found. In cases where multiple policy-based routes are matched, the
one with the lowest-numbered priority value wins. The default value is

1. The priority value must be from 1 to 65535, inclusive.

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

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

### getWarnings

Output only. If potential misconfigurations are detected for this route,
this field will be populated with warning messages.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-network-connectivity/latest/V1.PolicyBasedRoute.Warnings>` |   |

### setWarnings

Output only. If potential misconfigurations are detected for this route,
this field will be populated with warning messages.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-network-connectivity/latest/V1.PolicyBasedRoute.Warnings>` |

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

### getSelfLink

Output only. Server-defined fully-qualified URL for this resource.

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

### setSelfLink

Output only. Server-defined fully-qualified URL for this resource.

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

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

### getKind

Output only. Type of this resource. Always
networkconnectivity#policyBasedRoute for policy-based Route resources.

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

### setKind

Output only. Type of this resource. Always
networkconnectivity#policyBasedRoute for policy-based Route resources.

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

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

### getTarget

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

### getNextHop

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