target.proto 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. // Copyright 2020 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.cloud.tasks.v2beta3;
  16. import "google/api/annotations.proto";
  17. option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta3;tasks";
  18. option java_multiple_files = true;
  19. option java_outer_classname = "TargetProto";
  20. option java_package = "com.google.cloud.tasks.v2beta3";
  21. // Pull Message.
  22. //
  23. // This proto can only be used for tasks in a queue which has
  24. // [PULL][google.cloud.tasks.v2beta3.Queue.type] type. It currently exists for backwards compatibility with
  25. // the App Engine Task Queue SDK. This message type maybe returned with methods
  26. // [list][google.cloud.tasks.v2beta3.CloudTask.ListTasks] and
  27. // [get][google.cloud.tasks.v2beta3.CloudTask.ListTasks], when the response view
  28. // is [FULL][google.cloud.tasks.v2beta3.Task.View.Full].
  29. message PullMessage {
  30. // A data payload consumed by the worker to execute the task.
  31. bytes payload = 1;
  32. // The tasks's tag.
  33. //
  34. // The tag is less than 500 characters.
  35. //
  36. // SDK compatibility: Although the SDK allows tags to be either
  37. // string or
  38. // [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-),
  39. // only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8
  40. // encoded, the tag will be empty when the task is returned by Cloud Tasks.
  41. string tag = 2;
  42. }
  43. // HTTP request.
  44. //
  45. // The task will be pushed to the worker as an HTTP request. If the worker
  46. // or the redirected worker acknowledges the task by returning a successful HTTP
  47. // response code ([`200` - `299`]), the task will be removed from the queue. If
  48. // any other HTTP response code is returned or no response is received, the
  49. // task will be retried according to the following:
  50. //
  51. // * User-specified throttling: [retry configuration][google.cloud.tasks.v2beta3.Queue.retry_config],
  52. // [rate limits][google.cloud.tasks.v2beta3.Queue.rate_limits], and the [queue's state][google.cloud.tasks.v2beta3.Queue.state].
  53. //
  54. // * System throttling: To prevent the worker from overloading, Cloud Tasks may
  55. // temporarily reduce the queue's effective rate. User-specified settings
  56. // will not be changed.
  57. //
  58. // System throttling happens because:
  59. //
  60. // * Cloud Tasks backs off on all errors. Normally the backoff specified in
  61. // [rate limits][google.cloud.tasks.v2beta3.Queue.rate_limits] will be used. But if the worker returns
  62. // `429` (Too Many Requests), `503` (Service Unavailable), or the rate of
  63. // errors is high, Cloud Tasks will use a higher backoff rate. The retry
  64. // specified in the `Retry-After` HTTP response header is considered.
  65. //
  66. // * To prevent traffic spikes and to smooth sudden increases in traffic,
  67. // dispatches ramp up slowly when the queue is newly created or idle and
  68. // if large numbers of tasks suddenly become available to dispatch (due to
  69. // spikes in create task rates, the queue being unpaused, or many tasks
  70. // that are scheduled at the same time).
  71. message HttpRequest {
  72. // Required. The full url path that the request will be sent to.
  73. //
  74. // This string must begin with either "http://" or "https://". Some examples
  75. // are: `http://acme.com` and `https://acme.com/sales:8080`. Cloud Tasks will
  76. // encode some characters for safety and compatibility. The maximum allowed
  77. // URL length is 2083 characters after encoding.
  78. //
  79. // The `Location` header response from a redirect response [`300` - `399`]
  80. // may be followed. The redirect is not counted as a separate attempt.
  81. string url = 1;
  82. // The HTTP method to use for the request. The default is POST.
  83. HttpMethod http_method = 2;
  84. // HTTP request headers.
  85. //
  86. // This map contains the header field names and values.
  87. // Headers can be set when the
  88. // [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
  89. //
  90. // These headers represent a subset of the headers that will accompany the
  91. // task's HTTP request. Some HTTP request headers will be ignored or replaced.
  92. //
  93. // A partial list of headers that will be ignored or replaced is:
  94. //
  95. // * Host: This will be computed by Cloud Tasks and derived from
  96. // [HttpRequest.url][google.cloud.tasks.v2beta3.HttpRequest.url].
  97. // * Content-Length: This will be computed by Cloud Tasks.
  98. // * User-Agent: This will be set to `"Google-Cloud-Tasks"`.
  99. // * X-Google-*: Google use only.
  100. // * X-AppEngine-*: Google use only.
  101. //
  102. // `Content-Type` won't be set by Cloud Tasks. You can explicitly set
  103. // `Content-Type` to a media type when the
  104. // [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
  105. // For example, `Content-Type` can be set to `"application/octet-stream"` or
  106. // `"application/json"`.
  107. //
  108. // Headers which can have multiple values (according to RFC2616) can be
  109. // specified using comma-separated values.
  110. //
  111. // The size of the headers must be less than 80KB.
  112. map<string, string> headers = 3;
  113. // HTTP request body.
  114. //
  115. // A request body is allowed only if the
  116. // [HTTP method][google.cloud.tasks.v2beta3.HttpRequest.http_method] is POST, PUT, or PATCH. It is an
  117. // error to set body on a task with an incompatible [HttpMethod][google.cloud.tasks.v2beta3.HttpMethod].
  118. bytes body = 4;
  119. // The mode for generating an `Authorization` header for HTTP requests.
  120. //
  121. // If specified, all `Authorization` headers in the [HttpRequest.headers][google.cloud.tasks.v2beta3.HttpRequest.headers]
  122. // field will be overridden.
  123. oneof authorization_header {
  124. // If specified, an
  125. // [OAuth token](https://developers.google.com/identity/protocols/OAuth2)
  126. // will be generated and attached as an `Authorization` header in the HTTP
  127. // request.
  128. //
  129. // This type of authorization should generally only be used when calling
  130. // Google APIs hosted on *.googleapis.com.
  131. OAuthToken oauth_token = 5;
  132. // If specified, an
  133. // [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect)
  134. // token will be generated and attached as an `Authorization` header in the
  135. // HTTP request.
  136. //
  137. // This type of authorization can be used for many scenarios, including
  138. // calling Cloud Run, or endpoints where you intend to validate the token
  139. // yourself.
  140. OidcToken oidc_token = 6;
  141. }
  142. }
  143. // App Engine HTTP queue.
  144. //
  145. // The task will be delivered to the App Engine application hostname
  146. // specified by its [AppEngineHttpQueue][google.cloud.tasks.v2beta3.AppEngineHttpQueue] and [AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest].
  147. // The documentation for [AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest] explains how the
  148. // task's host URL is constructed.
  149. //
  150. // Using [AppEngineHttpQueue][google.cloud.tasks.v2beta3.AppEngineHttpQueue] requires
  151. // [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control)
  152. // Google IAM permission for the project
  153. // and the following scope:
  154. //
  155. // `https://www.googleapis.com/auth/cloud-platform`
  156. message AppEngineHttpQueue {
  157. // Overrides for the
  158. // [task-level app_engine_routing][google.cloud.tasks.v2beta3.AppEngineHttpRequest.app_engine_routing].
  159. //
  160. // If set, `app_engine_routing_override` is used for all tasks in
  161. // the queue, no matter what the setting is for the
  162. // [task-level app_engine_routing][google.cloud.tasks.v2beta3.AppEngineHttpRequest.app_engine_routing].
  163. AppEngineRouting app_engine_routing_override = 1;
  164. }
  165. // App Engine HTTP request.
  166. //
  167. // The message defines the HTTP request that is sent to an App Engine app when
  168. // the task is dispatched.
  169. //
  170. // Using [AppEngineHttpRequest][google.cloud.tasks.v2beta3.AppEngineHttpRequest] requires
  171. // [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control)
  172. // Google IAM permission for the project
  173. // and the following scope:
  174. //
  175. // `https://www.googleapis.com/auth/cloud-platform`
  176. //
  177. // The task will be delivered to the App Engine app which belongs to the same
  178. // project as the queue. For more information, see
  179. // [How Requests are
  180. // Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
  181. // and how routing is affected by
  182. // [dispatch
  183. // files](https://cloud.google.com/appengine/docs/python/config/dispatchref).
  184. // Traffic is encrypted during transport and never leaves Google datacenters.
  185. // Because this traffic is carried over a communication mechanism internal to
  186. // Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS).
  187. // The request to the handler, however, will appear to have used the HTTP
  188. // protocol.
  189. //
  190. // The [AppEngineRouting][google.cloud.tasks.v2beta3.AppEngineRouting] used to construct the URL that the task is
  191. // delivered to can be set at the queue-level or task-level:
  192. //
  193. // * If set,
  194. // [app_engine_routing_override][google.cloud.tasks.v2beta3.AppEngineHttpQueue.app_engine_routing_override]
  195. // is used for all tasks in the queue, no matter what the setting
  196. // is for the
  197. // [task-level app_engine_routing][google.cloud.tasks.v2beta3.AppEngineHttpRequest.app_engine_routing].
  198. //
  199. //
  200. // The `url` that the task will be sent to is:
  201. //
  202. // * `url =` [host][google.cloud.tasks.v2beta3.AppEngineRouting.host] `+`
  203. // [relative_uri][google.cloud.tasks.v2beta3.AppEngineHttpRequest.relative_uri]
  204. //
  205. // Tasks can be dispatched to secure app handlers, unsecure app handlers, and
  206. // URIs restricted with
  207. // [`login:
  208. // admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref).
  209. // Because tasks are not run as any user, they cannot be dispatched to URIs
  210. // restricted with
  211. // [`login:
  212. // required`](https://cloud.google.com/appengine/docs/standard/python/config/appref)
  213. // Task dispatches also do not follow redirects.
  214. //
  215. // The task attempt has succeeded if the app's request handler returns an HTTP
  216. // response code in the range [`200` - `299`]. The task attempt has failed if
  217. // the app's handler returns a non-2xx response code or Cloud Tasks does
  218. // not receive response before the [deadline][google.cloud.tasks.v2beta3.Task.dispatch_deadline]. Failed
  219. // tasks will be retried according to the
  220. // [retry configuration][google.cloud.tasks.v2beta3.Queue.retry_config]. `503` (Service Unavailable) is
  221. // considered an App Engine system error instead of an application error and
  222. // will cause Cloud Tasks' traffic congestion control to temporarily throttle
  223. // the queue's dispatches. Unlike other types of task targets, a `429` (Too Many
  224. // Requests) response from an app handler does not cause traffic congestion
  225. // control to throttle the queue.
  226. message AppEngineHttpRequest {
  227. // The HTTP method to use for the request. The default is POST.
  228. //
  229. // The app's request handler for the task's target URL must be able to handle
  230. // HTTP requests with this http_method, otherwise the task attempt fails with
  231. // error code 405 (Method Not Allowed). See [Writing a push task request
  232. // handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler)
  233. // and the App Engine documentation for your runtime on [How Requests are
  234. // Handled](https://cloud.google.com/appengine/docs/standard/python3/how-requests-are-handled).
  235. HttpMethod http_method = 1;
  236. // Task-level setting for App Engine routing.
  237. //
  238. // If set,
  239. // [app_engine_routing_override][google.cloud.tasks.v2beta3.AppEngineHttpQueue.app_engine_routing_override]
  240. // is used for all tasks in the queue, no matter what the setting is for the
  241. // [task-level app_engine_routing][google.cloud.tasks.v2beta3.AppEngineHttpRequest.app_engine_routing].
  242. AppEngineRouting app_engine_routing = 2;
  243. // The relative URI.
  244. //
  245. // The relative URI must begin with "/" and must be a valid HTTP relative URI.
  246. // It can contain a path and query string arguments.
  247. // If the relative URI is empty, then the root path "/" will be used.
  248. // No spaces are allowed, and the maximum length allowed is 2083 characters.
  249. string relative_uri = 3;
  250. // HTTP request headers.
  251. //
  252. // This map contains the header field names and values.
  253. // Headers can be set when the
  254. // [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
  255. // Repeated headers are not supported but a header value can contain commas.
  256. //
  257. // Cloud Tasks sets some headers to default values:
  258. //
  259. // * `User-Agent`: By default, this header is
  260. // `"AppEngine-Google; (+http://code.google.com/appengine)"`.
  261. // This header can be modified, but Cloud Tasks will append
  262. // `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
  263. // modified `User-Agent`.
  264. //
  265. // If the task has a [body][google.cloud.tasks.v2beta3.AppEngineHttpRequest.body], Cloud
  266. // Tasks sets the following headers:
  267. //
  268. // * `Content-Type`: By default, the `Content-Type` header is set to
  269. // `"application/octet-stream"`. The default can be overridden by explicitly
  270. // setting `Content-Type` to a particular media type when the
  271. // [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
  272. // For example, `Content-Type` can be set to `"application/json"`.
  273. // * `Content-Length`: This is computed by Cloud Tasks. This value is
  274. // output only. It cannot be changed.
  275. //
  276. // The headers below cannot be set or overridden:
  277. //
  278. // * `Host`
  279. // * `X-Google-*`
  280. // * `X-AppEngine-*`
  281. //
  282. // In addition, Cloud Tasks sets some headers when the task is dispatched,
  283. // such as headers containing information about the task; see
  284. // [request
  285. // headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers).
  286. // These headers are set only when the task is dispatched, so they are not
  287. // visible when the task is returned in a Cloud Tasks response.
  288. //
  289. // Although there is no specific limit for the maximum number of headers or
  290. // the size, there is a limit on the maximum size of the [Task][google.cloud.tasks.v2beta3.Task]. For more
  291. // information, see the [CreateTask][google.cloud.tasks.v2beta3.CloudTasks.CreateTask] documentation.
  292. map<string, string> headers = 4;
  293. // HTTP request body.
  294. //
  295. // A request body is allowed only if the HTTP method is POST or PUT. It is
  296. // an error to set a body on a task with an incompatible [HttpMethod][google.cloud.tasks.v2beta3.HttpMethod].
  297. bytes body = 5;
  298. }
  299. // App Engine Routing.
  300. //
  301. // Defines routing characteristics specific to App Engine - service, version,
  302. // and instance.
  303. //
  304. // For more information about services, versions, and instances see
  305. // [An Overview of App
  306. // Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine),
  307. // [Microservices Architecture on Google App
  308. // Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine),
  309. // [App Engine Standard request
  310. // routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed),
  311. // and [App Engine Flex request
  312. // routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
  313. message AppEngineRouting {
  314. // App service.
  315. //
  316. // By default, the task is sent to the service which is the default
  317. // service when the task is attempted.
  318. //
  319. // For some queues or tasks which were created using the App Engine
  320. // Task Queue API, [host][google.cloud.tasks.v2beta3.AppEngineRouting.host] is not parsable
  321. // into [service][google.cloud.tasks.v2beta3.AppEngineRouting.service],
  322. // [version][google.cloud.tasks.v2beta3.AppEngineRouting.version], and
  323. // [instance][google.cloud.tasks.v2beta3.AppEngineRouting.instance]. For example, some tasks
  324. // which were created using the App Engine SDK use a custom domain
  325. // name; custom domains are not parsed by Cloud Tasks. If
  326. // [host][google.cloud.tasks.v2beta3.AppEngineRouting.host] is not parsable, then
  327. // [service][google.cloud.tasks.v2beta3.AppEngineRouting.service],
  328. // [version][google.cloud.tasks.v2beta3.AppEngineRouting.version], and
  329. // [instance][google.cloud.tasks.v2beta3.AppEngineRouting.instance] are the empty string.
  330. string service = 1;
  331. // App version.
  332. //
  333. // By default, the task is sent to the version which is the default
  334. // version when the task is attempted.
  335. //
  336. // For some queues or tasks which were created using the App Engine
  337. // Task Queue API, [host][google.cloud.tasks.v2beta3.AppEngineRouting.host] is not parsable
  338. // into [service][google.cloud.tasks.v2beta3.AppEngineRouting.service],
  339. // [version][google.cloud.tasks.v2beta3.AppEngineRouting.version], and
  340. // [instance][google.cloud.tasks.v2beta3.AppEngineRouting.instance]. For example, some tasks
  341. // which were created using the App Engine SDK use a custom domain
  342. // name; custom domains are not parsed by Cloud Tasks. If
  343. // [host][google.cloud.tasks.v2beta3.AppEngineRouting.host] is not parsable, then
  344. // [service][google.cloud.tasks.v2beta3.AppEngineRouting.service],
  345. // [version][google.cloud.tasks.v2beta3.AppEngineRouting.version], and
  346. // [instance][google.cloud.tasks.v2beta3.AppEngineRouting.instance] are the empty string.
  347. string version = 2;
  348. // App instance.
  349. //
  350. // By default, the task is sent to an instance which is available when
  351. // the task is attempted.
  352. //
  353. // Requests can only be sent to a specific instance if
  354. // [manual scaling is used in App Engine
  355. // Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes).
  356. // App Engine Flex does not support instances. For more information, see
  357. // [App Engine Standard request
  358. // routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
  359. // and [App Engine Flex request
  360. // routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
  361. string instance = 3;
  362. // Output only. The host that the task is sent to.
  363. //
  364. // The host is constructed from the domain name of the app associated with
  365. // the queue's project ID (for example <app-id>.appspot.com), and the
  366. // [service][google.cloud.tasks.v2beta3.AppEngineRouting.service], [version][google.cloud.tasks.v2beta3.AppEngineRouting.version],
  367. // and [instance][google.cloud.tasks.v2beta3.AppEngineRouting.instance]. Tasks which were created using
  368. // the App Engine SDK might have a custom domain name.
  369. //
  370. // For more information, see
  371. // [How Requests are
  372. // Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed).
  373. string host = 4;
  374. }
  375. // The HTTP method used to execute the task.
  376. enum HttpMethod {
  377. // HTTP method unspecified
  378. HTTP_METHOD_UNSPECIFIED = 0;
  379. // HTTP POST
  380. POST = 1;
  381. // HTTP GET
  382. GET = 2;
  383. // HTTP HEAD
  384. HEAD = 3;
  385. // HTTP PUT
  386. PUT = 4;
  387. // HTTP DELETE
  388. DELETE = 5;
  389. // HTTP PATCH
  390. PATCH = 6;
  391. // HTTP OPTIONS
  392. OPTIONS = 7;
  393. }
  394. // Contains information needed for generating an
  395. // [OAuth token](https://developers.google.com/identity/protocols/OAuth2).
  396. // This type of authorization should generally only be used when calling Google
  397. // APIs hosted on *.googleapis.com.
  398. message OAuthToken {
  399. // [Service account email](https://cloud.google.com/iam/docs/service-accounts)
  400. // to be used for generating OAuth token.
  401. // The service account must be within the same project as the queue. The
  402. // caller must have iam.serviceAccounts.actAs permission for the service
  403. // account.
  404. string service_account_email = 1;
  405. // OAuth scope to be used for generating OAuth access token.
  406. // If not specified, "https://www.googleapis.com/auth/cloud-platform"
  407. // will be used.
  408. string scope = 2;
  409. }
  410. // Contains information needed for generating an
  411. // [OpenID Connect
  412. // token](https://developers.google.com/identity/protocols/OpenIDConnect).
  413. // This type of authorization can be used for many scenarios, including
  414. // calling Cloud Run, or endpoints where you intend to validate the token
  415. // yourself.
  416. message OidcToken {
  417. // [Service account email](https://cloud.google.com/iam/docs/service-accounts)
  418. // to be used for generating OIDC token.
  419. // The service account must be within the same project as the queue. The
  420. // caller must have iam.serviceAccounts.actAs permission for the service
  421. // account.
  422. string service_account_email = 1;
  423. // Audience to be used when generating OIDC token. If not specified, the URI
  424. // specified in target will be used.
  425. string audience = 2;
  426. }