xref: /aosp_15_r20/external/grpc-grpc-java/xds/third_party/envoy/src/main/proto/envoy/api/v2/scoped_route.proto (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1syntax = "proto3";
2
3package envoy.api.v2;
4
5import "udpa/annotations/migrate.proto";
6import "udpa/annotations/status.proto";
7import "validate/validate.proto";
8
9option java_package = "io.envoyproxy.envoy.api.v2";
10option java_outer_classname = "ScopedRouteProto";
11option java_multiple_files = true;
12option go_package = "github.com/envoyproxy/go-control-plane/envoy/api/v2;apiv2";
13option (udpa.annotations.file_migrate).move_to_package = "envoy.config.route.v3";
14option (udpa.annotations.file_status).package_version_status = FROZEN;
15
16// [#protodoc-title: HTTP scoped routing configuration]
17// * Routing :ref:`architecture overview <arch_overview_http_routing>`
18
19// Specifies a routing scope, which associates a
20// :ref:`Key<envoy_api_msg_ScopedRouteConfiguration.Key>` to a
21// :ref:`envoy_api_msg_RouteConfiguration` (identified by its resource name).
22//
23// The HTTP connection manager builds up a table consisting of these Key to
24// RouteConfiguration mappings, and looks up the RouteConfiguration to use per
25// request according to the algorithm specified in the
26// :ref:`scope_key_builder<envoy_api_field_config.filter.network.http_connection_manager.v2.ScopedRoutes.scope_key_builder>`
27// assigned to the HttpConnectionManager.
28//
29// For example, with the following configurations (in YAML):
30//
31// HttpConnectionManager config:
32//
33// .. code::
34//
35//   ...
36//   scoped_routes:
37//     name: foo-scoped-routes
38//     scope_key_builder:
39//       fragments:
40//         - header_value_extractor:
41//             name: X-Route-Selector
42//             element_separator: ,
43//             element:
44//               separator: =
45//               key: vip
46//
47// ScopedRouteConfiguration resources (specified statically via
48// :ref:`scoped_route_configurations_list<envoy_api_field_config.filter.network.http_connection_manager.v2.ScopedRoutes.scoped_route_configurations_list>`
49// or obtained dynamically via SRDS):
50//
51// .. code::
52//
53//  (1)
54//   name: route-scope1
55//   route_configuration_name: route-config1
56//   key:
57//      fragments:
58//        - string_key: 172.10.10.20
59//
60//  (2)
61//   name: route-scope2
62//   route_configuration_name: route-config2
63//   key:
64//     fragments:
65//       - string_key: 172.20.20.30
66//
67// A request from a client such as:
68//
69// .. code::
70//
71//     GET / HTTP/1.1
72//     Host: foo.com
73//     X-Route-Selector: vip=172.10.10.20
74//
75// would result in the routing table defined by the `route-config1`
76// RouteConfiguration being assigned to the HTTP request/stream.
77//
78message ScopedRouteConfiguration {
79  // Specifies a key which is matched against the output of the
80  // :ref:`scope_key_builder<envoy_api_field_config.filter.network.http_connection_manager.v2.ScopedRoutes.scope_key_builder>`
81  // specified in the HttpConnectionManager. The matching is done per HTTP
82  // request and is dependent on the order of the fragments contained in the
83  // Key.
84  message Key {
85    message Fragment {
86      oneof type {
87        option (validate.required) = true;
88
89        // A string to match against.
90        string string_key = 1;
91      }
92    }
93
94    // The ordered set of fragments to match against. The order must match the
95    // fragments in the corresponding
96    // :ref:`scope_key_builder<envoy_api_field_config.filter.network.http_connection_manager.v2.ScopedRoutes.scope_key_builder>`.
97    repeated Fragment fragments = 1 [(validate.rules).repeated = {min_items: 1}];
98  }
99
100  // The name assigned to the routing scope.
101  string name = 1 [(validate.rules).string = {min_bytes: 1}];
102
103  // The resource name to use for a :ref:`envoy_api_msg_DiscoveryRequest` to an
104  // RDS server to fetch the :ref:`envoy_api_msg_RouteConfiguration` associated
105  // with this scope.
106  string route_configuration_name = 2 [(validate.rules).string = {min_bytes: 1}];
107
108  // The key to match against.
109  Key key = 3 [(validate.rules).message = {required: true}];
110}
111