Show / Hide Table of Contents

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
Implements
IMessage<Context>
IMessage
System.IEquatable<Context>
IDeepCloneable<Context>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Google.Api
Assembly: Google.Api.CommonProtos.dll
Syntax
public sealed class Context : IMessage<Context>, IMessage, IEquatable<Context>, IDeepCloneable<Context>

Constructors

Context()

Declaration
public Context()

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
Type Description
MessageDescriptor

Parser

Declaration
public static MessageParser<Context> Parser { get; }
Property Value
Type Description
MessageParser<Context>

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
Type Description
RepeatedField<ContextRule>

Methods

CalculateSize()

Declaration
public int CalculateSize()
Returns
Type Description
System.Int32
Implements
IMessage.CalculateSize()

Clone()

Declaration
public Context Clone()
Returns
Type Description
Context
Implements
IDeepCloneable<T>.Clone()

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
IMessage<T>.MergeFrom(T)

MergeFrom(CodedInputStream)

Declaration
public void MergeFrom(CodedInputStream input)
Parameters
Type Name Description
CodedInputStream input
Implements
IMessage.MergeFrom(CodedInputStream)

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

WriteTo(CodedOutputStream)

Declaration
public void WriteTo(CodedOutputStream output)
Parameters
Type Name Description
CodedOutputStream output
Implements
IMessage.WriteTo(CodedOutputStream)

Explicit Interface Implementations

IMessage.Descriptor

Declaration
MessageDescriptor IMessage.Descriptor { get; }
Returns
Type Description
MessageDescriptor
Implements
IMessage.Descriptor
Back to top