# Google Cloud OsConfig V1 Client - Class PatchInstanceFilter (2.2.3)

2.2.3 (latest) 2.2.2 2.1.0 2.0.5 1.3.5 1.2.2 1.1.1 1.0.5 Reference documentation and code samples for the Google Cloud OsConfig V1 Client class PatchInstanceFilter.

A filter to target VM instances for patching. The targeted
VMs must meet all criteria specified. So if both labels and zones are
specified, the patch job targets only VMs with those labels and in those
zones.

Generated from protobuf message `google.cloud.osconfig.v1.PatchInstanceFilter`

## Namespace

Google \\ Cloud \\ OsConfig \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ all` | `bool` Target all VM instances in the project. If true, no other criteria is permitted. |
| `↳ group_labels` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-osconfig/latest/V1.PatchInstanceFilter.GroupLabel>` Targets VM instances matching ANY of these GroupLabels. This allows targeting of disparate groups of VM instances. |
| `↳ zones` | `string[]` Targets VM instances in ANY of these zones. Leave empty to target VM instances in any zone. |
| `↳ instances` | `string[]` Targets any of the VM instances specified. Instances are specified by their URI in the form `zones/[ZONE]/instances/[INSTANCE_NAME]`, `projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]`, or `https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]` |
| `↳ instance_name_prefixes` | `string[]` Targets VMs whose name starts with one of these prefixes. Similar to labels, this is another way to group VMs when targeting configs, for example prefix="prod-". |

### getAll

Target all VM instances in the project. If true, no other criteria is
permitted.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setAll

Target all VM instances in the project. If true, no other criteria is
permitted.

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

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

### getGroupLabels

Targets VM instances matching ANY of these GroupLabels. This allows
targeting of disparate groups of VM instances.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-osconfig/latest/V1.PatchInstanceFilter.GroupLabel>` |   |

### setGroupLabels

Targets VM instances matching ANY of these GroupLabels. This allows
targeting of disparate groups of VM instances.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-osconfig/latest/V1.PatchInstanceFilter.GroupLabel>` |

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

### getZones

Targets VM instances in ANY of these zones. Leave empty to target VM
instances in any zone.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setZones

Targets VM instances in ANY of these zones. Leave empty to target VM
instances in any zone.

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

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

### getInstances

Targets any of the VM instances specified. Instances are specified by their
URI in the form `zones/[ZONE]/instances/[INSTANCE_NAME]`,
`projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]`, or
`https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setInstances

Targets any of the VM instances specified. Instances are specified by their
URI in the form `zones/[ZONE]/instances/[INSTANCE_NAME]`,
`projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]`, or
`https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]`

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

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

### getInstanceNamePrefixes

Targets VMs whose name starts with one of these prefixes. Similar to
labels, this is another way to group VMs when targeting configs, for
example prefix="prod-".

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setInstanceNamePrefixes

Targets VMs whose name starts with one of these prefixes. Similar to
labels, this is another way to group VMs when targeting configs, for
example prefix="prod-".

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

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