Class RoutingParameter (2.10.0)

public sealed class RoutingParameter : IMessage<RoutingParameter>, IEquatable<RoutingParameter>, IDeepCloneable<RoutingParameter>, IBufferMessage, IMessage

A projection from an input message to the GRPC or REST header.

Inheritance

object > RoutingParameter

Namespace

Google.Api

Assembly

Google.Api.CommonProtos.dll

Constructors

RoutingParameter()

public RoutingParameter()

RoutingParameter(RoutingParameter)

public RoutingParameter(RoutingParameter other)
Parameter
NameDescription
otherRoutingParameter

Fields

FieldFieldNumber

public const int FieldFieldNumber = 1

Field number for the "field" field.

Field Value
TypeDescription
int

PathTemplateFieldNumber

public const int PathTemplateFieldNumber = 2

Field number for the "path_template" field.

Field Value
TypeDescription
int

Properties

Descriptor

public static MessageDescriptor Descriptor { get; }
Property Value
TypeDescription
MessageDescriptor

Field

public string Field { get; set; }

A request field to extract the header key-value pair from.

Property Value
TypeDescription
string

Parser

public static MessageParser<RoutingParameter> Parser { get; }
Property Value
TypeDescription
MessageParserRoutingParameter

PathTemplate

public string PathTemplate { get; set; }

A pattern matching the key-value field. Optional. If not specified, the whole field specified in the field field will be taken as value, and its name used as key. If specified, it MUST contain exactly one named segment (along with any number of unnamed segments) The pattern will be matched over the field specified in the field field, then if the match is successful:

  • the name of the single named segment will be used as a header name,
  • the match value of the segment will be used as a header value; if the match is NOT successful, nothing will be sent.

Example:

          -- This is a field in the request message
         |   that the header value will be extracted from.
         |
         |                     -- This is the key name in the
         |                    |   routing header.
         V                    |
field: "table_name"           v
path_template: "projects/*/{table_location=instances/*}/tables/*"
                                           ^            ^
                                           |            |
  In the {} brackets is the pattern that --             |
  specifies what to extract from the                    |
  field as a value to be sent.                          |
                                                        |
 The string in the field must match the whole pattern --
 before brackets, inside brackets, after brackets.

When looking at this specific example, we can see that:

  • A key-value pair with the key table_location and the value matching instances/* should be added to the x-goog-request-params routing header.
  • The value is extracted from the request message's table_name field if it matches the full pattern specified: projects/*/instances/*/tables/*.

NB: If the path_template field is not provided, the key name is equal to the field name, and the whole field should be sent as a value. This makes the pattern for the field and the value functionally equivalent to **, and the configuration

{
  field: "table_name"
}

is a functionally equivalent shorthand to:

{
  field: "table_name"
  path_template: "{table_name=**}"
}

See Example 1 for more details.

Property Value
TypeDescription
string

Methods

CalculateSize()

public int CalculateSize()
Returns
TypeDescription
int

Clone()

public RoutingParameter Clone()
Returns
TypeDescription
RoutingParameter

Equals(RoutingParameter)

public bool Equals(RoutingParameter other)
Parameter
NameDescription
otherRoutingParameter
Returns
TypeDescription
bool

Equals(object)

public override bool Equals(object other)
Parameter
NameDescription
otherobject
Returns
TypeDescription
bool
Overrides

GetHashCode()

public override int GetHashCode()
Returns
TypeDescription
int
Overrides

MergeFrom(RoutingParameter)

public void MergeFrom(RoutingParameter other)
Parameter
NameDescription
otherRoutingParameter

MergeFrom(CodedInputStream)

public void MergeFrom(CodedInputStream input)
Parameter
NameDescription
inputCodedInputStream

ToString()

public override string ToString()
Returns
TypeDescription
string
Overrides

WriteTo(CodedOutputStream)

public void WriteTo(CodedOutputStream output)
Parameter
NameDescription
outputCodedOutputStream