@@ -17,13 +17,120 @@ syntax = "proto3";
1717
1818package google.cloud.tasks.v2 ;
1919
20+ import "google/api/field_behavior.proto" ;
2021import "google/api/annotations.proto" ;
2122
2223option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2;tasks" ;
2324option java_multiple_files = true ;
2425option java_outer_classname = "TargetProto" ;
2526option java_package = "com.google.cloud.tasks.v2" ;
2627
28+ // HTTP request.
29+ //
30+ // The task will be pushed to the worker as an HTTP request. If the worker
31+ // or the redirected worker acknowledges the task by returning a successful HTTP
32+ // response code ([`200` - `299`]), the task will removed from the queue. If
33+ // any other HTTP response code is returned or no response is received, the
34+ // task will be retried according to the following:
35+ //
36+ // * User-specified throttling: [retry configuration][google.cloud.tasks.v2.Queue.retry_config],
37+ // [rate limits][google.cloud.tasks.v2.Queue.rate_limits], and the [queue's state][google.cloud.tasks.v2.Queue.state].
38+ //
39+ // * System throttling: To prevent the worker from overloading, Cloud Tasks may
40+ // temporarily reduce the queue's effective rate. User-specified settings
41+ // will not be changed.
42+ //
43+ // System throttling happens because:
44+ //
45+ // * Cloud Tasks backs off on all errors. Normally the backoff specified in
46+ // [rate limits][google.cloud.tasks.v2.Queue.rate_limits] will be used. But if the worker returns
47+ // `429` (Too Many Requests), `503` (Service Unavailable), or the rate of
48+ // errors is high, Cloud Tasks will use a higher backoff rate. The retry
49+ // specified in the `Retry-After` HTTP response header is considered.
50+ //
51+ // * To prevent traffic spikes and to smooth sudden large traffic spikes,
52+ // dispatches ramp up slowly when the queue is newly created or idle and
53+ // if large numbers of tasks suddenly become available to dispatch (due to
54+ // spikes in create task rates, the queue being unpaused, or many tasks
55+ // that are scheduled at the same time).
56+ message HttpRequest {
57+ // Required. The full url path that the request will be sent to.
58+ //
59+ // This string must begin with either "http://" or "https://". Some examples
60+ // are: `http://acme.com` and `https://acme.com/sales:8080`. Cloud Tasks will
61+ // encode some characters for safety and compatibility. The maximum allowed
62+ // URL length is 2083 characters after encoding.
63+ //
64+ // The `Location` header response from a redirect response [`300` - `399`]
65+ // may be followed. The redirect is not counted as a separate attempt.
66+ string url = 1 [(google.api.field_behavior ) = REQUIRED ];
67+
68+ // The HTTP method to use for the request. The default is POST.
69+ HttpMethod http_method = 2 ;
70+
71+ // HTTP request headers.
72+ //
73+ // This map contains the header field names and values.
74+ // Headers can be set when the
75+ // [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
76+ //
77+ // These headers represent a subset of the headers that will accompany the
78+ // task's HTTP request. Some HTTP request headers will be ignored or replaced.
79+ //
80+ // A partial list of headers that will be ignored or replaced is:
81+ //
82+ // * Host: This will be computed by Cloud Tasks and derived from
83+ // [HttpRequest.url][google.cloud.tasks.v2.HttpRequest.url].
84+ // * Content-Length: This will be computed by Cloud Tasks.
85+ // * User-Agent: This will be set to `"Google-Cloud-Tasks"`.
86+ // * X-Google-*: Google use only.
87+ // * X-AppEngine-*: Google use only.
88+ //
89+ // `Content-Type` won't be set by Cloud Tasks. You can explicitly set
90+ // `Content-Type` to a media type when the
91+ // [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
92+ // For example, `Content-Type` can be set to `"application/octet-stream"` or
93+ // `"application/json"`.
94+ //
95+ // Headers which can have multiple values (according to RFC2616) can be
96+ // specified using comma-separated values.
97+ //
98+ // The size of the headers must be less than 80KB.
99+ map <string , string > headers = 3 ;
100+
101+ // HTTP request body.
102+ //
103+ // A request body is allowed only if the
104+ // [HTTP method][google.cloud.tasks.v2.HttpRequest.http_method] is POST, PUT, or PATCH. It is an
105+ // error to set body on a task with an incompatible [HttpMethod][google.cloud.tasks.v2.HttpMethod].
106+ bytes body = 4 ;
107+
108+ // The mode for generating an `Authorization` header for HTTP requests.
109+ //
110+ // If specified, all `Authorization` headers in the [HttpRequest.headers][google.cloud.tasks.v2.HttpRequest.headers]
111+ // field will be overridden.
112+ oneof authorization_header {
113+ // If specified, an
114+ // [OAuth token](https://developers.google.com/identity/protocols/OAuth2)
115+ // will be generated and attached as an `Authorization` header in the HTTP
116+ // request.
117+ //
118+ // This type of authorization should generally only be used when calling
119+ // Google APIs hosted on *.googleapis.com.
120+ OAuthToken oauth_token = 5 ;
121+
122+ // If specified, an
123+ // [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect)
124+ // token will be generated and attached as an `Authorization` header in the
125+ // HTTP request.
126+ //
127+ // This type of authorization can be used for many scenarios, including
128+ // calling Cloud Run, or endpoints where you intend to validate the token
129+ // yourself.
130+ OidcToken oidc_token = 6 ;
131+ }
132+ }
133+
27134// App Engine HTTP request.
28135//
29136// The message defines the HTTP request that is sent to an App Engine app when
@@ -278,3 +385,40 @@ enum HttpMethod {
278385 // HTTP OPTIONS
279386 OPTIONS = 7 ;
280387}
388+
389+ // Contains information needed for generating an
390+ // [OAuth token](https://developers.google.com/identity/protocols/OAuth2).
391+ // This type of authorization should generally only be used when calling Google
392+ // APIs hosted on *.googleapis.com.
393+ message OAuthToken {
394+ // [Service account email](https://cloud.google.com/iam/docs/service-accounts)
395+ // to be used for generating OAuth token.
396+ // The service account must be within the same project as the queue. The
397+ // caller must have iam.serviceAccounts.actAs permission for the service
398+ // account.
399+ string service_account_email = 1 ;
400+
401+ // OAuth scope to be used for generating OAuth access token.
402+ // If not specified, "https://www.googleapis.com/auth/cloud-platform"
403+ // will be used.
404+ string scope = 2 ;
405+ }
406+
407+ // Contains information needed for generating an
408+ // [OpenID Connect
409+ // token](https://developers.google.com/identity/protocols/OpenIDConnect).
410+ // This type of authorization can be used for many scenarios, including
411+ // calling Cloud Run, or endpoints where you intend to validate the token
412+ // yourself.
413+ message OidcToken {
414+ // [Service account email](https://cloud.google.com/iam/docs/service-accounts)
415+ // to be used for generating OIDC token.
416+ // The service account must be within the same project as the queue. The
417+ // caller must have iam.serviceAccounts.actAs permission for the service
418+ // account.
419+ string service_account_email = 1 ;
420+
421+ // Audience to be used when generating OIDC token. If not specified, the URI
422+ // specified in target will be used.
423+ string audience = 2 ;
424+ }
0 commit comments