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