aboutsummaryrefslogtreecommitdiff
path: root/google/appengine/v1/app_yaml.proto
blob: c0bb2ce21ed2ad8072e8b6d0172f09fc4707f974 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
// Copyright 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.appengine.v1;

import "google/api/annotations.proto";
import "google/protobuf/duration.proto";

option go_package = "google.golang.org/genproto/googleapis/appengine/v1;appengine";
option java_multiple_files = true;
option java_outer_classname = "AppYamlProto";
option java_package = "com.google.appengine.v1";

// [Google Cloud
// Endpoints](https://cloud.google.com/appengine/docs/python/endpoints/)
// configuration for API handlers.
message ApiConfigHandler {
  // Action to take when users access resources that require
  // authentication. Defaults to `redirect`.
  AuthFailAction auth_fail_action = 1;

  // Level of login required to access this resource. Defaults to
  // `optional`.
  LoginRequirement login = 2;

  // Path to the script from the application root directory.
  string script = 3;

  // Security (HTTPS) enforcement for this URL.
  SecurityLevel security_level = 4;

  // URL to serve the endpoint at.
  string url = 5;
}

// Custom static error page to be served when an error occurs.
message ErrorHandler {
  // Error codes.
  enum ErrorCode {
    option allow_alias = true;

    // Not specified. ERROR_CODE_DEFAULT is assumed.
    ERROR_CODE_UNSPECIFIED = 0;

    // All other error types.
    ERROR_CODE_DEFAULT = 0;

    // Application has exceeded a resource quota.
    ERROR_CODE_OVER_QUOTA = 1;

    // Client blocked by the application's Denial of Service protection
    // configuration.
    ERROR_CODE_DOS_API_DENIAL = 2;

    // Deadline reached before the application responds.
    ERROR_CODE_TIMEOUT = 3;
  }

  // Error condition this handler applies to.
  ErrorCode error_code = 1;

  // Static file content to be served for this error.
  string static_file = 2;

  // MIME type of file. Defaults to `text/html`.
  string mime_type = 3;
}

// URL pattern and description of how the URL should be handled. App Engine can
// handle URLs by executing application code or by serving static files
// uploaded with the version, such as images, CSS, or JavaScript.
message UrlMap {
  // Redirect codes.
  enum RedirectHttpResponseCode {
    // Not specified. `302` is assumed.
    REDIRECT_HTTP_RESPONSE_CODE_UNSPECIFIED = 0;

    // `301 Moved Permanently` code.
    REDIRECT_HTTP_RESPONSE_CODE_301 = 1;

    // `302 Moved Temporarily` code.
    REDIRECT_HTTP_RESPONSE_CODE_302 = 2;

    // `303 See Other` code.
    REDIRECT_HTTP_RESPONSE_CODE_303 = 3;

    // `307 Temporary Redirect` code.
    REDIRECT_HTTP_RESPONSE_CODE_307 = 4;
  }

  // URL prefix. Uses regular expression syntax, which means regexp
  // special characters must be escaped, but should not contain groupings.
  // All URLs that begin with this prefix are handled by this handler, using the
  // portion of the URL after the prefix as part of the file path.
  string url_regex = 1;

  // Type of handler for this URL pattern.
  oneof handler_type {
    // Returns the contents of a file, such as an image, as the response.
    StaticFilesHandler static_files = 2;

    // Executes a script to handle the request that matches this URL
    // pattern.
    ScriptHandler script = 3;

    // Uses API Endpoints to handle requests.
    ApiEndpointHandler api_endpoint = 4;
  }

  // Security (HTTPS) enforcement for this URL.
  SecurityLevel security_level = 5;

  // Level of login required to access this resource.
  LoginRequirement login = 6;

  // Action to take when users access resources that require
  // authentication. Defaults to `redirect`.
  AuthFailAction auth_fail_action = 7;

  // `30x` code to use when performing redirects for the `secure` field.
  // Defaults to `302`.
  RedirectHttpResponseCode redirect_http_response_code = 8;
}

// Files served directly to the user for a given URL, such as images, CSS
// stylesheets, or JavaScript source files. Static file handlers describe which
// files in the application directory are static files, and which URLs serve
// them.
message StaticFilesHandler {
  // Path to the static files matched by the URL pattern, from the
  // application root directory. The path can refer to text matched in groupings
  // in the URL pattern.
  string path = 1;

  // Regular expression that matches the file paths for all files that should be
  // referenced by this handler.
  string upload_path_regex = 2;

  // HTTP headers to use for all responses from these URLs.
  map<string, string> http_headers = 3;

  // MIME type used to serve all files served by this handler.
  //
  // Defaults to file-specific MIME types, which are derived from each file's
  // filename extension.
  string mime_type = 4;

  // Time a static file served by this handler should be cached
  // by web proxies and browsers.
  google.protobuf.Duration expiration = 5;

  // Whether this handler should match the request if the file
  // referenced by the handler does not exist.
  bool require_matching_file = 6;

  // Whether files should also be uploaded as code data. By default, files
  // declared in static file handlers are uploaded as static
  // data and are only served to end users; they cannot be read by the
  // application. If enabled, uploads are charged against both your code and
  // static data storage resource quotas.
  bool application_readable = 7;
}

// Executes a script to handle the request that matches the URL pattern.
message ScriptHandler {
  // Path to the script from the application root directory.
  string script_path = 1;
}

// Uses Google Cloud Endpoints to handle requests.
message ApiEndpointHandler {
  // Path to the script from the application root directory.
  string script_path = 1;
}

// Health checking configuration for VM instances. Unhealthy instances
// are killed and replaced with new instances. Only applicable for
// instances in App Engine flexible environment.
message HealthCheck {
  // Whether to explicitly disable health checks for this instance.
  bool disable_health_check = 1;

  // Host header to send when performing an HTTP health check.
  // Example: "myapp.appspot.com"
  string host = 2;

  // Number of consecutive successful health checks required before receiving
  // traffic.
  uint32 healthy_threshold = 3;

  // Number of consecutive failed health checks required before removing
  // traffic.
  uint32 unhealthy_threshold = 4;

  // Number of consecutive failed health checks required before an instance is
  // restarted.
  uint32 restart_threshold = 5;

  // Interval between health checks.
  google.protobuf.Duration check_interval = 6;

  // Time before the health check is considered failed.
  google.protobuf.Duration timeout = 7;
}

// Third-party Python runtime library that is required by the application.
message Library {
  // Name of the library. Example: "django".
  string name = 1;

  // Version of the library to select, or "latest".
  string version = 2;
}

// Actions to take when the user is not logged in.
enum AuthFailAction {
  // Not specified. `AUTH_FAIL_ACTION_REDIRECT` is assumed.
  AUTH_FAIL_ACTION_UNSPECIFIED = 0;

  // Redirects user to "accounts.google.com". The user is redirected back to the
  // application URL after signing in or creating an account.
  AUTH_FAIL_ACTION_REDIRECT = 1;

  // Rejects request with a `401` HTTP status code and an error
  // message.
  AUTH_FAIL_ACTION_UNAUTHORIZED = 2;
}

// Methods to restrict access to a URL based on login status.
enum LoginRequirement {
  // Not specified. `LOGIN_OPTIONAL` is assumed.
  LOGIN_UNSPECIFIED = 0;

  // Does not require that the user is signed in.
  LOGIN_OPTIONAL = 1;

  // If the user is not signed in, the `auth_fail_action` is taken.
  // In addition, if the user is not an administrator for the
  // application, they are given an error message regardless of
  // `auth_fail_action`. If the user is an administrator, the handler
  // proceeds.
  LOGIN_ADMIN = 2;

  // If the user has signed in, the handler proceeds normally. Otherwise, the
  // auth_fail_action is taken.
  LOGIN_REQUIRED = 3;
}

// Methods to enforce security (HTTPS) on a URL.
enum SecurityLevel {
  option allow_alias = true;

  // Not specified.
  SECURE_UNSPECIFIED = 0;

  // Both HTTP and HTTPS requests with URLs that match the handler succeed
  // without redirects. The application can examine the request to determine
  // which protocol was used, and respond accordingly.
  SECURE_DEFAULT = 0;

  // Requests for a URL that match this handler that use HTTPS are automatically
  // redirected to the HTTP equivalent URL.
  SECURE_NEVER = 1;

  // Both HTTP and HTTPS requests with URLs that match the handler succeed
  // without redirects. The application can examine the request to determine
  // which protocol was used and respond accordingly.
  SECURE_OPTIONAL = 2;

  // Requests for a URL that match this handler that do not use HTTPS are
  // automatically redirected to the HTTPS URL with the same path. Query
  // parameters are reserved for the redirect.
  SECURE_ALWAYS = 3;
}