OLD | NEW |
1 // Copyright 2015 The Swarming Authors. All rights reserved. | 1 // Copyright 2015 The Swarming Authors. All rights reserved. |
2 // Use of this source code is governed by the Apache v2.0 license that can be | 2 // Use of this source code is governed by the Apache v2.0 license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Schemas for config files in services/luci-config config set. | 5 // Schemas for config files in services/luci-config config set. |
6 // | 6 // |
7 // In this file, "string pattern" is an exact string (can't have a colon) or a | 7 // In this file, "string pattern" is an exact string (can't have a colon) or a |
8 // string that starts with "regex:", followed by a regular expression. In case | 8 // string that starts with "regex:", followed by a regular expression. In case |
9 // of regex, the pattern must match an entire string, as if it was sorrounded by | 9 // of regex, the pattern must match an entire string, as if it was sorrounded by |
10 // ^ and $. | 10 // ^ and $. |
(...skipping 29 matching lines...) Expand all Loading... |
40 // Where to import "projects/<id>" config set from. | 40 // Where to import "projects/<id>" config set from. |
41 optional ConfigSetLocation config_location = 2; | 41 optional ConfigSetLocation config_location = 2; |
42 } | 42 } |
43 | 43 |
44 // Schema of projects.cfg file. Represents luci tenants registry. | 44 // Schema of projects.cfg file. Represents luci tenants registry. |
45 message ProjectsCfg { | 45 message ProjectsCfg { |
46 // All projects served by this instance of Luci. | 46 // All projects served by this instance of Luci. |
47 repeated Project projects = 1; | 47 repeated Project projects = 1; |
48 } | 48 } |
49 | 49 |
| 50 /******************************************************************************/ |
| 51 /* Services */ |
| 52 /******************************************************************************/ |
| 53 |
| 54 // Describes one luci service. |
| 55 message Service { |
| 56 // Globally unique id of the service. Required. |
| 57 // Used in "services/<service_id>" config set name. |
| 58 optional string id = 1; |
| 59 // Email addresses of responsible and point-of-contacts for the service. |
| 60 repeated string owners = 2; |
| 61 // Where to import "services/<id>" config set from. If config_location.url is |
| 62 // relative, it is relative to the current configuration file. |
| 63 // If not specified, defaults to "../<id>/". |
| 64 optional ConfigSetLocation config_location = 3; |
| 65 // An HTTPS endpoint that returns JSON-encoded ServiceDynamicMetadata in body. |
| 66 optional string metadata_url = 4; |
| 67 } |
| 68 |
| 69 // Machine-generated service metadata. |
| 70 message ServiceDynamicMetadata { |
| 71 // What configs this service can validate and how to validate them. |
| 72 optional Validator validation = 1; |
| 73 } |
| 74 |
| 75 // Schema of services.cfg |
| 76 message ServicesCfg { |
| 77 // A list of all luci services. Should be sorted by id. |
| 78 repeated Service services = 1; |
| 79 } |
| 80 |
| 81 /******************************************************************************/ |
| 82 /* Misc */ |
| 83 /******************************************************************************/ |
| 84 |
| 85 |
50 // Schema of acl.cfg file. | 86 // Schema of acl.cfg file. |
51 message AclCfg { | 87 message AclCfg { |
52 // Name of the group that has access to all services/* config sets. | 88 // Name of the group that has access to all services/* config sets. |
53 optional string service_access_group = 1; | 89 optional string service_access_group = 1; |
54 // Name of the group that has access to all projects/* config sets. | 90 // Name of the group that has access to all projects/* config sets. |
55 optional string project_access_group = 2; | 91 optional string project_access_group = 2; |
56 } | 92 } |
57 | 93 |
58 // Schema for import.cfg. It specified how to import configuration files from | 94 // Schema for import.cfg. It specified how to import configuration files from |
59 // external sources. | 95 // external sources. |
(...skipping 29 matching lines...) Expand all Loading... |
89 } | 125 } |
90 // List of known schemas. They are available at /schemas/<name> as a short | 126 // List of known schemas. They are available at /schemas/<name> as a short |
91 // mutable link. | 127 // mutable link. |
92 repeated Schema schemas = 1; | 128 repeated Schema schemas = 1; |
93 } | 129 } |
94 | 130 |
95 /******************************************************************************/ | 131 /******************************************************************************/ |
96 /* Validation */ | 132 /* Validation */ |
97 /******************************************************************************/ | 133 /******************************************************************************/ |
98 | 134 |
99 // Schema of validation.cfg | 135 // Defines a pattern of a config identity. Both config_set and path must |
100 message ValidationCfg { | 136 // match. |
101 // Defines one validation rule. It can match configs in different config-sets | 137 message ConfigPattern { |
102 // and paths. | 138 // A string pattern for config_set. |
103 message Rule { | 139 optional string config_set = 1; |
104 // A string pattern (see above) for config_set. | 140 // A string pattern for config file path. |
105 optional string config_set = 1; | 141 optional string path = 2; |
106 // A string pattern (see above) for config file path. | |
107 optional string path = 2; | |
108 // URL of a validation endpoint. The config service will send an HTTP POST | |
109 // request to the endpoint, where body is JSON-encoded | |
110 // ValidationRequestMessage. The endpoint is expected to respond with | |
111 // HTTP status 200 and JSON-encoded ValidationResponseMessage. | |
112 optional string url = 3; | |
113 } | |
114 | |
115 // Defines validation rules for externally-validated configs. | |
116 // All rules that match a config by config_set and path must pass in order | |
117 // for a config to be considered valid. | |
118 repeated Rule rules = 1; | |
119 } | 142 } |
120 | 143 |
| 144 // Describes what configuration can be validated and how to validate them. |
| 145 message Validator { |
| 146 // A list of configuration patterns that this validator can validate. |
| 147 repeated ConfigPattern patterns = 1; |
| 148 // URL of a validation endpoint. The config service will send an HTTP POST |
| 149 // request to the endpoint, where body is JSON-encoded |
| 150 // ValidationRequestMessage. The endpoint is expected to respond with |
| 151 // HTTP status 200 and JSON-encoded ValidationResponseMessage. |
| 152 optional string url = 2; |
| 153 } |
121 | 154 |
122 // This message is used only in JSON form. It is sent as request body to an | 155 // This message is used only in JSON form. It is sent as request body to an |
123 // external validation endpoint in order to validate a config. | 156 // external validation endpoint in order to validate a config. |
124 message ValidationRequestMessage { | 157 message ValidationRequestMessage { |
125 // Config set of the config file to validate. | 158 // Config set of the config file to validate. |
126 optional string config_set = 1; | 159 optional string config_set = 1; |
127 // Path of the config file to validate. | 160 // Path of the config file to validate. |
128 optional string path = 2; | 161 optional string path = 2; |
129 // Base64-encoded contents of the file. | 162 // Base64-encoded contents of the file. |
130 optional string content = 3; | 163 optional string content = 3; |
(...skipping 14 matching lines...) Expand all Loading... |
145 message Message { | 178 message Message { |
146 // Textual representation of the message. | 179 // Textual representation of the message. |
147 optional string text = 1; | 180 optional string text = 1; |
148 // If an error, a config is considered invalid. Defaults to INFO. | 181 // If an error, a config is considered invalid. Defaults to INFO. |
149 optional Severity severity = 2; | 182 optional Severity severity = 2; |
150 } | 183 } |
151 // Errors, warnings and other information found during validation. | 184 // Errors, warnings and other information found during validation. |
152 // If at least one error is found, the config is considered invalid. | 185 // If at least one error is found, the config is considered invalid. |
153 repeated Message messages = 1; | 186 repeated Message messages = 1; |
154 } | 187 } |
OLD | NEW |