target.proto 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  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.v2beta2;
  16. option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta2;tasks";
  17. option java_multiple_files = true;
  18. option java_outer_classname = "TargetProto";
  19. option java_package = "com.google.cloud.tasks.v2beta2";
  20. // Pull target.
  21. message PullTarget {
  22. }
  23. // The pull message contains data that can be used by the caller of
  24. // [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the task.
  25. //
  26. // This proto can only be used for tasks in a queue which has
  27. // [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] set.
  28. message PullMessage {
  29. // A data payload consumed by the worker to execute the task.
  30. bytes payload = 1;
  31. // The task's tag.
  32. //
  33. // Tags allow similar tasks to be processed in a batch. If you label
  34. // tasks with a tag, your worker can
  35. // [lease tasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] with the same tag using
  36. // [filter][google.cloud.tasks.v2beta2.LeaseTasksRequest.filter]. For example, if you want to
  37. // aggregate the events associated with a specific user once a day,
  38. // you could tag tasks with the user ID.
  39. //
  40. // The task's tag can only be set when the
  41. // [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
  42. //
  43. // The tag must be less than 500 characters.
  44. //
  45. // SDK compatibility: Although the SDK allows tags to be either
  46. // string or
  47. // [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-),
  48. // only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8
  49. // encoded, the tag will be empty when the task is returned by Cloud Tasks.
  50. string tag = 2;
  51. }
  52. // App Engine HTTP target.
  53. //
  54. // The task will be delivered to the App Engine application hostname
  55. // specified by its [AppEngineHttpTarget][google.cloud.tasks.v2beta2.AppEngineHttpTarget] and [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest].
  56. // The documentation for [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] explains how the
  57. // task's host URL is constructed.
  58. //
  59. // Using [AppEngineHttpTarget][google.cloud.tasks.v2beta2.AppEngineHttpTarget] requires
  60. // [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control)
  61. // Google IAM permission for the project
  62. // and the following scope:
  63. //
  64. // `https://www.googleapis.com/auth/cloud-platform`
  65. message AppEngineHttpTarget {
  66. // Overrides for the
  67. // [task-level app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
  68. //
  69. // If set, `app_engine_routing_override` is used for all tasks in
  70. // the queue, no matter what the setting is for the
  71. // [task-level app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
  72. AppEngineRouting app_engine_routing_override = 1;
  73. }
  74. // App Engine HTTP request.
  75. //
  76. // The message defines the HTTP request that is sent to an App Engine app when
  77. // the task is dispatched.
  78. //
  79. // This proto can only be used for tasks in a queue which has
  80. // [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] set.
  81. //
  82. // Using [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] requires
  83. // [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control)
  84. // Google IAM permission for the project
  85. // and the following scope:
  86. //
  87. // `https://www.googleapis.com/auth/cloud-platform`
  88. //
  89. // The task will be delivered to the App Engine app which belongs to the same
  90. // project as the queue. For more information, see
  91. // [How Requests are
  92. // Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
  93. // and how routing is affected by
  94. // [dispatch
  95. // files](https://cloud.google.com/appengine/docs/python/config/dispatchref).
  96. // Traffic is encrypted during transport and never leaves Google datacenters.
  97. // Because this traffic is carried over a communication mechanism internal to
  98. // Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS).
  99. // The request to the handler, however, will appear to have used the HTTP
  100. // protocol.
  101. //
  102. // The [AppEngineRouting][google.cloud.tasks.v2beta2.AppEngineRouting] used to construct the URL that the task is
  103. // delivered to can be set at the queue-level or task-level:
  104. //
  105. // * If set,
  106. // [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
  107. // is used for all tasks in the queue, no matter what the setting
  108. // is for the
  109. // [task-level app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
  110. //
  111. //
  112. // The `url` that the task will be sent to is:
  113. //
  114. // * `url =` [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] `+`
  115. // [relative_url][google.cloud.tasks.v2beta2.AppEngineHttpRequest.relative_url]
  116. //
  117. // Tasks can be dispatched to secure app handlers, unsecure app handlers, and
  118. // URIs restricted with
  119. // [`login:
  120. // admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref).
  121. // Because tasks are not run as any user, they cannot be dispatched to URIs
  122. // restricted with
  123. // [`login:
  124. // required`](https://cloud.google.com/appengine/docs/standard/python/config/appref)
  125. // Task dispatches also do not follow redirects.
  126. //
  127. // The task attempt has succeeded if the app's request handler returns an HTTP
  128. // response code in the range [`200` - `299`]. The task attempt has failed if
  129. // the app's handler returns a non-2xx response code or Cloud Tasks does
  130. // not receive response before the [deadline][Task.dispatch_deadline]. Failed
  131. // tasks will be retried according to the
  132. // [retry configuration][google.cloud.tasks.v2beta2.Queue.retry_config]. `503` (Service Unavailable) is
  133. // considered an App Engine system error instead of an application error and
  134. // will cause Cloud Tasks' traffic congestion control to temporarily throttle
  135. // the queue's dispatches. Unlike other types of task targets, a `429` (Too Many
  136. // Requests) response from an app handler does not cause traffic congestion
  137. // control to throttle the queue.
  138. message AppEngineHttpRequest {
  139. // The HTTP method to use for the request. The default is POST.
  140. //
  141. // The app's request handler for the task's target URL must be able to handle
  142. // HTTP requests with this http_method, otherwise the task attempt fails with
  143. // error code 405 (Method Not Allowed). See [Writing a push task request
  144. // handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler)
  145. // and the App Engine documentation for your runtime on [How Requests are
  146. // Handled](https://cloud.google.com/appengine/docs/standard/python3/how-requests-are-handled).
  147. HttpMethod http_method = 1;
  148. // Task-level setting for App Engine routing.
  149. //
  150. // If set,
  151. // [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
  152. // is used for all tasks in the queue, no matter what the setting is for the
  153. // [task-level app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
  154. AppEngineRouting app_engine_routing = 2;
  155. // The relative URL.
  156. //
  157. // The relative URL must begin with "/" and must be a valid HTTP relative URL.
  158. // It can contain a path and query string arguments.
  159. // If the relative URL is empty, then the root path "/" will be used.
  160. // No spaces are allowed, and the maximum length allowed is 2083 characters.
  161. string relative_url = 3;
  162. // HTTP request headers.
  163. //
  164. // This map contains the header field names and values.
  165. // Headers can be set when the
  166. // [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
  167. // Repeated headers are not supported but a header value can contain commas.
  168. //
  169. // Cloud Tasks sets some headers to default values:
  170. //
  171. // * `User-Agent`: By default, this header is
  172. // `"AppEngine-Google; (+http://code.google.com/appengine)"`.
  173. // This header can be modified, but Cloud Tasks will append
  174. // `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
  175. // modified `User-Agent`.
  176. //
  177. // If the task has a [payload][google.cloud.tasks.v2beta2.AppEngineHttpRequest.payload], Cloud
  178. // Tasks sets the following headers:
  179. //
  180. // * `Content-Type`: By default, the `Content-Type` header is set to
  181. // `"application/octet-stream"`. The default can be overridden by explicitly
  182. // setting `Content-Type` to a particular media type when the
  183. // [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
  184. // For example, `Content-Type` can be set to `"application/json"`.
  185. // * `Content-Length`: This is computed by Cloud Tasks. This value is
  186. // output only. It cannot be changed.
  187. //
  188. // The headers below cannot be set or overridden:
  189. //
  190. // * `Host`
  191. // * `X-Google-*`
  192. // * `X-AppEngine-*`
  193. //
  194. // In addition, Cloud Tasks sets some headers when the task is dispatched,
  195. // such as headers containing information about the task; see
  196. // [request
  197. // headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers).
  198. // These headers are set only when the task is dispatched, so they are not
  199. // visible when the task is returned in a Cloud Tasks response.
  200. //
  201. // Although there is no specific limit for the maximum number of headers or
  202. // the size, there is a limit on the maximum size of the [Task][google.cloud.tasks.v2beta2.Task]. For more
  203. // information, see the [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask] documentation.
  204. map<string, string> headers = 4;
  205. // Payload.
  206. //
  207. // The payload will be sent as the HTTP message body. A message
  208. // body, and thus a payload, is allowed only if the HTTP method is
  209. // POST or PUT. It is an error to set a data payload on a task with
  210. // an incompatible [HttpMethod][google.cloud.tasks.v2beta2.HttpMethod].
  211. bytes payload = 5;
  212. }
  213. // App Engine Routing.
  214. //
  215. // Defines routing characteristics specific to App Engine - service, version,
  216. // and instance.
  217. //
  218. // For more information about services, versions, and instances see
  219. // [An Overview of App
  220. // Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine),
  221. // [Microservices Architecture on Google App
  222. // Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine),
  223. // [App Engine Standard request
  224. // routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed),
  225. // and [App Engine Flex request
  226. // routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
  227. message AppEngineRouting {
  228. // App service.
  229. //
  230. // By default, the task is sent to the service which is the default
  231. // service when the task is attempted.
  232. //
  233. // For some queues or tasks which were created using the App Engine
  234. // Task Queue API, [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] is not parsable
  235. // into [service][google.cloud.tasks.v2beta2.AppEngineRouting.service],
  236. // [version][google.cloud.tasks.v2beta2.AppEngineRouting.version], and
  237. // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance]. For example, some tasks
  238. // which were created using the App Engine SDK use a custom domain
  239. // name; custom domains are not parsed by Cloud Tasks. If
  240. // [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] is not parsable, then
  241. // [service][google.cloud.tasks.v2beta2.AppEngineRouting.service],
  242. // [version][google.cloud.tasks.v2beta2.AppEngineRouting.version], and
  243. // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] are the empty string.
  244. string service = 1;
  245. // App version.
  246. //
  247. // By default, the task is sent to the version which is the default
  248. // version when the task is attempted.
  249. //
  250. // For some queues or tasks which were created using the App Engine
  251. // Task Queue API, [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] is not parsable
  252. // into [service][google.cloud.tasks.v2beta2.AppEngineRouting.service],
  253. // [version][google.cloud.tasks.v2beta2.AppEngineRouting.version], and
  254. // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance]. For example, some tasks
  255. // which were created using the App Engine SDK use a custom domain
  256. // name; custom domains are not parsed by Cloud Tasks. If
  257. // [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] is not parsable, then
  258. // [service][google.cloud.tasks.v2beta2.AppEngineRouting.service],
  259. // [version][google.cloud.tasks.v2beta2.AppEngineRouting.version], and
  260. // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] are the empty string.
  261. string version = 2;
  262. // App instance.
  263. //
  264. // By default, the task is sent to an instance which is available when
  265. // the task is attempted.
  266. //
  267. // Requests can only be sent to a specific instance if
  268. // [manual scaling is used in App Engine
  269. // Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes).
  270. // App Engine Flex does not support instances. For more information, see
  271. // [App Engine Standard request
  272. // routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
  273. // and [App Engine Flex request
  274. // routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
  275. string instance = 3;
  276. // Output only. The host that the task is sent to.
  277. //
  278. // For more information, see
  279. // [How Requests are
  280. // Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed).
  281. //
  282. // The host is constructed as:
  283. //
  284. //
  285. // * `host = [application_domain_name]`</br>
  286. // `| [service] + '.' + [application_domain_name]`</br>
  287. // `| [version] + '.' + [application_domain_name]`</br>
  288. // `| [version_dot_service]+ '.' + [application_domain_name]`</br>
  289. // `| [instance] + '.' + [application_domain_name]`</br>
  290. // `| [instance_dot_service] + '.' + [application_domain_name]`</br>
  291. // `| [instance_dot_version] + '.' + [application_domain_name]`</br>
  292. // `| [instance_dot_version_dot_service] + '.' + [application_domain_name]`
  293. //
  294. // * `application_domain_name` = The domain name of the app, for
  295. // example <app-id>.appspot.com, which is associated with the
  296. // queue's project ID. Some tasks which were created using the App Engine
  297. // SDK use a custom domain name.
  298. //
  299. // * `service =` [service][google.cloud.tasks.v2beta2.AppEngineRouting.service]
  300. //
  301. // * `version =` [version][google.cloud.tasks.v2beta2.AppEngineRouting.version]
  302. //
  303. // * `version_dot_service =`
  304. // [version][google.cloud.tasks.v2beta2.AppEngineRouting.version] `+ '.' +`
  305. // [service][google.cloud.tasks.v2beta2.AppEngineRouting.service]
  306. //
  307. // * `instance =` [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance]
  308. //
  309. // * `instance_dot_service =`
  310. // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] `+ '.' +`
  311. // [service][google.cloud.tasks.v2beta2.AppEngineRouting.service]
  312. //
  313. // * `instance_dot_version =`
  314. // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] `+ '.' +`
  315. // [version][google.cloud.tasks.v2beta2.AppEngineRouting.version]
  316. //
  317. // * `instance_dot_version_dot_service =`
  318. // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] `+ '.' +`
  319. // [version][google.cloud.tasks.v2beta2.AppEngineRouting.version] `+ '.' +`
  320. // [service][google.cloud.tasks.v2beta2.AppEngineRouting.service]
  321. //
  322. // If [service][google.cloud.tasks.v2beta2.AppEngineRouting.service] is empty, then the task will be sent
  323. // to the service which is the default service when the task is attempted.
  324. //
  325. // If [version][google.cloud.tasks.v2beta2.AppEngineRouting.version] is empty, then the task will be sent
  326. // to the version which is the default version when the task is attempted.
  327. //
  328. // If [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] is empty, then the task
  329. // will be sent to an instance which is available when the task is
  330. // attempted.
  331. //
  332. // If [service][google.cloud.tasks.v2beta2.AppEngineRouting.service],
  333. // [version][google.cloud.tasks.v2beta2.AppEngineRouting.version], or
  334. // [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] is invalid, then the task
  335. // will be sent to the default version of the default service when
  336. // the task is attempted.
  337. string host = 4;
  338. }
  339. // The HTTP method used to execute the task.
  340. enum HttpMethod {
  341. // HTTP method unspecified
  342. HTTP_METHOD_UNSPECIFIED = 0;
  343. // HTTP POST
  344. POST = 1;
  345. // HTTP GET
  346. GET = 2;
  347. // HTTP HEAD
  348. HEAD = 3;
  349. // HTTP PUT
  350. PUT = 4;
  351. // HTTP DELETE
  352. DELETE = 5;
  353. }