Class RoutingParameter (2.15.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
Name Description
other RoutingParameter

Fields

FieldFieldNumber

public const int FieldFieldNumber = 1

Field number for the "field" field.

Field Value
Type Description
int

PathTemplateFieldNumber

public const int PathTemplateFieldNumber = 2

Field number for the "path_template" field.

Field Value
Type Description
int

Properties

Descriptor

public static MessageDescriptor Descriptor { get; }
Property Value
Type Description
MessageDescriptor

Field

public string Field { get; set; }

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

Property Value
Type Description
string

Parser

public static MessageParser<RoutingParameter> Parser { get; }
Property Value
Type Description
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
Type Description
string

Methods

CalculateSize()

public int CalculateSize()

Calculates the size of this message in Protocol Buffer wire format, in bytes.

Returns
Type Description
int

The number of bytes required to write this message to a coded output stream.

Clone()

public RoutingParameter Clone()

Creates a deep clone of this object.

Returns
Type Description
RoutingParameter

A deep clone of this object.

Equals(RoutingParameter)

public bool Equals(RoutingParameter other)
Parameter
Name Description
other RoutingParameter
Returns
Type Description
bool

Equals(object)

public override bool Equals(object other)
Parameter
Name Description
other object
Returns
Type Description
bool
Overrides

GetHashCode()

public override int GetHashCode()
Returns
Type Description
int
Overrides

MergeFrom(RoutingParameter)

public void MergeFrom(RoutingParameter other)

Merges the given message into this one.

Parameter
Name Description
other RoutingParameter
Remarks

See the user guide for precise merge semantics.

MergeFrom(CodedInputStream)

public void MergeFrom(CodedInputStream input)

Merges the data from the specified coded input stream with the current message.

Parameter
Name Description
input CodedInputStream
Remarks

See the user guide for precise merge semantics.

ToString()

public override string ToString()
Returns
Type Description
string
Overrides

WriteTo(CodedOutputStream)

public void WriteTo(CodedOutputStream output)

Writes the data to the given coded output stream.

Parameter
Name Description
output CodedOutputStream

Coded output stream to write the data to. Must not be null.