target.proto 17 KB

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