1<html><body> 2<style> 3 4body, h1, h2, h3, div, span, p, pre, a { 5 margin: 0; 6 padding: 0; 7 border: 0; 8 font-weight: inherit; 9 font-style: inherit; 10 font-size: 100%; 11 font-family: inherit; 12 vertical-align: baseline; 13} 14 15body { 16 font-size: 13px; 17 padding: 1em; 18} 19 20h1 { 21 font-size: 26px; 22 margin-bottom: 1em; 23} 24 25h2 { 26 font-size: 24px; 27 margin-bottom: 1em; 28} 29 30h3 { 31 font-size: 20px; 32 margin-bottom: 1em; 33 margin-top: 1em; 34} 35 36pre, code { 37 line-height: 1.5; 38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; 39} 40 41pre { 42 margin-top: 0.5em; 43} 44 45h1, h2, h3, p { 46 font-family: Arial, sans serif; 47} 48 49h1, h2, h3 { 50 border-bottom: solid #CCC 1px; 51} 52 53.toc_element { 54 margin-top: 0.5em; 55} 56 57.firstline { 58 margin-left: 2 em; 59} 60 61.method { 62 margin-top: 1em; 63 border: solid 1px #CCC; 64 padding: 1em; 65 background: #EEE; 66} 67 68.details { 69 font-weight: bold; 70 font-size: 14px; 71} 72 73</style> 74 75<h1><a href="cloudtasks_v2beta2.html">Cloud Tasks API</a> . <a href="cloudtasks_v2beta2.projects.html">projects</a> . <a href="cloudtasks_v2beta2.projects.locations.html">locations</a> . <a href="cloudtasks_v2beta2.projects.locations.queues.html">queues</a> . <a href="cloudtasks_v2beta2.projects.locations.queues.tasks.html">tasks</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#acknowledge">acknowledge(name, body, x__xgafv=None)</a></code></p> 79<p class="firstline">Acknowledges a pull task.</p> 80<p class="toc_element"> 81 <code><a href="#cancelLease">cancelLease(name, body, x__xgafv=None)</a></code></p> 82<p class="firstline">Cancel a pull task's lease.</p> 83<p class="toc_element"> 84 <code><a href="#create">create(parent, body, x__xgafv=None)</a></code></p> 85<p class="firstline">Creates a task and adds it to a queue.</p> 86<p class="toc_element"> 87 <code><a href="#delete">delete(name, x__xgafv=None)</a></code></p> 88<p class="firstline">Deletes a task.</p> 89<p class="toc_element"> 90 <code><a href="#get">get(name, responseView=None, x__xgafv=None)</a></code></p> 91<p class="firstline">Gets a task.</p> 92<p class="toc_element"> 93 <code><a href="#lease">lease(parent, body, x__xgafv=None)</a></code></p> 94<p class="firstline">Leases tasks from a pull queue for</p> 95<p class="toc_element"> 96 <code><a href="#list">list(parent, responseView=None, pageSize=None, pageToken=None, x__xgafv=None)</a></code></p> 97<p class="firstline">Lists the tasks in a queue.</p> 98<p class="toc_element"> 99 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p> 100<p class="firstline">Retrieves the next page of results.</p> 101<p class="toc_element"> 102 <code><a href="#renewLease">renewLease(name, body, x__xgafv=None)</a></code></p> 103<p class="firstline">Renew the current lease of a pull task.</p> 104<p class="toc_element"> 105 <code><a href="#run">run(name, body, x__xgafv=None)</a></code></p> 106<p class="firstline">Forces a task to run now.</p> 107<h3>Method Details</h3> 108<div class="method"> 109 <code class="details" id="acknowledge">acknowledge(name, body, x__xgafv=None)</code> 110 <pre>Acknowledges a pull task. 111 112The worker, that is, the entity that 113leased this task must call this method 114to indicate that the work associated with the task has finished. 115 116The worker must acknowledge a task within the 117lease_duration or the lease 118will expire and the task will become available to be leased 119again. After the task is acknowledged, it will not be returned 120by a later LeaseTasks, 121GetTask, or 122ListTasks. 123 124Args: 125 name: string, Required. 126 127The task name. For example: 128`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` (required) 129 body: object, The request body. (required) 130 The object takes the form of: 131 132{ # Request message for acknowledging a task using 133 # AcknowledgeTask. 134 "scheduleTime": "A String", # Required. 135 # 136 # The task's current schedule time, available in the 137 # schedule_time returned by 138 # LeaseTasks response or 139 # RenewLease response. This restriction is 140 # to ensure that your worker currently holds the lease. 141 } 142 143 x__xgafv: string, V1 error format. 144 Allowed values 145 1 - v1 error format 146 2 - v2 error format 147 148Returns: 149 An object of the form: 150 151 { # A generic empty message that you can re-use to avoid defining duplicated 152 # empty messages in your APIs. A typical example is to use it as the request 153 # or the response type of an API method. For instance: 154 # 155 # service Foo { 156 # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); 157 # } 158 # 159 # The JSON representation for `Empty` is empty JSON object `{}`. 160 }</pre> 161</div> 162 163<div class="method"> 164 <code class="details" id="cancelLease">cancelLease(name, body, x__xgafv=None)</code> 165 <pre>Cancel a pull task's lease. 166 167The worker can use this method to cancel a task's lease by 168setting its schedule_time to now. This will 169make the task available to be leased to the next caller of 170LeaseTasks. 171 172Args: 173 name: string, Required. 174 175The task name. For example: 176`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` (required) 177 body: object, The request body. (required) 178 The object takes the form of: 179 180{ # Request message for canceling a lease using 181 # CancelLease. 182 "scheduleTime": "A String", # Required. 183 # 184 # The task's current schedule time, available in the 185 # schedule_time returned by 186 # LeaseTasks response or 187 # RenewLease response. This restriction is 188 # to ensure that your worker currently holds the lease. 189 "responseView": "A String", # The response_view specifies which subset of the Task will be 190 # returned. 191 # 192 # By default response_view is BASIC; not all 193 # information is retrieved by default because some data, such as 194 # payloads, might be desirable to return only when needed because 195 # of its large size or because of the sensitivity of data that it 196 # contains. 197 # 198 # Authorization for FULL requires 199 # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) 200 # permission on the Task resource. 201 } 202 203 x__xgafv: string, V1 error format. 204 Allowed values 205 1 - v1 error format 206 2 - v2 error format 207 208Returns: 209 An object of the form: 210 211 { # A unit of scheduled work. 212 "status": { # Status of the task. # Output only. The task status. 213 "lastAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's last attempt. 214 # 215 # This field is not calculated for pull tasks. 216 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 217 # 218 # `schedule_time` will be truncated to the nearest microsecond. 219 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 220 # 221 # If the task has not been attempted or the task is currently running 222 # then the response status is unset. 223 # different programming environments, including REST APIs and RPC APIs. It is 224 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 225 # three pieces of data: error code, error message, and error details. 226 # 227 # You can find out more about this error model and how to work with it in the 228 # [API Design Guide](https://cloud.google.com/apis/design/errors). 229 "message": "A String", # A developer-facing error message, which should be in English. Any 230 # user-facing error message should be localized and sent in the 231 # google.rpc.Status.details field, or localized by the client. 232 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 233 "details": [ # A list of messages that carry the error details. There is a common set of 234 # message types for APIs to use. 235 { 236 "a_key": "", # Properties of the object. Contains field @type with type URL. 237 }, 238 ], 239 }, 240 "responseTime": "A String", # Output only. The time that this attempt response was received. 241 # 242 # `response_time` will be truncated to the nearest microsecond. 243 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 244 # 245 # `dispatch_time` will be truncated to the nearest microsecond. 246 }, 247 "firstAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's first attempt. 248 # 249 # Only dispatch_time will be set. 250 # The other AttemptStatus information is not retained by Cloud Tasks. 251 # 252 # This field is not calculated for pull tasks. 253 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 254 # 255 # `schedule_time` will be truncated to the nearest microsecond. 256 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 257 # 258 # If the task has not been attempted or the task is currently running 259 # then the response status is unset. 260 # different programming environments, including REST APIs and RPC APIs. It is 261 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 262 # three pieces of data: error code, error message, and error details. 263 # 264 # You can find out more about this error model and how to work with it in the 265 # [API Design Guide](https://cloud.google.com/apis/design/errors). 266 "message": "A String", # A developer-facing error message, which should be in English. Any 267 # user-facing error message should be localized and sent in the 268 # google.rpc.Status.details field, or localized by the client. 269 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 270 "details": [ # A list of messages that carry the error details. There is a common set of 271 # message types for APIs to use. 272 { 273 "a_key": "", # Properties of the object. Contains field @type with type URL. 274 }, 275 ], 276 }, 277 "responseTime": "A String", # Output only. The time that this attempt response was received. 278 # 279 # `response_time` will be truncated to the nearest microsecond. 280 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 281 # 282 # `dispatch_time` will be truncated to the nearest microsecond. 283 }, 284 "attemptDispatchCount": 42, # Output only. The number of attempts dispatched. 285 # 286 # This count includes attempts which have been dispatched but haven't 287 # received a response. 288 "attemptResponseCount": 42, # Output only. The number of attempts which have received a response. 289 # 290 # This field is not calculated for pull tasks. 291 }, 292 "pullMessage": { # The pull message contains data that can be used by the caller of # LeaseTasks to process the task. Can be 293 # set only if pull_target is set on the queue. 294 # 295 # A pull task is a task that has PullMessage set. 296 # LeaseTasks to process the task. 297 # 298 # This proto can only be used for tasks in a queue which has 299 # pull_target set. 300 "tag": "A String", # The task's tag. 301 # 302 # Tags allow similar tasks to be processed in a batch. If you label 303 # tasks with a tag, your worker can 304 # lease tasks with the same tag using 305 # filter. For example, if you want to 306 # aggregate the events associated with a specific user once a day, 307 # you could tag tasks with the user ID. 308 # 309 # The task's tag can only be set when the 310 # task is created. 311 # 312 # The tag must be less than 500 characters. 313 # 314 # SDK compatibility: Although the SDK allows tags to be either 315 # string or 316 # [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), 317 # only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8 318 # encoded, the tag will be empty when the task is returned by Cloud Tasks. 319 "payload": "A String", # A data payload consumed by the worker to execute the task. 320 }, 321 "appEngineHttpRequest": { # App Engine HTTP request. # App Engine HTTP request that is sent to the task's target. Can 322 # be set only if 323 # app_engine_http_target is set 324 # on the queue. 325 # 326 # An App Engine task is a task that has AppEngineHttpRequest set. 327 # 328 # The message defines the HTTP request that is sent to an App Engine app when 329 # the task is dispatched. 330 # 331 # This proto can only be used for tasks in a queue which has 332 # app_engine_http_target set. 333 # 334 # Using AppEngineHttpRequest requires 335 # [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) 336 # Google IAM permission for the project 337 # and the following scope: 338 # 339 # `https://www.googleapis.com/auth/cloud-platform` 340 # 341 # The task will be delivered to the App Engine app which belongs to the same 342 # project as the queue. For more information, see 343 # [How Requests are 344 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 345 # and how routing is affected by 346 # [dispatch 347 # files](https://cloud.google.com/appengine/docs/python/config/dispatchref). 348 # Traffic is encrypted during transport and never leaves Google datacenters. 349 # Because this traffic is carried over a communication mechanism internal to 350 # Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). 351 # The request to the handler, however, will appear to have used the HTTP 352 # protocol. 353 # 354 # The AppEngineRouting used to construct the URL that the task is 355 # delivered to can be set at the queue-level or task-level: 356 # 357 # * If set, 358 # app_engine_routing_override 359 # is used for all tasks in the queue, no matter what the setting 360 # is for the 361 # task-level app_engine_routing. 362 # 363 # 364 # The `url` that the task will be sent to is: 365 # 366 # * `url =` host `+` 367 # relative_url 368 # 369 # Tasks can be dispatched to secure app handlers, unsecure app handlers, and 370 # URIs restricted with 371 # [`login: 372 # admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). 373 # Because tasks are not run as any user, they cannot be dispatched to URIs 374 # restricted with 375 # [`login: 376 # required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) 377 # Task dispatches also do not follow redirects. 378 # 379 # The task attempt has succeeded if the app's request handler returns an HTTP 380 # response code in the range [`200` - `299`]. The task attempt has failed if 381 # the app's handler returns a non-2xx response code or Cloud Tasks does 382 # not receive response before the deadline. Failed 383 # tasks will be retried according to the 384 # retry configuration. `503` (Service Unavailable) is 385 # considered an App Engine system error instead of an application error and 386 # will cause Cloud Tasks' traffic congestion control to temporarily throttle 387 # the queue's dispatches. Unlike other types of task targets, a `429` (Too Many 388 # Requests) response from an app handler does not cause traffic congestion 389 # control to throttle the queue. 390 "relativeUrl": "A String", # The relative URL. 391 # 392 # The relative URL must begin with "/" and must be a valid HTTP relative URL. 393 # It can contain a path and query string arguments. 394 # If the relative URL is empty, then the root path "/" will be used. 395 # No spaces are allowed, and the maximum length allowed is 2083 characters. 396 "httpMethod": "A String", # The HTTP method to use for the request. The default is POST. 397 # 398 # The app's request handler for the task's target URL must be able to handle 399 # HTTP requests with this http_method, otherwise the task attempt will fail 400 # with error code 405 (Method Not Allowed). See 401 # [Writing a push task request 402 # handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 403 # and the documentation for the request handlers in the language your app is 404 # written in e.g. 405 # [Python Request 406 # Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). 407 "appEngineRouting": { # App Engine Routing. # Task-level setting for App Engine routing. 408 # 409 # If set, 410 # app_engine_routing_override 411 # is used for all tasks in the queue, no matter what the setting is for the 412 # task-level app_engine_routing. 413 # 414 # Defines routing characteristics specific to App Engine - service, version, 415 # and instance. 416 # 417 # For more information about services, versions, and instances see 418 # [An Overview of App 419 # Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), 420 # [Microservices Architecture on Google App 421 # Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), 422 # [App Engine Standard request 423 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), 424 # and [App Engine Flex request 425 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 426 "instance": "A String", # App instance. 427 # 428 # By default, the task is sent to an instance which is available when 429 # the task is attempted. 430 # 431 # Requests can only be sent to a specific instance if 432 # [manual scaling is used in App Engine 433 # Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). 434 # App Engine Flex does not support instances. For more information, see 435 # [App Engine Standard request 436 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 437 # and [App Engine Flex request 438 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 439 "host": "A String", # Output only. The host that the task is sent to. 440 # 441 # For more information, see 442 # [How Requests are 443 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). 444 # 445 # The host is constructed as: 446 # 447 # 448 # * `host = [application_domain_name]`</br> 449 # `| [service] + '.' + [application_domain_name]`</br> 450 # `| [version] + '.' + [application_domain_name]`</br> 451 # `| [version_dot_service]+ '.' + [application_domain_name]`</br> 452 # `| [instance] + '.' + [application_domain_name]`</br> 453 # `| [instance_dot_service] + '.' + [application_domain_name]`</br> 454 # `| [instance_dot_version] + '.' + [application_domain_name]`</br> 455 # `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` 456 # 457 # * `application_domain_name` = The domain name of the app, for 458 # example <app-id>.appspot.com, which is associated with the 459 # queue's project ID. Some tasks which were created using the App Engine 460 # SDK use a custom domain name. 461 # 462 # * `service =` service 463 # 464 # * `version =` version 465 # 466 # * `version_dot_service =` 467 # version `+ '.' +` 468 # service 469 # 470 # * `instance =` instance 471 # 472 # * `instance_dot_service =` 473 # instance `+ '.' +` 474 # service 475 # 476 # * `instance_dot_version =` 477 # instance `+ '.' +` 478 # version 479 # 480 # * `instance_dot_version_dot_service =` 481 # instance `+ '.' +` 482 # version `+ '.' +` 483 # service 484 # 485 # If service is empty, then the task will be sent 486 # to the service which is the default service when the task is attempted. 487 # 488 # If version is empty, then the task will be sent 489 # to the version which is the default version when the task is attempted. 490 # 491 # If instance is empty, then the task 492 # will be sent to an instance which is available when the task is 493 # attempted. 494 # 495 # If service, 496 # version, or 497 # instance is invalid, then the task 498 # will be sent to the default version of the default service when 499 # the task is attempted. 500 "version": "A String", # App version. 501 # 502 # By default, the task is sent to the version which is the default 503 # version when the task is attempted. 504 # 505 # For some queues or tasks which were created using the App Engine 506 # Task Queue API, host is not parsable 507 # into service, 508 # version, and 509 # instance. For example, some tasks 510 # which were created using the App Engine SDK use a custom domain 511 # name; custom domains are not parsed by Cloud Tasks. If 512 # host is not parsable, then 513 # service, 514 # version, and 515 # instance are the empty string. 516 "service": "A String", # App service. 517 # 518 # By default, the task is sent to the service which is the default 519 # service when the task is attempted. 520 # 521 # For some queues or tasks which were created using the App Engine 522 # Task Queue API, host is not parsable 523 # into service, 524 # version, and 525 # instance. For example, some tasks 526 # which were created using the App Engine SDK use a custom domain 527 # name; custom domains are not parsed by Cloud Tasks. If 528 # host is not parsable, then 529 # service, 530 # version, and 531 # instance are the empty string. 532 }, 533 "payload": "A String", # Payload. 534 # 535 # The payload will be sent as the HTTP message body. A message 536 # body, and thus a payload, is allowed only if the HTTP method is 537 # POST or PUT. It is an error to set a data payload on a task with 538 # an incompatible HttpMethod. 539 "headers": { # HTTP request headers. 540 # 541 # This map contains the header field names and values. 542 # Headers can be set when the 543 # task is created. 544 # Repeated headers are not supported but a header value can contain commas. 545 # 546 # Cloud Tasks sets some headers to default values: 547 # 548 # * `User-Agent`: By default, this header is 549 # `"AppEngine-Google; (+http://code.google.com/appengine)"`. 550 # This header can be modified, but Cloud Tasks will append 551 # `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 552 # modified `User-Agent`. 553 # 554 # If the task has a payload, Cloud 555 # Tasks sets the following headers: 556 # 557 # * `Content-Type`: By default, the `Content-Type` header is set to 558 # `"application/octet-stream"`. The default can be overridden by explicitly 559 # setting `Content-Type` to a particular media type when the 560 # task is created. 561 # For example, `Content-Type` can be set to `"application/json"`. 562 # * `Content-Length`: This is computed by Cloud Tasks. This value is 563 # output only. It cannot be changed. 564 # 565 # The headers below cannot be set or overridden: 566 # 567 # * `Host` 568 # * `X-Google-*` 569 # * `X-AppEngine-*` 570 # 571 # In addition, Cloud Tasks sets some headers when the task is dispatched, 572 # such as headers containing information about the task; see 573 # [request 574 # headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). 575 # These headers are set only when the task is dispatched, so they are not 576 # visible when the task is returned in a Cloud Tasks response. 577 # 578 # Although there is no specific limit for the maximum number of headers or 579 # the size, there is a limit on the maximum size of the Task. For more 580 # information, see the CreateTask documentation. 581 "a_key": "A String", 582 }, 583 }, 584 "name": "A String", # Optionally caller-specified in CreateTask. 585 # 586 # The task name. 587 # 588 # The task name must have the following format: 589 # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` 590 # 591 # * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), 592 # hyphens (-), colons (:), or periods (.). 593 # For more information, see 594 # [Identifying 595 # projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) 596 # * `LOCATION_ID` is the canonical ID for the task's location. 597 # The list of available locations can be obtained by calling 598 # ListLocations. 599 # For more information, see https://cloud.google.com/about/locations/. 600 # * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or 601 # hyphens (-). The maximum length is 100 characters. 602 # * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), 603 # hyphens (-), or underscores (_). The maximum length is 500 characters. 604 "scheduleTime": "A String", # The time when the task is scheduled to be attempted. 605 # 606 # For App Engine queues, this is when the task will be attempted or retried. 607 # 608 # For pull queues, this is the time when the task is available to 609 # be leased; if a task is currently leased, this is the time when 610 # the current lease expires, that is, the time that the task was 611 # leased plus the lease_duration. 612 # 613 # `schedule_time` will be truncated to the nearest microsecond. 614 "createTime": "A String", # Output only. The time that the task was created. 615 # 616 # `create_time` will be truncated to the nearest second. 617 "view": "A String", # Output only. The view specifies which subset of the Task has 618 # been returned. 619 }</pre> 620</div> 621 622<div class="method"> 623 <code class="details" id="create">create(parent, body, x__xgafv=None)</code> 624 <pre>Creates a task and adds it to a queue. 625 626Tasks cannot be updated after creation; there is no UpdateTask command. 627 628* For App Engine queues, the maximum task size is 629 100KB. 630* For pull queues, the maximum task size is 1MB. 631 632Args: 633 parent: string, Required. 634 635The queue name. For example: 636`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` 637 638The queue must already exist. (required) 639 body: object, The request body. (required) 640 The object takes the form of: 641 642{ # Request message for CreateTask. 643 "responseView": "A String", # The response_view specifies which subset of the Task will be 644 # returned. 645 # 646 # By default response_view is BASIC; not all 647 # information is retrieved by default because some data, such as 648 # payloads, might be desirable to return only when needed because 649 # of its large size or because of the sensitivity of data that it 650 # contains. 651 # 652 # Authorization for FULL requires 653 # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) 654 # permission on the Task resource. 655 "task": { # A unit of scheduled work. # Required. 656 # 657 # The task to add. 658 # 659 # Task names have the following format: 660 # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. 661 # The user can optionally specify a task name. If a 662 # name is not specified then the system will generate a random 663 # unique task id, which will be set in the task returned in the 664 # response. 665 # 666 # If schedule_time is not set or is in the 667 # past then Cloud Tasks will set it to the current time. 668 # 669 # Task De-duplication: 670 # 671 # Explicitly specifying a task ID enables task de-duplication. If 672 # a task's ID is identical to that of an existing task or a task 673 # that was deleted or completed recently then the call will fail 674 # with ALREADY_EXISTS. 675 # If the task's queue was created using Cloud Tasks, then another task with 676 # the same name can't be created for ~1hour after the original task was 677 # deleted or completed. If the task's queue was created using queue.yaml or 678 # queue.xml, then another task with the same name can't be created 679 # for ~9days after the original task was deleted or completed. 680 # 681 # Because there is an extra lookup cost to identify duplicate task 682 # names, these CreateTask calls have significantly 683 # increased latency. Using hashed strings for the task id or for 684 # the prefix of the task id is recommended. Choosing task ids that 685 # are sequential or have sequential prefixes, for example using a 686 # timestamp, causes an increase in latency and error rates in all 687 # task commands. The infrastructure relies on an approximately 688 # uniform distribution of task ids to store and serve tasks 689 # efficiently. 690 "status": { # Status of the task. # Output only. The task status. 691 "lastAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's last attempt. 692 # 693 # This field is not calculated for pull tasks. 694 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 695 # 696 # `schedule_time` will be truncated to the nearest microsecond. 697 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 698 # 699 # If the task has not been attempted or the task is currently running 700 # then the response status is unset. 701 # different programming environments, including REST APIs and RPC APIs. It is 702 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 703 # three pieces of data: error code, error message, and error details. 704 # 705 # You can find out more about this error model and how to work with it in the 706 # [API Design Guide](https://cloud.google.com/apis/design/errors). 707 "message": "A String", # A developer-facing error message, which should be in English. Any 708 # user-facing error message should be localized and sent in the 709 # google.rpc.Status.details field, or localized by the client. 710 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 711 "details": [ # A list of messages that carry the error details. There is a common set of 712 # message types for APIs to use. 713 { 714 "a_key": "", # Properties of the object. Contains field @type with type URL. 715 }, 716 ], 717 }, 718 "responseTime": "A String", # Output only. The time that this attempt response was received. 719 # 720 # `response_time` will be truncated to the nearest microsecond. 721 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 722 # 723 # `dispatch_time` will be truncated to the nearest microsecond. 724 }, 725 "firstAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's first attempt. 726 # 727 # Only dispatch_time will be set. 728 # The other AttemptStatus information is not retained by Cloud Tasks. 729 # 730 # This field is not calculated for pull tasks. 731 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 732 # 733 # `schedule_time` will be truncated to the nearest microsecond. 734 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 735 # 736 # If the task has not been attempted or the task is currently running 737 # then the response status is unset. 738 # different programming environments, including REST APIs and RPC APIs. It is 739 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 740 # three pieces of data: error code, error message, and error details. 741 # 742 # You can find out more about this error model and how to work with it in the 743 # [API Design Guide](https://cloud.google.com/apis/design/errors). 744 "message": "A String", # A developer-facing error message, which should be in English. Any 745 # user-facing error message should be localized and sent in the 746 # google.rpc.Status.details field, or localized by the client. 747 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 748 "details": [ # A list of messages that carry the error details. There is a common set of 749 # message types for APIs to use. 750 { 751 "a_key": "", # Properties of the object. Contains field @type with type URL. 752 }, 753 ], 754 }, 755 "responseTime": "A String", # Output only. The time that this attempt response was received. 756 # 757 # `response_time` will be truncated to the nearest microsecond. 758 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 759 # 760 # `dispatch_time` will be truncated to the nearest microsecond. 761 }, 762 "attemptDispatchCount": 42, # Output only. The number of attempts dispatched. 763 # 764 # This count includes attempts which have been dispatched but haven't 765 # received a response. 766 "attemptResponseCount": 42, # Output only. The number of attempts which have received a response. 767 # 768 # This field is not calculated for pull tasks. 769 }, 770 "pullMessage": { # The pull message contains data that can be used by the caller of # LeaseTasks to process the task. Can be 771 # set only if pull_target is set on the queue. 772 # 773 # A pull task is a task that has PullMessage set. 774 # LeaseTasks to process the task. 775 # 776 # This proto can only be used for tasks in a queue which has 777 # pull_target set. 778 "tag": "A String", # The task's tag. 779 # 780 # Tags allow similar tasks to be processed in a batch. If you label 781 # tasks with a tag, your worker can 782 # lease tasks with the same tag using 783 # filter. For example, if you want to 784 # aggregate the events associated with a specific user once a day, 785 # you could tag tasks with the user ID. 786 # 787 # The task's tag can only be set when the 788 # task is created. 789 # 790 # The tag must be less than 500 characters. 791 # 792 # SDK compatibility: Although the SDK allows tags to be either 793 # string or 794 # [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), 795 # only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8 796 # encoded, the tag will be empty when the task is returned by Cloud Tasks. 797 "payload": "A String", # A data payload consumed by the worker to execute the task. 798 }, 799 "appEngineHttpRequest": { # App Engine HTTP request. # App Engine HTTP request that is sent to the task's target. Can 800 # be set only if 801 # app_engine_http_target is set 802 # on the queue. 803 # 804 # An App Engine task is a task that has AppEngineHttpRequest set. 805 # 806 # The message defines the HTTP request that is sent to an App Engine app when 807 # the task is dispatched. 808 # 809 # This proto can only be used for tasks in a queue which has 810 # app_engine_http_target set. 811 # 812 # Using AppEngineHttpRequest requires 813 # [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) 814 # Google IAM permission for the project 815 # and the following scope: 816 # 817 # `https://www.googleapis.com/auth/cloud-platform` 818 # 819 # The task will be delivered to the App Engine app which belongs to the same 820 # project as the queue. For more information, see 821 # [How Requests are 822 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 823 # and how routing is affected by 824 # [dispatch 825 # files](https://cloud.google.com/appengine/docs/python/config/dispatchref). 826 # Traffic is encrypted during transport and never leaves Google datacenters. 827 # Because this traffic is carried over a communication mechanism internal to 828 # Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). 829 # The request to the handler, however, will appear to have used the HTTP 830 # protocol. 831 # 832 # The AppEngineRouting used to construct the URL that the task is 833 # delivered to can be set at the queue-level or task-level: 834 # 835 # * If set, 836 # app_engine_routing_override 837 # is used for all tasks in the queue, no matter what the setting 838 # is for the 839 # task-level app_engine_routing. 840 # 841 # 842 # The `url` that the task will be sent to is: 843 # 844 # * `url =` host `+` 845 # relative_url 846 # 847 # Tasks can be dispatched to secure app handlers, unsecure app handlers, and 848 # URIs restricted with 849 # [`login: 850 # admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). 851 # Because tasks are not run as any user, they cannot be dispatched to URIs 852 # restricted with 853 # [`login: 854 # required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) 855 # Task dispatches also do not follow redirects. 856 # 857 # The task attempt has succeeded if the app's request handler returns an HTTP 858 # response code in the range [`200` - `299`]. The task attempt has failed if 859 # the app's handler returns a non-2xx response code or Cloud Tasks does 860 # not receive response before the deadline. Failed 861 # tasks will be retried according to the 862 # retry configuration. `503` (Service Unavailable) is 863 # considered an App Engine system error instead of an application error and 864 # will cause Cloud Tasks' traffic congestion control to temporarily throttle 865 # the queue's dispatches. Unlike other types of task targets, a `429` (Too Many 866 # Requests) response from an app handler does not cause traffic congestion 867 # control to throttle the queue. 868 "relativeUrl": "A String", # The relative URL. 869 # 870 # The relative URL must begin with "/" and must be a valid HTTP relative URL. 871 # It can contain a path and query string arguments. 872 # If the relative URL is empty, then the root path "/" will be used. 873 # No spaces are allowed, and the maximum length allowed is 2083 characters. 874 "httpMethod": "A String", # The HTTP method to use for the request. The default is POST. 875 # 876 # The app's request handler for the task's target URL must be able to handle 877 # HTTP requests with this http_method, otherwise the task attempt will fail 878 # with error code 405 (Method Not Allowed). See 879 # [Writing a push task request 880 # handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 881 # and the documentation for the request handlers in the language your app is 882 # written in e.g. 883 # [Python Request 884 # Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). 885 "appEngineRouting": { # App Engine Routing. # Task-level setting for App Engine routing. 886 # 887 # If set, 888 # app_engine_routing_override 889 # is used for all tasks in the queue, no matter what the setting is for the 890 # task-level app_engine_routing. 891 # 892 # Defines routing characteristics specific to App Engine - service, version, 893 # and instance. 894 # 895 # For more information about services, versions, and instances see 896 # [An Overview of App 897 # Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), 898 # [Microservices Architecture on Google App 899 # Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), 900 # [App Engine Standard request 901 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), 902 # and [App Engine Flex request 903 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 904 "instance": "A String", # App instance. 905 # 906 # By default, the task is sent to an instance which is available when 907 # the task is attempted. 908 # 909 # Requests can only be sent to a specific instance if 910 # [manual scaling is used in App Engine 911 # Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). 912 # App Engine Flex does not support instances. For more information, see 913 # [App Engine Standard request 914 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 915 # and [App Engine Flex request 916 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 917 "host": "A String", # Output only. The host that the task is sent to. 918 # 919 # For more information, see 920 # [How Requests are 921 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). 922 # 923 # The host is constructed as: 924 # 925 # 926 # * `host = [application_domain_name]`</br> 927 # `| [service] + '.' + [application_domain_name]`</br> 928 # `| [version] + '.' + [application_domain_name]`</br> 929 # `| [version_dot_service]+ '.' + [application_domain_name]`</br> 930 # `| [instance] + '.' + [application_domain_name]`</br> 931 # `| [instance_dot_service] + '.' + [application_domain_name]`</br> 932 # `| [instance_dot_version] + '.' + [application_domain_name]`</br> 933 # `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` 934 # 935 # * `application_domain_name` = The domain name of the app, for 936 # example <app-id>.appspot.com, which is associated with the 937 # queue's project ID. Some tasks which were created using the App Engine 938 # SDK use a custom domain name. 939 # 940 # * `service =` service 941 # 942 # * `version =` version 943 # 944 # * `version_dot_service =` 945 # version `+ '.' +` 946 # service 947 # 948 # * `instance =` instance 949 # 950 # * `instance_dot_service =` 951 # instance `+ '.' +` 952 # service 953 # 954 # * `instance_dot_version =` 955 # instance `+ '.' +` 956 # version 957 # 958 # * `instance_dot_version_dot_service =` 959 # instance `+ '.' +` 960 # version `+ '.' +` 961 # service 962 # 963 # If service is empty, then the task will be sent 964 # to the service which is the default service when the task is attempted. 965 # 966 # If version is empty, then the task will be sent 967 # to the version which is the default version when the task is attempted. 968 # 969 # If instance is empty, then the task 970 # will be sent to an instance which is available when the task is 971 # attempted. 972 # 973 # If service, 974 # version, or 975 # instance is invalid, then the task 976 # will be sent to the default version of the default service when 977 # the task is attempted. 978 "version": "A String", # App version. 979 # 980 # By default, the task is sent to the version which is the default 981 # version when the task is attempted. 982 # 983 # For some queues or tasks which were created using the App Engine 984 # Task Queue API, host is not parsable 985 # into service, 986 # version, and 987 # instance. For example, some tasks 988 # which were created using the App Engine SDK use a custom domain 989 # name; custom domains are not parsed by Cloud Tasks. If 990 # host is not parsable, then 991 # service, 992 # version, and 993 # instance are the empty string. 994 "service": "A String", # App service. 995 # 996 # By default, the task is sent to the service which is the default 997 # service when the task is attempted. 998 # 999 # For some queues or tasks which were created using the App Engine 1000 # Task Queue API, host is not parsable 1001 # into service, 1002 # version, and 1003 # instance. For example, some tasks 1004 # which were created using the App Engine SDK use a custom domain 1005 # name; custom domains are not parsed by Cloud Tasks. If 1006 # host is not parsable, then 1007 # service, 1008 # version, and 1009 # instance are the empty string. 1010 }, 1011 "payload": "A String", # Payload. 1012 # 1013 # The payload will be sent as the HTTP message body. A message 1014 # body, and thus a payload, is allowed only if the HTTP method is 1015 # POST or PUT. It is an error to set a data payload on a task with 1016 # an incompatible HttpMethod. 1017 "headers": { # HTTP request headers. 1018 # 1019 # This map contains the header field names and values. 1020 # Headers can be set when the 1021 # task is created. 1022 # Repeated headers are not supported but a header value can contain commas. 1023 # 1024 # Cloud Tasks sets some headers to default values: 1025 # 1026 # * `User-Agent`: By default, this header is 1027 # `"AppEngine-Google; (+http://code.google.com/appengine)"`. 1028 # This header can be modified, but Cloud Tasks will append 1029 # `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 1030 # modified `User-Agent`. 1031 # 1032 # If the task has a payload, Cloud 1033 # Tasks sets the following headers: 1034 # 1035 # * `Content-Type`: By default, the `Content-Type` header is set to 1036 # `"application/octet-stream"`. The default can be overridden by explicitly 1037 # setting `Content-Type` to a particular media type when the 1038 # task is created. 1039 # For example, `Content-Type` can be set to `"application/json"`. 1040 # * `Content-Length`: This is computed by Cloud Tasks. This value is 1041 # output only. It cannot be changed. 1042 # 1043 # The headers below cannot be set or overridden: 1044 # 1045 # * `Host` 1046 # * `X-Google-*` 1047 # * `X-AppEngine-*` 1048 # 1049 # In addition, Cloud Tasks sets some headers when the task is dispatched, 1050 # such as headers containing information about the task; see 1051 # [request 1052 # headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). 1053 # These headers are set only when the task is dispatched, so they are not 1054 # visible when the task is returned in a Cloud Tasks response. 1055 # 1056 # Although there is no specific limit for the maximum number of headers or 1057 # the size, there is a limit on the maximum size of the Task. For more 1058 # information, see the CreateTask documentation. 1059 "a_key": "A String", 1060 }, 1061 }, 1062 "name": "A String", # Optionally caller-specified in CreateTask. 1063 # 1064 # The task name. 1065 # 1066 # The task name must have the following format: 1067 # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` 1068 # 1069 # * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), 1070 # hyphens (-), colons (:), or periods (.). 1071 # For more information, see 1072 # [Identifying 1073 # projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) 1074 # * `LOCATION_ID` is the canonical ID for the task's location. 1075 # The list of available locations can be obtained by calling 1076 # ListLocations. 1077 # For more information, see https://cloud.google.com/about/locations/. 1078 # * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or 1079 # hyphens (-). The maximum length is 100 characters. 1080 # * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), 1081 # hyphens (-), or underscores (_). The maximum length is 500 characters. 1082 "scheduleTime": "A String", # The time when the task is scheduled to be attempted. 1083 # 1084 # For App Engine queues, this is when the task will be attempted or retried. 1085 # 1086 # For pull queues, this is the time when the task is available to 1087 # be leased; if a task is currently leased, this is the time when 1088 # the current lease expires, that is, the time that the task was 1089 # leased plus the lease_duration. 1090 # 1091 # `schedule_time` will be truncated to the nearest microsecond. 1092 "createTime": "A String", # Output only. The time that the task was created. 1093 # 1094 # `create_time` will be truncated to the nearest second. 1095 "view": "A String", # Output only. The view specifies which subset of the Task has 1096 # been returned. 1097 }, 1098 } 1099 1100 x__xgafv: string, V1 error format. 1101 Allowed values 1102 1 - v1 error format 1103 2 - v2 error format 1104 1105Returns: 1106 An object of the form: 1107 1108 { # A unit of scheduled work. 1109 "status": { # Status of the task. # Output only. The task status. 1110 "lastAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's last attempt. 1111 # 1112 # This field is not calculated for pull tasks. 1113 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 1114 # 1115 # `schedule_time` will be truncated to the nearest microsecond. 1116 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 1117 # 1118 # If the task has not been attempted or the task is currently running 1119 # then the response status is unset. 1120 # different programming environments, including REST APIs and RPC APIs. It is 1121 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 1122 # three pieces of data: error code, error message, and error details. 1123 # 1124 # You can find out more about this error model and how to work with it in the 1125 # [API Design Guide](https://cloud.google.com/apis/design/errors). 1126 "message": "A String", # A developer-facing error message, which should be in English. Any 1127 # user-facing error message should be localized and sent in the 1128 # google.rpc.Status.details field, or localized by the client. 1129 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 1130 "details": [ # A list of messages that carry the error details. There is a common set of 1131 # message types for APIs to use. 1132 { 1133 "a_key": "", # Properties of the object. Contains field @type with type URL. 1134 }, 1135 ], 1136 }, 1137 "responseTime": "A String", # Output only. The time that this attempt response was received. 1138 # 1139 # `response_time` will be truncated to the nearest microsecond. 1140 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 1141 # 1142 # `dispatch_time` will be truncated to the nearest microsecond. 1143 }, 1144 "firstAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's first attempt. 1145 # 1146 # Only dispatch_time will be set. 1147 # The other AttemptStatus information is not retained by Cloud Tasks. 1148 # 1149 # This field is not calculated for pull tasks. 1150 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 1151 # 1152 # `schedule_time` will be truncated to the nearest microsecond. 1153 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 1154 # 1155 # If the task has not been attempted or the task is currently running 1156 # then the response status is unset. 1157 # different programming environments, including REST APIs and RPC APIs. It is 1158 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 1159 # three pieces of data: error code, error message, and error details. 1160 # 1161 # You can find out more about this error model and how to work with it in the 1162 # [API Design Guide](https://cloud.google.com/apis/design/errors). 1163 "message": "A String", # A developer-facing error message, which should be in English. Any 1164 # user-facing error message should be localized and sent in the 1165 # google.rpc.Status.details field, or localized by the client. 1166 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 1167 "details": [ # A list of messages that carry the error details. There is a common set of 1168 # message types for APIs to use. 1169 { 1170 "a_key": "", # Properties of the object. Contains field @type with type URL. 1171 }, 1172 ], 1173 }, 1174 "responseTime": "A String", # Output only. The time that this attempt response was received. 1175 # 1176 # `response_time` will be truncated to the nearest microsecond. 1177 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 1178 # 1179 # `dispatch_time` will be truncated to the nearest microsecond. 1180 }, 1181 "attemptDispatchCount": 42, # Output only. The number of attempts dispatched. 1182 # 1183 # This count includes attempts which have been dispatched but haven't 1184 # received a response. 1185 "attemptResponseCount": 42, # Output only. The number of attempts which have received a response. 1186 # 1187 # This field is not calculated for pull tasks. 1188 }, 1189 "pullMessage": { # The pull message contains data that can be used by the caller of # LeaseTasks to process the task. Can be 1190 # set only if pull_target is set on the queue. 1191 # 1192 # A pull task is a task that has PullMessage set. 1193 # LeaseTasks to process the task. 1194 # 1195 # This proto can only be used for tasks in a queue which has 1196 # pull_target set. 1197 "tag": "A String", # The task's tag. 1198 # 1199 # Tags allow similar tasks to be processed in a batch. If you label 1200 # tasks with a tag, your worker can 1201 # lease tasks with the same tag using 1202 # filter. For example, if you want to 1203 # aggregate the events associated with a specific user once a day, 1204 # you could tag tasks with the user ID. 1205 # 1206 # The task's tag can only be set when the 1207 # task is created. 1208 # 1209 # The tag must be less than 500 characters. 1210 # 1211 # SDK compatibility: Although the SDK allows tags to be either 1212 # string or 1213 # [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), 1214 # only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8 1215 # encoded, the tag will be empty when the task is returned by Cloud Tasks. 1216 "payload": "A String", # A data payload consumed by the worker to execute the task. 1217 }, 1218 "appEngineHttpRequest": { # App Engine HTTP request. # App Engine HTTP request that is sent to the task's target. Can 1219 # be set only if 1220 # app_engine_http_target is set 1221 # on the queue. 1222 # 1223 # An App Engine task is a task that has AppEngineHttpRequest set. 1224 # 1225 # The message defines the HTTP request that is sent to an App Engine app when 1226 # the task is dispatched. 1227 # 1228 # This proto can only be used for tasks in a queue which has 1229 # app_engine_http_target set. 1230 # 1231 # Using AppEngineHttpRequest requires 1232 # [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) 1233 # Google IAM permission for the project 1234 # and the following scope: 1235 # 1236 # `https://www.googleapis.com/auth/cloud-platform` 1237 # 1238 # The task will be delivered to the App Engine app which belongs to the same 1239 # project as the queue. For more information, see 1240 # [How Requests are 1241 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 1242 # and how routing is affected by 1243 # [dispatch 1244 # files](https://cloud.google.com/appengine/docs/python/config/dispatchref). 1245 # Traffic is encrypted during transport and never leaves Google datacenters. 1246 # Because this traffic is carried over a communication mechanism internal to 1247 # Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). 1248 # The request to the handler, however, will appear to have used the HTTP 1249 # protocol. 1250 # 1251 # The AppEngineRouting used to construct the URL that the task is 1252 # delivered to can be set at the queue-level or task-level: 1253 # 1254 # * If set, 1255 # app_engine_routing_override 1256 # is used for all tasks in the queue, no matter what the setting 1257 # is for the 1258 # task-level app_engine_routing. 1259 # 1260 # 1261 # The `url` that the task will be sent to is: 1262 # 1263 # * `url =` host `+` 1264 # relative_url 1265 # 1266 # Tasks can be dispatched to secure app handlers, unsecure app handlers, and 1267 # URIs restricted with 1268 # [`login: 1269 # admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). 1270 # Because tasks are not run as any user, they cannot be dispatched to URIs 1271 # restricted with 1272 # [`login: 1273 # required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) 1274 # Task dispatches also do not follow redirects. 1275 # 1276 # The task attempt has succeeded if the app's request handler returns an HTTP 1277 # response code in the range [`200` - `299`]. The task attempt has failed if 1278 # the app's handler returns a non-2xx response code or Cloud Tasks does 1279 # not receive response before the deadline. Failed 1280 # tasks will be retried according to the 1281 # retry configuration. `503` (Service Unavailable) is 1282 # considered an App Engine system error instead of an application error and 1283 # will cause Cloud Tasks' traffic congestion control to temporarily throttle 1284 # the queue's dispatches. Unlike other types of task targets, a `429` (Too Many 1285 # Requests) response from an app handler does not cause traffic congestion 1286 # control to throttle the queue. 1287 "relativeUrl": "A String", # The relative URL. 1288 # 1289 # The relative URL must begin with "/" and must be a valid HTTP relative URL. 1290 # It can contain a path and query string arguments. 1291 # If the relative URL is empty, then the root path "/" will be used. 1292 # No spaces are allowed, and the maximum length allowed is 2083 characters. 1293 "httpMethod": "A String", # The HTTP method to use for the request. The default is POST. 1294 # 1295 # The app's request handler for the task's target URL must be able to handle 1296 # HTTP requests with this http_method, otherwise the task attempt will fail 1297 # with error code 405 (Method Not Allowed). See 1298 # [Writing a push task request 1299 # handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 1300 # and the documentation for the request handlers in the language your app is 1301 # written in e.g. 1302 # [Python Request 1303 # Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). 1304 "appEngineRouting": { # App Engine Routing. # Task-level setting for App Engine routing. 1305 # 1306 # If set, 1307 # app_engine_routing_override 1308 # is used for all tasks in the queue, no matter what the setting is for the 1309 # task-level app_engine_routing. 1310 # 1311 # Defines routing characteristics specific to App Engine - service, version, 1312 # and instance. 1313 # 1314 # For more information about services, versions, and instances see 1315 # [An Overview of App 1316 # Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), 1317 # [Microservices Architecture on Google App 1318 # Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), 1319 # [App Engine Standard request 1320 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), 1321 # and [App Engine Flex request 1322 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 1323 "instance": "A String", # App instance. 1324 # 1325 # By default, the task is sent to an instance which is available when 1326 # the task is attempted. 1327 # 1328 # Requests can only be sent to a specific instance if 1329 # [manual scaling is used in App Engine 1330 # Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). 1331 # App Engine Flex does not support instances. For more information, see 1332 # [App Engine Standard request 1333 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 1334 # and [App Engine Flex request 1335 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 1336 "host": "A String", # Output only. The host that the task is sent to. 1337 # 1338 # For more information, see 1339 # [How Requests are 1340 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). 1341 # 1342 # The host is constructed as: 1343 # 1344 # 1345 # * `host = [application_domain_name]`</br> 1346 # `| [service] + '.' + [application_domain_name]`</br> 1347 # `| [version] + '.' + [application_domain_name]`</br> 1348 # `| [version_dot_service]+ '.' + [application_domain_name]`</br> 1349 # `| [instance] + '.' + [application_domain_name]`</br> 1350 # `| [instance_dot_service] + '.' + [application_domain_name]`</br> 1351 # `| [instance_dot_version] + '.' + [application_domain_name]`</br> 1352 # `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` 1353 # 1354 # * `application_domain_name` = The domain name of the app, for 1355 # example <app-id>.appspot.com, which is associated with the 1356 # queue's project ID. Some tasks which were created using the App Engine 1357 # SDK use a custom domain name. 1358 # 1359 # * `service =` service 1360 # 1361 # * `version =` version 1362 # 1363 # * `version_dot_service =` 1364 # version `+ '.' +` 1365 # service 1366 # 1367 # * `instance =` instance 1368 # 1369 # * `instance_dot_service =` 1370 # instance `+ '.' +` 1371 # service 1372 # 1373 # * `instance_dot_version =` 1374 # instance `+ '.' +` 1375 # version 1376 # 1377 # * `instance_dot_version_dot_service =` 1378 # instance `+ '.' +` 1379 # version `+ '.' +` 1380 # service 1381 # 1382 # If service is empty, then the task will be sent 1383 # to the service which is the default service when the task is attempted. 1384 # 1385 # If version is empty, then the task will be sent 1386 # to the version which is the default version when the task is attempted. 1387 # 1388 # If instance is empty, then the task 1389 # will be sent to an instance which is available when the task is 1390 # attempted. 1391 # 1392 # If service, 1393 # version, or 1394 # instance is invalid, then the task 1395 # will be sent to the default version of the default service when 1396 # the task is attempted. 1397 "version": "A String", # App version. 1398 # 1399 # By default, the task is sent to the version which is the default 1400 # version when the task is attempted. 1401 # 1402 # For some queues or tasks which were created using the App Engine 1403 # Task Queue API, host is not parsable 1404 # into service, 1405 # version, and 1406 # instance. For example, some tasks 1407 # which were created using the App Engine SDK use a custom domain 1408 # name; custom domains are not parsed by Cloud Tasks. If 1409 # host is not parsable, then 1410 # service, 1411 # version, and 1412 # instance are the empty string. 1413 "service": "A String", # App service. 1414 # 1415 # By default, the task is sent to the service which is the default 1416 # service when the task is attempted. 1417 # 1418 # For some queues or tasks which were created using the App Engine 1419 # Task Queue API, host is not parsable 1420 # into service, 1421 # version, and 1422 # instance. For example, some tasks 1423 # which were created using the App Engine SDK use a custom domain 1424 # name; custom domains are not parsed by Cloud Tasks. If 1425 # host is not parsable, then 1426 # service, 1427 # version, and 1428 # instance are the empty string. 1429 }, 1430 "payload": "A String", # Payload. 1431 # 1432 # The payload will be sent as the HTTP message body. A message 1433 # body, and thus a payload, is allowed only if the HTTP method is 1434 # POST or PUT. It is an error to set a data payload on a task with 1435 # an incompatible HttpMethod. 1436 "headers": { # HTTP request headers. 1437 # 1438 # This map contains the header field names and values. 1439 # Headers can be set when the 1440 # task is created. 1441 # Repeated headers are not supported but a header value can contain commas. 1442 # 1443 # Cloud Tasks sets some headers to default values: 1444 # 1445 # * `User-Agent`: By default, this header is 1446 # `"AppEngine-Google; (+http://code.google.com/appengine)"`. 1447 # This header can be modified, but Cloud Tasks will append 1448 # `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 1449 # modified `User-Agent`. 1450 # 1451 # If the task has a payload, Cloud 1452 # Tasks sets the following headers: 1453 # 1454 # * `Content-Type`: By default, the `Content-Type` header is set to 1455 # `"application/octet-stream"`. The default can be overridden by explicitly 1456 # setting `Content-Type` to a particular media type when the 1457 # task is created. 1458 # For example, `Content-Type` can be set to `"application/json"`. 1459 # * `Content-Length`: This is computed by Cloud Tasks. This value is 1460 # output only. It cannot be changed. 1461 # 1462 # The headers below cannot be set or overridden: 1463 # 1464 # * `Host` 1465 # * `X-Google-*` 1466 # * `X-AppEngine-*` 1467 # 1468 # In addition, Cloud Tasks sets some headers when the task is dispatched, 1469 # such as headers containing information about the task; see 1470 # [request 1471 # headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). 1472 # These headers are set only when the task is dispatched, so they are not 1473 # visible when the task is returned in a Cloud Tasks response. 1474 # 1475 # Although there is no specific limit for the maximum number of headers or 1476 # the size, there is a limit on the maximum size of the Task. For more 1477 # information, see the CreateTask documentation. 1478 "a_key": "A String", 1479 }, 1480 }, 1481 "name": "A String", # Optionally caller-specified in CreateTask. 1482 # 1483 # The task name. 1484 # 1485 # The task name must have the following format: 1486 # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` 1487 # 1488 # * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), 1489 # hyphens (-), colons (:), or periods (.). 1490 # For more information, see 1491 # [Identifying 1492 # projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) 1493 # * `LOCATION_ID` is the canonical ID for the task's location. 1494 # The list of available locations can be obtained by calling 1495 # ListLocations. 1496 # For more information, see https://cloud.google.com/about/locations/. 1497 # * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or 1498 # hyphens (-). The maximum length is 100 characters. 1499 # * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), 1500 # hyphens (-), or underscores (_). The maximum length is 500 characters. 1501 "scheduleTime": "A String", # The time when the task is scheduled to be attempted. 1502 # 1503 # For App Engine queues, this is when the task will be attempted or retried. 1504 # 1505 # For pull queues, this is the time when the task is available to 1506 # be leased; if a task is currently leased, this is the time when 1507 # the current lease expires, that is, the time that the task was 1508 # leased plus the lease_duration. 1509 # 1510 # `schedule_time` will be truncated to the nearest microsecond. 1511 "createTime": "A String", # Output only. The time that the task was created. 1512 # 1513 # `create_time` will be truncated to the nearest second. 1514 "view": "A String", # Output only. The view specifies which subset of the Task has 1515 # been returned. 1516 }</pre> 1517</div> 1518 1519<div class="method"> 1520 <code class="details" id="delete">delete(name, x__xgafv=None)</code> 1521 <pre>Deletes a task. 1522 1523A task can be deleted if it is scheduled or dispatched. A task 1524cannot be deleted if it has completed successfully or permanently 1525failed. 1526 1527Args: 1528 name: string, Required. 1529 1530The task name. For example: 1531`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` (required) 1532 x__xgafv: string, V1 error format. 1533 Allowed values 1534 1 - v1 error format 1535 2 - v2 error format 1536 1537Returns: 1538 An object of the form: 1539 1540 { # A generic empty message that you can re-use to avoid defining duplicated 1541 # empty messages in your APIs. A typical example is to use it as the request 1542 # or the response type of an API method. For instance: 1543 # 1544 # service Foo { 1545 # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); 1546 # } 1547 # 1548 # The JSON representation for `Empty` is empty JSON object `{}`. 1549 }</pre> 1550</div> 1551 1552<div class="method"> 1553 <code class="details" id="get">get(name, responseView=None, x__xgafv=None)</code> 1554 <pre>Gets a task. 1555 1556Args: 1557 name: string, Required. 1558 1559The task name. For example: 1560`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` (required) 1561 responseView: string, The response_view specifies which subset of the Task will be 1562returned. 1563 1564By default response_view is BASIC; not all 1565information is retrieved by default because some data, such as 1566payloads, might be desirable to return only when needed because 1567of its large size or because of the sensitivity of data that it 1568contains. 1569 1570Authorization for FULL requires 1571`cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) 1572permission on the Task resource. 1573 x__xgafv: string, V1 error format. 1574 Allowed values 1575 1 - v1 error format 1576 2 - v2 error format 1577 1578Returns: 1579 An object of the form: 1580 1581 { # A unit of scheduled work. 1582 "status": { # Status of the task. # Output only. The task status. 1583 "lastAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's last attempt. 1584 # 1585 # This field is not calculated for pull tasks. 1586 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 1587 # 1588 # `schedule_time` will be truncated to the nearest microsecond. 1589 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 1590 # 1591 # If the task has not been attempted or the task is currently running 1592 # then the response status is unset. 1593 # different programming environments, including REST APIs and RPC APIs. It is 1594 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 1595 # three pieces of data: error code, error message, and error details. 1596 # 1597 # You can find out more about this error model and how to work with it in the 1598 # [API Design Guide](https://cloud.google.com/apis/design/errors). 1599 "message": "A String", # A developer-facing error message, which should be in English. Any 1600 # user-facing error message should be localized and sent in the 1601 # google.rpc.Status.details field, or localized by the client. 1602 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 1603 "details": [ # A list of messages that carry the error details. There is a common set of 1604 # message types for APIs to use. 1605 { 1606 "a_key": "", # Properties of the object. Contains field @type with type URL. 1607 }, 1608 ], 1609 }, 1610 "responseTime": "A String", # Output only. The time that this attempt response was received. 1611 # 1612 # `response_time` will be truncated to the nearest microsecond. 1613 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 1614 # 1615 # `dispatch_time` will be truncated to the nearest microsecond. 1616 }, 1617 "firstAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's first attempt. 1618 # 1619 # Only dispatch_time will be set. 1620 # The other AttemptStatus information is not retained by Cloud Tasks. 1621 # 1622 # This field is not calculated for pull tasks. 1623 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 1624 # 1625 # `schedule_time` will be truncated to the nearest microsecond. 1626 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 1627 # 1628 # If the task has not been attempted or the task is currently running 1629 # then the response status is unset. 1630 # different programming environments, including REST APIs and RPC APIs. It is 1631 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 1632 # three pieces of data: error code, error message, and error details. 1633 # 1634 # You can find out more about this error model and how to work with it in the 1635 # [API Design Guide](https://cloud.google.com/apis/design/errors). 1636 "message": "A String", # A developer-facing error message, which should be in English. Any 1637 # user-facing error message should be localized and sent in the 1638 # google.rpc.Status.details field, or localized by the client. 1639 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 1640 "details": [ # A list of messages that carry the error details. There is a common set of 1641 # message types for APIs to use. 1642 { 1643 "a_key": "", # Properties of the object. Contains field @type with type URL. 1644 }, 1645 ], 1646 }, 1647 "responseTime": "A String", # Output only. The time that this attempt response was received. 1648 # 1649 # `response_time` will be truncated to the nearest microsecond. 1650 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 1651 # 1652 # `dispatch_time` will be truncated to the nearest microsecond. 1653 }, 1654 "attemptDispatchCount": 42, # Output only. The number of attempts dispatched. 1655 # 1656 # This count includes attempts which have been dispatched but haven't 1657 # received a response. 1658 "attemptResponseCount": 42, # Output only. The number of attempts which have received a response. 1659 # 1660 # This field is not calculated for pull tasks. 1661 }, 1662 "pullMessage": { # The pull message contains data that can be used by the caller of # LeaseTasks to process the task. Can be 1663 # set only if pull_target is set on the queue. 1664 # 1665 # A pull task is a task that has PullMessage set. 1666 # LeaseTasks to process the task. 1667 # 1668 # This proto can only be used for tasks in a queue which has 1669 # pull_target set. 1670 "tag": "A String", # The task's tag. 1671 # 1672 # Tags allow similar tasks to be processed in a batch. If you label 1673 # tasks with a tag, your worker can 1674 # lease tasks with the same tag using 1675 # filter. For example, if you want to 1676 # aggregate the events associated with a specific user once a day, 1677 # you could tag tasks with the user ID. 1678 # 1679 # The task's tag can only be set when the 1680 # task is created. 1681 # 1682 # The tag must be less than 500 characters. 1683 # 1684 # SDK compatibility: Although the SDK allows tags to be either 1685 # string or 1686 # [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), 1687 # only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8 1688 # encoded, the tag will be empty when the task is returned by Cloud Tasks. 1689 "payload": "A String", # A data payload consumed by the worker to execute the task. 1690 }, 1691 "appEngineHttpRequest": { # App Engine HTTP request. # App Engine HTTP request that is sent to the task's target. Can 1692 # be set only if 1693 # app_engine_http_target is set 1694 # on the queue. 1695 # 1696 # An App Engine task is a task that has AppEngineHttpRequest set. 1697 # 1698 # The message defines the HTTP request that is sent to an App Engine app when 1699 # the task is dispatched. 1700 # 1701 # This proto can only be used for tasks in a queue which has 1702 # app_engine_http_target set. 1703 # 1704 # Using AppEngineHttpRequest requires 1705 # [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) 1706 # Google IAM permission for the project 1707 # and the following scope: 1708 # 1709 # `https://www.googleapis.com/auth/cloud-platform` 1710 # 1711 # The task will be delivered to the App Engine app which belongs to the same 1712 # project as the queue. For more information, see 1713 # [How Requests are 1714 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 1715 # and how routing is affected by 1716 # [dispatch 1717 # files](https://cloud.google.com/appengine/docs/python/config/dispatchref). 1718 # Traffic is encrypted during transport and never leaves Google datacenters. 1719 # Because this traffic is carried over a communication mechanism internal to 1720 # Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). 1721 # The request to the handler, however, will appear to have used the HTTP 1722 # protocol. 1723 # 1724 # The AppEngineRouting used to construct the URL that the task is 1725 # delivered to can be set at the queue-level or task-level: 1726 # 1727 # * If set, 1728 # app_engine_routing_override 1729 # is used for all tasks in the queue, no matter what the setting 1730 # is for the 1731 # task-level app_engine_routing. 1732 # 1733 # 1734 # The `url` that the task will be sent to is: 1735 # 1736 # * `url =` host `+` 1737 # relative_url 1738 # 1739 # Tasks can be dispatched to secure app handlers, unsecure app handlers, and 1740 # URIs restricted with 1741 # [`login: 1742 # admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). 1743 # Because tasks are not run as any user, they cannot be dispatched to URIs 1744 # restricted with 1745 # [`login: 1746 # required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) 1747 # Task dispatches also do not follow redirects. 1748 # 1749 # The task attempt has succeeded if the app's request handler returns an HTTP 1750 # response code in the range [`200` - `299`]. The task attempt has failed if 1751 # the app's handler returns a non-2xx response code or Cloud Tasks does 1752 # not receive response before the deadline. Failed 1753 # tasks will be retried according to the 1754 # retry configuration. `503` (Service Unavailable) is 1755 # considered an App Engine system error instead of an application error and 1756 # will cause Cloud Tasks' traffic congestion control to temporarily throttle 1757 # the queue's dispatches. Unlike other types of task targets, a `429` (Too Many 1758 # Requests) response from an app handler does not cause traffic congestion 1759 # control to throttle the queue. 1760 "relativeUrl": "A String", # The relative URL. 1761 # 1762 # The relative URL must begin with "/" and must be a valid HTTP relative URL. 1763 # It can contain a path and query string arguments. 1764 # If the relative URL is empty, then the root path "/" will be used. 1765 # No spaces are allowed, and the maximum length allowed is 2083 characters. 1766 "httpMethod": "A String", # The HTTP method to use for the request. The default is POST. 1767 # 1768 # The app's request handler for the task's target URL must be able to handle 1769 # HTTP requests with this http_method, otherwise the task attempt will fail 1770 # with error code 405 (Method Not Allowed). See 1771 # [Writing a push task request 1772 # handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 1773 # and the documentation for the request handlers in the language your app is 1774 # written in e.g. 1775 # [Python Request 1776 # Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). 1777 "appEngineRouting": { # App Engine Routing. # Task-level setting for App Engine routing. 1778 # 1779 # If set, 1780 # app_engine_routing_override 1781 # is used for all tasks in the queue, no matter what the setting is for the 1782 # task-level app_engine_routing. 1783 # 1784 # Defines routing characteristics specific to App Engine - service, version, 1785 # and instance. 1786 # 1787 # For more information about services, versions, and instances see 1788 # [An Overview of App 1789 # Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), 1790 # [Microservices Architecture on Google App 1791 # Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), 1792 # [App Engine Standard request 1793 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), 1794 # and [App Engine Flex request 1795 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 1796 "instance": "A String", # App instance. 1797 # 1798 # By default, the task is sent to an instance which is available when 1799 # the task is attempted. 1800 # 1801 # Requests can only be sent to a specific instance if 1802 # [manual scaling is used in App Engine 1803 # Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). 1804 # App Engine Flex does not support instances. For more information, see 1805 # [App Engine Standard request 1806 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 1807 # and [App Engine Flex request 1808 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 1809 "host": "A String", # Output only. The host that the task is sent to. 1810 # 1811 # For more information, see 1812 # [How Requests are 1813 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). 1814 # 1815 # The host is constructed as: 1816 # 1817 # 1818 # * `host = [application_domain_name]`</br> 1819 # `| [service] + '.' + [application_domain_name]`</br> 1820 # `| [version] + '.' + [application_domain_name]`</br> 1821 # `| [version_dot_service]+ '.' + [application_domain_name]`</br> 1822 # `| [instance] + '.' + [application_domain_name]`</br> 1823 # `| [instance_dot_service] + '.' + [application_domain_name]`</br> 1824 # `| [instance_dot_version] + '.' + [application_domain_name]`</br> 1825 # `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` 1826 # 1827 # * `application_domain_name` = The domain name of the app, for 1828 # example <app-id>.appspot.com, which is associated with the 1829 # queue's project ID. Some tasks which were created using the App Engine 1830 # SDK use a custom domain name. 1831 # 1832 # * `service =` service 1833 # 1834 # * `version =` version 1835 # 1836 # * `version_dot_service =` 1837 # version `+ '.' +` 1838 # service 1839 # 1840 # * `instance =` instance 1841 # 1842 # * `instance_dot_service =` 1843 # instance `+ '.' +` 1844 # service 1845 # 1846 # * `instance_dot_version =` 1847 # instance `+ '.' +` 1848 # version 1849 # 1850 # * `instance_dot_version_dot_service =` 1851 # instance `+ '.' +` 1852 # version `+ '.' +` 1853 # service 1854 # 1855 # If service is empty, then the task will be sent 1856 # to the service which is the default service when the task is attempted. 1857 # 1858 # If version is empty, then the task will be sent 1859 # to the version which is the default version when the task is attempted. 1860 # 1861 # If instance is empty, then the task 1862 # will be sent to an instance which is available when the task is 1863 # attempted. 1864 # 1865 # If service, 1866 # version, or 1867 # instance is invalid, then the task 1868 # will be sent to the default version of the default service when 1869 # the task is attempted. 1870 "version": "A String", # App version. 1871 # 1872 # By default, the task is sent to the version which is the default 1873 # version when the task is attempted. 1874 # 1875 # For some queues or tasks which were created using the App Engine 1876 # Task Queue API, host is not parsable 1877 # into service, 1878 # version, and 1879 # instance. For example, some tasks 1880 # which were created using the App Engine SDK use a custom domain 1881 # name; custom domains are not parsed by Cloud Tasks. If 1882 # host is not parsable, then 1883 # service, 1884 # version, and 1885 # instance are the empty string. 1886 "service": "A String", # App service. 1887 # 1888 # By default, the task is sent to the service which is the default 1889 # service when the task is attempted. 1890 # 1891 # For some queues or tasks which were created using the App Engine 1892 # Task Queue API, host is not parsable 1893 # into service, 1894 # version, and 1895 # instance. For example, some tasks 1896 # which were created using the App Engine SDK use a custom domain 1897 # name; custom domains are not parsed by Cloud Tasks. If 1898 # host is not parsable, then 1899 # service, 1900 # version, and 1901 # instance are the empty string. 1902 }, 1903 "payload": "A String", # Payload. 1904 # 1905 # The payload will be sent as the HTTP message body. A message 1906 # body, and thus a payload, is allowed only if the HTTP method is 1907 # POST or PUT. It is an error to set a data payload on a task with 1908 # an incompatible HttpMethod. 1909 "headers": { # HTTP request headers. 1910 # 1911 # This map contains the header field names and values. 1912 # Headers can be set when the 1913 # task is created. 1914 # Repeated headers are not supported but a header value can contain commas. 1915 # 1916 # Cloud Tasks sets some headers to default values: 1917 # 1918 # * `User-Agent`: By default, this header is 1919 # `"AppEngine-Google; (+http://code.google.com/appengine)"`. 1920 # This header can be modified, but Cloud Tasks will append 1921 # `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 1922 # modified `User-Agent`. 1923 # 1924 # If the task has a payload, Cloud 1925 # Tasks sets the following headers: 1926 # 1927 # * `Content-Type`: By default, the `Content-Type` header is set to 1928 # `"application/octet-stream"`. The default can be overridden by explicitly 1929 # setting `Content-Type` to a particular media type when the 1930 # task is created. 1931 # For example, `Content-Type` can be set to `"application/json"`. 1932 # * `Content-Length`: This is computed by Cloud Tasks. This value is 1933 # output only. It cannot be changed. 1934 # 1935 # The headers below cannot be set or overridden: 1936 # 1937 # * `Host` 1938 # * `X-Google-*` 1939 # * `X-AppEngine-*` 1940 # 1941 # In addition, Cloud Tasks sets some headers when the task is dispatched, 1942 # such as headers containing information about the task; see 1943 # [request 1944 # headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). 1945 # These headers are set only when the task is dispatched, so they are not 1946 # visible when the task is returned in a Cloud Tasks response. 1947 # 1948 # Although there is no specific limit for the maximum number of headers or 1949 # the size, there is a limit on the maximum size of the Task. For more 1950 # information, see the CreateTask documentation. 1951 "a_key": "A String", 1952 }, 1953 }, 1954 "name": "A String", # Optionally caller-specified in CreateTask. 1955 # 1956 # The task name. 1957 # 1958 # The task name must have the following format: 1959 # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` 1960 # 1961 # * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), 1962 # hyphens (-), colons (:), or periods (.). 1963 # For more information, see 1964 # [Identifying 1965 # projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) 1966 # * `LOCATION_ID` is the canonical ID for the task's location. 1967 # The list of available locations can be obtained by calling 1968 # ListLocations. 1969 # For more information, see https://cloud.google.com/about/locations/. 1970 # * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or 1971 # hyphens (-). The maximum length is 100 characters. 1972 # * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), 1973 # hyphens (-), or underscores (_). The maximum length is 500 characters. 1974 "scheduleTime": "A String", # The time when the task is scheduled to be attempted. 1975 # 1976 # For App Engine queues, this is when the task will be attempted or retried. 1977 # 1978 # For pull queues, this is the time when the task is available to 1979 # be leased; if a task is currently leased, this is the time when 1980 # the current lease expires, that is, the time that the task was 1981 # leased plus the lease_duration. 1982 # 1983 # `schedule_time` will be truncated to the nearest microsecond. 1984 "createTime": "A String", # Output only. The time that the task was created. 1985 # 1986 # `create_time` will be truncated to the nearest second. 1987 "view": "A String", # Output only. The view specifies which subset of the Task has 1988 # been returned. 1989 }</pre> 1990</div> 1991 1992<div class="method"> 1993 <code class="details" id="lease">lease(parent, body, x__xgafv=None)</code> 1994 <pre>Leases tasks from a pull queue for 1995lease_duration. 1996 1997This method is invoked by the worker to obtain a lease. The 1998worker must acknowledge the task via 1999AcknowledgeTask after they have 2000performed the work associated with the task. 2001 2002The payload is intended to store data that 2003the worker needs to perform the work associated with the task. To 2004return the payloads in the response, set 2005response_view to 2006FULL. 2007 2008A maximum of 10 qps of LeaseTasks 2009requests are allowed per 2010queue. RESOURCE_EXHAUSTED 2011is returned when this limit is 2012exceeded. RESOURCE_EXHAUSTED 2013is also returned when 2014max_tasks_dispatched_per_second 2015is exceeded. 2016 2017Args: 2018 parent: string, Required. 2019 2020The queue name. For example: 2021`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` (required) 2022 body: object, The request body. (required) 2023 The object takes the form of: 2024 2025{ # Request message for leasing tasks using LeaseTasks. 2026 "maxTasks": 42, # The maximum number of tasks to lease. 2027 # 2028 # The system will make a best effort to return as close to as 2029 # `max_tasks` as possible. 2030 # 2031 # The largest that `max_tasks` can be is 1000. 2032 # 2033 # The maximum total size of a lease tasks response is 2034 # 32 MB. If the sum of all task sizes requested reaches this limit, 2035 # fewer tasks than requested are returned. 2036 "filter": "A String", # `filter` can be used to specify a subset of tasks to lease. 2037 # 2038 # When `filter` is set to `tag=<my-tag>` then the 2039 # response will contain only tasks whose 2040 # tag is equal to `<my-tag>`. `<my-tag>` must be 2041 # less than 500 characters. 2042 # 2043 # When `filter` is set to `tag_function=oldest_tag()`, only tasks which have 2044 # the same tag as the task with the oldest 2045 # schedule_time will be returned. 2046 # 2047 # Grammar Syntax: 2048 # 2049 # * `filter = "tag=" tag | "tag_function=" function` 2050 # 2051 # * `tag = string` 2052 # 2053 # * `function = "oldest_tag()"` 2054 # 2055 # The `oldest_tag()` function returns tasks which have the same tag as the 2056 # oldest task (ordered by schedule time). 2057 # 2058 # SDK compatibility: Although the SDK allows tags to be either 2059 # string or 2060 # [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), 2061 # only UTF-8 encoded tags can be used in Cloud Tasks. Tag which 2062 # aren't UTF-8 encoded can't be used in the 2063 # filter and the task's 2064 # tag will be displayed as empty in Cloud Tasks. 2065 "responseView": "A String", # The response_view specifies which subset of the Task will be 2066 # returned. 2067 # 2068 # By default response_view is BASIC; not all 2069 # information is retrieved by default because some data, such as 2070 # payloads, might be desirable to return only when needed because 2071 # of its large size or because of the sensitivity of data that it 2072 # contains. 2073 # 2074 # Authorization for FULL requires 2075 # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) 2076 # permission on the Task resource. 2077 "leaseDuration": "A String", # 2078 # After the worker has successfully finished the work associated 2079 # with the task, the worker must call via 2080 # AcknowledgeTask before the 2081 # schedule_time. Otherwise the task will be 2082 # returned to a later LeaseTasks call so 2083 # that another worker can retry it. 2084 # 2085 # The maximum lease duration is 1 week. 2086 # `lease_duration` will be truncated to the nearest second. 2087 } 2088 2089 x__xgafv: string, V1 error format. 2090 Allowed values 2091 1 - v1 error format 2092 2 - v2 error format 2093 2094Returns: 2095 An object of the form: 2096 2097 { # Response message for leasing tasks using LeaseTasks. 2098 "tasks": [ # The leased tasks. 2099 { # A unit of scheduled work. 2100 "status": { # Status of the task. # Output only. The task status. 2101 "lastAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's last attempt. 2102 # 2103 # This field is not calculated for pull tasks. 2104 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 2105 # 2106 # `schedule_time` will be truncated to the nearest microsecond. 2107 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 2108 # 2109 # If the task has not been attempted or the task is currently running 2110 # then the response status is unset. 2111 # different programming environments, including REST APIs and RPC APIs. It is 2112 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 2113 # three pieces of data: error code, error message, and error details. 2114 # 2115 # You can find out more about this error model and how to work with it in the 2116 # [API Design Guide](https://cloud.google.com/apis/design/errors). 2117 "message": "A String", # A developer-facing error message, which should be in English. Any 2118 # user-facing error message should be localized and sent in the 2119 # google.rpc.Status.details field, or localized by the client. 2120 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 2121 "details": [ # A list of messages that carry the error details. There is a common set of 2122 # message types for APIs to use. 2123 { 2124 "a_key": "", # Properties of the object. Contains field @type with type URL. 2125 }, 2126 ], 2127 }, 2128 "responseTime": "A String", # Output only. The time that this attempt response was received. 2129 # 2130 # `response_time` will be truncated to the nearest microsecond. 2131 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 2132 # 2133 # `dispatch_time` will be truncated to the nearest microsecond. 2134 }, 2135 "firstAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's first attempt. 2136 # 2137 # Only dispatch_time will be set. 2138 # The other AttemptStatus information is not retained by Cloud Tasks. 2139 # 2140 # This field is not calculated for pull tasks. 2141 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 2142 # 2143 # `schedule_time` will be truncated to the nearest microsecond. 2144 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 2145 # 2146 # If the task has not been attempted or the task is currently running 2147 # then the response status is unset. 2148 # different programming environments, including REST APIs and RPC APIs. It is 2149 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 2150 # three pieces of data: error code, error message, and error details. 2151 # 2152 # You can find out more about this error model and how to work with it in the 2153 # [API Design Guide](https://cloud.google.com/apis/design/errors). 2154 "message": "A String", # A developer-facing error message, which should be in English. Any 2155 # user-facing error message should be localized and sent in the 2156 # google.rpc.Status.details field, or localized by the client. 2157 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 2158 "details": [ # A list of messages that carry the error details. There is a common set of 2159 # message types for APIs to use. 2160 { 2161 "a_key": "", # Properties of the object. Contains field @type with type URL. 2162 }, 2163 ], 2164 }, 2165 "responseTime": "A String", # Output only. The time that this attempt response was received. 2166 # 2167 # `response_time` will be truncated to the nearest microsecond. 2168 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 2169 # 2170 # `dispatch_time` will be truncated to the nearest microsecond. 2171 }, 2172 "attemptDispatchCount": 42, # Output only. The number of attempts dispatched. 2173 # 2174 # This count includes attempts which have been dispatched but haven't 2175 # received a response. 2176 "attemptResponseCount": 42, # Output only. The number of attempts which have received a response. 2177 # 2178 # This field is not calculated for pull tasks. 2179 }, 2180 "pullMessage": { # The pull message contains data that can be used by the caller of # LeaseTasks to process the task. Can be 2181 # set only if pull_target is set on the queue. 2182 # 2183 # A pull task is a task that has PullMessage set. 2184 # LeaseTasks to process the task. 2185 # 2186 # This proto can only be used for tasks in a queue which has 2187 # pull_target set. 2188 "tag": "A String", # The task's tag. 2189 # 2190 # Tags allow similar tasks to be processed in a batch. If you label 2191 # tasks with a tag, your worker can 2192 # lease tasks with the same tag using 2193 # filter. For example, if you want to 2194 # aggregate the events associated with a specific user once a day, 2195 # you could tag tasks with the user ID. 2196 # 2197 # The task's tag can only be set when the 2198 # task is created. 2199 # 2200 # The tag must be less than 500 characters. 2201 # 2202 # SDK compatibility: Although the SDK allows tags to be either 2203 # string or 2204 # [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), 2205 # only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8 2206 # encoded, the tag will be empty when the task is returned by Cloud Tasks. 2207 "payload": "A String", # A data payload consumed by the worker to execute the task. 2208 }, 2209 "appEngineHttpRequest": { # App Engine HTTP request. # App Engine HTTP request that is sent to the task's target. Can 2210 # be set only if 2211 # app_engine_http_target is set 2212 # on the queue. 2213 # 2214 # An App Engine task is a task that has AppEngineHttpRequest set. 2215 # 2216 # The message defines the HTTP request that is sent to an App Engine app when 2217 # the task is dispatched. 2218 # 2219 # This proto can only be used for tasks in a queue which has 2220 # app_engine_http_target set. 2221 # 2222 # Using AppEngineHttpRequest requires 2223 # [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) 2224 # Google IAM permission for the project 2225 # and the following scope: 2226 # 2227 # `https://www.googleapis.com/auth/cloud-platform` 2228 # 2229 # The task will be delivered to the App Engine app which belongs to the same 2230 # project as the queue. For more information, see 2231 # [How Requests are 2232 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 2233 # and how routing is affected by 2234 # [dispatch 2235 # files](https://cloud.google.com/appengine/docs/python/config/dispatchref). 2236 # Traffic is encrypted during transport and never leaves Google datacenters. 2237 # Because this traffic is carried over a communication mechanism internal to 2238 # Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). 2239 # The request to the handler, however, will appear to have used the HTTP 2240 # protocol. 2241 # 2242 # The AppEngineRouting used to construct the URL that the task is 2243 # delivered to can be set at the queue-level or task-level: 2244 # 2245 # * If set, 2246 # app_engine_routing_override 2247 # is used for all tasks in the queue, no matter what the setting 2248 # is for the 2249 # task-level app_engine_routing. 2250 # 2251 # 2252 # The `url` that the task will be sent to is: 2253 # 2254 # * `url =` host `+` 2255 # relative_url 2256 # 2257 # Tasks can be dispatched to secure app handlers, unsecure app handlers, and 2258 # URIs restricted with 2259 # [`login: 2260 # admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). 2261 # Because tasks are not run as any user, they cannot be dispatched to URIs 2262 # restricted with 2263 # [`login: 2264 # required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) 2265 # Task dispatches also do not follow redirects. 2266 # 2267 # The task attempt has succeeded if the app's request handler returns an HTTP 2268 # response code in the range [`200` - `299`]. The task attempt has failed if 2269 # the app's handler returns a non-2xx response code or Cloud Tasks does 2270 # not receive response before the deadline. Failed 2271 # tasks will be retried according to the 2272 # retry configuration. `503` (Service Unavailable) is 2273 # considered an App Engine system error instead of an application error and 2274 # will cause Cloud Tasks' traffic congestion control to temporarily throttle 2275 # the queue's dispatches. Unlike other types of task targets, a `429` (Too Many 2276 # Requests) response from an app handler does not cause traffic congestion 2277 # control to throttle the queue. 2278 "relativeUrl": "A String", # The relative URL. 2279 # 2280 # The relative URL must begin with "/" and must be a valid HTTP relative URL. 2281 # It can contain a path and query string arguments. 2282 # If the relative URL is empty, then the root path "/" will be used. 2283 # No spaces are allowed, and the maximum length allowed is 2083 characters. 2284 "httpMethod": "A String", # The HTTP method to use for the request. The default is POST. 2285 # 2286 # The app's request handler for the task's target URL must be able to handle 2287 # HTTP requests with this http_method, otherwise the task attempt will fail 2288 # with error code 405 (Method Not Allowed). See 2289 # [Writing a push task request 2290 # handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 2291 # and the documentation for the request handlers in the language your app is 2292 # written in e.g. 2293 # [Python Request 2294 # Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). 2295 "appEngineRouting": { # App Engine Routing. # Task-level setting for App Engine routing. 2296 # 2297 # If set, 2298 # app_engine_routing_override 2299 # is used for all tasks in the queue, no matter what the setting is for the 2300 # task-level app_engine_routing. 2301 # 2302 # Defines routing characteristics specific to App Engine - service, version, 2303 # and instance. 2304 # 2305 # For more information about services, versions, and instances see 2306 # [An Overview of App 2307 # Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), 2308 # [Microservices Architecture on Google App 2309 # Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), 2310 # [App Engine Standard request 2311 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), 2312 # and [App Engine Flex request 2313 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 2314 "instance": "A String", # App instance. 2315 # 2316 # By default, the task is sent to an instance which is available when 2317 # the task is attempted. 2318 # 2319 # Requests can only be sent to a specific instance if 2320 # [manual scaling is used in App Engine 2321 # Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). 2322 # App Engine Flex does not support instances. For more information, see 2323 # [App Engine Standard request 2324 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 2325 # and [App Engine Flex request 2326 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 2327 "host": "A String", # Output only. The host that the task is sent to. 2328 # 2329 # For more information, see 2330 # [How Requests are 2331 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). 2332 # 2333 # The host is constructed as: 2334 # 2335 # 2336 # * `host = [application_domain_name]`</br> 2337 # `| [service] + '.' + [application_domain_name]`</br> 2338 # `| [version] + '.' + [application_domain_name]`</br> 2339 # `| [version_dot_service]+ '.' + [application_domain_name]`</br> 2340 # `| [instance] + '.' + [application_domain_name]`</br> 2341 # `| [instance_dot_service] + '.' + [application_domain_name]`</br> 2342 # `| [instance_dot_version] + '.' + [application_domain_name]`</br> 2343 # `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` 2344 # 2345 # * `application_domain_name` = The domain name of the app, for 2346 # example <app-id>.appspot.com, which is associated with the 2347 # queue's project ID. Some tasks which were created using the App Engine 2348 # SDK use a custom domain name. 2349 # 2350 # * `service =` service 2351 # 2352 # * `version =` version 2353 # 2354 # * `version_dot_service =` 2355 # version `+ '.' +` 2356 # service 2357 # 2358 # * `instance =` instance 2359 # 2360 # * `instance_dot_service =` 2361 # instance `+ '.' +` 2362 # service 2363 # 2364 # * `instance_dot_version =` 2365 # instance `+ '.' +` 2366 # version 2367 # 2368 # * `instance_dot_version_dot_service =` 2369 # instance `+ '.' +` 2370 # version `+ '.' +` 2371 # service 2372 # 2373 # If service is empty, then the task will be sent 2374 # to the service which is the default service when the task is attempted. 2375 # 2376 # If version is empty, then the task will be sent 2377 # to the version which is the default version when the task is attempted. 2378 # 2379 # If instance is empty, then the task 2380 # will be sent to an instance which is available when the task is 2381 # attempted. 2382 # 2383 # If service, 2384 # version, or 2385 # instance is invalid, then the task 2386 # will be sent to the default version of the default service when 2387 # the task is attempted. 2388 "version": "A String", # App version. 2389 # 2390 # By default, the task is sent to the version which is the default 2391 # version when the task is attempted. 2392 # 2393 # For some queues or tasks which were created using the App Engine 2394 # Task Queue API, host is not parsable 2395 # into service, 2396 # version, and 2397 # instance. For example, some tasks 2398 # which were created using the App Engine SDK use a custom domain 2399 # name; custom domains are not parsed by Cloud Tasks. If 2400 # host is not parsable, then 2401 # service, 2402 # version, and 2403 # instance are the empty string. 2404 "service": "A String", # App service. 2405 # 2406 # By default, the task is sent to the service which is the default 2407 # service when the task is attempted. 2408 # 2409 # For some queues or tasks which were created using the App Engine 2410 # Task Queue API, host is not parsable 2411 # into service, 2412 # version, and 2413 # instance. For example, some tasks 2414 # which were created using the App Engine SDK use a custom domain 2415 # name; custom domains are not parsed by Cloud Tasks. If 2416 # host is not parsable, then 2417 # service, 2418 # version, and 2419 # instance are the empty string. 2420 }, 2421 "payload": "A String", # Payload. 2422 # 2423 # The payload will be sent as the HTTP message body. A message 2424 # body, and thus a payload, is allowed only if the HTTP method is 2425 # POST or PUT. It is an error to set a data payload on a task with 2426 # an incompatible HttpMethod. 2427 "headers": { # HTTP request headers. 2428 # 2429 # This map contains the header field names and values. 2430 # Headers can be set when the 2431 # task is created. 2432 # Repeated headers are not supported but a header value can contain commas. 2433 # 2434 # Cloud Tasks sets some headers to default values: 2435 # 2436 # * `User-Agent`: By default, this header is 2437 # `"AppEngine-Google; (+http://code.google.com/appengine)"`. 2438 # This header can be modified, but Cloud Tasks will append 2439 # `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 2440 # modified `User-Agent`. 2441 # 2442 # If the task has a payload, Cloud 2443 # Tasks sets the following headers: 2444 # 2445 # * `Content-Type`: By default, the `Content-Type` header is set to 2446 # `"application/octet-stream"`. The default can be overridden by explicitly 2447 # setting `Content-Type` to a particular media type when the 2448 # task is created. 2449 # For example, `Content-Type` can be set to `"application/json"`. 2450 # * `Content-Length`: This is computed by Cloud Tasks. This value is 2451 # output only. It cannot be changed. 2452 # 2453 # The headers below cannot be set or overridden: 2454 # 2455 # * `Host` 2456 # * `X-Google-*` 2457 # * `X-AppEngine-*` 2458 # 2459 # In addition, Cloud Tasks sets some headers when the task is dispatched, 2460 # such as headers containing information about the task; see 2461 # [request 2462 # headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). 2463 # These headers are set only when the task is dispatched, so they are not 2464 # visible when the task is returned in a Cloud Tasks response. 2465 # 2466 # Although there is no specific limit for the maximum number of headers or 2467 # the size, there is a limit on the maximum size of the Task. For more 2468 # information, see the CreateTask documentation. 2469 "a_key": "A String", 2470 }, 2471 }, 2472 "name": "A String", # Optionally caller-specified in CreateTask. 2473 # 2474 # The task name. 2475 # 2476 # The task name must have the following format: 2477 # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` 2478 # 2479 # * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), 2480 # hyphens (-), colons (:), or periods (.). 2481 # For more information, see 2482 # [Identifying 2483 # projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) 2484 # * `LOCATION_ID` is the canonical ID for the task's location. 2485 # The list of available locations can be obtained by calling 2486 # ListLocations. 2487 # For more information, see https://cloud.google.com/about/locations/. 2488 # * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or 2489 # hyphens (-). The maximum length is 100 characters. 2490 # * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), 2491 # hyphens (-), or underscores (_). The maximum length is 500 characters. 2492 "scheduleTime": "A String", # The time when the task is scheduled to be attempted. 2493 # 2494 # For App Engine queues, this is when the task will be attempted or retried. 2495 # 2496 # For pull queues, this is the time when the task is available to 2497 # be leased; if a task is currently leased, this is the time when 2498 # the current lease expires, that is, the time that the task was 2499 # leased plus the lease_duration. 2500 # 2501 # `schedule_time` will be truncated to the nearest microsecond. 2502 "createTime": "A String", # Output only. The time that the task was created. 2503 # 2504 # `create_time` will be truncated to the nearest second. 2505 "view": "A String", # Output only. The view specifies which subset of the Task has 2506 # been returned. 2507 }, 2508 ], 2509 }</pre> 2510</div> 2511 2512<div class="method"> 2513 <code class="details" id="list">list(parent, responseView=None, pageSize=None, pageToken=None, x__xgafv=None)</code> 2514 <pre>Lists the tasks in a queue. 2515 2516By default, only the BASIC view is retrieved 2517due to performance considerations; 2518response_view controls the 2519subset of information which is returned. 2520 2521The tasks may be returned in any order. The ordering may change at any 2522time. 2523 2524Args: 2525 parent: string, Required. 2526 2527The queue name. For example: 2528`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` (required) 2529 responseView: string, The response_view specifies which subset of the Task will be 2530returned. 2531 2532By default response_view is BASIC; not all 2533information is retrieved by default because some data, such as 2534payloads, might be desirable to return only when needed because 2535of its large size or because of the sensitivity of data that it 2536contains. 2537 2538Authorization for FULL requires 2539`cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) 2540permission on the Task resource. 2541 pageSize: integer, Maximum page size. 2542 2543Fewer tasks than requested might be returned, even if more tasks exist; use 2544next_page_token in the response to 2545determine if more tasks exist. 2546 2547The maximum page size is 1000. If unspecified, the page size will be the 2548maximum. 2549 pageToken: string, A token identifying the page of results to return. 2550 2551To request the first page results, page_token must be empty. To 2552request the next page of results, page_token must be the value of 2553next_page_token returned 2554from the previous call to ListTasks 2555method. 2556 2557The page token is valid for only 2 hours. 2558 x__xgafv: string, V1 error format. 2559 Allowed values 2560 1 - v1 error format 2561 2 - v2 error format 2562 2563Returns: 2564 An object of the form: 2565 2566 { # Response message for listing tasks using ListTasks. 2567 "nextPageToken": "A String", # A token to retrieve next page of results. 2568 # 2569 # To return the next page of results, call 2570 # ListTasks with this value as the 2571 # page_token. 2572 # 2573 # If the next_page_token is empty, there are no more results. 2574 "tasks": [ # The list of tasks. 2575 { # A unit of scheduled work. 2576 "status": { # Status of the task. # Output only. The task status. 2577 "lastAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's last attempt. 2578 # 2579 # This field is not calculated for pull tasks. 2580 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 2581 # 2582 # `schedule_time` will be truncated to the nearest microsecond. 2583 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 2584 # 2585 # If the task has not been attempted or the task is currently running 2586 # then the response status is unset. 2587 # different programming environments, including REST APIs and RPC APIs. It is 2588 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 2589 # three pieces of data: error code, error message, and error details. 2590 # 2591 # You can find out more about this error model and how to work with it in the 2592 # [API Design Guide](https://cloud.google.com/apis/design/errors). 2593 "message": "A String", # A developer-facing error message, which should be in English. Any 2594 # user-facing error message should be localized and sent in the 2595 # google.rpc.Status.details field, or localized by the client. 2596 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 2597 "details": [ # A list of messages that carry the error details. There is a common set of 2598 # message types for APIs to use. 2599 { 2600 "a_key": "", # Properties of the object. Contains field @type with type URL. 2601 }, 2602 ], 2603 }, 2604 "responseTime": "A String", # Output only. The time that this attempt response was received. 2605 # 2606 # `response_time` will be truncated to the nearest microsecond. 2607 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 2608 # 2609 # `dispatch_time` will be truncated to the nearest microsecond. 2610 }, 2611 "firstAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's first attempt. 2612 # 2613 # Only dispatch_time will be set. 2614 # The other AttemptStatus information is not retained by Cloud Tasks. 2615 # 2616 # This field is not calculated for pull tasks. 2617 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 2618 # 2619 # `schedule_time` will be truncated to the nearest microsecond. 2620 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 2621 # 2622 # If the task has not been attempted or the task is currently running 2623 # then the response status is unset. 2624 # different programming environments, including REST APIs and RPC APIs. It is 2625 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 2626 # three pieces of data: error code, error message, and error details. 2627 # 2628 # You can find out more about this error model and how to work with it in the 2629 # [API Design Guide](https://cloud.google.com/apis/design/errors). 2630 "message": "A String", # A developer-facing error message, which should be in English. Any 2631 # user-facing error message should be localized and sent in the 2632 # google.rpc.Status.details field, or localized by the client. 2633 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 2634 "details": [ # A list of messages that carry the error details. There is a common set of 2635 # message types for APIs to use. 2636 { 2637 "a_key": "", # Properties of the object. Contains field @type with type URL. 2638 }, 2639 ], 2640 }, 2641 "responseTime": "A String", # Output only. The time that this attempt response was received. 2642 # 2643 # `response_time` will be truncated to the nearest microsecond. 2644 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 2645 # 2646 # `dispatch_time` will be truncated to the nearest microsecond. 2647 }, 2648 "attemptDispatchCount": 42, # Output only. The number of attempts dispatched. 2649 # 2650 # This count includes attempts which have been dispatched but haven't 2651 # received a response. 2652 "attemptResponseCount": 42, # Output only. The number of attempts which have received a response. 2653 # 2654 # This field is not calculated for pull tasks. 2655 }, 2656 "pullMessage": { # The pull message contains data that can be used by the caller of # LeaseTasks to process the task. Can be 2657 # set only if pull_target is set on the queue. 2658 # 2659 # A pull task is a task that has PullMessage set. 2660 # LeaseTasks to process the task. 2661 # 2662 # This proto can only be used for tasks in a queue which has 2663 # pull_target set. 2664 "tag": "A String", # The task's tag. 2665 # 2666 # Tags allow similar tasks to be processed in a batch. If you label 2667 # tasks with a tag, your worker can 2668 # lease tasks with the same tag using 2669 # filter. For example, if you want to 2670 # aggregate the events associated with a specific user once a day, 2671 # you could tag tasks with the user ID. 2672 # 2673 # The task's tag can only be set when the 2674 # task is created. 2675 # 2676 # The tag must be less than 500 characters. 2677 # 2678 # SDK compatibility: Although the SDK allows tags to be either 2679 # string or 2680 # [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), 2681 # only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8 2682 # encoded, the tag will be empty when the task is returned by Cloud Tasks. 2683 "payload": "A String", # A data payload consumed by the worker to execute the task. 2684 }, 2685 "appEngineHttpRequest": { # App Engine HTTP request. # App Engine HTTP request that is sent to the task's target. Can 2686 # be set only if 2687 # app_engine_http_target is set 2688 # on the queue. 2689 # 2690 # An App Engine task is a task that has AppEngineHttpRequest set. 2691 # 2692 # The message defines the HTTP request that is sent to an App Engine app when 2693 # the task is dispatched. 2694 # 2695 # This proto can only be used for tasks in a queue which has 2696 # app_engine_http_target set. 2697 # 2698 # Using AppEngineHttpRequest requires 2699 # [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) 2700 # Google IAM permission for the project 2701 # and the following scope: 2702 # 2703 # `https://www.googleapis.com/auth/cloud-platform` 2704 # 2705 # The task will be delivered to the App Engine app which belongs to the same 2706 # project as the queue. For more information, see 2707 # [How Requests are 2708 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 2709 # and how routing is affected by 2710 # [dispatch 2711 # files](https://cloud.google.com/appengine/docs/python/config/dispatchref). 2712 # Traffic is encrypted during transport and never leaves Google datacenters. 2713 # Because this traffic is carried over a communication mechanism internal to 2714 # Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). 2715 # The request to the handler, however, will appear to have used the HTTP 2716 # protocol. 2717 # 2718 # The AppEngineRouting used to construct the URL that the task is 2719 # delivered to can be set at the queue-level or task-level: 2720 # 2721 # * If set, 2722 # app_engine_routing_override 2723 # is used for all tasks in the queue, no matter what the setting 2724 # is for the 2725 # task-level app_engine_routing. 2726 # 2727 # 2728 # The `url` that the task will be sent to is: 2729 # 2730 # * `url =` host `+` 2731 # relative_url 2732 # 2733 # Tasks can be dispatched to secure app handlers, unsecure app handlers, and 2734 # URIs restricted with 2735 # [`login: 2736 # admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). 2737 # Because tasks are not run as any user, they cannot be dispatched to URIs 2738 # restricted with 2739 # [`login: 2740 # required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) 2741 # Task dispatches also do not follow redirects. 2742 # 2743 # The task attempt has succeeded if the app's request handler returns an HTTP 2744 # response code in the range [`200` - `299`]. The task attempt has failed if 2745 # the app's handler returns a non-2xx response code or Cloud Tasks does 2746 # not receive response before the deadline. Failed 2747 # tasks will be retried according to the 2748 # retry configuration. `503` (Service Unavailable) is 2749 # considered an App Engine system error instead of an application error and 2750 # will cause Cloud Tasks' traffic congestion control to temporarily throttle 2751 # the queue's dispatches. Unlike other types of task targets, a `429` (Too Many 2752 # Requests) response from an app handler does not cause traffic congestion 2753 # control to throttle the queue. 2754 "relativeUrl": "A String", # The relative URL. 2755 # 2756 # The relative URL must begin with "/" and must be a valid HTTP relative URL. 2757 # It can contain a path and query string arguments. 2758 # If the relative URL is empty, then the root path "/" will be used. 2759 # No spaces are allowed, and the maximum length allowed is 2083 characters. 2760 "httpMethod": "A String", # The HTTP method to use for the request. The default is POST. 2761 # 2762 # The app's request handler for the task's target URL must be able to handle 2763 # HTTP requests with this http_method, otherwise the task attempt will fail 2764 # with error code 405 (Method Not Allowed). See 2765 # [Writing a push task request 2766 # handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 2767 # and the documentation for the request handlers in the language your app is 2768 # written in e.g. 2769 # [Python Request 2770 # Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). 2771 "appEngineRouting": { # App Engine Routing. # Task-level setting for App Engine routing. 2772 # 2773 # If set, 2774 # app_engine_routing_override 2775 # is used for all tasks in the queue, no matter what the setting is for the 2776 # task-level app_engine_routing. 2777 # 2778 # Defines routing characteristics specific to App Engine - service, version, 2779 # and instance. 2780 # 2781 # For more information about services, versions, and instances see 2782 # [An Overview of App 2783 # Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), 2784 # [Microservices Architecture on Google App 2785 # Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), 2786 # [App Engine Standard request 2787 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), 2788 # and [App Engine Flex request 2789 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 2790 "instance": "A String", # App instance. 2791 # 2792 # By default, the task is sent to an instance which is available when 2793 # the task is attempted. 2794 # 2795 # Requests can only be sent to a specific instance if 2796 # [manual scaling is used in App Engine 2797 # Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). 2798 # App Engine Flex does not support instances. For more information, see 2799 # [App Engine Standard request 2800 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 2801 # and [App Engine Flex request 2802 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 2803 "host": "A String", # Output only. The host that the task is sent to. 2804 # 2805 # For more information, see 2806 # [How Requests are 2807 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). 2808 # 2809 # The host is constructed as: 2810 # 2811 # 2812 # * `host = [application_domain_name]`</br> 2813 # `| [service] + '.' + [application_domain_name]`</br> 2814 # `| [version] + '.' + [application_domain_name]`</br> 2815 # `| [version_dot_service]+ '.' + [application_domain_name]`</br> 2816 # `| [instance] + '.' + [application_domain_name]`</br> 2817 # `| [instance_dot_service] + '.' + [application_domain_name]`</br> 2818 # `| [instance_dot_version] + '.' + [application_domain_name]`</br> 2819 # `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` 2820 # 2821 # * `application_domain_name` = The domain name of the app, for 2822 # example <app-id>.appspot.com, which is associated with the 2823 # queue's project ID. Some tasks which were created using the App Engine 2824 # SDK use a custom domain name. 2825 # 2826 # * `service =` service 2827 # 2828 # * `version =` version 2829 # 2830 # * `version_dot_service =` 2831 # version `+ '.' +` 2832 # service 2833 # 2834 # * `instance =` instance 2835 # 2836 # * `instance_dot_service =` 2837 # instance `+ '.' +` 2838 # service 2839 # 2840 # * `instance_dot_version =` 2841 # instance `+ '.' +` 2842 # version 2843 # 2844 # * `instance_dot_version_dot_service =` 2845 # instance `+ '.' +` 2846 # version `+ '.' +` 2847 # service 2848 # 2849 # If service is empty, then the task will be sent 2850 # to the service which is the default service when the task is attempted. 2851 # 2852 # If version is empty, then the task will be sent 2853 # to the version which is the default version when the task is attempted. 2854 # 2855 # If instance is empty, then the task 2856 # will be sent to an instance which is available when the task is 2857 # attempted. 2858 # 2859 # If service, 2860 # version, or 2861 # instance is invalid, then the task 2862 # will be sent to the default version of the default service when 2863 # the task is attempted. 2864 "version": "A String", # App version. 2865 # 2866 # By default, the task is sent to the version which is the default 2867 # version when the task is attempted. 2868 # 2869 # For some queues or tasks which were created using the App Engine 2870 # Task Queue API, host is not parsable 2871 # into service, 2872 # version, and 2873 # instance. For example, some tasks 2874 # which were created using the App Engine SDK use a custom domain 2875 # name; custom domains are not parsed by Cloud Tasks. If 2876 # host is not parsable, then 2877 # service, 2878 # version, and 2879 # instance are the empty string. 2880 "service": "A String", # App service. 2881 # 2882 # By default, the task is sent to the service which is the default 2883 # service when the task is attempted. 2884 # 2885 # For some queues or tasks which were created using the App Engine 2886 # Task Queue API, host is not parsable 2887 # into service, 2888 # version, and 2889 # instance. For example, some tasks 2890 # which were created using the App Engine SDK use a custom domain 2891 # name; custom domains are not parsed by Cloud Tasks. If 2892 # host is not parsable, then 2893 # service, 2894 # version, and 2895 # instance are the empty string. 2896 }, 2897 "payload": "A String", # Payload. 2898 # 2899 # The payload will be sent as the HTTP message body. A message 2900 # body, and thus a payload, is allowed only if the HTTP method is 2901 # POST or PUT. It is an error to set a data payload on a task with 2902 # an incompatible HttpMethod. 2903 "headers": { # HTTP request headers. 2904 # 2905 # This map contains the header field names and values. 2906 # Headers can be set when the 2907 # task is created. 2908 # Repeated headers are not supported but a header value can contain commas. 2909 # 2910 # Cloud Tasks sets some headers to default values: 2911 # 2912 # * `User-Agent`: By default, this header is 2913 # `"AppEngine-Google; (+http://code.google.com/appengine)"`. 2914 # This header can be modified, but Cloud Tasks will append 2915 # `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 2916 # modified `User-Agent`. 2917 # 2918 # If the task has a payload, Cloud 2919 # Tasks sets the following headers: 2920 # 2921 # * `Content-Type`: By default, the `Content-Type` header is set to 2922 # `"application/octet-stream"`. The default can be overridden by explicitly 2923 # setting `Content-Type` to a particular media type when the 2924 # task is created. 2925 # For example, `Content-Type` can be set to `"application/json"`. 2926 # * `Content-Length`: This is computed by Cloud Tasks. This value is 2927 # output only. It cannot be changed. 2928 # 2929 # The headers below cannot be set or overridden: 2930 # 2931 # * `Host` 2932 # * `X-Google-*` 2933 # * `X-AppEngine-*` 2934 # 2935 # In addition, Cloud Tasks sets some headers when the task is dispatched, 2936 # such as headers containing information about the task; see 2937 # [request 2938 # headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). 2939 # These headers are set only when the task is dispatched, so they are not 2940 # visible when the task is returned in a Cloud Tasks response. 2941 # 2942 # Although there is no specific limit for the maximum number of headers or 2943 # the size, there is a limit on the maximum size of the Task. For more 2944 # information, see the CreateTask documentation. 2945 "a_key": "A String", 2946 }, 2947 }, 2948 "name": "A String", # Optionally caller-specified in CreateTask. 2949 # 2950 # The task name. 2951 # 2952 # The task name must have the following format: 2953 # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` 2954 # 2955 # * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), 2956 # hyphens (-), colons (:), or periods (.). 2957 # For more information, see 2958 # [Identifying 2959 # projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) 2960 # * `LOCATION_ID` is the canonical ID for the task's location. 2961 # The list of available locations can be obtained by calling 2962 # ListLocations. 2963 # For more information, see https://cloud.google.com/about/locations/. 2964 # * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or 2965 # hyphens (-). The maximum length is 100 characters. 2966 # * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), 2967 # hyphens (-), or underscores (_). The maximum length is 500 characters. 2968 "scheduleTime": "A String", # The time when the task is scheduled to be attempted. 2969 # 2970 # For App Engine queues, this is when the task will be attempted or retried. 2971 # 2972 # For pull queues, this is the time when the task is available to 2973 # be leased; if a task is currently leased, this is the time when 2974 # the current lease expires, that is, the time that the task was 2975 # leased plus the lease_duration. 2976 # 2977 # `schedule_time` will be truncated to the nearest microsecond. 2978 "createTime": "A String", # Output only. The time that the task was created. 2979 # 2980 # `create_time` will be truncated to the nearest second. 2981 "view": "A String", # Output only. The view specifies which subset of the Task has 2982 # been returned. 2983 }, 2984 ], 2985 }</pre> 2986</div> 2987 2988<div class="method"> 2989 <code class="details" id="list_next">list_next(previous_request, previous_response)</code> 2990 <pre>Retrieves the next page of results. 2991 2992Args: 2993 previous_request: The request for the previous page. (required) 2994 previous_response: The response from the request for the previous page. (required) 2995 2996Returns: 2997 A request object that you can call 'execute()' on to request the next 2998 page. Returns None if there are no more items in the collection. 2999 </pre> 3000</div> 3001 3002<div class="method"> 3003 <code class="details" id="renewLease">renewLease(name, body, x__xgafv=None)</code> 3004 <pre>Renew the current lease of a pull task. 3005 3006The worker can use this method to extend the lease by a new 3007duration, starting from now. The new task lease will be 3008returned in the task's schedule_time. 3009 3010Args: 3011 name: string, Required. 3012 3013The task name. For example: 3014`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` (required) 3015 body: object, The request body. (required) 3016 The object takes the form of: 3017 3018{ # Request message for renewing a lease using 3019 # RenewLease. 3020 "scheduleTime": "A String", # Required. 3021 # 3022 # The task's current schedule time, available in the 3023 # schedule_time returned by 3024 # LeaseTasks response or 3025 # RenewLease response. This restriction is 3026 # to ensure that your worker currently holds the lease. 3027 "responseView": "A String", # The response_view specifies which subset of the Task will be 3028 # returned. 3029 # 3030 # By default response_view is BASIC; not all 3031 # information is retrieved by default because some data, such as 3032 # payloads, might be desirable to return only when needed because 3033 # of its large size or because of the sensitivity of data that it 3034 # contains. 3035 # 3036 # Authorization for FULL requires 3037 # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) 3038 # permission on the Task resource. 3039 "leaseDuration": "A String", # Required. 3040 # 3041 # The desired new lease duration, starting from now. 3042 # 3043 # 3044 # The maximum lease duration is 1 week. 3045 # `lease_duration` will be truncated to the nearest second. 3046 } 3047 3048 x__xgafv: string, V1 error format. 3049 Allowed values 3050 1 - v1 error format 3051 2 - v2 error format 3052 3053Returns: 3054 An object of the form: 3055 3056 { # A unit of scheduled work. 3057 "status": { # Status of the task. # Output only. The task status. 3058 "lastAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's last attempt. 3059 # 3060 # This field is not calculated for pull tasks. 3061 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 3062 # 3063 # `schedule_time` will be truncated to the nearest microsecond. 3064 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 3065 # 3066 # If the task has not been attempted or the task is currently running 3067 # then the response status is unset. 3068 # different programming environments, including REST APIs and RPC APIs. It is 3069 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 3070 # three pieces of data: error code, error message, and error details. 3071 # 3072 # You can find out more about this error model and how to work with it in the 3073 # [API Design Guide](https://cloud.google.com/apis/design/errors). 3074 "message": "A String", # A developer-facing error message, which should be in English. Any 3075 # user-facing error message should be localized and sent in the 3076 # google.rpc.Status.details field, or localized by the client. 3077 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 3078 "details": [ # A list of messages that carry the error details. There is a common set of 3079 # message types for APIs to use. 3080 { 3081 "a_key": "", # Properties of the object. Contains field @type with type URL. 3082 }, 3083 ], 3084 }, 3085 "responseTime": "A String", # Output only. The time that this attempt response was received. 3086 # 3087 # `response_time` will be truncated to the nearest microsecond. 3088 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 3089 # 3090 # `dispatch_time` will be truncated to the nearest microsecond. 3091 }, 3092 "firstAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's first attempt. 3093 # 3094 # Only dispatch_time will be set. 3095 # The other AttemptStatus information is not retained by Cloud Tasks. 3096 # 3097 # This field is not calculated for pull tasks. 3098 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 3099 # 3100 # `schedule_time` will be truncated to the nearest microsecond. 3101 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 3102 # 3103 # If the task has not been attempted or the task is currently running 3104 # then the response status is unset. 3105 # different programming environments, including REST APIs and RPC APIs. It is 3106 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 3107 # three pieces of data: error code, error message, and error details. 3108 # 3109 # You can find out more about this error model and how to work with it in the 3110 # [API Design Guide](https://cloud.google.com/apis/design/errors). 3111 "message": "A String", # A developer-facing error message, which should be in English. Any 3112 # user-facing error message should be localized and sent in the 3113 # google.rpc.Status.details field, or localized by the client. 3114 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 3115 "details": [ # A list of messages that carry the error details. There is a common set of 3116 # message types for APIs to use. 3117 { 3118 "a_key": "", # Properties of the object. Contains field @type with type URL. 3119 }, 3120 ], 3121 }, 3122 "responseTime": "A String", # Output only. The time that this attempt response was received. 3123 # 3124 # `response_time` will be truncated to the nearest microsecond. 3125 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 3126 # 3127 # `dispatch_time` will be truncated to the nearest microsecond. 3128 }, 3129 "attemptDispatchCount": 42, # Output only. The number of attempts dispatched. 3130 # 3131 # This count includes attempts which have been dispatched but haven't 3132 # received a response. 3133 "attemptResponseCount": 42, # Output only. The number of attempts which have received a response. 3134 # 3135 # This field is not calculated for pull tasks. 3136 }, 3137 "pullMessage": { # The pull message contains data that can be used by the caller of # LeaseTasks to process the task. Can be 3138 # set only if pull_target is set on the queue. 3139 # 3140 # A pull task is a task that has PullMessage set. 3141 # LeaseTasks to process the task. 3142 # 3143 # This proto can only be used for tasks in a queue which has 3144 # pull_target set. 3145 "tag": "A String", # The task's tag. 3146 # 3147 # Tags allow similar tasks to be processed in a batch. If you label 3148 # tasks with a tag, your worker can 3149 # lease tasks with the same tag using 3150 # filter. For example, if you want to 3151 # aggregate the events associated with a specific user once a day, 3152 # you could tag tasks with the user ID. 3153 # 3154 # The task's tag can only be set when the 3155 # task is created. 3156 # 3157 # The tag must be less than 500 characters. 3158 # 3159 # SDK compatibility: Although the SDK allows tags to be either 3160 # string or 3161 # [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), 3162 # only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8 3163 # encoded, the tag will be empty when the task is returned by Cloud Tasks. 3164 "payload": "A String", # A data payload consumed by the worker to execute the task. 3165 }, 3166 "appEngineHttpRequest": { # App Engine HTTP request. # App Engine HTTP request that is sent to the task's target. Can 3167 # be set only if 3168 # app_engine_http_target is set 3169 # on the queue. 3170 # 3171 # An App Engine task is a task that has AppEngineHttpRequest set. 3172 # 3173 # The message defines the HTTP request that is sent to an App Engine app when 3174 # the task is dispatched. 3175 # 3176 # This proto can only be used for tasks in a queue which has 3177 # app_engine_http_target set. 3178 # 3179 # Using AppEngineHttpRequest requires 3180 # [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) 3181 # Google IAM permission for the project 3182 # and the following scope: 3183 # 3184 # `https://www.googleapis.com/auth/cloud-platform` 3185 # 3186 # The task will be delivered to the App Engine app which belongs to the same 3187 # project as the queue. For more information, see 3188 # [How Requests are 3189 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 3190 # and how routing is affected by 3191 # [dispatch 3192 # files](https://cloud.google.com/appengine/docs/python/config/dispatchref). 3193 # Traffic is encrypted during transport and never leaves Google datacenters. 3194 # Because this traffic is carried over a communication mechanism internal to 3195 # Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). 3196 # The request to the handler, however, will appear to have used the HTTP 3197 # protocol. 3198 # 3199 # The AppEngineRouting used to construct the URL that the task is 3200 # delivered to can be set at the queue-level or task-level: 3201 # 3202 # * If set, 3203 # app_engine_routing_override 3204 # is used for all tasks in the queue, no matter what the setting 3205 # is for the 3206 # task-level app_engine_routing. 3207 # 3208 # 3209 # The `url` that the task will be sent to is: 3210 # 3211 # * `url =` host `+` 3212 # relative_url 3213 # 3214 # Tasks can be dispatched to secure app handlers, unsecure app handlers, and 3215 # URIs restricted with 3216 # [`login: 3217 # admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). 3218 # Because tasks are not run as any user, they cannot be dispatched to URIs 3219 # restricted with 3220 # [`login: 3221 # required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) 3222 # Task dispatches also do not follow redirects. 3223 # 3224 # The task attempt has succeeded if the app's request handler returns an HTTP 3225 # response code in the range [`200` - `299`]. The task attempt has failed if 3226 # the app's handler returns a non-2xx response code or Cloud Tasks does 3227 # not receive response before the deadline. Failed 3228 # tasks will be retried according to the 3229 # retry configuration. `503` (Service Unavailable) is 3230 # considered an App Engine system error instead of an application error and 3231 # will cause Cloud Tasks' traffic congestion control to temporarily throttle 3232 # the queue's dispatches. Unlike other types of task targets, a `429` (Too Many 3233 # Requests) response from an app handler does not cause traffic congestion 3234 # control to throttle the queue. 3235 "relativeUrl": "A String", # The relative URL. 3236 # 3237 # The relative URL must begin with "/" and must be a valid HTTP relative URL. 3238 # It can contain a path and query string arguments. 3239 # If the relative URL is empty, then the root path "/" will be used. 3240 # No spaces are allowed, and the maximum length allowed is 2083 characters. 3241 "httpMethod": "A String", # The HTTP method to use for the request. The default is POST. 3242 # 3243 # The app's request handler for the task's target URL must be able to handle 3244 # HTTP requests with this http_method, otherwise the task attempt will fail 3245 # with error code 405 (Method Not Allowed). See 3246 # [Writing a push task request 3247 # handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 3248 # and the documentation for the request handlers in the language your app is 3249 # written in e.g. 3250 # [Python Request 3251 # Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). 3252 "appEngineRouting": { # App Engine Routing. # Task-level setting for App Engine routing. 3253 # 3254 # If set, 3255 # app_engine_routing_override 3256 # is used for all tasks in the queue, no matter what the setting is for the 3257 # task-level app_engine_routing. 3258 # 3259 # Defines routing characteristics specific to App Engine - service, version, 3260 # and instance. 3261 # 3262 # For more information about services, versions, and instances see 3263 # [An Overview of App 3264 # Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), 3265 # [Microservices Architecture on Google App 3266 # Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), 3267 # [App Engine Standard request 3268 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), 3269 # and [App Engine Flex request 3270 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 3271 "instance": "A String", # App instance. 3272 # 3273 # By default, the task is sent to an instance which is available when 3274 # the task is attempted. 3275 # 3276 # Requests can only be sent to a specific instance if 3277 # [manual scaling is used in App Engine 3278 # Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). 3279 # App Engine Flex does not support instances. For more information, see 3280 # [App Engine Standard request 3281 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 3282 # and [App Engine Flex request 3283 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 3284 "host": "A String", # Output only. The host that the task is sent to. 3285 # 3286 # For more information, see 3287 # [How Requests are 3288 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). 3289 # 3290 # The host is constructed as: 3291 # 3292 # 3293 # * `host = [application_domain_name]`</br> 3294 # `| [service] + '.' + [application_domain_name]`</br> 3295 # `| [version] + '.' + [application_domain_name]`</br> 3296 # `| [version_dot_service]+ '.' + [application_domain_name]`</br> 3297 # `| [instance] + '.' + [application_domain_name]`</br> 3298 # `| [instance_dot_service] + '.' + [application_domain_name]`</br> 3299 # `| [instance_dot_version] + '.' + [application_domain_name]`</br> 3300 # `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` 3301 # 3302 # * `application_domain_name` = The domain name of the app, for 3303 # example <app-id>.appspot.com, which is associated with the 3304 # queue's project ID. Some tasks which were created using the App Engine 3305 # SDK use a custom domain name. 3306 # 3307 # * `service =` service 3308 # 3309 # * `version =` version 3310 # 3311 # * `version_dot_service =` 3312 # version `+ '.' +` 3313 # service 3314 # 3315 # * `instance =` instance 3316 # 3317 # * `instance_dot_service =` 3318 # instance `+ '.' +` 3319 # service 3320 # 3321 # * `instance_dot_version =` 3322 # instance `+ '.' +` 3323 # version 3324 # 3325 # * `instance_dot_version_dot_service =` 3326 # instance `+ '.' +` 3327 # version `+ '.' +` 3328 # service 3329 # 3330 # If service is empty, then the task will be sent 3331 # to the service which is the default service when the task is attempted. 3332 # 3333 # If version is empty, then the task will be sent 3334 # to the version which is the default version when the task is attempted. 3335 # 3336 # If instance is empty, then the task 3337 # will be sent to an instance which is available when the task is 3338 # attempted. 3339 # 3340 # If service, 3341 # version, or 3342 # instance is invalid, then the task 3343 # will be sent to the default version of the default service when 3344 # the task is attempted. 3345 "version": "A String", # App version. 3346 # 3347 # By default, the task is sent to the version which is the default 3348 # version when the task is attempted. 3349 # 3350 # For some queues or tasks which were created using the App Engine 3351 # Task Queue API, host is not parsable 3352 # into service, 3353 # version, and 3354 # instance. For example, some tasks 3355 # which were created using the App Engine SDK use a custom domain 3356 # name; custom domains are not parsed by Cloud Tasks. If 3357 # host is not parsable, then 3358 # service, 3359 # version, and 3360 # instance are the empty string. 3361 "service": "A String", # App service. 3362 # 3363 # By default, the task is sent to the service which is the default 3364 # service when the task is attempted. 3365 # 3366 # For some queues or tasks which were created using the App Engine 3367 # Task Queue API, host is not parsable 3368 # into service, 3369 # version, and 3370 # instance. For example, some tasks 3371 # which were created using the App Engine SDK use a custom domain 3372 # name; custom domains are not parsed by Cloud Tasks. If 3373 # host is not parsable, then 3374 # service, 3375 # version, and 3376 # instance are the empty string. 3377 }, 3378 "payload": "A String", # Payload. 3379 # 3380 # The payload will be sent as the HTTP message body. A message 3381 # body, and thus a payload, is allowed only if the HTTP method is 3382 # POST or PUT. It is an error to set a data payload on a task with 3383 # an incompatible HttpMethod. 3384 "headers": { # HTTP request headers. 3385 # 3386 # This map contains the header field names and values. 3387 # Headers can be set when the 3388 # task is created. 3389 # Repeated headers are not supported but a header value can contain commas. 3390 # 3391 # Cloud Tasks sets some headers to default values: 3392 # 3393 # * `User-Agent`: By default, this header is 3394 # `"AppEngine-Google; (+http://code.google.com/appengine)"`. 3395 # This header can be modified, but Cloud Tasks will append 3396 # `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 3397 # modified `User-Agent`. 3398 # 3399 # If the task has a payload, Cloud 3400 # Tasks sets the following headers: 3401 # 3402 # * `Content-Type`: By default, the `Content-Type` header is set to 3403 # `"application/octet-stream"`. The default can be overridden by explicitly 3404 # setting `Content-Type` to a particular media type when the 3405 # task is created. 3406 # For example, `Content-Type` can be set to `"application/json"`. 3407 # * `Content-Length`: This is computed by Cloud Tasks. This value is 3408 # output only. It cannot be changed. 3409 # 3410 # The headers below cannot be set or overridden: 3411 # 3412 # * `Host` 3413 # * `X-Google-*` 3414 # * `X-AppEngine-*` 3415 # 3416 # In addition, Cloud Tasks sets some headers when the task is dispatched, 3417 # such as headers containing information about the task; see 3418 # [request 3419 # headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). 3420 # These headers are set only when the task is dispatched, so they are not 3421 # visible when the task is returned in a Cloud Tasks response. 3422 # 3423 # Although there is no specific limit for the maximum number of headers or 3424 # the size, there is a limit on the maximum size of the Task. For more 3425 # information, see the CreateTask documentation. 3426 "a_key": "A String", 3427 }, 3428 }, 3429 "name": "A String", # Optionally caller-specified in CreateTask. 3430 # 3431 # The task name. 3432 # 3433 # The task name must have the following format: 3434 # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` 3435 # 3436 # * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), 3437 # hyphens (-), colons (:), or periods (.). 3438 # For more information, see 3439 # [Identifying 3440 # projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) 3441 # * `LOCATION_ID` is the canonical ID for the task's location. 3442 # The list of available locations can be obtained by calling 3443 # ListLocations. 3444 # For more information, see https://cloud.google.com/about/locations/. 3445 # * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or 3446 # hyphens (-). The maximum length is 100 characters. 3447 # * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), 3448 # hyphens (-), or underscores (_). The maximum length is 500 characters. 3449 "scheduleTime": "A String", # The time when the task is scheduled to be attempted. 3450 # 3451 # For App Engine queues, this is when the task will be attempted or retried. 3452 # 3453 # For pull queues, this is the time when the task is available to 3454 # be leased; if a task is currently leased, this is the time when 3455 # the current lease expires, that is, the time that the task was 3456 # leased plus the lease_duration. 3457 # 3458 # `schedule_time` will be truncated to the nearest microsecond. 3459 "createTime": "A String", # Output only. The time that the task was created. 3460 # 3461 # `create_time` will be truncated to the nearest second. 3462 "view": "A String", # Output only. The view specifies which subset of the Task has 3463 # been returned. 3464 }</pre> 3465</div> 3466 3467<div class="method"> 3468 <code class="details" id="run">run(name, body, x__xgafv=None)</code> 3469 <pre>Forces a task to run now. 3470 3471When this method is called, Cloud Tasks will dispatch the task, even if 3472the task is already running, the queue has reached its RateLimits or 3473is PAUSED. 3474 3475This command is meant to be used for manual debugging. For 3476example, RunTask can be used to retry a failed 3477task after a fix has been made or to manually force a task to be 3478dispatched now. 3479 3480The dispatched task is returned. That is, the task that is returned 3481contains the status after the task is dispatched but 3482before the task is received by its target. 3483 3484If Cloud Tasks receives a successful response from the task's 3485target, then the task will be deleted; otherwise the task's 3486schedule_time will be reset to the time that 3487RunTask was called plus the retry delay specified 3488in the queue's RetryConfig. 3489 3490RunTask returns 3491NOT_FOUND when it is called on a 3492task that has already succeeded or permanently failed. 3493 3494RunTask cannot be called on a 3495pull task. 3496 3497Args: 3498 name: string, Required. 3499 3500The task name. For example: 3501`projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` (required) 3502 body: object, The request body. (required) 3503 The object takes the form of: 3504 3505{ # Request message for forcing a task to run now using 3506 # RunTask. 3507 "responseView": "A String", # The response_view specifies which subset of the Task will be 3508 # returned. 3509 # 3510 # By default response_view is BASIC; not all 3511 # information is retrieved by default because some data, such as 3512 # payloads, might be desirable to return only when needed because 3513 # of its large size or because of the sensitivity of data that it 3514 # contains. 3515 # 3516 # Authorization for FULL requires 3517 # `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) 3518 # permission on the Task resource. 3519 } 3520 3521 x__xgafv: string, V1 error format. 3522 Allowed values 3523 1 - v1 error format 3524 2 - v2 error format 3525 3526Returns: 3527 An object of the form: 3528 3529 { # A unit of scheduled work. 3530 "status": { # Status of the task. # Output only. The task status. 3531 "lastAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's last attempt. 3532 # 3533 # This field is not calculated for pull tasks. 3534 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 3535 # 3536 # `schedule_time` will be truncated to the nearest microsecond. 3537 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 3538 # 3539 # If the task has not been attempted or the task is currently running 3540 # then the response status is unset. 3541 # different programming environments, including REST APIs and RPC APIs. It is 3542 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 3543 # three pieces of data: error code, error message, and error details. 3544 # 3545 # You can find out more about this error model and how to work with it in the 3546 # [API Design Guide](https://cloud.google.com/apis/design/errors). 3547 "message": "A String", # A developer-facing error message, which should be in English. Any 3548 # user-facing error message should be localized and sent in the 3549 # google.rpc.Status.details field, or localized by the client. 3550 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 3551 "details": [ # A list of messages that carry the error details. There is a common set of 3552 # message types for APIs to use. 3553 { 3554 "a_key": "", # Properties of the object. Contains field @type with type URL. 3555 }, 3556 ], 3557 }, 3558 "responseTime": "A String", # Output only. The time that this attempt response was received. 3559 # 3560 # `response_time` will be truncated to the nearest microsecond. 3561 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 3562 # 3563 # `dispatch_time` will be truncated to the nearest microsecond. 3564 }, 3565 "firstAttemptStatus": { # The status of a task attempt. # Output only. The status of the task's first attempt. 3566 # 3567 # Only dispatch_time will be set. 3568 # The other AttemptStatus information is not retained by Cloud Tasks. 3569 # 3570 # This field is not calculated for pull tasks. 3571 "scheduleTime": "A String", # Output only. The time that this attempt was scheduled. 3572 # 3573 # `schedule_time` will be truncated to the nearest microsecond. 3574 "responseStatus": { # The `Status` type defines a logical error model that is suitable for # Output only. The response from the target for this attempt. 3575 # 3576 # If the task has not been attempted or the task is currently running 3577 # then the response status is unset. 3578 # different programming environments, including REST APIs and RPC APIs. It is 3579 # used by [gRPC](https://github.com/grpc). Each `Status` message contains 3580 # three pieces of data: error code, error message, and error details. 3581 # 3582 # You can find out more about this error model and how to work with it in the 3583 # [API Design Guide](https://cloud.google.com/apis/design/errors). 3584 "message": "A String", # A developer-facing error message, which should be in English. Any 3585 # user-facing error message should be localized and sent in the 3586 # google.rpc.Status.details field, or localized by the client. 3587 "code": 42, # The status code, which should be an enum value of google.rpc.Code. 3588 "details": [ # A list of messages that carry the error details. There is a common set of 3589 # message types for APIs to use. 3590 { 3591 "a_key": "", # Properties of the object. Contains field @type with type URL. 3592 }, 3593 ], 3594 }, 3595 "responseTime": "A String", # Output only. The time that this attempt response was received. 3596 # 3597 # `response_time` will be truncated to the nearest microsecond. 3598 "dispatchTime": "A String", # Output only. The time that this attempt was dispatched. 3599 # 3600 # `dispatch_time` will be truncated to the nearest microsecond. 3601 }, 3602 "attemptDispatchCount": 42, # Output only. The number of attempts dispatched. 3603 # 3604 # This count includes attempts which have been dispatched but haven't 3605 # received a response. 3606 "attemptResponseCount": 42, # Output only. The number of attempts which have received a response. 3607 # 3608 # This field is not calculated for pull tasks. 3609 }, 3610 "pullMessage": { # The pull message contains data that can be used by the caller of # LeaseTasks to process the task. Can be 3611 # set only if pull_target is set on the queue. 3612 # 3613 # A pull task is a task that has PullMessage set. 3614 # LeaseTasks to process the task. 3615 # 3616 # This proto can only be used for tasks in a queue which has 3617 # pull_target set. 3618 "tag": "A String", # The task's tag. 3619 # 3620 # Tags allow similar tasks to be processed in a batch. If you label 3621 # tasks with a tag, your worker can 3622 # lease tasks with the same tag using 3623 # filter. For example, if you want to 3624 # aggregate the events associated with a specific user once a day, 3625 # you could tag tasks with the user ID. 3626 # 3627 # The task's tag can only be set when the 3628 # task is created. 3629 # 3630 # The tag must be less than 500 characters. 3631 # 3632 # SDK compatibility: Although the SDK allows tags to be either 3633 # string or 3634 # [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), 3635 # only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8 3636 # encoded, the tag will be empty when the task is returned by Cloud Tasks. 3637 "payload": "A String", # A data payload consumed by the worker to execute the task. 3638 }, 3639 "appEngineHttpRequest": { # App Engine HTTP request. # App Engine HTTP request that is sent to the task's target. Can 3640 # be set only if 3641 # app_engine_http_target is set 3642 # on the queue. 3643 # 3644 # An App Engine task is a task that has AppEngineHttpRequest set. 3645 # 3646 # The message defines the HTTP request that is sent to an App Engine app when 3647 # the task is dispatched. 3648 # 3649 # This proto can only be used for tasks in a queue which has 3650 # app_engine_http_target set. 3651 # 3652 # Using AppEngineHttpRequest requires 3653 # [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) 3654 # Google IAM permission for the project 3655 # and the following scope: 3656 # 3657 # `https://www.googleapis.com/auth/cloud-platform` 3658 # 3659 # The task will be delivered to the App Engine app which belongs to the same 3660 # project as the queue. For more information, see 3661 # [How Requests are 3662 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 3663 # and how routing is affected by 3664 # [dispatch 3665 # files](https://cloud.google.com/appengine/docs/python/config/dispatchref). 3666 # Traffic is encrypted during transport and never leaves Google datacenters. 3667 # Because this traffic is carried over a communication mechanism internal to 3668 # Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). 3669 # The request to the handler, however, will appear to have used the HTTP 3670 # protocol. 3671 # 3672 # The AppEngineRouting used to construct the URL that the task is 3673 # delivered to can be set at the queue-level or task-level: 3674 # 3675 # * If set, 3676 # app_engine_routing_override 3677 # is used for all tasks in the queue, no matter what the setting 3678 # is for the 3679 # task-level app_engine_routing. 3680 # 3681 # 3682 # The `url` that the task will be sent to is: 3683 # 3684 # * `url =` host `+` 3685 # relative_url 3686 # 3687 # Tasks can be dispatched to secure app handlers, unsecure app handlers, and 3688 # URIs restricted with 3689 # [`login: 3690 # admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). 3691 # Because tasks are not run as any user, they cannot be dispatched to URIs 3692 # restricted with 3693 # [`login: 3694 # required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) 3695 # Task dispatches also do not follow redirects. 3696 # 3697 # The task attempt has succeeded if the app's request handler returns an HTTP 3698 # response code in the range [`200` - `299`]. The task attempt has failed if 3699 # the app's handler returns a non-2xx response code or Cloud Tasks does 3700 # not receive response before the deadline. Failed 3701 # tasks will be retried according to the 3702 # retry configuration. `503` (Service Unavailable) is 3703 # considered an App Engine system error instead of an application error and 3704 # will cause Cloud Tasks' traffic congestion control to temporarily throttle 3705 # the queue's dispatches. Unlike other types of task targets, a `429` (Too Many 3706 # Requests) response from an app handler does not cause traffic congestion 3707 # control to throttle the queue. 3708 "relativeUrl": "A String", # The relative URL. 3709 # 3710 # The relative URL must begin with "/" and must be a valid HTTP relative URL. 3711 # It can contain a path and query string arguments. 3712 # If the relative URL is empty, then the root path "/" will be used. 3713 # No spaces are allowed, and the maximum length allowed is 2083 characters. 3714 "httpMethod": "A String", # The HTTP method to use for the request. The default is POST. 3715 # 3716 # The app's request handler for the task's target URL must be able to handle 3717 # HTTP requests with this http_method, otherwise the task attempt will fail 3718 # with error code 405 (Method Not Allowed). See 3719 # [Writing a push task request 3720 # handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 3721 # and the documentation for the request handlers in the language your app is 3722 # written in e.g. 3723 # [Python Request 3724 # Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). 3725 "appEngineRouting": { # App Engine Routing. # Task-level setting for App Engine routing. 3726 # 3727 # If set, 3728 # app_engine_routing_override 3729 # is used for all tasks in the queue, no matter what the setting is for the 3730 # task-level app_engine_routing. 3731 # 3732 # Defines routing characteristics specific to App Engine - service, version, 3733 # and instance. 3734 # 3735 # For more information about services, versions, and instances see 3736 # [An Overview of App 3737 # Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), 3738 # [Microservices Architecture on Google App 3739 # Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), 3740 # [App Engine Standard request 3741 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), 3742 # and [App Engine Flex request 3743 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 3744 "instance": "A String", # App instance. 3745 # 3746 # By default, the task is sent to an instance which is available when 3747 # the task is attempted. 3748 # 3749 # Requests can only be sent to a specific instance if 3750 # [manual scaling is used in App Engine 3751 # Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). 3752 # App Engine Flex does not support instances. For more information, see 3753 # [App Engine Standard request 3754 # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 3755 # and [App Engine Flex request 3756 # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). 3757 "host": "A String", # Output only. The host that the task is sent to. 3758 # 3759 # For more information, see 3760 # [How Requests are 3761 # Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). 3762 # 3763 # The host is constructed as: 3764 # 3765 # 3766 # * `host = [application_domain_name]`</br> 3767 # `| [service] + '.' + [application_domain_name]`</br> 3768 # `| [version] + '.' + [application_domain_name]`</br> 3769 # `| [version_dot_service]+ '.' + [application_domain_name]`</br> 3770 # `| [instance] + '.' + [application_domain_name]`</br> 3771 # `| [instance_dot_service] + '.' + [application_domain_name]`</br> 3772 # `| [instance_dot_version] + '.' + [application_domain_name]`</br> 3773 # `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` 3774 # 3775 # * `application_domain_name` = The domain name of the app, for 3776 # example <app-id>.appspot.com, which is associated with the 3777 # queue's project ID. Some tasks which were created using the App Engine 3778 # SDK use a custom domain name. 3779 # 3780 # * `service =` service 3781 # 3782 # * `version =` version 3783 # 3784 # * `version_dot_service =` 3785 # version `+ '.' +` 3786 # service 3787 # 3788 # * `instance =` instance 3789 # 3790 # * `instance_dot_service =` 3791 # instance `+ '.' +` 3792 # service 3793 # 3794 # * `instance_dot_version =` 3795 # instance `+ '.' +` 3796 # version 3797 # 3798 # * `instance_dot_version_dot_service =` 3799 # instance `+ '.' +` 3800 # version `+ '.' +` 3801 # service 3802 # 3803 # If service is empty, then the task will be sent 3804 # to the service which is the default service when the task is attempted. 3805 # 3806 # If version is empty, then the task will be sent 3807 # to the version which is the default version when the task is attempted. 3808 # 3809 # If instance is empty, then the task 3810 # will be sent to an instance which is available when the task is 3811 # attempted. 3812 # 3813 # If service, 3814 # version, or 3815 # instance is invalid, then the task 3816 # will be sent to the default version of the default service when 3817 # the task is attempted. 3818 "version": "A String", # App version. 3819 # 3820 # By default, the task is sent to the version which is the default 3821 # version when the task is attempted. 3822 # 3823 # For some queues or tasks which were created using the App Engine 3824 # Task Queue API, host is not parsable 3825 # into service, 3826 # version, and 3827 # instance. For example, some tasks 3828 # which were created using the App Engine SDK use a custom domain 3829 # name; custom domains are not parsed by Cloud Tasks. If 3830 # host is not parsable, then 3831 # service, 3832 # version, and 3833 # instance are the empty string. 3834 "service": "A String", # App service. 3835 # 3836 # By default, the task is sent to the service which is the default 3837 # service when the task is attempted. 3838 # 3839 # For some queues or tasks which were created using the App Engine 3840 # Task Queue API, host is not parsable 3841 # into service, 3842 # version, and 3843 # instance. For example, some tasks 3844 # which were created using the App Engine SDK use a custom domain 3845 # name; custom domains are not parsed by Cloud Tasks. If 3846 # host is not parsable, then 3847 # service, 3848 # version, and 3849 # instance are the empty string. 3850 }, 3851 "payload": "A String", # Payload. 3852 # 3853 # The payload will be sent as the HTTP message body. A message 3854 # body, and thus a payload, is allowed only if the HTTP method is 3855 # POST or PUT. It is an error to set a data payload on a task with 3856 # an incompatible HttpMethod. 3857 "headers": { # HTTP request headers. 3858 # 3859 # This map contains the header field names and values. 3860 # Headers can be set when the 3861 # task is created. 3862 # Repeated headers are not supported but a header value can contain commas. 3863 # 3864 # Cloud Tasks sets some headers to default values: 3865 # 3866 # * `User-Agent`: By default, this header is 3867 # `"AppEngine-Google; (+http://code.google.com/appengine)"`. 3868 # This header can be modified, but Cloud Tasks will append 3869 # `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 3870 # modified `User-Agent`. 3871 # 3872 # If the task has a payload, Cloud 3873 # Tasks sets the following headers: 3874 # 3875 # * `Content-Type`: By default, the `Content-Type` header is set to 3876 # `"application/octet-stream"`. The default can be overridden by explicitly 3877 # setting `Content-Type` to a particular media type when the 3878 # task is created. 3879 # For example, `Content-Type` can be set to `"application/json"`. 3880 # * `Content-Length`: This is computed by Cloud Tasks. This value is 3881 # output only. It cannot be changed. 3882 # 3883 # The headers below cannot be set or overridden: 3884 # 3885 # * `Host` 3886 # * `X-Google-*` 3887 # * `X-AppEngine-*` 3888 # 3889 # In addition, Cloud Tasks sets some headers when the task is dispatched, 3890 # such as headers containing information about the task; see 3891 # [request 3892 # headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). 3893 # These headers are set only when the task is dispatched, so they are not 3894 # visible when the task is returned in a Cloud Tasks response. 3895 # 3896 # Although there is no specific limit for the maximum number of headers or 3897 # the size, there is a limit on the maximum size of the Task. For more 3898 # information, see the CreateTask documentation. 3899 "a_key": "A String", 3900 }, 3901 }, 3902 "name": "A String", # Optionally caller-specified in CreateTask. 3903 # 3904 # The task name. 3905 # 3906 # The task name must have the following format: 3907 # `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` 3908 # 3909 # * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), 3910 # hyphens (-), colons (:), or periods (.). 3911 # For more information, see 3912 # [Identifying 3913 # projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) 3914 # * `LOCATION_ID` is the canonical ID for the task's location. 3915 # The list of available locations can be obtained by calling 3916 # ListLocations. 3917 # For more information, see https://cloud.google.com/about/locations/. 3918 # * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or 3919 # hyphens (-). The maximum length is 100 characters. 3920 # * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), 3921 # hyphens (-), or underscores (_). The maximum length is 500 characters. 3922 "scheduleTime": "A String", # The time when the task is scheduled to be attempted. 3923 # 3924 # For App Engine queues, this is when the task will be attempted or retried. 3925 # 3926 # For pull queues, this is the time when the task is available to 3927 # be leased; if a task is currently leased, this is the time when 3928 # the current lease expires, that is, the time that the task was 3929 # leased plus the lease_duration. 3930 # 3931 # `schedule_time` will be truncated to the nearest microsecond. 3932 "createTime": "A String", # Output only. The time that the task was created. 3933 # 3934 # `create_time` will be truncated to the nearest second. 3935 "view": "A String", # Output only. The view specifies which subset of the Task has 3936 # been returned. 3937 }</pre> 3938</div> 3939 3940</body></html>