/
metadata.proto
114 lines (94 loc) · 3.57 KB
/
metadata.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
syntax = "proto3";
package envoy.type.metadata.v3;
import "udpa/annotations/status.proto";
import "udpa/annotations/versioning.proto";
import "validate/validate.proto";
option java_package = "io.envoyproxy.envoy.type.metadata.v3";
option java_outer_classname = "MetadataProto";
option java_multiple_files = true;
option (udpa.annotations.file_status).package_version_status = ACTIVE;
// [#protodoc-title: Metadata]
// MetadataKey provides a general interface using `key` and `path` to retrieve value from
// :ref:`Metadata <envoy_api_msg_config.core.v3.Metadata>`.
//
// For example, for the following Metadata:
//
// .. code-block:: yaml
//
// filter_metadata:
// envoy.xxx:
// prop:
// foo: bar
// xyz:
// hello: envoy
//
// The following MetadataKey will retrieve a string value "bar" from the Metadata.
//
// .. code-block:: yaml
//
// key: envoy.xxx
// path:
// - key: prop
// - key: foo
//
message MetadataKey {
option (udpa.annotations.versioning).previous_message_type = "envoy.type.metadata.v2.MetadataKey";
// Specifies the segment in a path to retrieve value from Metadata.
// Currently it is only supported to specify the key, i.e. field name, as one segment of a path.
message PathSegment {
option (udpa.annotations.versioning).previous_message_type =
"envoy.type.metadata.v2.MetadataKey.PathSegment";
oneof segment {
option (validate.required) = true;
// If specified, use the key to retrieve the value in a Struct.
string key = 1 [(validate.rules).string = {min_len: 1}];
}
}
// The key name of Metadata to retrieve the Struct from the metadata.
// Typically, it represents a builtin subsystem or custom extension.
string key = 1 [(validate.rules).string = {min_len: 1}];
// The path to retrieve the Value from the Struct. It can be a prefix or a full path,
// e.g. ``[prop, xyz]`` for a struct or ``[prop, foo]`` for a string in the example,
// which depends on the particular scenario.
//
// Note: Due to that only the key type segment is supported, the path can not specify a list
// unless the list is the last segment.
repeated PathSegment path = 2 [(validate.rules).repeated = {min_items: 1}];
}
// Describes what kind of metadata.
message MetadataKind {
option (udpa.annotations.versioning).previous_message_type =
"envoy.type.metadata.v2.MetadataKind";
// Represents dynamic metadata associated with the request.
message Request {
option (udpa.annotations.versioning).previous_message_type =
"envoy.type.metadata.v2.MetadataKind.Request";
}
// Represents metadata from :ref:`the route<envoy_api_field_config.route.v3.Route.metadata>`.
message Route {
option (udpa.annotations.versioning).previous_message_type =
"envoy.type.metadata.v2.MetadataKind.Route";
}
// Represents metadata from :ref:`the upstream cluster<envoy_api_field_config.cluster.v3.Cluster.metadata>`.
message Cluster {
option (udpa.annotations.versioning).previous_message_type =
"envoy.type.metadata.v2.MetadataKind.Cluster";
}
// Represents metadata from :ref:`the upstream
// host<envoy_api_field_config.endpoint.v3.LbEndpoint.metadata>`.
message Host {
option (udpa.annotations.versioning).previous_message_type =
"envoy.type.metadata.v2.MetadataKind.Host";
}
oneof kind {
option (validate.required) = true;
// Request kind of metadata.
Request request = 1;
// Route kind of metadata.
Route route = 2;
// Cluster kind of metadata.
Cluster cluster = 3;
// Host kind of metadata.
Host host = 4;
}
}