Struct google_api_proto::google::api::RoutingParameter
source · pub struct RoutingParameter {
pub field: String,
pub path_template: String,
}
Expand description
A projection from an input message to the GRPC or REST header.
Fields§
§field: String
A request field to extract the header key-value pair from.
path_template: String
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 matchinginstances/*
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.
Trait Implementations§
source§impl Clone for RoutingParameter
impl Clone for RoutingParameter
source§fn clone(&self) -> RoutingParameter
fn clone(&self) -> RoutingParameter
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for RoutingParameter
impl Debug for RoutingParameter
source§impl Default for RoutingParameter
impl Default for RoutingParameter
source§impl Message for RoutingParameter
impl Message for RoutingParameter
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moresource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.source§impl PartialEq for RoutingParameter
impl PartialEq for RoutingParameter
source§fn eq(&self, other: &RoutingParameter) -> bool
fn eq(&self, other: &RoutingParameter) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for RoutingParameter
Auto Trait Implementations§
impl Freeze for RoutingParameter
impl RefUnwindSafe for RoutingParameter
impl Send for RoutingParameter
impl Sync for RoutingParameter
impl Unpin for RoutingParameter
impl UnwindSafe for RoutingParameter
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request