1 /* 2 * Copyright 2020 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 // Generated by the protocol buffer compiler. DO NOT EDIT! 17 // source: google/cloud/tasks/v2/target.proto 18 19 package com.google.cloud.tasks.v2; 20 21 /** 22 * 23 * 24 * <pre> 25 * App Engine HTTP request. 26 * The message defines the HTTP request that is sent to an App Engine app when 27 * the task is dispatched. 28 * Using [AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest] 29 * requires 30 * [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) 31 * Google IAM permission for the project 32 * and the following scope: 33 * `https://www.googleapis.com/auth/cloud-platform` 34 * The task will be delivered to the App Engine app which belongs to the same 35 * project as the queue. For more information, see 36 * [How Requests are 37 * Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 38 * and how routing is affected by 39 * [dispatch 40 * files](https://cloud.google.com/appengine/docs/python/config/dispatchref). 41 * Traffic is encrypted during transport and never leaves Google datacenters. 42 * Because this traffic is carried over a communication mechanism internal to 43 * Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). 44 * The request to the handler, however, will appear to have used the HTTP 45 * protocol. 46 * The [AppEngineRouting][google.cloud.tasks.v2.AppEngineRouting] used to 47 * construct the URL that the task is delivered to can be set at the queue-level 48 * or task-level: 49 * * If [app_engine_routing_override is set on the 50 * queue][Queue.app_engine_routing_override], this value is used for all 51 * tasks in the queue, no matter what the setting is for the [task-level 52 * app_engine_routing][AppEngineHttpRequest.app_engine_routing]. 53 * The `url` that the task will be sent to is: 54 * * `url =` [host][google.cloud.tasks.v2.AppEngineRouting.host] `+` 55 * [relative_uri][google.cloud.tasks.v2.AppEngineHttpRequest.relative_uri] 56 * Tasks can be dispatched to secure app handlers, unsecure app handlers, and 57 * URIs restricted with 58 * [`login: 59 * admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). 60 * Because tasks are not run as any user, they cannot be dispatched to URIs 61 * restricted with 62 * [`login: 63 * required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) 64 * Task dispatches also do not follow redirects. 65 * The task attempt has succeeded if the app's request handler returns an HTTP 66 * response code in the range [`200` - `299`]. The task attempt has failed if 67 * the app's handler returns a non-2xx response code or Cloud Tasks does 68 * not receive response before the 69 * [deadline][google.cloud.tasks.v2.Task.dispatch_deadline]. Failed tasks will 70 * be retried according to the [retry 71 * configuration][google.cloud.tasks.v2.Queue.retry_config]. `503` (Service 72 * Unavailable) is considered an App Engine system error instead of an 73 * application error and will cause Cloud Tasks' traffic congestion control to 74 * temporarily throttle the queue's dispatches. Unlike other types of task 75 * targets, a `429` (Too Many Requests) response from an app handler does not 76 * cause traffic congestion control to throttle the queue. 77 * </pre> 78 * 79 * Protobuf type {@code google.cloud.tasks.v2.AppEngineHttpRequest} 80 */ 81 public final class AppEngineHttpRequest extends com.google.protobuf.GeneratedMessageV3 82 implements 83 // @@protoc_insertion_point(message_implements:google.cloud.tasks.v2.AppEngineHttpRequest) 84 AppEngineHttpRequestOrBuilder { 85 private static final long serialVersionUID = 0L; 86 // Use AppEngineHttpRequest.newBuilder() to construct. AppEngineHttpRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)87 private AppEngineHttpRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 88 super(builder); 89 } 90 AppEngineHttpRequest()91 private AppEngineHttpRequest() { 92 httpMethod_ = 0; 93 relativeUri_ = ""; 94 body_ = com.google.protobuf.ByteString.EMPTY; 95 } 96 97 @java.lang.Override 98 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)99 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 100 return new AppEngineHttpRequest(); 101 } 102 103 @java.lang.Override getUnknownFields()104 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 105 return this.unknownFields; 106 } 107 getDescriptor()108 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 109 return com.google.cloud.tasks.v2.TargetProto 110 .internal_static_google_cloud_tasks_v2_AppEngineHttpRequest_descriptor; 111 } 112 113 @SuppressWarnings({"rawtypes"}) 114 @java.lang.Override internalGetMapField(int number)115 protected com.google.protobuf.MapField internalGetMapField(int number) { 116 switch (number) { 117 case 4: 118 return internalGetHeaders(); 119 default: 120 throw new RuntimeException("Invalid map field number: " + number); 121 } 122 } 123 124 @java.lang.Override 125 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()126 internalGetFieldAccessorTable() { 127 return com.google.cloud.tasks.v2.TargetProto 128 .internal_static_google_cloud_tasks_v2_AppEngineHttpRequest_fieldAccessorTable 129 .ensureFieldAccessorsInitialized( 130 com.google.cloud.tasks.v2.AppEngineHttpRequest.class, 131 com.google.cloud.tasks.v2.AppEngineHttpRequest.Builder.class); 132 } 133 134 public static final int HTTP_METHOD_FIELD_NUMBER = 1; 135 private int httpMethod_ = 0; 136 /** 137 * 138 * 139 * <pre> 140 * The HTTP method to use for the request. The default is POST. 141 * The app's request handler for the task's target URL must be able to handle 142 * HTTP requests with this http_method, otherwise the task attempt will fail 143 * with error code 405 (Method Not Allowed). See 144 * [Writing a push task request 145 * handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 146 * and the documentation for the request handlers in the language your app is 147 * written in e.g. 148 * [Python Request 149 * Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). 150 * </pre> 151 * 152 * <code>.google.cloud.tasks.v2.HttpMethod http_method = 1;</code> 153 * 154 * @return The enum numeric value on the wire for httpMethod. 155 */ 156 @java.lang.Override getHttpMethodValue()157 public int getHttpMethodValue() { 158 return httpMethod_; 159 } 160 /** 161 * 162 * 163 * <pre> 164 * The HTTP method to use for the request. The default is POST. 165 * The app's request handler for the task's target URL must be able to handle 166 * HTTP requests with this http_method, otherwise the task attempt will fail 167 * with error code 405 (Method Not Allowed). See 168 * [Writing a push task request 169 * handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 170 * and the documentation for the request handlers in the language your app is 171 * written in e.g. 172 * [Python Request 173 * Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). 174 * </pre> 175 * 176 * <code>.google.cloud.tasks.v2.HttpMethod http_method = 1;</code> 177 * 178 * @return The httpMethod. 179 */ 180 @java.lang.Override getHttpMethod()181 public com.google.cloud.tasks.v2.HttpMethod getHttpMethod() { 182 com.google.cloud.tasks.v2.HttpMethod result = 183 com.google.cloud.tasks.v2.HttpMethod.forNumber(httpMethod_); 184 return result == null ? com.google.cloud.tasks.v2.HttpMethod.UNRECOGNIZED : result; 185 } 186 187 public static final int APP_ENGINE_ROUTING_FIELD_NUMBER = 2; 188 private com.google.cloud.tasks.v2.AppEngineRouting appEngineRouting_; 189 /** 190 * 191 * 192 * <pre> 193 * Task-level setting for App Engine routing. 194 * * If [app_engine_routing_override is set on the 195 * queue][Queue.app_engine_routing_override], this value is used for all 196 * tasks in the queue, no matter what the setting is for the [task-level 197 * app_engine_routing][AppEngineHttpRequest.app_engine_routing]. 198 * </pre> 199 * 200 * <code>.google.cloud.tasks.v2.AppEngineRouting app_engine_routing = 2;</code> 201 * 202 * @return Whether the appEngineRouting field is set. 203 */ 204 @java.lang.Override hasAppEngineRouting()205 public boolean hasAppEngineRouting() { 206 return appEngineRouting_ != null; 207 } 208 /** 209 * 210 * 211 * <pre> 212 * Task-level setting for App Engine routing. 213 * * If [app_engine_routing_override is set on the 214 * queue][Queue.app_engine_routing_override], this value is used for all 215 * tasks in the queue, no matter what the setting is for the [task-level 216 * app_engine_routing][AppEngineHttpRequest.app_engine_routing]. 217 * </pre> 218 * 219 * <code>.google.cloud.tasks.v2.AppEngineRouting app_engine_routing = 2;</code> 220 * 221 * @return The appEngineRouting. 222 */ 223 @java.lang.Override getAppEngineRouting()224 public com.google.cloud.tasks.v2.AppEngineRouting getAppEngineRouting() { 225 return appEngineRouting_ == null 226 ? com.google.cloud.tasks.v2.AppEngineRouting.getDefaultInstance() 227 : appEngineRouting_; 228 } 229 /** 230 * 231 * 232 * <pre> 233 * Task-level setting for App Engine routing. 234 * * If [app_engine_routing_override is set on the 235 * queue][Queue.app_engine_routing_override], this value is used for all 236 * tasks in the queue, no matter what the setting is for the [task-level 237 * app_engine_routing][AppEngineHttpRequest.app_engine_routing]. 238 * </pre> 239 * 240 * <code>.google.cloud.tasks.v2.AppEngineRouting app_engine_routing = 2;</code> 241 */ 242 @java.lang.Override getAppEngineRoutingOrBuilder()243 public com.google.cloud.tasks.v2.AppEngineRoutingOrBuilder getAppEngineRoutingOrBuilder() { 244 return appEngineRouting_ == null 245 ? com.google.cloud.tasks.v2.AppEngineRouting.getDefaultInstance() 246 : appEngineRouting_; 247 } 248 249 public static final int RELATIVE_URI_FIELD_NUMBER = 3; 250 251 @SuppressWarnings("serial") 252 private volatile java.lang.Object relativeUri_ = ""; 253 /** 254 * 255 * 256 * <pre> 257 * The relative URI. 258 * The relative URI must begin with "/" and must be a valid HTTP relative URI. 259 * It can contain a path and query string arguments. 260 * If the relative URI is empty, then the root path "/" will be used. 261 * No spaces are allowed, and the maximum length allowed is 2083 characters. 262 * </pre> 263 * 264 * <code>string relative_uri = 3;</code> 265 * 266 * @return The relativeUri. 267 */ 268 @java.lang.Override getRelativeUri()269 public java.lang.String getRelativeUri() { 270 java.lang.Object ref = relativeUri_; 271 if (ref instanceof java.lang.String) { 272 return (java.lang.String) ref; 273 } else { 274 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 275 java.lang.String s = bs.toStringUtf8(); 276 relativeUri_ = s; 277 return s; 278 } 279 } 280 /** 281 * 282 * 283 * <pre> 284 * The relative URI. 285 * The relative URI must begin with "/" and must be a valid HTTP relative URI. 286 * It can contain a path and query string arguments. 287 * If the relative URI is empty, then the root path "/" will be used. 288 * No spaces are allowed, and the maximum length allowed is 2083 characters. 289 * </pre> 290 * 291 * <code>string relative_uri = 3;</code> 292 * 293 * @return The bytes for relativeUri. 294 */ 295 @java.lang.Override getRelativeUriBytes()296 public com.google.protobuf.ByteString getRelativeUriBytes() { 297 java.lang.Object ref = relativeUri_; 298 if (ref instanceof java.lang.String) { 299 com.google.protobuf.ByteString b = 300 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 301 relativeUri_ = b; 302 return b; 303 } else { 304 return (com.google.protobuf.ByteString) ref; 305 } 306 } 307 308 public static final int HEADERS_FIELD_NUMBER = 4; 309 310 private static final class HeadersDefaultEntryHolder { 311 static final com.google.protobuf.MapEntry<java.lang.String, java.lang.String> defaultEntry = 312 com.google.protobuf.MapEntry.<java.lang.String, java.lang.String>newDefaultInstance( 313 com.google.cloud.tasks.v2.TargetProto 314 .internal_static_google_cloud_tasks_v2_AppEngineHttpRequest_HeadersEntry_descriptor, 315 com.google.protobuf.WireFormat.FieldType.STRING, 316 "", 317 com.google.protobuf.WireFormat.FieldType.STRING, 318 ""); 319 } 320 321 @SuppressWarnings("serial") 322 private com.google.protobuf.MapField<java.lang.String, java.lang.String> headers_; 323 internalGetHeaders()324 private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetHeaders() { 325 if (headers_ == null) { 326 return com.google.protobuf.MapField.emptyMapField(HeadersDefaultEntryHolder.defaultEntry); 327 } 328 return headers_; 329 } 330 getHeadersCount()331 public int getHeadersCount() { 332 return internalGetHeaders().getMap().size(); 333 } 334 /** 335 * 336 * 337 * <pre> 338 * HTTP request headers. 339 * This map contains the header field names and values. 340 * Headers can be set when the 341 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 342 * Repeated headers are not supported but a header value can contain commas. 343 * Cloud Tasks sets some headers to default values: 344 * * `User-Agent`: By default, this header is 345 * `"AppEngine-Google; (+http://code.google.com/appengine)"`. 346 * This header can be modified, but Cloud Tasks will append 347 * `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 348 * modified `User-Agent`. 349 * If the task has a [body][google.cloud.tasks.v2.AppEngineHttpRequest.body], 350 * Cloud Tasks sets the following headers: 351 * * `Content-Type`: By default, the `Content-Type` header is set to 352 * `"application/octet-stream"`. The default can be overridden by explicitly 353 * setting `Content-Type` to a particular media type when the 354 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 355 * For example, `Content-Type` can be set to `"application/json"`. 356 * * `Content-Length`: This is computed by Cloud Tasks. This value is 357 * output only. It cannot be changed. 358 * The headers below cannot be set or overridden: 359 * * `Host` 360 * * `X-Google-*` 361 * * `X-AppEngine-*` 362 * In addition, Cloud Tasks sets some headers when the task is dispatched, 363 * such as headers containing information about the task; see 364 * [request 365 * headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers). 366 * These headers are set only when the task is dispatched, so they are not 367 * visible when the task is returned in a Cloud Tasks response. 368 * Although there is no specific limit for the maximum number of headers or 369 * the size, there is a limit on the maximum size of the 370 * [Task][google.cloud.tasks.v2.Task]. For more information, see the 371 * [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] documentation. 372 * </pre> 373 * 374 * <code>map<string, string> headers = 4;</code> 375 */ 376 @java.lang.Override containsHeaders(java.lang.String key)377 public boolean containsHeaders(java.lang.String key) { 378 if (key == null) { 379 throw new NullPointerException("map key"); 380 } 381 return internalGetHeaders().getMap().containsKey(key); 382 } 383 /** Use {@link #getHeadersMap()} instead. */ 384 @java.lang.Override 385 @java.lang.Deprecated getHeaders()386 public java.util.Map<java.lang.String, java.lang.String> getHeaders() { 387 return getHeadersMap(); 388 } 389 /** 390 * 391 * 392 * <pre> 393 * HTTP request headers. 394 * This map contains the header field names and values. 395 * Headers can be set when the 396 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 397 * Repeated headers are not supported but a header value can contain commas. 398 * Cloud Tasks sets some headers to default values: 399 * * `User-Agent`: By default, this header is 400 * `"AppEngine-Google; (+http://code.google.com/appengine)"`. 401 * This header can be modified, but Cloud Tasks will append 402 * `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 403 * modified `User-Agent`. 404 * If the task has a [body][google.cloud.tasks.v2.AppEngineHttpRequest.body], 405 * Cloud Tasks sets the following headers: 406 * * `Content-Type`: By default, the `Content-Type` header is set to 407 * `"application/octet-stream"`. The default can be overridden by explicitly 408 * setting `Content-Type` to a particular media type when the 409 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 410 * For example, `Content-Type` can be set to `"application/json"`. 411 * * `Content-Length`: This is computed by Cloud Tasks. This value is 412 * output only. It cannot be changed. 413 * The headers below cannot be set or overridden: 414 * * `Host` 415 * * `X-Google-*` 416 * * `X-AppEngine-*` 417 * In addition, Cloud Tasks sets some headers when the task is dispatched, 418 * such as headers containing information about the task; see 419 * [request 420 * headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers). 421 * These headers are set only when the task is dispatched, so they are not 422 * visible when the task is returned in a Cloud Tasks response. 423 * Although there is no specific limit for the maximum number of headers or 424 * the size, there is a limit on the maximum size of the 425 * [Task][google.cloud.tasks.v2.Task]. For more information, see the 426 * [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] documentation. 427 * </pre> 428 * 429 * <code>map<string, string> headers = 4;</code> 430 */ 431 @java.lang.Override getHeadersMap()432 public java.util.Map<java.lang.String, java.lang.String> getHeadersMap() { 433 return internalGetHeaders().getMap(); 434 } 435 /** 436 * 437 * 438 * <pre> 439 * HTTP request headers. 440 * This map contains the header field names and values. 441 * Headers can be set when the 442 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 443 * Repeated headers are not supported but a header value can contain commas. 444 * Cloud Tasks sets some headers to default values: 445 * * `User-Agent`: By default, this header is 446 * `"AppEngine-Google; (+http://code.google.com/appengine)"`. 447 * This header can be modified, but Cloud Tasks will append 448 * `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 449 * modified `User-Agent`. 450 * If the task has a [body][google.cloud.tasks.v2.AppEngineHttpRequest.body], 451 * Cloud Tasks sets the following headers: 452 * * `Content-Type`: By default, the `Content-Type` header is set to 453 * `"application/octet-stream"`. The default can be overridden by explicitly 454 * setting `Content-Type` to a particular media type when the 455 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 456 * For example, `Content-Type` can be set to `"application/json"`. 457 * * `Content-Length`: This is computed by Cloud Tasks. This value is 458 * output only. It cannot be changed. 459 * The headers below cannot be set or overridden: 460 * * `Host` 461 * * `X-Google-*` 462 * * `X-AppEngine-*` 463 * In addition, Cloud Tasks sets some headers when the task is dispatched, 464 * such as headers containing information about the task; see 465 * [request 466 * headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers). 467 * These headers are set only when the task is dispatched, so they are not 468 * visible when the task is returned in a Cloud Tasks response. 469 * Although there is no specific limit for the maximum number of headers or 470 * the size, there is a limit on the maximum size of the 471 * [Task][google.cloud.tasks.v2.Task]. For more information, see the 472 * [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] documentation. 473 * </pre> 474 * 475 * <code>map<string, string> headers = 4;</code> 476 */ 477 @java.lang.Override getHeadersOrDefault( java.lang.String key, java.lang.String defaultValue)478 public /* nullable */ java.lang.String getHeadersOrDefault( 479 java.lang.String key, 480 /* nullable */ 481 java.lang.String defaultValue) { 482 if (key == null) { 483 throw new NullPointerException("map key"); 484 } 485 java.util.Map<java.lang.String, java.lang.String> map = internalGetHeaders().getMap(); 486 return map.containsKey(key) ? map.get(key) : defaultValue; 487 } 488 /** 489 * 490 * 491 * <pre> 492 * HTTP request headers. 493 * This map contains the header field names and values. 494 * Headers can be set when the 495 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 496 * Repeated headers are not supported but a header value can contain commas. 497 * Cloud Tasks sets some headers to default values: 498 * * `User-Agent`: By default, this header is 499 * `"AppEngine-Google; (+http://code.google.com/appengine)"`. 500 * This header can be modified, but Cloud Tasks will append 501 * `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 502 * modified `User-Agent`. 503 * If the task has a [body][google.cloud.tasks.v2.AppEngineHttpRequest.body], 504 * Cloud Tasks sets the following headers: 505 * * `Content-Type`: By default, the `Content-Type` header is set to 506 * `"application/octet-stream"`. The default can be overridden by explicitly 507 * setting `Content-Type` to a particular media type when the 508 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 509 * For example, `Content-Type` can be set to `"application/json"`. 510 * * `Content-Length`: This is computed by Cloud Tasks. This value is 511 * output only. It cannot be changed. 512 * The headers below cannot be set or overridden: 513 * * `Host` 514 * * `X-Google-*` 515 * * `X-AppEngine-*` 516 * In addition, Cloud Tasks sets some headers when the task is dispatched, 517 * such as headers containing information about the task; see 518 * [request 519 * headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers). 520 * These headers are set only when the task is dispatched, so they are not 521 * visible when the task is returned in a Cloud Tasks response. 522 * Although there is no specific limit for the maximum number of headers or 523 * the size, there is a limit on the maximum size of the 524 * [Task][google.cloud.tasks.v2.Task]. For more information, see the 525 * [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] documentation. 526 * </pre> 527 * 528 * <code>map<string, string> headers = 4;</code> 529 */ 530 @java.lang.Override getHeadersOrThrow(java.lang.String key)531 public java.lang.String getHeadersOrThrow(java.lang.String key) { 532 if (key == null) { 533 throw new NullPointerException("map key"); 534 } 535 java.util.Map<java.lang.String, java.lang.String> map = internalGetHeaders().getMap(); 536 if (!map.containsKey(key)) { 537 throw new java.lang.IllegalArgumentException(); 538 } 539 return map.get(key); 540 } 541 542 public static final int BODY_FIELD_NUMBER = 5; 543 private com.google.protobuf.ByteString body_ = com.google.protobuf.ByteString.EMPTY; 544 /** 545 * 546 * 547 * <pre> 548 * HTTP request body. 549 * A request body is allowed only if the HTTP method is POST or PUT. It is 550 * an error to set a body on a task with an incompatible 551 * [HttpMethod][google.cloud.tasks.v2.HttpMethod]. 552 * </pre> 553 * 554 * <code>bytes body = 5;</code> 555 * 556 * @return The body. 557 */ 558 @java.lang.Override getBody()559 public com.google.protobuf.ByteString getBody() { 560 return body_; 561 } 562 563 private byte memoizedIsInitialized = -1; 564 565 @java.lang.Override isInitialized()566 public final boolean isInitialized() { 567 byte isInitialized = memoizedIsInitialized; 568 if (isInitialized == 1) return true; 569 if (isInitialized == 0) return false; 570 571 memoizedIsInitialized = 1; 572 return true; 573 } 574 575 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)576 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 577 if (httpMethod_ != com.google.cloud.tasks.v2.HttpMethod.HTTP_METHOD_UNSPECIFIED.getNumber()) { 578 output.writeEnum(1, httpMethod_); 579 } 580 if (appEngineRouting_ != null) { 581 output.writeMessage(2, getAppEngineRouting()); 582 } 583 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(relativeUri_)) { 584 com.google.protobuf.GeneratedMessageV3.writeString(output, 3, relativeUri_); 585 } 586 com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( 587 output, internalGetHeaders(), HeadersDefaultEntryHolder.defaultEntry, 4); 588 if (!body_.isEmpty()) { 589 output.writeBytes(5, body_); 590 } 591 getUnknownFields().writeTo(output); 592 } 593 594 @java.lang.Override getSerializedSize()595 public int getSerializedSize() { 596 int size = memoizedSize; 597 if (size != -1) return size; 598 599 size = 0; 600 if (httpMethod_ != com.google.cloud.tasks.v2.HttpMethod.HTTP_METHOD_UNSPECIFIED.getNumber()) { 601 size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, httpMethod_); 602 } 603 if (appEngineRouting_ != null) { 604 size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getAppEngineRouting()); 605 } 606 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(relativeUri_)) { 607 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, relativeUri_); 608 } 609 for (java.util.Map.Entry<java.lang.String, java.lang.String> entry : 610 internalGetHeaders().getMap().entrySet()) { 611 com.google.protobuf.MapEntry<java.lang.String, java.lang.String> headers__ = 612 HeadersDefaultEntryHolder.defaultEntry 613 .newBuilderForType() 614 .setKey(entry.getKey()) 615 .setValue(entry.getValue()) 616 .build(); 617 size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, headers__); 618 } 619 if (!body_.isEmpty()) { 620 size += com.google.protobuf.CodedOutputStream.computeBytesSize(5, body_); 621 } 622 size += getUnknownFields().getSerializedSize(); 623 memoizedSize = size; 624 return size; 625 } 626 627 @java.lang.Override equals(final java.lang.Object obj)628 public boolean equals(final java.lang.Object obj) { 629 if (obj == this) { 630 return true; 631 } 632 if (!(obj instanceof com.google.cloud.tasks.v2.AppEngineHttpRequest)) { 633 return super.equals(obj); 634 } 635 com.google.cloud.tasks.v2.AppEngineHttpRequest other = 636 (com.google.cloud.tasks.v2.AppEngineHttpRequest) obj; 637 638 if (httpMethod_ != other.httpMethod_) return false; 639 if (hasAppEngineRouting() != other.hasAppEngineRouting()) return false; 640 if (hasAppEngineRouting()) { 641 if (!getAppEngineRouting().equals(other.getAppEngineRouting())) return false; 642 } 643 if (!getRelativeUri().equals(other.getRelativeUri())) return false; 644 if (!internalGetHeaders().equals(other.internalGetHeaders())) return false; 645 if (!getBody().equals(other.getBody())) return false; 646 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 647 return true; 648 } 649 650 @java.lang.Override hashCode()651 public int hashCode() { 652 if (memoizedHashCode != 0) { 653 return memoizedHashCode; 654 } 655 int hash = 41; 656 hash = (19 * hash) + getDescriptor().hashCode(); 657 hash = (37 * hash) + HTTP_METHOD_FIELD_NUMBER; 658 hash = (53 * hash) + httpMethod_; 659 if (hasAppEngineRouting()) { 660 hash = (37 * hash) + APP_ENGINE_ROUTING_FIELD_NUMBER; 661 hash = (53 * hash) + getAppEngineRouting().hashCode(); 662 } 663 hash = (37 * hash) + RELATIVE_URI_FIELD_NUMBER; 664 hash = (53 * hash) + getRelativeUri().hashCode(); 665 if (!internalGetHeaders().getMap().isEmpty()) { 666 hash = (37 * hash) + HEADERS_FIELD_NUMBER; 667 hash = (53 * hash) + internalGetHeaders().hashCode(); 668 } 669 hash = (37 * hash) + BODY_FIELD_NUMBER; 670 hash = (53 * hash) + getBody().hashCode(); 671 hash = (29 * hash) + getUnknownFields().hashCode(); 672 memoizedHashCode = hash; 673 return hash; 674 } 675 parseFrom(java.nio.ByteBuffer data)676 public static com.google.cloud.tasks.v2.AppEngineHttpRequest parseFrom(java.nio.ByteBuffer data) 677 throws com.google.protobuf.InvalidProtocolBufferException { 678 return PARSER.parseFrom(data); 679 } 680 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)681 public static com.google.cloud.tasks.v2.AppEngineHttpRequest parseFrom( 682 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 683 throws com.google.protobuf.InvalidProtocolBufferException { 684 return PARSER.parseFrom(data, extensionRegistry); 685 } 686 parseFrom( com.google.protobuf.ByteString data)687 public static com.google.cloud.tasks.v2.AppEngineHttpRequest parseFrom( 688 com.google.protobuf.ByteString data) 689 throws com.google.protobuf.InvalidProtocolBufferException { 690 return PARSER.parseFrom(data); 691 } 692 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)693 public static com.google.cloud.tasks.v2.AppEngineHttpRequest parseFrom( 694 com.google.protobuf.ByteString data, 695 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 696 throws com.google.protobuf.InvalidProtocolBufferException { 697 return PARSER.parseFrom(data, extensionRegistry); 698 } 699 parseFrom(byte[] data)700 public static com.google.cloud.tasks.v2.AppEngineHttpRequest parseFrom(byte[] data) 701 throws com.google.protobuf.InvalidProtocolBufferException { 702 return PARSER.parseFrom(data); 703 } 704 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)705 public static com.google.cloud.tasks.v2.AppEngineHttpRequest parseFrom( 706 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 707 throws com.google.protobuf.InvalidProtocolBufferException { 708 return PARSER.parseFrom(data, extensionRegistry); 709 } 710 parseFrom(java.io.InputStream input)711 public static com.google.cloud.tasks.v2.AppEngineHttpRequest parseFrom(java.io.InputStream input) 712 throws java.io.IOException { 713 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 714 } 715 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)716 public static com.google.cloud.tasks.v2.AppEngineHttpRequest parseFrom( 717 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 718 throws java.io.IOException { 719 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 720 PARSER, input, extensionRegistry); 721 } 722 parseDelimitedFrom( java.io.InputStream input)723 public static com.google.cloud.tasks.v2.AppEngineHttpRequest parseDelimitedFrom( 724 java.io.InputStream input) throws java.io.IOException { 725 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 726 } 727 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)728 public static com.google.cloud.tasks.v2.AppEngineHttpRequest parseDelimitedFrom( 729 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 730 throws java.io.IOException { 731 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 732 PARSER, input, extensionRegistry); 733 } 734 parseFrom( com.google.protobuf.CodedInputStream input)735 public static com.google.cloud.tasks.v2.AppEngineHttpRequest parseFrom( 736 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 737 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 738 } 739 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)740 public static com.google.cloud.tasks.v2.AppEngineHttpRequest parseFrom( 741 com.google.protobuf.CodedInputStream input, 742 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 743 throws java.io.IOException { 744 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 745 PARSER, input, extensionRegistry); 746 } 747 748 @java.lang.Override newBuilderForType()749 public Builder newBuilderForType() { 750 return newBuilder(); 751 } 752 newBuilder()753 public static Builder newBuilder() { 754 return DEFAULT_INSTANCE.toBuilder(); 755 } 756 newBuilder(com.google.cloud.tasks.v2.AppEngineHttpRequest prototype)757 public static Builder newBuilder(com.google.cloud.tasks.v2.AppEngineHttpRequest prototype) { 758 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 759 } 760 761 @java.lang.Override toBuilder()762 public Builder toBuilder() { 763 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 764 } 765 766 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)767 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 768 Builder builder = new Builder(parent); 769 return builder; 770 } 771 /** 772 * 773 * 774 * <pre> 775 * App Engine HTTP request. 776 * The message defines the HTTP request that is sent to an App Engine app when 777 * the task is dispatched. 778 * Using [AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest] 779 * requires 780 * [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) 781 * Google IAM permission for the project 782 * and the following scope: 783 * `https://www.googleapis.com/auth/cloud-platform` 784 * The task will be delivered to the App Engine app which belongs to the same 785 * project as the queue. For more information, see 786 * [How Requests are 787 * Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) 788 * and how routing is affected by 789 * [dispatch 790 * files](https://cloud.google.com/appengine/docs/python/config/dispatchref). 791 * Traffic is encrypted during transport and never leaves Google datacenters. 792 * Because this traffic is carried over a communication mechanism internal to 793 * Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). 794 * The request to the handler, however, will appear to have used the HTTP 795 * protocol. 796 * The [AppEngineRouting][google.cloud.tasks.v2.AppEngineRouting] used to 797 * construct the URL that the task is delivered to can be set at the queue-level 798 * or task-level: 799 * * If [app_engine_routing_override is set on the 800 * queue][Queue.app_engine_routing_override], this value is used for all 801 * tasks in the queue, no matter what the setting is for the [task-level 802 * app_engine_routing][AppEngineHttpRequest.app_engine_routing]. 803 * The `url` that the task will be sent to is: 804 * * `url =` [host][google.cloud.tasks.v2.AppEngineRouting.host] `+` 805 * [relative_uri][google.cloud.tasks.v2.AppEngineHttpRequest.relative_uri] 806 * Tasks can be dispatched to secure app handlers, unsecure app handlers, and 807 * URIs restricted with 808 * [`login: 809 * admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). 810 * Because tasks are not run as any user, they cannot be dispatched to URIs 811 * restricted with 812 * [`login: 813 * required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) 814 * Task dispatches also do not follow redirects. 815 * The task attempt has succeeded if the app's request handler returns an HTTP 816 * response code in the range [`200` - `299`]. The task attempt has failed if 817 * the app's handler returns a non-2xx response code or Cloud Tasks does 818 * not receive response before the 819 * [deadline][google.cloud.tasks.v2.Task.dispatch_deadline]. Failed tasks will 820 * be retried according to the [retry 821 * configuration][google.cloud.tasks.v2.Queue.retry_config]. `503` (Service 822 * Unavailable) is considered an App Engine system error instead of an 823 * application error and will cause Cloud Tasks' traffic congestion control to 824 * temporarily throttle the queue's dispatches. Unlike other types of task 825 * targets, a `429` (Too Many Requests) response from an app handler does not 826 * cause traffic congestion control to throttle the queue. 827 * </pre> 828 * 829 * Protobuf type {@code google.cloud.tasks.v2.AppEngineHttpRequest} 830 */ 831 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 832 implements 833 // @@protoc_insertion_point(builder_implements:google.cloud.tasks.v2.AppEngineHttpRequest) 834 com.google.cloud.tasks.v2.AppEngineHttpRequestOrBuilder { getDescriptor()835 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 836 return com.google.cloud.tasks.v2.TargetProto 837 .internal_static_google_cloud_tasks_v2_AppEngineHttpRequest_descriptor; 838 } 839 840 @SuppressWarnings({"rawtypes"}) internalGetMapField(int number)841 protected com.google.protobuf.MapField internalGetMapField(int number) { 842 switch (number) { 843 case 4: 844 return internalGetHeaders(); 845 default: 846 throw new RuntimeException("Invalid map field number: " + number); 847 } 848 } 849 850 @SuppressWarnings({"rawtypes"}) internalGetMutableMapField(int number)851 protected com.google.protobuf.MapField internalGetMutableMapField(int number) { 852 switch (number) { 853 case 4: 854 return internalGetMutableHeaders(); 855 default: 856 throw new RuntimeException("Invalid map field number: " + number); 857 } 858 } 859 860 @java.lang.Override 861 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()862 internalGetFieldAccessorTable() { 863 return com.google.cloud.tasks.v2.TargetProto 864 .internal_static_google_cloud_tasks_v2_AppEngineHttpRequest_fieldAccessorTable 865 .ensureFieldAccessorsInitialized( 866 com.google.cloud.tasks.v2.AppEngineHttpRequest.class, 867 com.google.cloud.tasks.v2.AppEngineHttpRequest.Builder.class); 868 } 869 870 // Construct using com.google.cloud.tasks.v2.AppEngineHttpRequest.newBuilder() Builder()871 private Builder() {} 872 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)873 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 874 super(parent); 875 } 876 877 @java.lang.Override clear()878 public Builder clear() { 879 super.clear(); 880 bitField0_ = 0; 881 httpMethod_ = 0; 882 appEngineRouting_ = null; 883 if (appEngineRoutingBuilder_ != null) { 884 appEngineRoutingBuilder_.dispose(); 885 appEngineRoutingBuilder_ = null; 886 } 887 relativeUri_ = ""; 888 internalGetMutableHeaders().clear(); 889 body_ = com.google.protobuf.ByteString.EMPTY; 890 return this; 891 } 892 893 @java.lang.Override getDescriptorForType()894 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 895 return com.google.cloud.tasks.v2.TargetProto 896 .internal_static_google_cloud_tasks_v2_AppEngineHttpRequest_descriptor; 897 } 898 899 @java.lang.Override getDefaultInstanceForType()900 public com.google.cloud.tasks.v2.AppEngineHttpRequest getDefaultInstanceForType() { 901 return com.google.cloud.tasks.v2.AppEngineHttpRequest.getDefaultInstance(); 902 } 903 904 @java.lang.Override build()905 public com.google.cloud.tasks.v2.AppEngineHttpRequest build() { 906 com.google.cloud.tasks.v2.AppEngineHttpRequest result = buildPartial(); 907 if (!result.isInitialized()) { 908 throw newUninitializedMessageException(result); 909 } 910 return result; 911 } 912 913 @java.lang.Override buildPartial()914 public com.google.cloud.tasks.v2.AppEngineHttpRequest buildPartial() { 915 com.google.cloud.tasks.v2.AppEngineHttpRequest result = 916 new com.google.cloud.tasks.v2.AppEngineHttpRequest(this); 917 if (bitField0_ != 0) { 918 buildPartial0(result); 919 } 920 onBuilt(); 921 return result; 922 } 923 buildPartial0(com.google.cloud.tasks.v2.AppEngineHttpRequest result)924 private void buildPartial0(com.google.cloud.tasks.v2.AppEngineHttpRequest result) { 925 int from_bitField0_ = bitField0_; 926 if (((from_bitField0_ & 0x00000001) != 0)) { 927 result.httpMethod_ = httpMethod_; 928 } 929 if (((from_bitField0_ & 0x00000002) != 0)) { 930 result.appEngineRouting_ = 931 appEngineRoutingBuilder_ == null ? appEngineRouting_ : appEngineRoutingBuilder_.build(); 932 } 933 if (((from_bitField0_ & 0x00000004) != 0)) { 934 result.relativeUri_ = relativeUri_; 935 } 936 if (((from_bitField0_ & 0x00000008) != 0)) { 937 result.headers_ = internalGetHeaders(); 938 result.headers_.makeImmutable(); 939 } 940 if (((from_bitField0_ & 0x00000010) != 0)) { 941 result.body_ = body_; 942 } 943 } 944 945 @java.lang.Override clone()946 public Builder clone() { 947 return super.clone(); 948 } 949 950 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)951 public Builder setField( 952 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 953 return super.setField(field, value); 954 } 955 956 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)957 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 958 return super.clearField(field); 959 } 960 961 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)962 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 963 return super.clearOneof(oneof); 964 } 965 966 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)967 public Builder setRepeatedField( 968 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 969 return super.setRepeatedField(field, index, value); 970 } 971 972 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)973 public Builder addRepeatedField( 974 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 975 return super.addRepeatedField(field, value); 976 } 977 978 @java.lang.Override mergeFrom(com.google.protobuf.Message other)979 public Builder mergeFrom(com.google.protobuf.Message other) { 980 if (other instanceof com.google.cloud.tasks.v2.AppEngineHttpRequest) { 981 return mergeFrom((com.google.cloud.tasks.v2.AppEngineHttpRequest) other); 982 } else { 983 super.mergeFrom(other); 984 return this; 985 } 986 } 987 mergeFrom(com.google.cloud.tasks.v2.AppEngineHttpRequest other)988 public Builder mergeFrom(com.google.cloud.tasks.v2.AppEngineHttpRequest other) { 989 if (other == com.google.cloud.tasks.v2.AppEngineHttpRequest.getDefaultInstance()) return this; 990 if (other.httpMethod_ != 0) { 991 setHttpMethodValue(other.getHttpMethodValue()); 992 } 993 if (other.hasAppEngineRouting()) { 994 mergeAppEngineRouting(other.getAppEngineRouting()); 995 } 996 if (!other.getRelativeUri().isEmpty()) { 997 relativeUri_ = other.relativeUri_; 998 bitField0_ |= 0x00000004; 999 onChanged(); 1000 } 1001 internalGetMutableHeaders().mergeFrom(other.internalGetHeaders()); 1002 bitField0_ |= 0x00000008; 1003 if (other.getBody() != com.google.protobuf.ByteString.EMPTY) { 1004 setBody(other.getBody()); 1005 } 1006 this.mergeUnknownFields(other.getUnknownFields()); 1007 onChanged(); 1008 return this; 1009 } 1010 1011 @java.lang.Override isInitialized()1012 public final boolean isInitialized() { 1013 return true; 1014 } 1015 1016 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1017 public Builder mergeFrom( 1018 com.google.protobuf.CodedInputStream input, 1019 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1020 throws java.io.IOException { 1021 if (extensionRegistry == null) { 1022 throw new java.lang.NullPointerException(); 1023 } 1024 try { 1025 boolean done = false; 1026 while (!done) { 1027 int tag = input.readTag(); 1028 switch (tag) { 1029 case 0: 1030 done = true; 1031 break; 1032 case 8: 1033 { 1034 httpMethod_ = input.readEnum(); 1035 bitField0_ |= 0x00000001; 1036 break; 1037 } // case 8 1038 case 18: 1039 { 1040 input.readMessage( 1041 getAppEngineRoutingFieldBuilder().getBuilder(), extensionRegistry); 1042 bitField0_ |= 0x00000002; 1043 break; 1044 } // case 18 1045 case 26: 1046 { 1047 relativeUri_ = input.readStringRequireUtf8(); 1048 bitField0_ |= 0x00000004; 1049 break; 1050 } // case 26 1051 case 34: 1052 { 1053 com.google.protobuf.MapEntry<java.lang.String, java.lang.String> headers__ = 1054 input.readMessage( 1055 HeadersDefaultEntryHolder.defaultEntry.getParserForType(), 1056 extensionRegistry); 1057 internalGetMutableHeaders() 1058 .getMutableMap() 1059 .put(headers__.getKey(), headers__.getValue()); 1060 bitField0_ |= 0x00000008; 1061 break; 1062 } // case 34 1063 case 42: 1064 { 1065 body_ = input.readBytes(); 1066 bitField0_ |= 0x00000010; 1067 break; 1068 } // case 42 1069 default: 1070 { 1071 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 1072 done = true; // was an endgroup tag 1073 } 1074 break; 1075 } // default: 1076 } // switch (tag) 1077 } // while (!done) 1078 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1079 throw e.unwrapIOException(); 1080 } finally { 1081 onChanged(); 1082 } // finally 1083 return this; 1084 } 1085 1086 private int bitField0_; 1087 1088 private int httpMethod_ = 0; 1089 /** 1090 * 1091 * 1092 * <pre> 1093 * The HTTP method to use for the request. The default is POST. 1094 * The app's request handler for the task's target URL must be able to handle 1095 * HTTP requests with this http_method, otherwise the task attempt will fail 1096 * with error code 405 (Method Not Allowed). See 1097 * [Writing a push task request 1098 * handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 1099 * and the documentation for the request handlers in the language your app is 1100 * written in e.g. 1101 * [Python Request 1102 * Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). 1103 * </pre> 1104 * 1105 * <code>.google.cloud.tasks.v2.HttpMethod http_method = 1;</code> 1106 * 1107 * @return The enum numeric value on the wire for httpMethod. 1108 */ 1109 @java.lang.Override getHttpMethodValue()1110 public int getHttpMethodValue() { 1111 return httpMethod_; 1112 } 1113 /** 1114 * 1115 * 1116 * <pre> 1117 * The HTTP method to use for the request. The default is POST. 1118 * The app's request handler for the task's target URL must be able to handle 1119 * HTTP requests with this http_method, otherwise the task attempt will fail 1120 * with error code 405 (Method Not Allowed). See 1121 * [Writing a push task request 1122 * handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 1123 * and the documentation for the request handlers in the language your app is 1124 * written in e.g. 1125 * [Python Request 1126 * Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). 1127 * </pre> 1128 * 1129 * <code>.google.cloud.tasks.v2.HttpMethod http_method = 1;</code> 1130 * 1131 * @param value The enum numeric value on the wire for httpMethod to set. 1132 * @return This builder for chaining. 1133 */ setHttpMethodValue(int value)1134 public Builder setHttpMethodValue(int value) { 1135 httpMethod_ = value; 1136 bitField0_ |= 0x00000001; 1137 onChanged(); 1138 return this; 1139 } 1140 /** 1141 * 1142 * 1143 * <pre> 1144 * The HTTP method to use for the request. The default is POST. 1145 * The app's request handler for the task's target URL must be able to handle 1146 * HTTP requests with this http_method, otherwise the task attempt will fail 1147 * with error code 405 (Method Not Allowed). See 1148 * [Writing a push task request 1149 * handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 1150 * and the documentation for the request handlers in the language your app is 1151 * written in e.g. 1152 * [Python Request 1153 * Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). 1154 * </pre> 1155 * 1156 * <code>.google.cloud.tasks.v2.HttpMethod http_method = 1;</code> 1157 * 1158 * @return The httpMethod. 1159 */ 1160 @java.lang.Override getHttpMethod()1161 public com.google.cloud.tasks.v2.HttpMethod getHttpMethod() { 1162 com.google.cloud.tasks.v2.HttpMethod result = 1163 com.google.cloud.tasks.v2.HttpMethod.forNumber(httpMethod_); 1164 return result == null ? com.google.cloud.tasks.v2.HttpMethod.UNRECOGNIZED : result; 1165 } 1166 /** 1167 * 1168 * 1169 * <pre> 1170 * The HTTP method to use for the request. The default is POST. 1171 * The app's request handler for the task's target URL must be able to handle 1172 * HTTP requests with this http_method, otherwise the task attempt will fail 1173 * with error code 405 (Method Not Allowed). See 1174 * [Writing a push task request 1175 * handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 1176 * and the documentation for the request handlers in the language your app is 1177 * written in e.g. 1178 * [Python Request 1179 * Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). 1180 * </pre> 1181 * 1182 * <code>.google.cloud.tasks.v2.HttpMethod http_method = 1;</code> 1183 * 1184 * @param value The httpMethod to set. 1185 * @return This builder for chaining. 1186 */ setHttpMethod(com.google.cloud.tasks.v2.HttpMethod value)1187 public Builder setHttpMethod(com.google.cloud.tasks.v2.HttpMethod value) { 1188 if (value == null) { 1189 throw new NullPointerException(); 1190 } 1191 bitField0_ |= 0x00000001; 1192 httpMethod_ = value.getNumber(); 1193 onChanged(); 1194 return this; 1195 } 1196 /** 1197 * 1198 * 1199 * <pre> 1200 * The HTTP method to use for the request. The default is POST. 1201 * The app's request handler for the task's target URL must be able to handle 1202 * HTTP requests with this http_method, otherwise the task attempt will fail 1203 * with error code 405 (Method Not Allowed). See 1204 * [Writing a push task request 1205 * handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) 1206 * and the documentation for the request handlers in the language your app is 1207 * written in e.g. 1208 * [Python Request 1209 * Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). 1210 * </pre> 1211 * 1212 * <code>.google.cloud.tasks.v2.HttpMethod http_method = 1;</code> 1213 * 1214 * @return This builder for chaining. 1215 */ clearHttpMethod()1216 public Builder clearHttpMethod() { 1217 bitField0_ = (bitField0_ & ~0x00000001); 1218 httpMethod_ = 0; 1219 onChanged(); 1220 return this; 1221 } 1222 1223 private com.google.cloud.tasks.v2.AppEngineRouting appEngineRouting_; 1224 private com.google.protobuf.SingleFieldBuilderV3< 1225 com.google.cloud.tasks.v2.AppEngineRouting, 1226 com.google.cloud.tasks.v2.AppEngineRouting.Builder, 1227 com.google.cloud.tasks.v2.AppEngineRoutingOrBuilder> 1228 appEngineRoutingBuilder_; 1229 /** 1230 * 1231 * 1232 * <pre> 1233 * Task-level setting for App Engine routing. 1234 * * If [app_engine_routing_override is set on the 1235 * queue][Queue.app_engine_routing_override], this value is used for all 1236 * tasks in the queue, no matter what the setting is for the [task-level 1237 * app_engine_routing][AppEngineHttpRequest.app_engine_routing]. 1238 * </pre> 1239 * 1240 * <code>.google.cloud.tasks.v2.AppEngineRouting app_engine_routing = 2;</code> 1241 * 1242 * @return Whether the appEngineRouting field is set. 1243 */ hasAppEngineRouting()1244 public boolean hasAppEngineRouting() { 1245 return ((bitField0_ & 0x00000002) != 0); 1246 } 1247 /** 1248 * 1249 * 1250 * <pre> 1251 * Task-level setting for App Engine routing. 1252 * * If [app_engine_routing_override is set on the 1253 * queue][Queue.app_engine_routing_override], this value is used for all 1254 * tasks in the queue, no matter what the setting is for the [task-level 1255 * app_engine_routing][AppEngineHttpRequest.app_engine_routing]. 1256 * </pre> 1257 * 1258 * <code>.google.cloud.tasks.v2.AppEngineRouting app_engine_routing = 2;</code> 1259 * 1260 * @return The appEngineRouting. 1261 */ getAppEngineRouting()1262 public com.google.cloud.tasks.v2.AppEngineRouting getAppEngineRouting() { 1263 if (appEngineRoutingBuilder_ == null) { 1264 return appEngineRouting_ == null 1265 ? com.google.cloud.tasks.v2.AppEngineRouting.getDefaultInstance() 1266 : appEngineRouting_; 1267 } else { 1268 return appEngineRoutingBuilder_.getMessage(); 1269 } 1270 } 1271 /** 1272 * 1273 * 1274 * <pre> 1275 * Task-level setting for App Engine routing. 1276 * * If [app_engine_routing_override is set on the 1277 * queue][Queue.app_engine_routing_override], this value is used for all 1278 * tasks in the queue, no matter what the setting is for the [task-level 1279 * app_engine_routing][AppEngineHttpRequest.app_engine_routing]. 1280 * </pre> 1281 * 1282 * <code>.google.cloud.tasks.v2.AppEngineRouting app_engine_routing = 2;</code> 1283 */ setAppEngineRouting(com.google.cloud.tasks.v2.AppEngineRouting value)1284 public Builder setAppEngineRouting(com.google.cloud.tasks.v2.AppEngineRouting value) { 1285 if (appEngineRoutingBuilder_ == null) { 1286 if (value == null) { 1287 throw new NullPointerException(); 1288 } 1289 appEngineRouting_ = value; 1290 } else { 1291 appEngineRoutingBuilder_.setMessage(value); 1292 } 1293 bitField0_ |= 0x00000002; 1294 onChanged(); 1295 return this; 1296 } 1297 /** 1298 * 1299 * 1300 * <pre> 1301 * Task-level setting for App Engine routing. 1302 * * If [app_engine_routing_override is set on the 1303 * queue][Queue.app_engine_routing_override], this value is used for all 1304 * tasks in the queue, no matter what the setting is for the [task-level 1305 * app_engine_routing][AppEngineHttpRequest.app_engine_routing]. 1306 * </pre> 1307 * 1308 * <code>.google.cloud.tasks.v2.AppEngineRouting app_engine_routing = 2;</code> 1309 */ setAppEngineRouting( com.google.cloud.tasks.v2.AppEngineRouting.Builder builderForValue)1310 public Builder setAppEngineRouting( 1311 com.google.cloud.tasks.v2.AppEngineRouting.Builder builderForValue) { 1312 if (appEngineRoutingBuilder_ == null) { 1313 appEngineRouting_ = builderForValue.build(); 1314 } else { 1315 appEngineRoutingBuilder_.setMessage(builderForValue.build()); 1316 } 1317 bitField0_ |= 0x00000002; 1318 onChanged(); 1319 return this; 1320 } 1321 /** 1322 * 1323 * 1324 * <pre> 1325 * Task-level setting for App Engine routing. 1326 * * If [app_engine_routing_override is set on the 1327 * queue][Queue.app_engine_routing_override], this value is used for all 1328 * tasks in the queue, no matter what the setting is for the [task-level 1329 * app_engine_routing][AppEngineHttpRequest.app_engine_routing]. 1330 * </pre> 1331 * 1332 * <code>.google.cloud.tasks.v2.AppEngineRouting app_engine_routing = 2;</code> 1333 */ mergeAppEngineRouting(com.google.cloud.tasks.v2.AppEngineRouting value)1334 public Builder mergeAppEngineRouting(com.google.cloud.tasks.v2.AppEngineRouting value) { 1335 if (appEngineRoutingBuilder_ == null) { 1336 if (((bitField0_ & 0x00000002) != 0) 1337 && appEngineRouting_ != null 1338 && appEngineRouting_ 1339 != com.google.cloud.tasks.v2.AppEngineRouting.getDefaultInstance()) { 1340 getAppEngineRoutingBuilder().mergeFrom(value); 1341 } else { 1342 appEngineRouting_ = value; 1343 } 1344 } else { 1345 appEngineRoutingBuilder_.mergeFrom(value); 1346 } 1347 bitField0_ |= 0x00000002; 1348 onChanged(); 1349 return this; 1350 } 1351 /** 1352 * 1353 * 1354 * <pre> 1355 * Task-level setting for App Engine routing. 1356 * * If [app_engine_routing_override is set on the 1357 * queue][Queue.app_engine_routing_override], this value is used for all 1358 * tasks in the queue, no matter what the setting is for the [task-level 1359 * app_engine_routing][AppEngineHttpRequest.app_engine_routing]. 1360 * </pre> 1361 * 1362 * <code>.google.cloud.tasks.v2.AppEngineRouting app_engine_routing = 2;</code> 1363 */ clearAppEngineRouting()1364 public Builder clearAppEngineRouting() { 1365 bitField0_ = (bitField0_ & ~0x00000002); 1366 appEngineRouting_ = null; 1367 if (appEngineRoutingBuilder_ != null) { 1368 appEngineRoutingBuilder_.dispose(); 1369 appEngineRoutingBuilder_ = null; 1370 } 1371 onChanged(); 1372 return this; 1373 } 1374 /** 1375 * 1376 * 1377 * <pre> 1378 * Task-level setting for App Engine routing. 1379 * * If [app_engine_routing_override is set on the 1380 * queue][Queue.app_engine_routing_override], this value is used for all 1381 * tasks in the queue, no matter what the setting is for the [task-level 1382 * app_engine_routing][AppEngineHttpRequest.app_engine_routing]. 1383 * </pre> 1384 * 1385 * <code>.google.cloud.tasks.v2.AppEngineRouting app_engine_routing = 2;</code> 1386 */ getAppEngineRoutingBuilder()1387 public com.google.cloud.tasks.v2.AppEngineRouting.Builder getAppEngineRoutingBuilder() { 1388 bitField0_ |= 0x00000002; 1389 onChanged(); 1390 return getAppEngineRoutingFieldBuilder().getBuilder(); 1391 } 1392 /** 1393 * 1394 * 1395 * <pre> 1396 * Task-level setting for App Engine routing. 1397 * * If [app_engine_routing_override is set on the 1398 * queue][Queue.app_engine_routing_override], this value is used for all 1399 * tasks in the queue, no matter what the setting is for the [task-level 1400 * app_engine_routing][AppEngineHttpRequest.app_engine_routing]. 1401 * </pre> 1402 * 1403 * <code>.google.cloud.tasks.v2.AppEngineRouting app_engine_routing = 2;</code> 1404 */ getAppEngineRoutingOrBuilder()1405 public com.google.cloud.tasks.v2.AppEngineRoutingOrBuilder getAppEngineRoutingOrBuilder() { 1406 if (appEngineRoutingBuilder_ != null) { 1407 return appEngineRoutingBuilder_.getMessageOrBuilder(); 1408 } else { 1409 return appEngineRouting_ == null 1410 ? com.google.cloud.tasks.v2.AppEngineRouting.getDefaultInstance() 1411 : appEngineRouting_; 1412 } 1413 } 1414 /** 1415 * 1416 * 1417 * <pre> 1418 * Task-level setting for App Engine routing. 1419 * * If [app_engine_routing_override is set on the 1420 * queue][Queue.app_engine_routing_override], this value is used for all 1421 * tasks in the queue, no matter what the setting is for the [task-level 1422 * app_engine_routing][AppEngineHttpRequest.app_engine_routing]. 1423 * </pre> 1424 * 1425 * <code>.google.cloud.tasks.v2.AppEngineRouting app_engine_routing = 2;</code> 1426 */ 1427 private com.google.protobuf.SingleFieldBuilderV3< 1428 com.google.cloud.tasks.v2.AppEngineRouting, 1429 com.google.cloud.tasks.v2.AppEngineRouting.Builder, 1430 com.google.cloud.tasks.v2.AppEngineRoutingOrBuilder> getAppEngineRoutingFieldBuilder()1431 getAppEngineRoutingFieldBuilder() { 1432 if (appEngineRoutingBuilder_ == null) { 1433 appEngineRoutingBuilder_ = 1434 new com.google.protobuf.SingleFieldBuilderV3< 1435 com.google.cloud.tasks.v2.AppEngineRouting, 1436 com.google.cloud.tasks.v2.AppEngineRouting.Builder, 1437 com.google.cloud.tasks.v2.AppEngineRoutingOrBuilder>( 1438 getAppEngineRouting(), getParentForChildren(), isClean()); 1439 appEngineRouting_ = null; 1440 } 1441 return appEngineRoutingBuilder_; 1442 } 1443 1444 private java.lang.Object relativeUri_ = ""; 1445 /** 1446 * 1447 * 1448 * <pre> 1449 * The relative URI. 1450 * The relative URI must begin with "/" and must be a valid HTTP relative URI. 1451 * It can contain a path and query string arguments. 1452 * If the relative URI is empty, then the root path "/" will be used. 1453 * No spaces are allowed, and the maximum length allowed is 2083 characters. 1454 * </pre> 1455 * 1456 * <code>string relative_uri = 3;</code> 1457 * 1458 * @return The relativeUri. 1459 */ getRelativeUri()1460 public java.lang.String getRelativeUri() { 1461 java.lang.Object ref = relativeUri_; 1462 if (!(ref instanceof java.lang.String)) { 1463 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 1464 java.lang.String s = bs.toStringUtf8(); 1465 relativeUri_ = s; 1466 return s; 1467 } else { 1468 return (java.lang.String) ref; 1469 } 1470 } 1471 /** 1472 * 1473 * 1474 * <pre> 1475 * The relative URI. 1476 * The relative URI must begin with "/" and must be a valid HTTP relative URI. 1477 * It can contain a path and query string arguments. 1478 * If the relative URI is empty, then the root path "/" will be used. 1479 * No spaces are allowed, and the maximum length allowed is 2083 characters. 1480 * </pre> 1481 * 1482 * <code>string relative_uri = 3;</code> 1483 * 1484 * @return The bytes for relativeUri. 1485 */ getRelativeUriBytes()1486 public com.google.protobuf.ByteString getRelativeUriBytes() { 1487 java.lang.Object ref = relativeUri_; 1488 if (ref instanceof String) { 1489 com.google.protobuf.ByteString b = 1490 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 1491 relativeUri_ = b; 1492 return b; 1493 } else { 1494 return (com.google.protobuf.ByteString) ref; 1495 } 1496 } 1497 /** 1498 * 1499 * 1500 * <pre> 1501 * The relative URI. 1502 * The relative URI must begin with "/" and must be a valid HTTP relative URI. 1503 * It can contain a path and query string arguments. 1504 * If the relative URI is empty, then the root path "/" will be used. 1505 * No spaces are allowed, and the maximum length allowed is 2083 characters. 1506 * </pre> 1507 * 1508 * <code>string relative_uri = 3;</code> 1509 * 1510 * @param value The relativeUri to set. 1511 * @return This builder for chaining. 1512 */ setRelativeUri(java.lang.String value)1513 public Builder setRelativeUri(java.lang.String value) { 1514 if (value == null) { 1515 throw new NullPointerException(); 1516 } 1517 relativeUri_ = value; 1518 bitField0_ |= 0x00000004; 1519 onChanged(); 1520 return this; 1521 } 1522 /** 1523 * 1524 * 1525 * <pre> 1526 * The relative URI. 1527 * The relative URI must begin with "/" and must be a valid HTTP relative URI. 1528 * It can contain a path and query string arguments. 1529 * If the relative URI is empty, then the root path "/" will be used. 1530 * No spaces are allowed, and the maximum length allowed is 2083 characters. 1531 * </pre> 1532 * 1533 * <code>string relative_uri = 3;</code> 1534 * 1535 * @return This builder for chaining. 1536 */ clearRelativeUri()1537 public Builder clearRelativeUri() { 1538 relativeUri_ = getDefaultInstance().getRelativeUri(); 1539 bitField0_ = (bitField0_ & ~0x00000004); 1540 onChanged(); 1541 return this; 1542 } 1543 /** 1544 * 1545 * 1546 * <pre> 1547 * The relative URI. 1548 * The relative URI must begin with "/" and must be a valid HTTP relative URI. 1549 * It can contain a path and query string arguments. 1550 * If the relative URI is empty, then the root path "/" will be used. 1551 * No spaces are allowed, and the maximum length allowed is 2083 characters. 1552 * </pre> 1553 * 1554 * <code>string relative_uri = 3;</code> 1555 * 1556 * @param value The bytes for relativeUri to set. 1557 * @return This builder for chaining. 1558 */ setRelativeUriBytes(com.google.protobuf.ByteString value)1559 public Builder setRelativeUriBytes(com.google.protobuf.ByteString value) { 1560 if (value == null) { 1561 throw new NullPointerException(); 1562 } 1563 checkByteStringIsUtf8(value); 1564 relativeUri_ = value; 1565 bitField0_ |= 0x00000004; 1566 onChanged(); 1567 return this; 1568 } 1569 1570 private com.google.protobuf.MapField<java.lang.String, java.lang.String> headers_; 1571 internalGetHeaders()1572 private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetHeaders() { 1573 if (headers_ == null) { 1574 return com.google.protobuf.MapField.emptyMapField(HeadersDefaultEntryHolder.defaultEntry); 1575 } 1576 return headers_; 1577 } 1578 1579 private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetMutableHeaders()1580 internalGetMutableHeaders() { 1581 if (headers_ == null) { 1582 headers_ = com.google.protobuf.MapField.newMapField(HeadersDefaultEntryHolder.defaultEntry); 1583 } 1584 if (!headers_.isMutable()) { 1585 headers_ = headers_.copy(); 1586 } 1587 bitField0_ |= 0x00000008; 1588 onChanged(); 1589 return headers_; 1590 } 1591 getHeadersCount()1592 public int getHeadersCount() { 1593 return internalGetHeaders().getMap().size(); 1594 } 1595 /** 1596 * 1597 * 1598 * <pre> 1599 * HTTP request headers. 1600 * This map contains the header field names and values. 1601 * Headers can be set when the 1602 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 1603 * Repeated headers are not supported but a header value can contain commas. 1604 * Cloud Tasks sets some headers to default values: 1605 * * `User-Agent`: By default, this header is 1606 * `"AppEngine-Google; (+http://code.google.com/appengine)"`. 1607 * This header can be modified, but Cloud Tasks will append 1608 * `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 1609 * modified `User-Agent`. 1610 * If the task has a [body][google.cloud.tasks.v2.AppEngineHttpRequest.body], 1611 * Cloud Tasks sets the following headers: 1612 * * `Content-Type`: By default, the `Content-Type` header is set to 1613 * `"application/octet-stream"`. The default can be overridden by explicitly 1614 * setting `Content-Type` to a particular media type when the 1615 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 1616 * For example, `Content-Type` can be set to `"application/json"`. 1617 * * `Content-Length`: This is computed by Cloud Tasks. This value is 1618 * output only. It cannot be changed. 1619 * The headers below cannot be set or overridden: 1620 * * `Host` 1621 * * `X-Google-*` 1622 * * `X-AppEngine-*` 1623 * In addition, Cloud Tasks sets some headers when the task is dispatched, 1624 * such as headers containing information about the task; see 1625 * [request 1626 * headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers). 1627 * These headers are set only when the task is dispatched, so they are not 1628 * visible when the task is returned in a Cloud Tasks response. 1629 * Although there is no specific limit for the maximum number of headers or 1630 * the size, there is a limit on the maximum size of the 1631 * [Task][google.cloud.tasks.v2.Task]. For more information, see the 1632 * [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] documentation. 1633 * </pre> 1634 * 1635 * <code>map<string, string> headers = 4;</code> 1636 */ 1637 @java.lang.Override containsHeaders(java.lang.String key)1638 public boolean containsHeaders(java.lang.String key) { 1639 if (key == null) { 1640 throw new NullPointerException("map key"); 1641 } 1642 return internalGetHeaders().getMap().containsKey(key); 1643 } 1644 /** Use {@link #getHeadersMap()} instead. */ 1645 @java.lang.Override 1646 @java.lang.Deprecated getHeaders()1647 public java.util.Map<java.lang.String, java.lang.String> getHeaders() { 1648 return getHeadersMap(); 1649 } 1650 /** 1651 * 1652 * 1653 * <pre> 1654 * HTTP request headers. 1655 * This map contains the header field names and values. 1656 * Headers can be set when the 1657 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 1658 * Repeated headers are not supported but a header value can contain commas. 1659 * Cloud Tasks sets some headers to default values: 1660 * * `User-Agent`: By default, this header is 1661 * `"AppEngine-Google; (+http://code.google.com/appengine)"`. 1662 * This header can be modified, but Cloud Tasks will append 1663 * `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 1664 * modified `User-Agent`. 1665 * If the task has a [body][google.cloud.tasks.v2.AppEngineHttpRequest.body], 1666 * Cloud Tasks sets the following headers: 1667 * * `Content-Type`: By default, the `Content-Type` header is set to 1668 * `"application/octet-stream"`. The default can be overridden by explicitly 1669 * setting `Content-Type` to a particular media type when the 1670 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 1671 * For example, `Content-Type` can be set to `"application/json"`. 1672 * * `Content-Length`: This is computed by Cloud Tasks. This value is 1673 * output only. It cannot be changed. 1674 * The headers below cannot be set or overridden: 1675 * * `Host` 1676 * * `X-Google-*` 1677 * * `X-AppEngine-*` 1678 * In addition, Cloud Tasks sets some headers when the task is dispatched, 1679 * such as headers containing information about the task; see 1680 * [request 1681 * headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers). 1682 * These headers are set only when the task is dispatched, so they are not 1683 * visible when the task is returned in a Cloud Tasks response. 1684 * Although there is no specific limit for the maximum number of headers or 1685 * the size, there is a limit on the maximum size of the 1686 * [Task][google.cloud.tasks.v2.Task]. For more information, see the 1687 * [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] documentation. 1688 * </pre> 1689 * 1690 * <code>map<string, string> headers = 4;</code> 1691 */ 1692 @java.lang.Override getHeadersMap()1693 public java.util.Map<java.lang.String, java.lang.String> getHeadersMap() { 1694 return internalGetHeaders().getMap(); 1695 } 1696 /** 1697 * 1698 * 1699 * <pre> 1700 * HTTP request headers. 1701 * This map contains the header field names and values. 1702 * Headers can be set when the 1703 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 1704 * Repeated headers are not supported but a header value can contain commas. 1705 * Cloud Tasks sets some headers to default values: 1706 * * `User-Agent`: By default, this header is 1707 * `"AppEngine-Google; (+http://code.google.com/appengine)"`. 1708 * This header can be modified, but Cloud Tasks will append 1709 * `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 1710 * modified `User-Agent`. 1711 * If the task has a [body][google.cloud.tasks.v2.AppEngineHttpRequest.body], 1712 * Cloud Tasks sets the following headers: 1713 * * `Content-Type`: By default, the `Content-Type` header is set to 1714 * `"application/octet-stream"`. The default can be overridden by explicitly 1715 * setting `Content-Type` to a particular media type when the 1716 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 1717 * For example, `Content-Type` can be set to `"application/json"`. 1718 * * `Content-Length`: This is computed by Cloud Tasks. This value is 1719 * output only. It cannot be changed. 1720 * The headers below cannot be set or overridden: 1721 * * `Host` 1722 * * `X-Google-*` 1723 * * `X-AppEngine-*` 1724 * In addition, Cloud Tasks sets some headers when the task is dispatched, 1725 * such as headers containing information about the task; see 1726 * [request 1727 * headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers). 1728 * These headers are set only when the task is dispatched, so they are not 1729 * visible when the task is returned in a Cloud Tasks response. 1730 * Although there is no specific limit for the maximum number of headers or 1731 * the size, there is a limit on the maximum size of the 1732 * [Task][google.cloud.tasks.v2.Task]. For more information, see the 1733 * [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] documentation. 1734 * </pre> 1735 * 1736 * <code>map<string, string> headers = 4;</code> 1737 */ 1738 @java.lang.Override getHeadersOrDefault( java.lang.String key, java.lang.String defaultValue)1739 public /* nullable */ java.lang.String getHeadersOrDefault( 1740 java.lang.String key, 1741 /* nullable */ 1742 java.lang.String defaultValue) { 1743 if (key == null) { 1744 throw new NullPointerException("map key"); 1745 } 1746 java.util.Map<java.lang.String, java.lang.String> map = internalGetHeaders().getMap(); 1747 return map.containsKey(key) ? map.get(key) : defaultValue; 1748 } 1749 /** 1750 * 1751 * 1752 * <pre> 1753 * HTTP request headers. 1754 * This map contains the header field names and values. 1755 * Headers can be set when the 1756 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 1757 * Repeated headers are not supported but a header value can contain commas. 1758 * Cloud Tasks sets some headers to default values: 1759 * * `User-Agent`: By default, this header is 1760 * `"AppEngine-Google; (+http://code.google.com/appengine)"`. 1761 * This header can be modified, but Cloud Tasks will append 1762 * `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 1763 * modified `User-Agent`. 1764 * If the task has a [body][google.cloud.tasks.v2.AppEngineHttpRequest.body], 1765 * Cloud Tasks sets the following headers: 1766 * * `Content-Type`: By default, the `Content-Type` header is set to 1767 * `"application/octet-stream"`. The default can be overridden by explicitly 1768 * setting `Content-Type` to a particular media type when the 1769 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 1770 * For example, `Content-Type` can be set to `"application/json"`. 1771 * * `Content-Length`: This is computed by Cloud Tasks. This value is 1772 * output only. It cannot be changed. 1773 * The headers below cannot be set or overridden: 1774 * * `Host` 1775 * * `X-Google-*` 1776 * * `X-AppEngine-*` 1777 * In addition, Cloud Tasks sets some headers when the task is dispatched, 1778 * such as headers containing information about the task; see 1779 * [request 1780 * headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers). 1781 * These headers are set only when the task is dispatched, so they are not 1782 * visible when the task is returned in a Cloud Tasks response. 1783 * Although there is no specific limit for the maximum number of headers or 1784 * the size, there is a limit on the maximum size of the 1785 * [Task][google.cloud.tasks.v2.Task]. For more information, see the 1786 * [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] documentation. 1787 * </pre> 1788 * 1789 * <code>map<string, string> headers = 4;</code> 1790 */ 1791 @java.lang.Override getHeadersOrThrow(java.lang.String key)1792 public java.lang.String getHeadersOrThrow(java.lang.String key) { 1793 if (key == null) { 1794 throw new NullPointerException("map key"); 1795 } 1796 java.util.Map<java.lang.String, java.lang.String> map = internalGetHeaders().getMap(); 1797 if (!map.containsKey(key)) { 1798 throw new java.lang.IllegalArgumentException(); 1799 } 1800 return map.get(key); 1801 } 1802 clearHeaders()1803 public Builder clearHeaders() { 1804 bitField0_ = (bitField0_ & ~0x00000008); 1805 internalGetMutableHeaders().getMutableMap().clear(); 1806 return this; 1807 } 1808 /** 1809 * 1810 * 1811 * <pre> 1812 * HTTP request headers. 1813 * This map contains the header field names and values. 1814 * Headers can be set when the 1815 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 1816 * Repeated headers are not supported but a header value can contain commas. 1817 * Cloud Tasks sets some headers to default values: 1818 * * `User-Agent`: By default, this header is 1819 * `"AppEngine-Google; (+http://code.google.com/appengine)"`. 1820 * This header can be modified, but Cloud Tasks will append 1821 * `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 1822 * modified `User-Agent`. 1823 * If the task has a [body][google.cloud.tasks.v2.AppEngineHttpRequest.body], 1824 * Cloud Tasks sets the following headers: 1825 * * `Content-Type`: By default, the `Content-Type` header is set to 1826 * `"application/octet-stream"`. The default can be overridden by explicitly 1827 * setting `Content-Type` to a particular media type when the 1828 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 1829 * For example, `Content-Type` can be set to `"application/json"`. 1830 * * `Content-Length`: This is computed by Cloud Tasks. This value is 1831 * output only. It cannot be changed. 1832 * The headers below cannot be set or overridden: 1833 * * `Host` 1834 * * `X-Google-*` 1835 * * `X-AppEngine-*` 1836 * In addition, Cloud Tasks sets some headers when the task is dispatched, 1837 * such as headers containing information about the task; see 1838 * [request 1839 * headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers). 1840 * These headers are set only when the task is dispatched, so they are not 1841 * visible when the task is returned in a Cloud Tasks response. 1842 * Although there is no specific limit for the maximum number of headers or 1843 * the size, there is a limit on the maximum size of the 1844 * [Task][google.cloud.tasks.v2.Task]. For more information, see the 1845 * [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] documentation. 1846 * </pre> 1847 * 1848 * <code>map<string, string> headers = 4;</code> 1849 */ removeHeaders(java.lang.String key)1850 public Builder removeHeaders(java.lang.String key) { 1851 if (key == null) { 1852 throw new NullPointerException("map key"); 1853 } 1854 internalGetMutableHeaders().getMutableMap().remove(key); 1855 return this; 1856 } 1857 /** Use alternate mutation accessors instead. */ 1858 @java.lang.Deprecated getMutableHeaders()1859 public java.util.Map<java.lang.String, java.lang.String> getMutableHeaders() { 1860 bitField0_ |= 0x00000008; 1861 return internalGetMutableHeaders().getMutableMap(); 1862 } 1863 /** 1864 * 1865 * 1866 * <pre> 1867 * HTTP request headers. 1868 * This map contains the header field names and values. 1869 * Headers can be set when the 1870 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 1871 * Repeated headers are not supported but a header value can contain commas. 1872 * Cloud Tasks sets some headers to default values: 1873 * * `User-Agent`: By default, this header is 1874 * `"AppEngine-Google; (+http://code.google.com/appengine)"`. 1875 * This header can be modified, but Cloud Tasks will append 1876 * `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 1877 * modified `User-Agent`. 1878 * If the task has a [body][google.cloud.tasks.v2.AppEngineHttpRequest.body], 1879 * Cloud Tasks sets the following headers: 1880 * * `Content-Type`: By default, the `Content-Type` header is set to 1881 * `"application/octet-stream"`. The default can be overridden by explicitly 1882 * setting `Content-Type` to a particular media type when the 1883 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 1884 * For example, `Content-Type` can be set to `"application/json"`. 1885 * * `Content-Length`: This is computed by Cloud Tasks. This value is 1886 * output only. It cannot be changed. 1887 * The headers below cannot be set or overridden: 1888 * * `Host` 1889 * * `X-Google-*` 1890 * * `X-AppEngine-*` 1891 * In addition, Cloud Tasks sets some headers when the task is dispatched, 1892 * such as headers containing information about the task; see 1893 * [request 1894 * headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers). 1895 * These headers are set only when the task is dispatched, so they are not 1896 * visible when the task is returned in a Cloud Tasks response. 1897 * Although there is no specific limit for the maximum number of headers or 1898 * the size, there is a limit on the maximum size of the 1899 * [Task][google.cloud.tasks.v2.Task]. For more information, see the 1900 * [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] documentation. 1901 * </pre> 1902 * 1903 * <code>map<string, string> headers = 4;</code> 1904 */ putHeaders(java.lang.String key, java.lang.String value)1905 public Builder putHeaders(java.lang.String key, java.lang.String value) { 1906 if (key == null) { 1907 throw new NullPointerException("map key"); 1908 } 1909 if (value == null) { 1910 throw new NullPointerException("map value"); 1911 } 1912 internalGetMutableHeaders().getMutableMap().put(key, value); 1913 bitField0_ |= 0x00000008; 1914 return this; 1915 } 1916 /** 1917 * 1918 * 1919 * <pre> 1920 * HTTP request headers. 1921 * This map contains the header field names and values. 1922 * Headers can be set when the 1923 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 1924 * Repeated headers are not supported but a header value can contain commas. 1925 * Cloud Tasks sets some headers to default values: 1926 * * `User-Agent`: By default, this header is 1927 * `"AppEngine-Google; (+http://code.google.com/appengine)"`. 1928 * This header can be modified, but Cloud Tasks will append 1929 * `"AppEngine-Google; (+http://code.google.com/appengine)"` to the 1930 * modified `User-Agent`. 1931 * If the task has a [body][google.cloud.tasks.v2.AppEngineHttpRequest.body], 1932 * Cloud Tasks sets the following headers: 1933 * * `Content-Type`: By default, the `Content-Type` header is set to 1934 * `"application/octet-stream"`. The default can be overridden by explicitly 1935 * setting `Content-Type` to a particular media type when the 1936 * [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. 1937 * For example, `Content-Type` can be set to `"application/json"`. 1938 * * `Content-Length`: This is computed by Cloud Tasks. This value is 1939 * output only. It cannot be changed. 1940 * The headers below cannot be set or overridden: 1941 * * `Host` 1942 * * `X-Google-*` 1943 * * `X-AppEngine-*` 1944 * In addition, Cloud Tasks sets some headers when the task is dispatched, 1945 * such as headers containing information about the task; see 1946 * [request 1947 * headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers). 1948 * These headers are set only when the task is dispatched, so they are not 1949 * visible when the task is returned in a Cloud Tasks response. 1950 * Although there is no specific limit for the maximum number of headers or 1951 * the size, there is a limit on the maximum size of the 1952 * [Task][google.cloud.tasks.v2.Task]. For more information, see the 1953 * [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] documentation. 1954 * </pre> 1955 * 1956 * <code>map<string, string> headers = 4;</code> 1957 */ putAllHeaders(java.util.Map<java.lang.String, java.lang.String> values)1958 public Builder putAllHeaders(java.util.Map<java.lang.String, java.lang.String> values) { 1959 internalGetMutableHeaders().getMutableMap().putAll(values); 1960 bitField0_ |= 0x00000008; 1961 return this; 1962 } 1963 1964 private com.google.protobuf.ByteString body_ = com.google.protobuf.ByteString.EMPTY; 1965 /** 1966 * 1967 * 1968 * <pre> 1969 * HTTP request body. 1970 * A request body is allowed only if the HTTP method is POST or PUT. It is 1971 * an error to set a body on a task with an incompatible 1972 * [HttpMethod][google.cloud.tasks.v2.HttpMethod]. 1973 * </pre> 1974 * 1975 * <code>bytes body = 5;</code> 1976 * 1977 * @return The body. 1978 */ 1979 @java.lang.Override getBody()1980 public com.google.protobuf.ByteString getBody() { 1981 return body_; 1982 } 1983 /** 1984 * 1985 * 1986 * <pre> 1987 * HTTP request body. 1988 * A request body is allowed only if the HTTP method is POST or PUT. It is 1989 * an error to set a body on a task with an incompatible 1990 * [HttpMethod][google.cloud.tasks.v2.HttpMethod]. 1991 * </pre> 1992 * 1993 * <code>bytes body = 5;</code> 1994 * 1995 * @param value The body to set. 1996 * @return This builder for chaining. 1997 */ setBody(com.google.protobuf.ByteString value)1998 public Builder setBody(com.google.protobuf.ByteString value) { 1999 if (value == null) { 2000 throw new NullPointerException(); 2001 } 2002 body_ = value; 2003 bitField0_ |= 0x00000010; 2004 onChanged(); 2005 return this; 2006 } 2007 /** 2008 * 2009 * 2010 * <pre> 2011 * HTTP request body. 2012 * A request body is allowed only if the HTTP method is POST or PUT. It is 2013 * an error to set a body on a task with an incompatible 2014 * [HttpMethod][google.cloud.tasks.v2.HttpMethod]. 2015 * </pre> 2016 * 2017 * <code>bytes body = 5;</code> 2018 * 2019 * @return This builder for chaining. 2020 */ clearBody()2021 public Builder clearBody() { 2022 bitField0_ = (bitField0_ & ~0x00000010); 2023 body_ = getDefaultInstance().getBody(); 2024 onChanged(); 2025 return this; 2026 } 2027 2028 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)2029 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 2030 return super.setUnknownFields(unknownFields); 2031 } 2032 2033 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)2034 public final Builder mergeUnknownFields( 2035 final com.google.protobuf.UnknownFieldSet unknownFields) { 2036 return super.mergeUnknownFields(unknownFields); 2037 } 2038 2039 // @@protoc_insertion_point(builder_scope:google.cloud.tasks.v2.AppEngineHttpRequest) 2040 } 2041 2042 // @@protoc_insertion_point(class_scope:google.cloud.tasks.v2.AppEngineHttpRequest) 2043 private static final com.google.cloud.tasks.v2.AppEngineHttpRequest DEFAULT_INSTANCE; 2044 2045 static { 2046 DEFAULT_INSTANCE = new com.google.cloud.tasks.v2.AppEngineHttpRequest(); 2047 } 2048 getDefaultInstance()2049 public static com.google.cloud.tasks.v2.AppEngineHttpRequest getDefaultInstance() { 2050 return DEFAULT_INSTANCE; 2051 } 2052 2053 private static final com.google.protobuf.Parser<AppEngineHttpRequest> PARSER = 2054 new com.google.protobuf.AbstractParser<AppEngineHttpRequest>() { 2055 @java.lang.Override 2056 public AppEngineHttpRequest parsePartialFrom( 2057 com.google.protobuf.CodedInputStream input, 2058 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2059 throws com.google.protobuf.InvalidProtocolBufferException { 2060 Builder builder = newBuilder(); 2061 try { 2062 builder.mergeFrom(input, extensionRegistry); 2063 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 2064 throw e.setUnfinishedMessage(builder.buildPartial()); 2065 } catch (com.google.protobuf.UninitializedMessageException e) { 2066 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 2067 } catch (java.io.IOException e) { 2068 throw new com.google.protobuf.InvalidProtocolBufferException(e) 2069 .setUnfinishedMessage(builder.buildPartial()); 2070 } 2071 return builder.buildPartial(); 2072 } 2073 }; 2074 parser()2075 public static com.google.protobuf.Parser<AppEngineHttpRequest> parser() { 2076 return PARSER; 2077 } 2078 2079 @java.lang.Override getParserForType()2080 public com.google.protobuf.Parser<AppEngineHttpRequest> getParserForType() { 2081 return PARSER; 2082 } 2083 2084 @java.lang.Override getDefaultInstanceForType()2085 public com.google.cloud.tasks.v2.AppEngineHttpRequest getDefaultInstanceForType() { 2086 return DEFAULT_INSTANCE; 2087 } 2088 } 2089