public sealed class OSPolicy.Types.Resource.Types.FileResource : IMessage<OSPolicy.Types.Resource.Types.FileResource>, IEquatable<OSPolicy.Types.Resource.Types.FileResource>, IDeepCloneable<OSPolicy.Types.Resource.Types.FileResource>, IBufferMessage, IMessage
Reference documentation and code samples for the Google Cloud OS Config v1alpha API class OSPolicy.Types.Resource.Types.FileResource.
Consists of three octal digits which represent, in
order, the permissions of the owner, group, and other users for the
file (similarly to the numeric mode used in the linux chmod
utility). Each digit represents a three bit number with the 4 bit
corresponding to the read permissions, the 2 bit corresponds to the
write bit, and the one bit corresponds to the execute permission.
Default behavior is 755.
Below are some examples of permissions and their associated values:
read, write, and execute: 7
read and execute: 5
read and write: 6
read only: 4
[[["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 document provides reference documentation for the \u003ccode\u003eOSPolicy.Types.Resource.Types.FileResource\u003c/code\u003e class in the Google Cloud OS Config v1alpha API.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eFileResource\u003c/code\u003e class manages the state of a file on a virtual machine, allowing for content specification, file source selection, and permission settings.\u003c/p\u003e\n"],["\u003cp\u003eIt supports setting the desired state of the file, which can include specifying the content directly or referencing a remote/local source, alongside a defined file path.\u003c/p\u003e\n"],["\u003cp\u003eThe class provides properties such as \u003ccode\u003eContent\u003c/code\u003e, \u003ccode\u003eFile\u003c/code\u003e, \u003ccode\u003ePath\u003c/code\u003e, \u003ccode\u003ePermissions\u003c/code\u003e, and \u003ccode\u003eState\u003c/code\u003e to configure the file's properties and behaviour within the virtual machine environment.\u003c/p\u003e\n"],["\u003cp\u003eThere are three different available version for this API with the latest being 2.0.0-alpha06.\u003c/p\u003e\n"]]],[],null,["# Google Cloud OS Config v1alpha API - Class OSPolicy.Types.Resource.Types.FileResource (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.Types.FileResource)\n- [2.0.0-alpha05](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/2.0.0-alpha05/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types.Resource.Types.FileResource)\n- [1.0.0-alpha04](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/1.0.0-alpha04/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types.Resource.Types.FileResource) \n\n public sealed class OSPolicy.Types.Resource.Types.FileResource : IMessage\u003cOSPolicy.Types.Resource.Types.FileResource\u003e, IEquatable\u003cOSPolicy.Types.Resource.Types.FileResource\u003e, IDeepCloneable\u003cOSPolicy.Types.Resource.Types.FileResource\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud OS Config v1alpha API class OSPolicy.Types.Resource.Types.FileResource.\n\nA resource that manages the state of a file. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e OSPolicy.Types.Resource.Types.FileResource \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)[Types](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types.Resource.Types)[FileResource](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types.Resource.Types.FileResource), [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)[Types](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types.Resource.Types)[FileResource](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types.Resource.Types.FileResource), [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)[Types](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types.Resource.Types)[FileResource](/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy.Types.Resource.Types.FileResource), [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### FileResource()\n\n public FileResource()\n\n### FileResource(FileResource)\n\n public FileResource(OSPolicy.Types.Resource.Types.FileResource other)\n\nProperties\n----------\n\n### Content\n\n public string Content { get; set; }\n\nA a file with this content.\nThe size of the content is limited to 1024 characters.\n\n### File\n\n public OSPolicy.Types.Resource.Types.File File { get; set; }\n\nA remote or local source.\n\n### HasContent\n\n public bool HasContent { get; }\n\nGets whether the \"content\" field is set\n\n### Path\n\n public string Path { get; set; }\n\nRequired. The absolute path of the file within the VM.\n\n### Permissions\n\n public string Permissions { get; set; }\n\nConsists of three octal digits which represent, in\norder, the permissions of the owner, group, and other users for the\nfile (similarly to the numeric mode used in the linux chmod\nutility). Each digit represents a three bit number with the 4 bit\ncorresponding to the read permissions, the 2 bit corresponds to the\nwrite bit, and the one bit corresponds to the execute permission.\nDefault behavior is 755.\n\nBelow are some examples of permissions and their associated values:\nread, write, and execute: 7\nread and execute: 5\nread and write: 6\nread only: 4\n\n### SourceCase\n\n public OSPolicy.Types.Resource.Types.FileResource.SourceOneofCase SourceCase { get; }\n\n### State\n\n public OSPolicy.Types.Resource.Types.FileResource.Types.DesiredState State { get; set; }\n\nRequired. Desired state of the file."]]