Class Context
Context
defines which contexts an API requests.
Example:
context:
rules:
- selector: "*"
requested:
- google.rpc.context.ProjectContext
- google.rpc.context.OriginContext
The above specifies that all methods in the API request
google.rpc.context.ProjectContext
and
google.rpc.context.OriginContext
.
Available context types are defined in package
google.rpc.context
.
This also provides mechanism to whitelist 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:
Example:
context:
rules:
- selector: "google.example.library.v1.LibraryService.CreateBook"
allowed_request_extensions:
- google.foo.v1.NewExtension
allowed_response_extensions:
- google.foo.v1.NewExtension
You can also specify extension ID instead of fully qualified extension name
here.
Inheritance
System.Object
Context
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: Google.Api.CommonProtos.dll
Syntax
public sealed class Context : IMessage<Context>, IMessage, IEquatable<Context>, IDeepCloneable<Context>
Constructors
Context()
Declaration
Context(Context)
Declaration
public Context(Context other)
Parameters
Type |
Name |
Description |
Context |
other |
|
Fields
RulesFieldNumber
Field number for the "rules" field.
Declaration
public const int RulesFieldNumber = 1
Field Value
Type |
Description |
System.Int32 |
|
Properties
Descriptor
Declaration
public static MessageDescriptor Descriptor { get; }
Property Value
Parser
Declaration
public static MessageParser<Context> Parser { get; }
Property Value
Rules
A list of RPC context rules that apply to individual API methods.
NOTE: All service configuration rules follow "last one wins" order.
Declaration
public RepeatedField<ContextRule> Rules { get; }
Property Value
Methods
CalculateSize()
Declaration
public int CalculateSize()
Returns
Type |
Description |
System.Int32 |
|
Implements
Clone()
Declaration
Returns
Implements
Equals(Context)
Declaration
public bool Equals(Context other)
Parameters
Type |
Name |
Description |
Context |
other |
|
Returns
Type |
Description |
System.Boolean |
|
Implements
System.IEquatable<T>.Equals(T)
Equals(Object)
Declaration
public override bool Equals(object other)
Parameters
Type |
Name |
Description |
System.Object |
other |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
System.Object.Equals(System.Object)
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.Object.GetHashCode()
MergeFrom(Context)
Declaration
public void MergeFrom(Context other)
Parameters
Type |
Name |
Description |
Context |
other |
|
Implements
MergeFrom(CodedInputStream)
Declaration
public void MergeFrom(CodedInputStream input)
Parameters
Implements
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Overrides
System.Object.ToString()
WriteTo(CodedOutputStream)
Declaration
public void WriteTo(CodedOutputStream output)
Parameters
Implements
Explicit Interface Implementations
IMessage.Descriptor
Declaration
MessageDescriptor IMessage.Descriptor { get; }
Returns
Implements