public sealed class FieldPolicy : IMessage<FieldPolicy>, IEquatable<FieldPolicy>, IDeepCloneable<FieldPolicy>, IBufferMessage, IMessage
Google API Policy Annotation
This message defines a simple API policy annotation that can be used to
annotate API request and response message fields with applicable policies.
One field may have multiple applicable policies that must all be satisfied
before a request can be processed. This policy annotation is used to
generate the overall policy that will be used for automatic runtime
policy enforcement and documentation generation.
Specifies the required permission(s) for the resource referred to by the
field. It requires the field contains a valid resource reference, and
the request must pass the permission checks to proceed. For example,
"resourcemanager.projects.get".
Selects one or more request or response message fields to apply this
FieldPolicy.
When a FieldPolicy is used in proto annotation, the selector must
be left as empty. The service config generator will automatically fill
the correct value.
When a FieldPolicy is used in service config, the selector must be a
comma-separated string with valid request or response field paths,
such as "foo.bar" or "foo.bar,foo.baz".
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[[["\u003cp\u003e\u003ccode\u003eFieldPolicy\u003c/code\u003e is a class used to annotate API request and response message fields with applicable policies within the Google API.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eFieldPolicy\u003c/code\u003e class implements interfaces such as \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, enabling features like deep cloning and message equality checks.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eFieldPolicy\u003c/code\u003e includes properties like \u003ccode\u003eResourcePermission\u003c/code\u003e, \u003ccode\u003eResourceType\u003c/code\u003e, and \u003ccode\u003eSelector\u003c/code\u003e to specify resource requirements and identify which fields are subject to the policy.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eFieldPolicy\u003c/code\u003e class provides methods for operations like calculating message size (\u003ccode\u003eCalculateSize\u003c/code\u003e), creating clones (\u003ccode\u003eClone\u003c/code\u003e), and merging messages (\u003ccode\u003eMergeFrom\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of \u003ccode\u003eFieldPolicy\u003c/code\u003e is available under the \u003ccode\u003e2.15.0\u003c/code\u003e version.\u003c/p\u003e\n"]]],[],null,["# Class FieldPolicy (2.17.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.17.0 (latest)](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.FieldPolicy)\n- [2.15.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.15.0/Google.Api.FieldPolicy)\n- [2.10.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.10.0/Google.Api.FieldPolicy)\n- [2.2.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.2.0/Google.Api.FieldPolicy) \n\n public sealed class FieldPolicy : IMessage\u003cFieldPolicy\u003e, IEquatable\u003cFieldPolicy\u003e, IDeepCloneable\u003cFieldPolicy\u003e, IBufferMessage, IMessage\n\nGoogle API Policy Annotation\n\nThis message defines a simple API policy annotation that can be used to\nannotate API request and response message fields with applicable policies.\nOne field may have multiple applicable policies that must all be satisfied\nbefore a request can be processed. This policy annotation is used to\ngenerate the overall policy that will be used for automatic runtime\npolicy enforcement and documentation generation. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e FieldPolicy \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[FieldPolicy](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.FieldPolicy), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[FieldPolicy](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.FieldPolicy), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[FieldPolicy](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.FieldPolicy), [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.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)\n\nNamespace\n---------\n\n[Google.Api](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api)\n\nAssembly\n--------\n\nGoogle.Api.CommonProtos.dll\n\nConstructors\n------------\n\n### FieldPolicy()\n\n public FieldPolicy()\n\n### FieldPolicy(FieldPolicy)\n\n public FieldPolicy(FieldPolicy other)\n\nFields\n------\n\n### ResourcePermissionFieldNumber\n\n public const int ResourcePermissionFieldNumber = 2\n\nField number for the \"resource_permission\" field.\n\n### ResourceTypeFieldNumber\n\n public const int ResourceTypeFieldNumber = 3\n\nField number for the \"resource_type\" field.\n\n### SelectorFieldNumber\n\n public const int SelectorFieldNumber = 1\n\nField number for the \"selector\" field.\n\nProperties\n----------\n\n### Descriptor\n\n public static MessageDescriptor Descriptor { get; }\n\n### Parser\n\n public static MessageParser\u003cFieldPolicy\u003e Parser { get; }\n\n### ResourcePermission\n\n public string ResourcePermission { get; set; }\n\nSpecifies the required permission(s) for the resource referred to by the\nfield. It requires the field contains a valid resource reference, and\nthe request must pass the permission checks to proceed. For example,\n\"resourcemanager.projects.get\".\n\n### ResourceType\n\n public string ResourceType { get; set; }\n\nSpecifies the resource type for the resource referred to by the field.\n\n### Selector\n\n public string Selector { get; set; }\n\nSelects one or more request or response message fields to apply this\n`FieldPolicy`.\n\nWhen a `FieldPolicy` is used in proto annotation, the selector must\nbe left as empty. The service config generator will automatically fill\nthe correct value.\n\nWhen a `FieldPolicy` is used in service config, the selector must be a\ncomma-separated string with valid request or response field paths,\nsuch as \"foo.bar\" or \"foo.bar,foo.baz\".\n\nMethods\n-------\n\n### CalculateSize()\n\n public int CalculateSize()\n\n### Clone()\n\n public FieldPolicy Clone()\n\n### Equals(FieldPolicy)\n\n public bool Equals(FieldPolicy other)\n\n### Equals(object)\n\n public override bool Equals(object other)\n\n**Overrides** \n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object))\n\n### GetHashCode()\n\n public override int GetHashCode()\n\n**Overrides** \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)\n\n### MergeFrom(FieldPolicy)\n\n public void MergeFrom(FieldPolicy other)\n\n### MergeFrom(CodedInputStream)\n\n public void MergeFrom(CodedInputStream input)\n\n### ToString()\n\n public override string ToString()\n\n**Overrides** \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\n### WriteTo(CodedOutputStream)\n\n public void WriteTo(CodedOutputStream output)"]]