| 1 |
syntax = "proto3"; |
| 2 |
|
| 3 |
package xds.core.v3; |
| 4 |
|
| 5 |
import "xds/annotations/v3/status.proto"; |
| 6 |
import "xds/core/v3/context_params.proto"; |
| 7 |
|
| 8 |
import "validate/validate.proto"; |
| 9 |
|
| 10 |
option java_outer_classname = "ResourceLocatorProto"; |
| 11 |
option java_multiple_files = true; |
| 12 |
option java_package = "com.github.xds.core.v3"; |
| 13 |
option go_package = "github.com/cncf/xds/go/xds/core/v3"; |
| 14 |
|
| 15 |
option (xds.annotations.v3.file_status).work_in_progress = true; |
| 16 |
|
| 17 |
// xDS resource locators identify a xDS resource name and instruct the |
| 18 |
// data-plane load balancer on how the resource may be located. |
| 19 |
// |
| 20 |
// Resource locators have a canonical xdstp:// URI representation: |
| 21 |
// |
| 22 |
// xdstp://{authority}/{type_url}/{id}?{context_params}{#directive,*} |
| 23 |
// |
| 24 |
// where context_params take the form of URI query parameters. |
| 25 |
// |
| 26 |
// Resource locators have a similar canonical http:// URI representation: |
| 27 |
// |
| 28 |
// http://{authority}/{type_url}/{id}?{context_params}{#directive,*} |
| 29 |
// |
| 30 |
// Resource locators also have a simplified file:// URI representation: |
| 31 |
// |
| 32 |
// file:///{id}{#directive,*} |
| 33 |
// |
| 34 |
message ResourceLocator { |
| 35 |
enum Scheme { |
| 36 |
XDSTP = 0; |
| 37 |
HTTP = 1; |
| 38 |
FILE = 2; |
| 39 |
} |
| 40 |
|
| 41 |
// URI scheme. |
| 42 |
Scheme scheme = 1 [(validate.rules).enum = {defined_only: true}]; |
| 43 |
|
| 44 |
// Opaque identifier for the resource. Any '/' will not be escaped during URI |
| 45 |
// encoding and will form part of the URI path. This may end |
| 46 |
// with ‘*’ for glob collection references. |
| 47 |
string id = 2; |
| 48 |
|
| 49 |
// Logical authority for resource (not necessarily transport network address). |
| 50 |
// Authorities are opaque in the xDS API, data-plane load balancers will map |
| 51 |
// them to concrete network transports such as an xDS management server, e.g. |
| 52 |
// via envoy.config.core.v3.ConfigSource. |
| 53 |
string authority = 3; |
| 54 |
|
| 55 |
// Fully qualified resource type (as in type URL without types.googleapis.com/ |
| 56 |
// prefix). |
| 57 |
string resource_type = 4 [(validate.rules).string = {min_len: 1}]; |
| 58 |
|
| 59 |
oneof context_param_specifier { |
| 60 |
// Additional parameters that can be used to select resource variants. |
| 61 |
// Matches must be exact, i.e. all context parameters must match exactly and |
| 62 |
// there must be no additional context parameters set on the matched |
| 63 |
// resource. |
| 64 |
ContextParams exact_context = 5; |
| 65 |
|
| 66 |
// .. space reserved for future potential matchers, e.g. CEL expressions. |
| 67 |
} |
| 68 |
|
| 69 |
// Directives provide information to data-plane load balancers on how xDS |
| 70 |
// resource names are to be interpreted and potentially further resolved. For |
| 71 |
// example, they may provide alternative resource locators for when primary |
| 72 |
// resolution fails. Directives are not part of resource names and do not |
| 73 |
// appear in a xDS transport discovery request. |
| 74 |
// |
| 75 |
// When encoding to URIs, directives take the form: |
| 76 |
// |
| 77 |
// <directive name>=<string representation of directive value> |
| 78 |
// |
| 79 |
// For example, we can have alt=xdstp://foo/bar or entry=some%20thing. Each |
| 80 |
// directive value type may have its own string encoding, in the case of |
| 81 |
// ResourceLocator there is a recursive URI encoding. |
| 82 |
// |
| 83 |
// Percent encoding applies to the URI encoding of the directive value. |
| 84 |
// Multiple directives are comma-separated, so the reserved characters that |
| 85 |
// require percent encoding in a directive value are [',', '#', '[', ']', |
| 86 |
// '%']. These are the RFC3986 fragment reserved characters with the addition |
| 87 |
// of the xDS scheme specific ','. See |
| 88 |
// https://tools.ietf.org/html/rfc3986#page-49 for further details on URI ABNF |
| 89 |
// and reserved characters. |
| 90 |
message Directive { |
| 91 |
oneof directive { |
| 92 |
option (validate.required) = true; |
| 93 |
|
| 94 |
// An alternative resource locator for fallback if the resource is |
| 95 |
// unavailable. For example, take the resource locator: |
| 96 |
// |
| 97 |
// xdstp://foo/some-type/some-route-table#alt=xdstp://bar/some-type/another-route-table |
| 98 |
// |
| 99 |
// If the data-plane load balancer is unable to reach `foo` to fetch the |
| 100 |
// resource, it will fallback to `bar`. Alternative resources do not need |
| 101 |
// to have equivalent content, but they should be functional substitutes. |
| 102 |
ResourceLocator alt = 1; |
| 103 |
|
| 104 |
// List collections support inlining of resources via the entry field in |
| 105 |
// Resource. These inlined Resource objects may have an optional name |
| 106 |
// field specified. When specified, the entry directive allows |
| 107 |
// ResourceLocator to directly reference these inlined resources, e.g. |
| 108 |
// xdstp://.../foo#entry=bar. |
| 109 |
string entry = 2 [(validate.rules).string = {min_len: 1, pattern: "^[0-9a-zA-Z_\\-\\./~:]+$"}]; |
| 110 |
} |
| 111 |
} |
| 112 |
|
| 113 |
// A list of directives that appear in the xDS resource locator #fragment. |
| 114 |
// |
| 115 |
// When encoding to URI form, directives are percent encoded with comma |
| 116 |
// separation. |
| 117 |
repeated Directive directives = 6; |
| 118 |
} |