app_yaml.proto 11 KB

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