The above specifies that all methods in the API requestgoogle.rpc.context.ProjectContextandgoogle.rpc.context.OriginContext.
Available context types are defined in packagegoogle.rpc.context.
This also provides mechanism to allowlist any protobuf message extension that
can be sent in grpc metadata using “x-goog-ext-<extension_id>-bin” and
“x-goog-ext-<extension_id>-jspb” format. For example, list any service
specific protobuf types that can appear in grpc metadata as follows in your
yaml file:
[[["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-09-04 UTC."],[[["\u003cp\u003e\u003ccode\u003eContext\u003c/code\u003e class defines the contexts that an API can request, using rules to specify which contexts apply to different methods.\u003c/p\u003e\n"],["\u003cp\u003eContext rules can specify required context types such as \u003ccode\u003egoogle.rpc.context.ProjectContext\u003c/code\u003e and \u003ccode\u003egoogle.rpc.context.OriginContext\u003c/code\u003e for various methods.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eContext\u003c/code\u003e class allows for allowlisting protobuf message extensions to be sent in gRPC metadata via specific formats like "x-goog-ext-<extension_id>-bin".\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of \u003ccode\u003eContext\u003c/code\u003e is 2.15.0, with older versions 2.10.0 and 2.2.0 also available.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eContext\u003c/code\u003e class inherits from object and implements interfaces like IMessage, IEquatable, IDeepCloneable, and IBufferMessage, providing methods for cloning, equality checking, and data manipulation.\u003c/p\u003e\n"]]],[],null,["# Class Context (2.17.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.17.0 (latest)](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.Context)\n- [2.15.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.15.0/Google.Api.Context)\n- [2.10.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.10.0/Google.Api.Context)\n- [2.2.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.2.0/Google.Api.Context) \n\n public sealed class Context : IMessage\u003cContext\u003e, IEquatable\u003cContext\u003e, IDeepCloneable\u003cContext\u003e, IBufferMessage, IMessage\n\n`Context` defines which contexts an API requests.\n\nExample: \n\n context:\n rules:\n - selector: \"*\"\n requested:\n - google.rpc.context.ProjectContext\n - google.rpc.context.OriginContext\n\nThe above specifies that all methods in the API request\n`google.rpc.context.ProjectContext` and\n`google.rpc.context.OriginContext`.\n\nAvailable context types are defined in package\n`google.rpc.context`.\n\nThis also provides mechanism to allowlist any protobuf message extension that\ncan be sent in grpc metadata using \"x-goog-ext-\\\u003cextension_id\\\u003e-bin\" and\n\"x-goog-ext-\\\u003cextension_id\\\u003e-jspb\" format. For example, list any service\nspecific protobuf types that can appear in grpc metadata as follows in your\nyaml file:\n\nExample: \n\n context:\n rules:\n - selector: \"google.example.library.v1.LibraryService.CreateBook\"\n allowed_request_extensions:\n - google.foo.v1.NewExtension\n allowed_response_extensions:\n - google.foo.v1.NewExtension\n\nYou can also specify extension ID instead of fully qualified extension name\nhere. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e Context \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[Context](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.Context), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Context](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.Context), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[Context](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.Context), [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### Context()\n\n public Context()\n\n### Context(Context)\n\n public Context(Context other)\n\nFields\n------\n\n### RulesFieldNumber\n\n public const int RulesFieldNumber = 1\n\nField number for the \"rules\" field.\n\nProperties\n----------\n\n### Descriptor\n\n public static MessageDescriptor Descriptor { get; }\n\n### Parser\n\n public static MessageParser\u003cContext\u003e Parser { get; }\n\n### Rules\n\n public RepeatedField\u003cContextRule\u003e Rules { get; }\n\nA list of RPC context rules that apply to individual API methods.\n\n**NOTE:** All service configuration rules follow \"last one wins\" order.\n\nMethods\n-------\n\n### CalculateSize()\n\n public int CalculateSize()\n\n### Clone()\n\n public Context Clone()\n\n### Equals(Context)\n\n public bool Equals(Context 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(Context)\n\n public void MergeFrom(Context 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)"]]