public sealed class OSPolicyAssignment.Types.LabelSet : IMessage<OSPolicyAssignment.Types.LabelSet>, IEquatable<OSPolicyAssignment.Types.LabelSet>, IDeepCloneable<OSPolicyAssignment.Types.LabelSet>, IBufferMessage, IMessage
Reference documentation and code samples for the Google Cloud OS Config v1 API class OSPolicyAssignment.Types.LabelSet.
Message representing label set.
A label is a key value pair set for a VM.
A LabelSet is a set of labels.
Labels within a LabelSet are ANDed. In other words, a LabelSet is
applicable for a VM only if it matches all the labels in the
LabelSet.
Example: A LabelSet with 2 labels: env=prod and type=webserver will
only be applicable for those VMs with both labels
present.
[[["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\u003eThis webpage provides documentation for the \u003ccode\u003eOSPolicyAssignment.Types.LabelSet\u003c/code\u003e class within the Google Cloud OS Config v1 API, detailing its structure and functionality.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the \u003ccode\u003eOSPolicyAssignment.Types.LabelSet\u003c/code\u003e class is 2.4.0, with documentation available for multiple previous versions ranging back to 1.3.0.\u003c/p\u003e\n"],["\u003cp\u003eA \u003ccode\u003eLabelSet\u003c/code\u003e is defined as a set of key-value pairs (labels) that are used to identify and select VMs; a VM must match all the labels within a \u003ccode\u003eLabelSet\u003c/code\u003e to be considered applicable.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eOSPolicyAssignment.Types.LabelSet\u003c/code\u003e 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, and is part of the \u003ccode\u003eGoogle.Cloud.OsConfig.V1\u003c/code\u003e namespace.\u003c/p\u003e\n"],["\u003cp\u003eThe class includes a \u003ccode\u003eLabels\u003c/code\u003e property, which is a map of string key-value pairs used to specify the labels, and it has 2 constructors, a default one and one accepting another instance of \u003ccode\u003eOSPolicyAssignment.Types.LabelSet\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Google Cloud OS Config v1 API - Class OSPolicyAssignment.Types.LabelSet (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.OSPolicyAssignment.Types.LabelSet)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/2.4.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types.LabelSet)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/2.3.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types.LabelSet)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/2.2.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types.LabelSet)\n- [2.1.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/2.1.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types.LabelSet)\n- [2.0.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/2.0.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types.LabelSet)\n- [1.8.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.8.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types.LabelSet)\n- [1.7.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.7.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types.LabelSet)\n- [1.6.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.6.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types.LabelSet)\n- [1.5.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.5.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types.LabelSet)\n- [1.4.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.4.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types.LabelSet)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/1.3.0/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types.LabelSet) \n\n public sealed class OSPolicyAssignment.Types.LabelSet : IMessage\u003cOSPolicyAssignment.Types.LabelSet\u003e, IEquatable\u003cOSPolicyAssignment.Types.LabelSet\u003e, IDeepCloneable\u003cOSPolicyAssignment.Types.LabelSet\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud OS Config v1 API class OSPolicyAssignment.Types.LabelSet.\n\nMessage representing label set.\n\n- A label is a key value pair set for a VM.\n- A LabelSet is a set of labels.\n- Labels within a LabelSet are ANDed. In other words, a LabelSet is applicable for a VM only if it matches all the labels in the LabelSet.\n- Example: A LabelSet with 2 labels: `env=prod` and `type=webserver` will only be applicable for those VMs with both labels present. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e OSPolicyAssignment.Types.LabelSet \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[OSPolicyAssignment](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.OSPolicyAssignment)[Types](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types)[LabelSet](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types.LabelSet), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[OSPolicyAssignment](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.OSPolicyAssignment)[Types](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types)[LabelSet](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types.LabelSet), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[OSPolicyAssignment](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.OSPolicyAssignment)[Types](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types)[LabelSet](/dotnet/docs/reference/Google.Cloud.OsConfig.V1/latest/Google.Cloud.OsConfig.V1.OSPolicyAssignment.Types.LabelSet), [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### LabelSet()\n\n public LabelSet()\n\n### LabelSet(LabelSet)\n\n public LabelSet(OSPolicyAssignment.Types.LabelSet other)\n\nProperties\n----------\n\n### Labels\n\n public MapField\u003cstring, string\u003e Labels { get; }\n\nLabels are identified by key/value pairs in this map.\nA VM should contain all the key/value pairs specified in this\nmap to be selected."]]