pub struct GrpcJsonTranscoder {Show 15 fields
pub services: Vec<String>,
pub print_options: Option<PrintOptions>,
pub match_incoming_request_route: bool,
pub ignored_query_parameters: Vec<String>,
pub auto_mapping: bool,
pub ignore_unknown_query_parameters: bool,
pub convert_grpc_status: bool,
pub url_unescape_spec: i32,
pub query_param_unescape_plus: bool,
pub match_unregistered_custom_verb: bool,
pub request_validation_options: Option<RequestValidationOptions>,
pub case_insensitive_enum_parsing: bool,
pub max_request_body_size: Option<UInt32Value>,
pub max_response_body_size: Option<UInt32Value>,
pub descriptor_set: Option<DescriptorSet>,
}Expand description
[#next-free-field: 17] GrpcJsonTranscoder filter configuration. The filter itself can be used per route / per virtual host or on the general level. The most specific one is being used for a given route. If the list of services is empty - filter is considered to be disabled. Note that if specifying the filter per route, first the route is matched, and then transcoding filter is applied. It matters when specifying the route configuration and paths to match the request - for per-route grpc transcoder configs, the original path should be matched, while in other cases, the grpc-like path is expected (the one AFTER the filter is applied).
Fields§
§services: Vec<String>A list of strings that
supplies the fully qualified service names (i.e. “package_name.service_name”) that
the transcoder will translate. If the service name doesn’t exist in proto_descriptor,
Envoy will fail at startup. The proto_descriptor may contain more services than
the service names specified here, but they won’t be translated.
By default, the filter will pass through requests that do not map to any specified services.
If the list of services is empty, filter is considered disabled.
However, this behavior changes if
:ref:reject_unknown_method <envoy_v3_api_field_extensions.filters.http.grpc_json_transcoder.v3.GrpcJsonTranscoder.RequestValidationOptions.reject_unknown_method>
is enabled.
print_options: Option<PrintOptions>Control options for response JSON. These options are passed directly to
JsonPrintOptions <<https://developers.google.com/protocol-buffers/docs/reference/cpp/> google.protobuf.util.json_util#JsonPrintOptions>_.
match_incoming_request_route: boolWhether to keep the incoming request route after the outgoing headers have been transformed to
the match the upstream gRPC service. Note: This means that routes for gRPC services that are
not transcoded cannot be used in combination with match_incoming_request_route.
ignored_query_parameters: Vec<String>A list of query parameters to be ignored for transcoding method mapping. By default, the transcoder filter will not transcode a request if there are any unknown/invalid query parameters.
Example :
.. code-block:: proto
service Bookstore {
rpc GetShelf(GetShelfRequest) returns (Shelf) {
option (google.api.http) = {
get: "/shelves/{shelf}"
};
}
}
message GetShelfRequest {
int64 shelf = 1;
}
message Shelf {}The request /shelves/100?foo=bar will not be mapped to GetShelf``` because variable binding for foois not defined. Addingfootoignored_query_parameterswill allow the same request to be mapped toGetShelf``.
auto_mapping: boolWhether to route methods without the google.api.http option.
Example :
.. code-block:: proto
package bookstore;
service Bookstore {
rpc GetShelf(GetShelfRequest) returns (Shelf) {}
}
message GetShelfRequest {
int64 shelf = 1;
}
message Shelf {}The client could post a json body {"shelf": 1234} with the path of
/bookstore.Bookstore/GetShelfRequest to call GetShelfRequest.
ignore_unknown_query_parameters: boolWhether to ignore query parameters that cannot be mapped to a corresponding
protobuf field. Use this if you cannot control the query parameters and do
not know them beforehand. Otherwise use ignored_query_parameters.
Defaults to false.
convert_grpc_status: boolWhether to convert gRPC status headers to JSON.
When trailer indicates a gRPC error and there was no HTTP body, take google.rpc.Status
from the grpc-status-details-bin header and use it as JSON body.
If there was no such header, make google.rpc.Status out of the grpc-status and
grpc-message headers.
The error details types must be present in the proto_descriptor.
For example, if an upstream server replies with headers:
.. code-block:: none
grpc-status: 5
grpc-status-details-bin:
CAUaMwoqdHlwZS5nb29nbGVhcGlzLmNvbS9nb29nbGUucnBjLlJlcXVlc3RJbmZvEgUKA3ItMQThe grpc-status-details-bin header contains a base64-encoded protobuf message
google.rpc.Status. It will be transcoded into:
.. code-block:: none
HTTP/1.1 404 Not Found
content-type: application/json
{"code":5,"details":\[{"@type":"type.googleapis.com/google.rpc.RequestInfo","requestId":"r-1"}\]}In order to transcode the message, the google.rpc.RequestInfo type from
the google/rpc/error_details.proto should be included in the configured
:ref:proto descriptor set <config_grpc_json_generate_proto_descriptor_set>.
url_unescape_spec: i32URL unescaping policy.
This spec is only applied when extracting variable with multiple segments in the URL path.
For example, in case of /foo/{x=*}/bar/{y=prefix/*}/{z=**} x variable is single segment and y and z are multiple segments.
For a path with /foo/first/bar/prefix/second/third/fourth, x=first, y=prefix/second, z=third/fourth.
If this setting is not specified, the value defaults to :ref:ALL_CHARACTERS_EXCEPT_RESERVED<envoy_v3_api_enum_value_extensions.filters.http.grpc_json_transcoder.v3.GrpcJsonTranscoder.UrlUnescapeSpec.ALL_CHARACTERS_EXCEPT_RESERVED>.
query_param_unescape_plus: boolIf true, unescape ‘+’ to space when extracting variables in query parameters.
This is to support HTML 2.0 <<https://tools.ietf.org/html/rfc1866#section-8.2.1>_>
match_unregistered_custom_verb: boolIf true, try to match the custom verb even if it is unregistered. By default, only match when it is registered.
According to the http template syntax <<https://github.com/googleapis/googleapis/blob/master/google/api/http.proto#L226-L231>_,>
the custom verb is “:” LITERAL at the end of http template.
For a request with /foo/bar:baz and :baz is not registered in any url_template, here is the behavior change
- if the field is not set,
:bazwill not be treated as custom verb, so it will match/foo/{x=*}. - if the field is set,
:bazis treated as custom verb, so it will NOT match/foo/{x=*}since the template doesn’t use any custom verb.
request_validation_options: Option<RequestValidationOptions>Configure the behavior when handling requests that cannot be transcoded.
By default, the transcoder will silently pass through HTTP requests that are malformed. This includes requests with unknown query parameters, unregister paths, etc.
Set these options to enable strict HTTP request validation, resulting in the transcoder rejecting
such requests with a HTTP 4xx. See each individual option for more details on the validation.
gRPC requests will still silently pass through without transcoding.
The benefit is a proper error message to the downstream.
If the upstream is a gRPC server, it cannot handle the passed-through HTTP requests and will reset
the TCP connection. The downstream will then
receive a HTTP 503 Service Unavailable due to the upstream connection reset.
This incorrect error message may conflict with other Envoy components, such as retry policies.
case_insensitive_enum_parsing: boolProto enum values are supposed to be in upper cases when used in JSON. Set this to true if your JSON request uses non uppercase enum values.
max_request_body_size: Option<UInt32Value>The maximum size of a request body to be transcoded, in bytes. A body exceeding this size will
provoke a HTTP 413 Request Entity Too Large response.
Large values may cause envoy to use a lot of memory if there are many concurrent requests.
If unset, the current stream buffer size is used.
max_response_body_size: Option<UInt32Value>The maximum size of a response body to be transcoded, in bytes. A body exceeding this size will
provoke a HTTP 500 Internal Server Error response.
Large values may cause envoy to use a lot of memory if there are many concurrent requests.
If unset, the current stream buffer size is used.
descriptor_set: Option<DescriptorSet>Implementations§
Source§impl GrpcJsonTranscoder
impl GrpcJsonTranscoder
Sourcepub fn url_unescape_spec(&self) -> UrlUnescapeSpec
pub fn url_unescape_spec(&self) -> UrlUnescapeSpec
Returns the enum value of url_unescape_spec, or the default if the field is set to an invalid enum value.
Sourcepub fn set_url_unescape_spec(&mut self, value: UrlUnescapeSpec)
pub fn set_url_unescape_spec(&mut self, value: UrlUnescapeSpec)
Sets url_unescape_spec to the provided enum value.
Trait Implementations§
Source§impl Clone for GrpcJsonTranscoder
impl Clone for GrpcJsonTranscoder
Source§fn clone(&self) -> GrpcJsonTranscoder
fn clone(&self) -> GrpcJsonTranscoder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GrpcJsonTranscoder
impl Debug for GrpcJsonTranscoder
Source§impl Default for GrpcJsonTranscoder
impl Default for GrpcJsonTranscoder
§impl<'de> Deserialize<'de> for GrpcJsonTranscoder
impl<'de> Deserialize<'de> for GrpcJsonTranscoder
§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Message for GrpcJsonTranscoder
impl Message for GrpcJsonTranscoder
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
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<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
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<B>(buf: B) -> Result<Self, DecodeError>
fn decode<B>(buf: B) -> Result<Self, DecodeError>
Source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
Source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
self. Read moreSource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
self.Source§impl PartialEq for GrpcJsonTranscoder
impl PartialEq for GrpcJsonTranscoder
§impl Serialize for GrpcJsonTranscoder
impl Serialize for GrpcJsonTranscoder
impl StructuralPartialEq for GrpcJsonTranscoder
Auto Trait Implementations§
impl !Freeze for GrpcJsonTranscoder
impl RefUnwindSafe for GrpcJsonTranscoder
impl Send for GrpcJsonTranscoder
impl Sync for GrpcJsonTranscoder
impl Unpin for GrpcJsonTranscoder
impl UnwindSafe for GrpcJsonTranscoder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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