app_yaml.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.appengine.v1;
  16. import "google/protobuf/duration.proto";
  17. option csharp_namespace = "Google.Cloud.AppEngine.V1";
  18. option go_package = "google.golang.org/genproto/googleapis/appengine/v1;appengine";
  19. option java_multiple_files = true;
  20. option java_outer_classname = "AppYamlProto";
  21. option java_package = "com.google.appengine.v1";
  22. option php_namespace = "Google\\Cloud\\AppEngine\\V1";
  23. option ruby_package = "Google::Cloud::AppEngine::V1";
  24. // [Google Cloud Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/)
  25. // configuration for API handlers.
  26. message ApiConfigHandler {
  27. // Action to take when users access resources that require
  28. // authentication. Defaults to `redirect`.
  29. AuthFailAction auth_fail_action = 1;
  30. // Level of login required to access this resource. Defaults to
  31. // `optional`.
  32. LoginRequirement login = 2;
  33. // Path to the script from the application root directory.
  34. string script = 3;
  35. // Security (HTTPS) enforcement for this URL.
  36. SecurityLevel security_level = 4;
  37. // URL to serve the endpoint at.
  38. string url = 5;
  39. }
  40. // Custom static error page to be served when an error occurs.
  41. message ErrorHandler {
  42. // Error codes.
  43. enum ErrorCode {
  44. option allow_alias = true;
  45. // Not specified. ERROR_CODE_DEFAULT is assumed.
  46. ERROR_CODE_UNSPECIFIED = 0;
  47. // All other error types.
  48. ERROR_CODE_DEFAULT = 0;
  49. // Application has exceeded a resource quota.
  50. ERROR_CODE_OVER_QUOTA = 1;
  51. // Client blocked by the application's Denial of Service protection
  52. // configuration.
  53. ERROR_CODE_DOS_API_DENIAL = 2;
  54. // Deadline reached before the application responds.
  55. ERROR_CODE_TIMEOUT = 3;
  56. }
  57. // Error condition this handler applies to.
  58. ErrorCode error_code = 1;
  59. // Static file content to be served for this error.
  60. string static_file = 2;
  61. // MIME type of file. Defaults to `text/html`.
  62. string mime_type = 3;
  63. }
  64. // URL pattern and description of how the URL should be handled. App Engine can
  65. // handle URLs by executing application code or by serving static files
  66. // uploaded with the version, such as images, CSS, or JavaScript.
  67. message UrlMap {
  68. // Redirect codes.
  69. enum RedirectHttpResponseCode {
  70. // Not specified. `302` is assumed.
  71. REDIRECT_HTTP_RESPONSE_CODE_UNSPECIFIED = 0;
  72. // `301 Moved Permanently` code.
  73. REDIRECT_HTTP_RESPONSE_CODE_301 = 1;
  74. // `302 Moved Temporarily` code.
  75. REDIRECT_HTTP_RESPONSE_CODE_302 = 2;
  76. // `303 See Other` code.
  77. REDIRECT_HTTP_RESPONSE_CODE_303 = 3;
  78. // `307 Temporary Redirect` code.
  79. REDIRECT_HTTP_RESPONSE_CODE_307 = 4;
  80. }
  81. // URL prefix. Uses regular expression syntax, which means regexp
  82. // special characters must be escaped, but should not contain groupings.
  83. // All URLs that begin with this prefix are handled by this handler, using the
  84. // portion of the URL after the prefix as part of the file path.
  85. string url_regex = 1;
  86. // Type of handler for this URL pattern.
  87. oneof handler_type {
  88. // Returns the contents of a file, such as an image, as the response.
  89. StaticFilesHandler static_files = 2;
  90. // Executes a script to handle the requests that match this URL
  91. // pattern. Only the `auto` value is supported for Node.js in the
  92. // App Engine standard environment, for example `"script": "auto"`.
  93. ScriptHandler script = 3;
  94. // Uses API Endpoints to handle requests.
  95. ApiEndpointHandler api_endpoint = 4;
  96. }
  97. // Security (HTTPS) enforcement for this URL.
  98. SecurityLevel security_level = 5;
  99. // Level of login required to access this resource. Not supported for Node.js
  100. // in the App Engine standard environment.
  101. LoginRequirement login = 6;
  102. // Action to take when users access resources that require
  103. // authentication. Defaults to `redirect`.
  104. AuthFailAction auth_fail_action = 7;
  105. // `30x` code to use when performing redirects for the `secure` field.
  106. // Defaults to `302`.
  107. RedirectHttpResponseCode redirect_http_response_code = 8;
  108. }
  109. // Files served directly to the user for a given URL, such as images, CSS
  110. // stylesheets, or JavaScript source files. Static file handlers describe which
  111. // files in the application directory are static files, and which URLs serve
  112. // them.
  113. message StaticFilesHandler {
  114. // Path to the static files matched by the URL pattern, from the
  115. // application root directory. The path can refer to text matched in groupings
  116. // in the URL pattern.
  117. string path = 1;
  118. // Regular expression that matches the file paths for all files that should be
  119. // referenced by this handler.
  120. string upload_path_regex = 2;
  121. // HTTP headers to use for all responses from these URLs.
  122. map<string, string> http_headers = 3;
  123. // MIME type used to serve all files served by this handler.
  124. //
  125. // Defaults to file-specific MIME types, which are derived from each file's
  126. // filename extension.
  127. string mime_type = 4;
  128. // Time a static file served by this handler should be cached
  129. // by web proxies and browsers.
  130. google.protobuf.Duration expiration = 5;
  131. // Whether this handler should match the request if the file
  132. // referenced by the handler does not exist.
  133. bool require_matching_file = 6;
  134. // Whether files should also be uploaded as code data. By default, files
  135. // declared in static file handlers are uploaded as static
  136. // data and are only served to end users; they cannot be read by the
  137. // application. If enabled, uploads are charged against both your code and
  138. // static data storage resource quotas.
  139. bool application_readable = 7;
  140. }
  141. // Executes a script to handle the request that matches the URL pattern.
  142. message ScriptHandler {
  143. // Path to the script from the application root directory.
  144. string script_path = 1;
  145. }
  146. // Uses Google Cloud Endpoints to handle requests.
  147. message ApiEndpointHandler {
  148. // Path to the script from the application root directory.
  149. string script_path = 1;
  150. }
  151. // Health checking configuration for VM instances. Unhealthy instances
  152. // are killed and replaced with new instances. Only applicable for
  153. // instances in App Engine flexible environment.
  154. message HealthCheck {
  155. // Whether to explicitly disable health checks for this instance.
  156. bool disable_health_check = 1;
  157. // Host header to send when performing an HTTP health check.
  158. // Example: "myapp.appspot.com"
  159. string host = 2;
  160. // Number of consecutive successful health checks required before receiving
  161. // traffic.
  162. uint32 healthy_threshold = 3;
  163. // Number of consecutive failed health checks required before removing
  164. // traffic.
  165. uint32 unhealthy_threshold = 4;
  166. // Number of consecutive failed health checks required before an instance is
  167. // restarted.
  168. uint32 restart_threshold = 5;
  169. // Interval between health checks.
  170. google.protobuf.Duration check_interval = 6;
  171. // Time before the health check is considered failed.
  172. google.protobuf.Duration timeout = 7;
  173. }
  174. // Readiness checking configuration for VM instances. Unhealthy instances
  175. // are removed from traffic rotation.
  176. message ReadinessCheck {
  177. // The request path.
  178. string path = 1;
  179. // Host header to send when performing a HTTP Readiness check.
  180. // Example: "myapp.appspot.com"
  181. string host = 2;
  182. // Number of consecutive failed checks required before removing
  183. // traffic.
  184. uint32 failure_threshold = 3;
  185. // Number of consecutive successful checks required before receiving
  186. // traffic.
  187. uint32 success_threshold = 4;
  188. // Interval between health checks.
  189. google.protobuf.Duration check_interval = 5;
  190. // Time before the check is considered failed.
  191. google.protobuf.Duration timeout = 6;
  192. // A maximum time limit on application initialization, measured from moment
  193. // the application successfully replies to a healthcheck until it is ready to
  194. // serve traffic.
  195. google.protobuf.Duration app_start_timeout = 7;
  196. }
  197. // Health checking configuration for VM instances. Unhealthy instances
  198. // are killed and replaced with new instances.
  199. message LivenessCheck {
  200. // The request path.
  201. string path = 1;
  202. // Host header to send when performing a HTTP Liveness check.
  203. // Example: "myapp.appspot.com"
  204. string host = 2;
  205. // Number of consecutive failed checks required before considering the
  206. // VM unhealthy.
  207. uint32 failure_threshold = 3;
  208. // Number of consecutive successful checks required before considering
  209. // the VM healthy.
  210. uint32 success_threshold = 4;
  211. // Interval between health checks.
  212. google.protobuf.Duration check_interval = 5;
  213. // Time before the check is considered failed.
  214. google.protobuf.Duration timeout = 6;
  215. // The initial delay before starting to execute the checks.
  216. google.protobuf.Duration initial_delay = 7;
  217. }
  218. // Third-party Python runtime library that is required by the application.
  219. message Library {
  220. // Name of the library. Example: "django".
  221. string name = 1;
  222. // Version of the library to select, or "latest".
  223. string version = 2;
  224. }
  225. // Actions to take when the user is not logged in.
  226. enum AuthFailAction {
  227. // Not specified. `AUTH_FAIL_ACTION_REDIRECT` is assumed.
  228. AUTH_FAIL_ACTION_UNSPECIFIED = 0;
  229. // Redirects user to "accounts.google.com". The user is redirected back to the
  230. // application URL after signing in or creating an account.
  231. AUTH_FAIL_ACTION_REDIRECT = 1;
  232. // Rejects request with a `401` HTTP status code and an error
  233. // message.
  234. AUTH_FAIL_ACTION_UNAUTHORIZED = 2;
  235. }
  236. // Methods to restrict access to a URL based on login status.
  237. enum LoginRequirement {
  238. // Not specified. `LOGIN_OPTIONAL` is assumed.
  239. LOGIN_UNSPECIFIED = 0;
  240. // Does not require that the user is signed in.
  241. LOGIN_OPTIONAL = 1;
  242. // If the user is not signed in, the `auth_fail_action` is taken.
  243. // In addition, if the user is not an administrator for the
  244. // application, they are given an error message regardless of
  245. // `auth_fail_action`. If the user is an administrator, the handler
  246. // proceeds.
  247. LOGIN_ADMIN = 2;
  248. // If the user has signed in, the handler proceeds normally. Otherwise, the
  249. // auth_fail_action is taken.
  250. LOGIN_REQUIRED = 3;
  251. }
  252. // Methods to enforce security (HTTPS) on a URL.
  253. enum SecurityLevel {
  254. option allow_alias = true;
  255. // Not specified.
  256. SECURE_UNSPECIFIED = 0;
  257. // Both HTTP and HTTPS requests with URLs that match the handler succeed
  258. // without redirects. The application can examine the request to determine
  259. // which protocol was used, and respond accordingly.
  260. SECURE_DEFAULT = 0;
  261. // Requests for a URL that match this handler that use HTTPS are automatically
  262. // redirected to the HTTP equivalent URL.
  263. SECURE_NEVER = 1;
  264. // Both HTTP and HTTPS requests with URLs that match the handler succeed
  265. // without redirects. The application can examine the request to determine
  266. // which protocol was used and respond accordingly.
  267. SECURE_OPTIONAL = 2;
  268. // Requests for a URL that match this handler that do not use HTTPS are
  269. // automatically redirected to the HTTPS URL with the same path. Query
  270. // parameters are reserved for the redirect.
  271. SECURE_ALWAYS = 3;
  272. }