public sealed class PatchInstanceFilter : IMessage<PatchInstanceFilter>, IEquatable<PatchInstanceFilter>, IDeepCloneable<PatchInstanceFilter>, IBufferMessage, IMessage
Reference documentation and code samples for the Google Cloud OS Config v1 API 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.
public RepeatedField<string> InstanceNamePrefixes { get; }
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-".
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]
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-12 UTC."],[[["\u003cp\u003eThe \u003ccode\u003ePatchInstanceFilter\u003c/code\u003e class in the Google Cloud OS Config v1 API is used to define criteria for targeting specific VM instances for patching.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the \u003ccode\u003ePatchInstanceFilter\u003c/code\u003e documentation is 2.4.0, with older versions ranging back to 1.3.0 also available.\u003c/p\u003e\n"],["\u003cp\u003eVM instances can be targeted based on a variety of factors including labels, zones, instance names, or whether all instances are targeted within the specified project.\u003c/p\u003e\n"],["\u003cp\u003eThe class implements several interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe PatchInstanceFilter class contains properties to allow for the targeting of VM instances based on various elements including group labels, instance name prefixes, specific instances or zones, or all VM instances.\u003c/p\u003e\n"]]],[],null,["# Google Cloud OS Config v1 API - Class PatchInstanceFilter (2.5.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.5.0 (latest)](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.PatchInstanceFilter)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/2.4.0/Google.Cloud.OsConfig.V1.PatchInstanceFilter)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/2.3.0/Google.Cloud.OsConfig.V1.PatchInstanceFilter)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/2.2.0/Google.Cloud.OsConfig.V1.PatchInstanceFilter)\n- [2.1.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/2.1.0/Google.Cloud.OsConfig.V1.PatchInstanceFilter)\n- [2.0.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/2.0.0/Google.Cloud.OsConfig.V1.PatchInstanceFilter)\n- [1.8.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.8.0/Google.Cloud.OsConfig.V1.PatchInstanceFilter)\n- [1.7.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.7.0/Google.Cloud.OsConfig.V1.PatchInstanceFilter)\n- [1.6.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.6.0/Google.Cloud.OsConfig.V1.PatchInstanceFilter)\n- [1.5.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.5.0/Google.Cloud.OsConfig.V1.PatchInstanceFilter)\n- [1.4.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.4.0/Google.Cloud.OsConfig.V1.PatchInstanceFilter)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.3.0/Google.Cloud.OsConfig.V1.PatchInstanceFilter) \n\n public sealed class PatchInstanceFilter : IMessage\u003cPatchInstanceFilter\u003e, IEquatable\u003cPatchInstanceFilter\u003e, IDeepCloneable\u003cPatchInstanceFilter\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud OS Config v1 API class PatchInstanceFilter.\n\nA filter to target VM instances for patching. The targeted\nVMs must meet all criteria specified. So if both labels and zones are\nspecified, the patch job targets only VMs with those labels and in those\nzones. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e PatchInstanceFilter \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[PatchInstanceFilter](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.PatchInstanceFilter), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[PatchInstanceFilter](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.PatchInstanceFilter), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[PatchInstanceFilter](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.PatchInstanceFilter), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.OsConfig.V1](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.OsConfig.V1.dll\n\nConstructors\n------------\n\n### PatchInstanceFilter()\n\n public PatchInstanceFilter()\n\n### PatchInstanceFilter(PatchInstanceFilter)\n\n public PatchInstanceFilter(PatchInstanceFilter other)\n\nProperties\n----------\n\n### All\n\n public bool All { get; set; }\n\nTarget all VM instances in the project. If true, no other criteria is\npermitted.\n\n### GroupLabels\n\n public RepeatedField\u003cPatchInstanceFilter.Types.GroupLabel\u003e GroupLabels { get; }\n\nTargets VM instances matching ANY of these GroupLabels. This allows\ntargeting of disparate groups of VM instances.\n\n### InstanceNamePrefixes\n\n public RepeatedField\u003cstring\u003e InstanceNamePrefixes { get; }\n\nTargets VMs whose name starts with one of these prefixes. Similar to\nlabels, this is another way to group VMs when targeting configs, for\nexample prefix=\"prod-\".\n\n### Instances\n\n public RepeatedField\u003cstring\u003e Instances { get; }\n\nTargets any of the VM instances specified. Instances are specified by their\nURI in the form `zones/[ZONE]/instances/[INSTANCE_NAME]`,\n`projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]`, or\n`https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]`\n\n### Zones\n\n public RepeatedField\u003cstring\u003e Zones { get; }\n\nTargets VM instances in ANY of these zones. Leave empty to target VM\ninstances in any zone."]]