1// Copyright 2023 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.cloud.tasks.v2beta2; 18 19import "google/api/field_behavior.proto"; 20 21option go_package = "cloud.google.com/go/cloudtasks/apiv2beta2/cloudtaskspb;cloudtaskspb"; 22option java_multiple_files = true; 23option java_outer_classname = "TargetProto"; 24option java_package = "com.google.cloud.tasks.v2beta2"; 25 26// Pull target. 27message PullTarget {} 28 29// The pull message contains data that can be used by the caller of 30// [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the 31// task. 32// 33// This proto can only be used for tasks in a queue which has 34// [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] set. 35message PullMessage { 36 // A data payload consumed by the worker to execute the task. 37 bytes payload = 1; 38 39 // The task's tag. 40 // 41 // Tags allow similar tasks to be processed in a batch. If you label 42 // tasks with a tag, your worker can 43 // [lease tasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] with the 44 // same tag using 45 // [filter][google.cloud.tasks.v2beta2.LeaseTasksRequest.filter]. For example, 46 // if you want to aggregate the events associated with a specific user once a 47 // day, you could tag tasks with the user ID. 48 // 49 // The task's tag can only be set when the 50 // [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. 51 // 52 // The tag must be less than 500 characters. 53 // 54 // SDK compatibility: Although the SDK allows tags to be either 55 // string or 56 // [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), 57 // only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8 58 // encoded, the tag will be empty when the task is returned by Cloud Tasks. 59 string tag = 2; 60} 61 62// App Engine HTTP target. 63// 64// The task will be delivered to the App Engine application hostname 65// specified by its 66// [AppEngineHttpTarget][google.cloud.tasks.v2beta2.AppEngineHttpTarget] and 67// [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest]. The 68// documentation for 69// [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] 70// explains how the task's host URL is constructed. 71// 72// Using [AppEngineHttpTarget][google.cloud.tasks.v2beta2.AppEngineHttpTarget] 73// requires 74// [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) 75// Google IAM permission for the project 76// and the following scope: 77// 78// `https://www.googleapis.com/auth/cloud-platform` 79message AppEngineHttpTarget { 80 // Overrides for the 81 // [task-level 82 // app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing]. 83 // 84 // If set, `app_engine_routing_override` is used for all tasks in 85 // the queue, no matter what the setting is for the 86 // [task-level 87 // app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing]. 88 AppEngineRouting app_engine_routing_override = 1; 89} 90 91// App Engine HTTP request. 92// 93// The message defines the HTTP request that is sent to an App Engine app when 94// the task is dispatched. 95// 96// This proto can only be used for tasks in a queue which has 97// [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] 98// set. 99// 100// Using [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] 101// requires 102// [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) 103// Google IAM permission for the project 104// and the following scope: 105// 106// `https://www.googleapis.com/auth/cloud-platform` 107// 108// The task will be delivered to the App Engine app which belongs to the same 109// project as the queue. For more information, see 110// [How Requests are 111// Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 112// and how routing is affected by 113// [dispatch 114// files](https://cloud.google.com/appengine/docs/python/config/dispatchref). 115// Traffic is encrypted during transport and never leaves Google datacenters. 116// Because this traffic is carried over a communication mechanism internal to 117// Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). 118// The request to the handler, however, will appear to have used the HTTP 119// protocol. 120// 121// The [AppEngineRouting][google.cloud.tasks.v2beta2.AppEngineRouting] used to 122// construct the URL that the task is delivered to can be set at the queue-level 123// or task-level: 124// 125// * If set, 126// [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override] 127// is used for all tasks in the queue, no matter what the setting 128// is for the 129// [task-level 130// app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing]. 131// 132// 133// The `url` that the task will be sent to is: 134// 135// * `url =` [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] `+` 136// [relative_url][google.cloud.tasks.v2beta2.AppEngineHttpRequest.relative_url] 137// 138// Tasks can be dispatched to secure app handlers, unsecure app handlers, and 139// URIs restricted with 140// [`login: 141// admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). 142// Because tasks are not run as any user, they cannot be dispatched to URIs 143// restricted with 144// [`login: 145// required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) 146// Task dispatches also do not follow redirects. 147// 148// The task attempt has succeeded if the app's request handler returns an HTTP 149// response code in the range [`200` - `299`]. The task attempt has failed if 150// the app's handler returns a non-2xx response code or Cloud Tasks does 151// not receive response before the [deadline][Task.dispatch_deadline]. Failed 152// tasks will be retried according to the 153// [retry configuration][google.cloud.tasks.v2beta2.Queue.retry_config]. `503` 154// (Service Unavailable) is considered an App Engine system error instead of an 155// application error and will cause Cloud Tasks' traffic congestion control to 156// temporarily throttle the queue's dispatches. Unlike other types of task 157// targets, a `429` (Too Many Requests) response from an app handler does not 158// cause traffic congestion control to throttle the queue. 159message AppEngineHttpRequest { 160 // The HTTP method to use for the request. The default is POST. 161 // 162 // The app's request handler for the task's target URL must be able to handle 163 // HTTP requests with this http_method, otherwise the task attempt fails with 164 // error code 405 (Method Not Allowed). See [Writing a push task request 165 // handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 166 // and the App Engine documentation for your runtime on [How Requests are 167 // Handled](https://cloud.google.com/appengine/docs/standard/python3/how-requests-are-handled). 168 HttpMethod http_method = 1; 169 170 // Task-level setting for App Engine routing. 171 // 172 // If set, 173 // [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override] 174 // is used for all tasks in the queue, no matter what the setting is for the 175 // [task-level 176 // app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing]. 177 AppEngineRouting app_engine_routing = 2; 178 179 // The relative URL. 180 // 181 // The relative URL must begin with "/" and must be a valid HTTP relative URL. 182 // It can contain a path and query string arguments. 183 // If the relative URL is empty, then the root path "/" will be used. 184 // No spaces are allowed, and the maximum length allowed is 2083 characters. 185 string relative_url = 3; 186 187 // HTTP request headers. 188 // 189 // This map contains the header field names and values. 190 // Headers can be set when the 191 // [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. 192 // Repeated headers are not supported but a header value can contain commas. 193 // 194 // Cloud Tasks sets some headers to default values: 195 // 196 // * `User-Agent`: By default, this header is 197 // `"AppEngine-Google; (+http://code.google.com/appengine)"`. 198 // This header can be modified, but Cloud Tasks will append 199 // `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 200 // modified `User-Agent`. 201 // 202 // If the task has a 203 // [payload][google.cloud.tasks.v2beta2.AppEngineHttpRequest.payload], Cloud 204 // Tasks sets the following headers: 205 // 206 // * `Content-Type`: By default, the `Content-Type` header is set to 207 // `"application/octet-stream"`. The default can be overridden by explicitly 208 // setting `Content-Type` to a particular media type when the 209 // [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. 210 // For example, `Content-Type` can be set to `"application/json"`. 211 // * `Content-Length`: This is computed by Cloud Tasks. This value is 212 // output only. It cannot be changed. 213 // 214 // The headers below cannot be set or overridden: 215 // 216 // * `Host` 217 // * `X-Google-*` 218 // * `X-AppEngine-*` 219 // 220 // In addition, Cloud Tasks sets some headers when the task is dispatched, 221 // such as headers containing information about the task; see 222 // [request 223 // headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). 224 // These headers are set only when the task is dispatched, so they are not 225 // visible when the task is returned in a Cloud Tasks response. 226 // 227 // Although there is no specific limit for the maximum number of headers or 228 // the size, there is a limit on the maximum size of the 229 // [Task][google.cloud.tasks.v2beta2.Task]. For more information, see the 230 // [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask] 231 // documentation. 232 map<string, string> headers = 4; 233 234 // Payload. 235 // 236 // The payload will be sent as the HTTP message body. A message 237 // body, and thus a payload, is allowed only if the HTTP method is 238 // POST or PUT. It is an error to set a data payload on a task with 239 // an incompatible [HttpMethod][google.cloud.tasks.v2beta2.HttpMethod]. 240 bytes payload = 5; 241} 242 243// App Engine Routing. 244// 245// Defines routing characteristics specific to App Engine - service, version, 246// and instance. 247// 248// For more information about services, versions, and instances see 249// [An Overview of App 250// Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), 251// [Microservices Architecture on Google App 252// Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), 253// [App Engine Standard request 254// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), 255// and [App Engine Flex request 256// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 257message AppEngineRouting { 258 // App service. 259 // 260 // By default, the task is sent to the service which is the default 261 // service when the task is attempted. 262 // 263 // For some queues or tasks which were created using the App Engine 264 // Task Queue API, [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] is 265 // not parsable into 266 // [service][google.cloud.tasks.v2beta2.AppEngineRouting.service], 267 // [version][google.cloud.tasks.v2beta2.AppEngineRouting.version], and 268 // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance]. For 269 // example, some tasks which were created using the App Engine SDK use a 270 // custom domain name; custom domains are not parsed by Cloud Tasks. If 271 // [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] is not parsable, 272 // then [service][google.cloud.tasks.v2beta2.AppEngineRouting.service], 273 // [version][google.cloud.tasks.v2beta2.AppEngineRouting.version], and 274 // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] are the 275 // empty string. 276 string service = 1; 277 278 // App version. 279 // 280 // By default, the task is sent to the version which is the default 281 // version when the task is attempted. 282 // 283 // For some queues or tasks which were created using the App Engine 284 // Task Queue API, [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] is 285 // not parsable into 286 // [service][google.cloud.tasks.v2beta2.AppEngineRouting.service], 287 // [version][google.cloud.tasks.v2beta2.AppEngineRouting.version], and 288 // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance]. For 289 // example, some tasks which were created using the App Engine SDK use a 290 // custom domain name; custom domains are not parsed by Cloud Tasks. If 291 // [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] is not parsable, 292 // then [service][google.cloud.tasks.v2beta2.AppEngineRouting.service], 293 // [version][google.cloud.tasks.v2beta2.AppEngineRouting.version], and 294 // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] are the 295 // empty string. 296 string version = 2; 297 298 // App instance. 299 // 300 // By default, the task is sent to an instance which is available when 301 // the task is attempted. 302 // 303 // Requests can only be sent to a specific instance if 304 // [manual scaling is used in App Engine 305 // Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). 306 // App Engine Flex does not support instances. For more information, see 307 // [App Engine Standard request 308 // routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 309 // and [App Engine Flex request 310 // routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 311 string instance = 3; 312 313 // Output only. The host that the task is sent to. 314 // 315 // For more information, see 316 // [How Requests are 317 // Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). 318 // 319 // The host is constructed as: 320 // 321 // 322 // * `host = [application_domain_name]`</br> 323 // `| [service] + '.' + [application_domain_name]`</br> 324 // `| [version] + '.' + [application_domain_name]`</br> 325 // `| [version_dot_service]+ '.' + [application_domain_name]`</br> 326 // `| [instance] + '.' + [application_domain_name]`</br> 327 // `| [instance_dot_service] + '.' + [application_domain_name]`</br> 328 // `| [instance_dot_version] + '.' + [application_domain_name]`</br> 329 // `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` 330 // 331 // * `application_domain_name` = The domain name of the app, for 332 // example <app-id>.appspot.com, which is associated with the 333 // queue's project ID. Some tasks which were created using the App Engine 334 // SDK use a custom domain name. 335 // 336 // * `service =` 337 // [service][google.cloud.tasks.v2beta2.AppEngineRouting.service] 338 // 339 // * `version =` 340 // [version][google.cloud.tasks.v2beta2.AppEngineRouting.version] 341 // 342 // * `version_dot_service =` 343 // [version][google.cloud.tasks.v2beta2.AppEngineRouting.version] `+ '.' +` 344 // [service][google.cloud.tasks.v2beta2.AppEngineRouting.service] 345 // 346 // * `instance =` 347 // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] 348 // 349 // * `instance_dot_service =` 350 // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] `+ '.' 351 // +` [service][google.cloud.tasks.v2beta2.AppEngineRouting.service] 352 // 353 // * `instance_dot_version =` 354 // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] `+ '.' 355 // +` [version][google.cloud.tasks.v2beta2.AppEngineRouting.version] 356 // 357 // * `instance_dot_version_dot_service =` 358 // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] `+ '.' 359 // +` [version][google.cloud.tasks.v2beta2.AppEngineRouting.version] `+ '.' 360 // +` [service][google.cloud.tasks.v2beta2.AppEngineRouting.service] 361 // 362 // If [service][google.cloud.tasks.v2beta2.AppEngineRouting.service] is empty, 363 // then the task will be sent to the service which is the default service when 364 // the task is attempted. 365 // 366 // If [version][google.cloud.tasks.v2beta2.AppEngineRouting.version] is empty, 367 // then the task will be sent to the version which is the default version when 368 // the task is attempted. 369 // 370 // If [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] is 371 // empty, then the task will be sent to an instance which is available when 372 // the task is attempted. 373 // 374 // If [service][google.cloud.tasks.v2beta2.AppEngineRouting.service], 375 // [version][google.cloud.tasks.v2beta2.AppEngineRouting.version], or 376 // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] is 377 // invalid, then the task will be sent to the default version of the default 378 // service when the task is attempted. 379 string host = 4; 380} 381 382// HTTP request. 383// 384// The task will be pushed to the worker as an HTTP request. An HTTP request 385// embodies a url, an http method, headers, body and authorization for the http 386// task. 387message HttpRequest { 388 // Required. The full url path that the request will be sent to. 389 // 390 // This string must begin with either "http://" or "https://". Some examples 391 // are: `http://acme.com` and `https://acme.com/sales:8080`. Cloud Tasks will 392 // encode some characters for safety and compatibility. The maximum allowed 393 // URL length is 2083 characters after encoding. 394 // 395 // The `Location` header response from a redirect response [`300` - `399`] 396 // may be followed. The redirect is not counted as a separate attempt. 397 string url = 1 [(google.api.field_behavior) = REQUIRED]; 398 399 // The HTTP method to use for the request. The default is POST. 400 HttpMethod http_method = 2; 401 402 // HTTP request headers. 403 // 404 // This map contains the header field names and values. 405 // Headers can be set when running the 406 // [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask] or 407 // [task is created][google.cloud.tasks.v2beta2.CloudTasks.BufferTask]. 408 // 409 // These headers represent a subset of the headers that will accompany the 410 // task's HTTP request. Some HTTP request headers will be ignored or replaced. 411 // 412 // A partial list of headers that will be ignored or replaced is: 413 // 414 // * Any header that is prefixed with "X-CloudTasks-" will be treated 415 // as service header. Service headers define properties of the task and are 416 // predefined in CloudTask. 417 // * Host: This will be computed by Cloud Tasks and derived from 418 // [HttpRequest.url][google.cloud.tasks.v2beta2.HttpRequest.url]. 419 // * Content-Length: This will be computed by Cloud Tasks. 420 // * User-Agent: This will be set to `"Google-Cloud-Tasks"`. 421 // * `X-Google-*`: Google use only. 422 // * `X-AppEngine-*`: Google use only. 423 // 424 // `Content-Type` won't be set by Cloud Tasks. You can explicitly set 425 // `Content-Type` to a media type when the 426 // [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask]. 427 // For example, `Content-Type` can be set to `"application/octet-stream"` or 428 // `"application/json"`. 429 // 430 // Headers which can have multiple values (according to RFC2616) can be 431 // specified using comma-separated values. 432 // 433 // The size of the headers must be less than 80KB. 434 map<string, string> headers = 3; 435 436 // HTTP request body. 437 // 438 // A request body is allowed only if the 439 // [HTTP method][google.cloud.tasks.v2beta2.HttpRequest.http_method] is POST, 440 // PUT, or PATCH. It is an error to set body on a task with an incompatible 441 // [HttpMethod][google.cloud.tasks.v2beta2.HttpMethod]. 442 bytes body = 4; 443 444 // The mode for generating an `Authorization` header for HTTP requests. 445 // 446 // If specified, all `Authorization` headers in the 447 // [HttpRequest.headers][google.cloud.tasks.v2beta2.HttpRequest.headers] field 448 // will be overridden. 449 oneof authorization_header { 450 // If specified, an 451 // [OAuth token](https://developers.google.com/identity/protocols/OAuth2) 452 // will be generated and attached as an `Authorization` header in the HTTP 453 // request. 454 // 455 // This type of authorization should generally only be used when calling 456 // Google APIs hosted on *.googleapis.com. 457 OAuthToken oauth_token = 5; 458 459 // If specified, an 460 // [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect) 461 // token will be generated and attached as an `Authorization` header in the 462 // HTTP request. 463 // 464 // This type of authorization can be used for many scenarios, including 465 // calling Cloud Run, or endpoints where you intend to validate the token 466 // yourself. 467 OidcToken oidc_token = 6; 468 } 469} 470 471// PathOverride. 472// 473// Path message defines path override for HTTP targets. 474message PathOverride { 475 // The URI path (e.g., /users/1234). Default is an empty string. 476 string path = 1; 477} 478 479// QueryOverride. 480// 481// Query message defines query override for HTTP targets. 482message QueryOverride { 483 // The query parameters (e.g., qparam1=123&qparam2=456). Default is an empty 484 // string. 485 string query_params = 1; 486} 487 488// Uri Override. 489// 490// When specified, all the HTTP tasks inside the queue will be partially or 491// fully overridden depending on the configured values. 492message UriOverride { 493 // The Scheme for an HTTP request. By default, it is HTTPS. 494 enum Scheme { 495 // Scheme unspecified. Defaults to HTTPS. 496 SCHEME_UNSPECIFIED = 0; 497 498 // Convert the scheme to HTTP, e.g., https://www.google.ca will change to 499 // http://www.google.ca. 500 HTTP = 1; 501 502 // Convert the scheme to HTTPS, e.g., http://www.google.ca will change to 503 // https://www.google.ca. 504 HTTPS = 2; 505 } 506 507 // UriOverrideEnforceMode mode is to define enforcing mode for the override 508 // modes. 509 enum UriOverrideEnforceMode { 510 // OverrideMode Unspecified. Defaults to ALWAYS. 511 URI_OVERRIDE_ENFORCE_MODE_UNSPECIFIED = 0; 512 513 // In the IF_NOT_EXISTS mode, queue-level configuration is only 514 // applied where task-level configuration does not exist. 515 IF_NOT_EXISTS = 1; 516 517 // In the ALWAYS mode, queue-level configuration overrides all 518 // task-level configuration 519 ALWAYS = 2; 520 } 521 522 // Scheme override. 523 // 524 // When specified, the task URI scheme is replaced by the provided value (HTTP 525 // or HTTPS). 526 optional Scheme scheme = 1; 527 528 // Host override. 529 // 530 // When specified, replaces the host part of the task URL. For example, 531 // if the task URL is "https://www.google.com," and host value is set to 532 // "example.net", the overridden URI will be changed to "https://example.net." 533 // Host value cannot be an empty string (INVALID_ARGUMENT). 534 optional string host = 2; 535 536 // Port override. 537 // 538 // When specified, replaces the port part of the task URI. For instance, 539 // for a URI http://www.google.com/foo and port=123, the overridden URI 540 // becomes http://www.google.com:123/foo. Note that the port value must be a 541 // positive integer. Setting the port to 0 (Zero) clears the URI port. 542 optional int64 port = 3; 543 544 // URI path. 545 // 546 // When specified, replaces the existing path of the task URL. Setting the 547 // path value to an empty string clears the URI path segment. 548 PathOverride path_override = 4; 549 550 // URI Query. 551 // 552 // When specified, replaces the query part of the task URI. Setting the 553 // query value to an empty string clears the URI query segment. 554 QueryOverride query_override = 5; 555 556 // URI Override Enforce Mode 557 // 558 // When specified, determines the Target UriOverride mode. If not specified, 559 // it defaults to ALWAYS. 560 UriOverrideEnforceMode uri_override_enforce_mode = 6; 561} 562 563// HTTP target. 564// 565// When specified as a [Queue][target_type], all the tasks with [HttpRequest] 566// will be overridden according to the target. 567message HttpTarget { 568 // Defines a header message. A header can have a key and a value. 569 message Header { 570 // The key of the header. 571 string key = 1; 572 573 // The value of the header. 574 string value = 2; 575 } 576 577 // Wraps the Header object. 578 message HeaderOverride { 579 // header embodying a key and a value. 580 Header header = 1; 581 } 582 583 // Uri override. 584 // 585 // When specified, overrides the execution Uri for all the tasks in the queue. 586 UriOverride uri_override = 1; 587 588 // The HTTP method to use for the request. 589 // 590 // When specified, it overrides 591 // [HttpRequest][google.cloud.tasks.v2beta2.HttpTarget.http_method] for the 592 // task. Note that if the value is set to [HttpMethod][GET] the 593 // [HttpRequest][body] of the task will be ignored at execution time. 594 HttpMethod http_method = 2; 595 596 // HTTP target headers. 597 // 598 // This map contains the header field names and values. 599 // Headers will be set when running the 600 // [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask] and/or 601 // [task is created][google.cloud.tasks.v2beta2.CloudTasks.BufferTask]. 602 // 603 // These headers represent a subset of the headers that will accompany the 604 // task's HTTP request. Some HTTP request headers will be ignored or replaced. 605 // 606 // A partial list of headers that will be ignored or replaced is: 607 // * Any header that is prefixed with "X-CloudTasks-" will be treated 608 // as service header. Service headers define properties of the task and are 609 // predefined in CloudTask. 610 // * Host: This will be computed by Cloud Tasks and derived from 611 // [HttpRequest.url][google.cloud.tasks.v2beta2.HttpRequest.url]. 612 // * Content-Length: This will be computed by Cloud Tasks. 613 // * User-Agent: This will be set to `"Google-CloudTasks"`. 614 // * `X-Google-*`: Google use only. 615 // * `X-AppEngine-*`: Google use only. 616 // 617 // `Content-Type` won't be set by Cloud Tasks. You can explicitly set 618 // `Content-Type` to a media type when the 619 // [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask]. 620 // For example, `Content-Type` can be set to `"application/octet-stream"` or 621 // `"application/json"`. 622 // 623 // Headers which can have multiple values (according to RFC2616) can be 624 // specified using comma-separated values. 625 // 626 // The size of the headers must be less than 80KB. 627 // Queue-level headers to override headers of all the tasks in the queue. 628 repeated HeaderOverride header_overrides = 3; 629 630 // The mode for generating an `Authorization` header for HTTP requests. 631 // 632 // If specified, all `Authorization` headers in the 633 // [HttpRequest.headers][google.cloud.tasks.v2beta2.HttpRequest.headers] field 634 // will be overridden. 635 oneof authorization_header { 636 // If specified, an 637 // [OAuth token](https://developers.google.com/identity/protocols/OAuth2) 638 // will be generated and attached as an `Authorization` header in the HTTP 639 // request. 640 // 641 // This type of authorization should generally only be used when calling 642 // Google APIs hosted on *.googleapis.com. 643 OAuthToken oauth_token = 5; 644 645 // If specified, an 646 // [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect) 647 // token will be generated and attached as an `Authorization` header in the 648 // HTTP request. 649 // 650 // This type of authorization can be used for many scenarios, including 651 // calling Cloud Run, or endpoints where you intend to validate the token 652 // yourself. 653 OidcToken oidc_token = 6; 654 } 655} 656 657// Contains information needed for generating an 658// [OAuth token](https://developers.google.com/identity/protocols/OAuth2). 659// This type of authorization should generally only be used when calling Google 660// APIs hosted on *.googleapis.com. 661message OAuthToken { 662 // [Service account email](https://cloud.google.com/iam/docs/service-accounts) 663 // to be used for generating OAuth token. 664 // The service account must be within the same project as the queue. The 665 // caller must have iam.serviceAccounts.actAs permission for the service 666 // account. 667 string service_account_email = 1; 668 669 // OAuth scope to be used for generating OAuth access token. 670 // If not specified, "https://www.googleapis.com/auth/cloud-platform" 671 // will be used. 672 string scope = 2; 673} 674 675// Contains information needed for generating an 676// [OpenID Connect 677// token](https://developers.google.com/identity/protocols/OpenIDConnect). 678// This type of authorization can be used for many scenarios, including 679// calling Cloud Run, or endpoints where you intend to validate the token 680// yourself. 681message OidcToken { 682 // [Service account email](https://cloud.google.com/iam/docs/service-accounts) 683 // to be used for generating OIDC token. 684 // The service account must be within the same project as the queue. The 685 // caller must have iam.serviceAccounts.actAs permission for the service 686 // account. 687 string service_account_email = 1; 688 689 // Audience to be used when generating OIDC token. If not specified, the URI 690 // specified in target will be used. 691 string audience = 2; 692} 693 694// The HTTP method used to execute the task. 695enum HttpMethod { 696 // HTTP method unspecified 697 HTTP_METHOD_UNSPECIFIED = 0; 698 699 // HTTP POST 700 POST = 1; 701 702 // HTTP GET 703 GET = 2; 704 705 // HTTP HEAD 706 HEAD = 3; 707 708 // HTTP PUT 709 PUT = 4; 710 711 // HTTP DELETE 712 DELETE = 5; 713 714 // HTTP PATCH 715 PATCH = 6; 716 717 // HTTP OPTIONS 718 OPTIONS = 7; 719} 720