target.proto 20 KB

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