public sealed class OSPolicy.Types.Resource : IMessage<OSPolicy.Types.Resource>, IEquatable<OSPolicy.Types.Resource>, IDeepCloneable<OSPolicy.Types.Resource>, IBufferMessage, IMessage
Reference documentation and code samples for the Google Cloud OS Config v1alpha API class OSPolicy.Types.Resource.
An OS policy resource is used to define the desired state configuration
and provides a specific functionality like installing/removing packages,
executing a script etc.
The system ensures that resources are always in their desired state by
taking necessary actions if they have drifted from their desired state.
[[["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-07 UTC."],[[["\u003cp\u003eThis documentation is for the \u003ccode\u003eOSPolicy.Types.Resource\u003c/code\u003e class within the Google Cloud OS Config v1alpha API, which is available in multiple versions including the latest, 2.0.0-alpha06.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eOSPolicy.Types.Resource\u003c/code\u003e class is used to define the desired state of configurations, such as managing packages or executing scripts.\u003c/p\u003e\n"],["\u003cp\u003eThis class ensures that resources maintain their desired state by implementing automatic adjustments if there is a deviation.\u003c/p\u003e\n"],["\u003cp\u003eThe class \u003ccode\u003eOSPolicy.Types.Resource\u003c/code\u003e has properties like \u003ccode\u003eExec\u003c/code\u003e, \u003ccode\u003eFile\u003c/code\u003e, \u003ccode\u003ePkg\u003c/code\u003e, and \u003ccode\u003eRepository\u003c/code\u003e, allowing for specific configuration of executing resources, managing files, and working with package and package repositories.\u003c/p\u003e\n"],["\u003cp\u003eThis class implements the interfaces \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, and inherits members from the base \u003ccode\u003eobject\u003c/code\u003e class.\u003c/p\u003e\n"]]],[],null,["# Google Cloud OS Config v1alpha API - Class OSPolicy.Types.Resource (2.0.0-alpha06)\n\nVersion latestkeyboard_arrow_down\n\n- [2.0.0-alpha06 (latest)](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types.Resource)\n- [2.0.0-alpha05](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/2.0.0-alpha05/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types.Resource)\n- [1.0.0-alpha04](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/1.0.0-alpha04/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types.Resource) \n\n public sealed class OSPolicy.Types.Resource : IMessage\u003cOSPolicy.Types.Resource\u003e, IEquatable\u003cOSPolicy.Types.Resource\u003e, IDeepCloneable\u003cOSPolicy.Types.Resource\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud OS Config v1alpha API class OSPolicy.Types.Resource.\n\nAn OS policy resource is used to define the desired state configuration\nand provides a specific functionality like installing/removing packages,\nexecuting a script etc.\n\nThe system ensures that resources are always in their desired state by\ntaking necessary actions if they have drifted from their desired state. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e OSPolicy.Types.Resource \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[OSPolicy](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy)[Types](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types)[Resource](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types.Resource), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[OSPolicy](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy)[Types](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types)[Resource](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types.Resource), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[OSPolicy](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy)[Types](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types)[Resource](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types.Resource), [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.V1Alpha](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha)\n\nAssembly\n--------\n\nGoogle.Cloud.OsConfig.V1Alpha.dll\n\nConstructors\n------------\n\n### Resource()\n\n public Resource()\n\n### Resource(Resource)\n\n public Resource(OSPolicy.Types.Resource other)\n\nProperties\n----------\n\n### Exec\n\n public OSPolicy.Types.Resource.Types.ExecResource Exec { get; set; }\n\nExec resource\n\n### File\n\n public OSPolicy.Types.Resource.Types.FileResource File { get; set; }\n\nFile resource\n\n### Id\n\n public string Id { get; set; }\n\nRequired. The id of the resource with the following restrictions:\n\n- Must contain only lowercase letters, numbers, and hyphens.\n- Must start with a letter.\n- Must be between 1-63 characters.\n- Must end with a number or a letter.\n- Must be unique within the OS policy.\n\n### Pkg\n\n public OSPolicy.Types.Resource.Types.PackageResource Pkg { get; set; }\n\nPackage resource\n\n### Repository\n\n public OSPolicy.Types.Resource.Types.RepositoryResource Repository { get; set; }\n\nPackage repository resource\n\n### ResourceTypeCase\n\n public OSPolicy.Types.Resource.ResourceTypeOneofCase ResourceTypeCase { get; }"]]