// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/tasks/v2beta2/target.proto

package com.google.cloud.tasks.v2beta2;

/**
 *
 *
 * <pre>
 * App Engine HTTP request.
 * The message defines the HTTP request that is sent to an App Engine app when
 * the task is dispatched.
 * This proto can only be used for tasks in a queue which has
 * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target]
 * set.
 * Using [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest]
 * requires
 * [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control)
 * Google IAM permission for the project
 * and the following scope:
 * `https://www.googleapis.com/auth/cloud-platform`
 * The task will be delivered to the App Engine app which belongs to the same
 * project as the queue. For more information, see
 * [How Requests are
 * Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
 * and how routing is affected by
 * [dispatch
 * files](https://cloud.google.com/appengine/docs/python/config/dispatchref).
 * The [AppEngineRouting][google.cloud.tasks.v2beta2.AppEngineRouting] used to
 * construct the URL that the task is delivered to can be set at the queue-level
 * or task-level:
 * * If set,
 *    [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
 *    is used for all tasks in the queue, no matter what the setting
 *    is for the
 *    [task-level
 *    app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
 * The `url` that the task will be sent to is:
 * * `url =` [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] `+`
 *   [relative_url][google.cloud.tasks.v2beta2.AppEngineHttpRequest.relative_url]
 * The task attempt has succeeded if the app's request handler returns
 * an HTTP response code in the range [`200` - `299`]. `503` is
 * considered an App Engine system error instead of an application
 * error. Requests returning error `503` will be retried regardless of
 * retry configuration and not counted against retry counts.
 * Any other response code or a failure to receive a response before the
 * deadline is a failed attempt.
 * </pre>
 *
 * Protobuf type {@code google.cloud.tasks.v2beta2.AppEngineHttpRequest}
 */
public final class AppEngineHttpRequest extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.tasks.v2beta2.AppEngineHttpRequest)
    AppEngineHttpRequestOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use AppEngineHttpRequest.newBuilder() to construct.
  private AppEngineHttpRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private AppEngineHttpRequest() {
    httpMethod_ = 0;
    relativeUrl_ = "";
    payload_ = com.google.protobuf.ByteString.EMPTY;
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    return this.unknownFields;
  }

  private AppEngineHttpRequest(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          case 8:
            {
              int rawValue = input.readEnum();

              httpMethod_ = rawValue;
              break;
            }
          case 18:
            {
              com.google.cloud.tasks.v2beta2.AppEngineRouting.Builder subBuilder = null;
              if (appEngineRouting_ != null) {
                subBuilder = appEngineRouting_.toBuilder();
              }
              appEngineRouting_ =
                  input.readMessage(
                      com.google.cloud.tasks.v2beta2.AppEngineRouting.parser(), extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(appEngineRouting_);
                appEngineRouting_ = subBuilder.buildPartial();
              }

              break;
            }
          case 26:
            {
              java.lang.String s = input.readStringRequireUtf8();

              relativeUrl_ = s;
              break;
            }
          case 34:
            {
              if (!((mutable_bitField0_ & 0x00000008) != 0)) {
                headers_ =
                    com.google.protobuf.MapField.newMapField(
                        HeadersDefaultEntryHolder.defaultEntry);
                mutable_bitField0_ |= 0x00000008;
              }
              com.google.protobuf.MapEntry<java.lang.String, java.lang.String> headers__ =
                  input.readMessage(
                      HeadersDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
              headers_.getMutableMap().put(headers__.getKey(), headers__.getValue());
              break;
            }
          case 42:
            {
              payload_ = input.readBytes();
              break;
            }
          default:
            {
              if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
    } finally {
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.tasks.v2beta2.TargetProto
        .internal_static_google_cloud_tasks_v2beta2_AppEngineHttpRequest_descriptor;
  }

  @SuppressWarnings({"rawtypes"})
  @java.lang.Override
  protected com.google.protobuf.MapField internalGetMapField(int number) {
    switch (number) {
      case 4:
        return internalGetHeaders();
      default:
        throw new RuntimeException("Invalid map field number: " + number);
    }
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.tasks.v2beta2.TargetProto
        .internal_static_google_cloud_tasks_v2beta2_AppEngineHttpRequest_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.class,
            com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.Builder.class);
  }

  private int bitField0_;
  public static final int HTTP_METHOD_FIELD_NUMBER = 1;
  private int httpMethod_;
  /**
   *
   *
   * <pre>
   * The HTTP method to use for the request. The default is POST.
   * The app's request handler for the task's target URL must be able to handle
   * HTTP requests with this http_method, otherwise the task attempt will fail
   * with error code 405 (Method Not Allowed). See
   * [Writing a push task request
   * handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler)
   * and the documentation for the request handlers in the language your app is
   * written in e.g.
   * [Python Request
   * Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass).
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.HttpMethod http_method = 1;</code>
   */
  public int getHttpMethodValue() {
    return httpMethod_;
  }
  /**
   *
   *
   * <pre>
   * The HTTP method to use for the request. The default is POST.
   * The app's request handler for the task's target URL must be able to handle
   * HTTP requests with this http_method, otherwise the task attempt will fail
   * with error code 405 (Method Not Allowed). See
   * [Writing a push task request
   * handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler)
   * and the documentation for the request handlers in the language your app is
   * written in e.g.
   * [Python Request
   * Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass).
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.HttpMethod http_method = 1;</code>
   */
  public com.google.cloud.tasks.v2beta2.HttpMethod getHttpMethod() {
    @SuppressWarnings("deprecation")
    com.google.cloud.tasks.v2beta2.HttpMethod result =
        com.google.cloud.tasks.v2beta2.HttpMethod.valueOf(httpMethod_);
    return result == null ? com.google.cloud.tasks.v2beta2.HttpMethod.UNRECOGNIZED : result;
  }

  public static final int APP_ENGINE_ROUTING_FIELD_NUMBER = 2;
  private com.google.cloud.tasks.v2beta2.AppEngineRouting appEngineRouting_;
  /**
   *
   *
   * <pre>
   * Task-level setting for App Engine routing.
   * If set,
   * [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
   * is used for all tasks in the queue, no matter what the setting is for the
   * [task-level
   * app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.AppEngineRouting app_engine_routing = 2;</code>
   */
  public boolean hasAppEngineRouting() {
    return appEngineRouting_ != null;
  }
  /**
   *
   *
   * <pre>
   * Task-level setting for App Engine routing.
   * If set,
   * [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
   * is used for all tasks in the queue, no matter what the setting is for the
   * [task-level
   * app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.AppEngineRouting app_engine_routing = 2;</code>
   */
  public com.google.cloud.tasks.v2beta2.AppEngineRouting getAppEngineRouting() {
    return appEngineRouting_ == null
        ? com.google.cloud.tasks.v2beta2.AppEngineRouting.getDefaultInstance()
        : appEngineRouting_;
  }
  /**
   *
   *
   * <pre>
   * Task-level setting for App Engine routing.
   * If set,
   * [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
   * is used for all tasks in the queue, no matter what the setting is for the
   * [task-level
   * app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.AppEngineRouting app_engine_routing = 2;</code>
   */
  public com.google.cloud.tasks.v2beta2.AppEngineRoutingOrBuilder getAppEngineRoutingOrBuilder() {
    return getAppEngineRouting();
  }

  public static final int RELATIVE_URL_FIELD_NUMBER = 3;
  private volatile java.lang.Object relativeUrl_;
  /**
   *
   *
   * <pre>
   * The relative URL.
   * The relative URL must begin with "/" and must be a valid HTTP relative URL.
   * It can contain a path and query string arguments.
   * If the relative URL is empty, then the root path "/" will be used.
   * No spaces are allowed, and the maximum length allowed is 2083 characters.
   * </pre>
   *
   * <code>string relative_url = 3;</code>
   */
  public java.lang.String getRelativeUrl() {
    java.lang.Object ref = relativeUrl_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      relativeUrl_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The relative URL.
   * The relative URL must begin with "/" and must be a valid HTTP relative URL.
   * It can contain a path and query string arguments.
   * If the relative URL is empty, then the root path "/" will be used.
   * No spaces are allowed, and the maximum length allowed is 2083 characters.
   * </pre>
   *
   * <code>string relative_url = 3;</code>
   */
  public com.google.protobuf.ByteString getRelativeUrlBytes() {
    java.lang.Object ref = relativeUrl_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      relativeUrl_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int HEADERS_FIELD_NUMBER = 4;

  private static final class HeadersDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<java.lang.String, java.lang.String> defaultEntry =
        com.google.protobuf.MapEntry.<java.lang.String, java.lang.String>newDefaultInstance(
            com.google.cloud.tasks.v2beta2.TargetProto
                .internal_static_google_cloud_tasks_v2beta2_AppEngineHttpRequest_HeadersEntry_descriptor,
            com.google.protobuf.WireFormat.FieldType.STRING,
            "",
            com.google.protobuf.WireFormat.FieldType.STRING,
            "");
  }

  private com.google.protobuf.MapField<java.lang.String, java.lang.String> headers_;

  private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetHeaders() {
    if (headers_ == null) {
      return com.google.protobuf.MapField.emptyMapField(HeadersDefaultEntryHolder.defaultEntry);
    }
    return headers_;
  }

  public int getHeadersCount() {
    return internalGetHeaders().getMap().size();
  }
  /**
   *
   *
   * <pre>
   * HTTP request headers.
   * This map contains the header field names and values.
   * Headers can be set when the
   * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
   * Repeated headers are not supported but a header value can contain commas.
   * Cloud Tasks sets some headers to default values:
   * * `User-Agent`: By default, this header is
   *   `"AppEngine-Google; (+http://code.google.com/appengine)"`.
   *   This header can be modified, but Cloud Tasks will append
   *   `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
   *   modified `User-Agent`.
   * If the task has a
   * [payload][google.cloud.tasks.v2beta2.AppEngineHttpRequest.payload], Cloud
   * Tasks sets the following headers:
   * * `Content-Type`: By default, the `Content-Type` header is set to
   *   `"application/octet-stream"`. The default can be overridden by explicitly
   *   setting `Content-Type` to a particular media type when the
   *   [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
   *   For example, `Content-Type` can be set to `"application/json"`.
   * * `Content-Length`: This is computed by Cloud Tasks. This value is
   *   output only.   It cannot be changed.
   * The headers below cannot be set or overridden:
   * * `Host`
   * * `X-Google-*`
   * * `X-AppEngine-*`
   * In addition, Cloud Tasks sets some headers when the task is dispatched,
   * such as headers containing information about the task; see
   * [request
   * headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers).
   * These headers are set only when the task is dispatched, so they are not
   * visible when the task is returned in a Cloud Tasks response.
   * Although there is no specific limit for the maximum number of headers or
   * the size, there is a limit on the maximum size of the
   * [Task][google.cloud.tasks.v2beta2.Task]. For more information, see the
   * [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]
   * documentation.
   * </pre>
   *
   * <code>map&lt;string, string&gt; headers = 4;</code>
   */
  public boolean containsHeaders(java.lang.String key) {
    if (key == null) {
      throw new java.lang.NullPointerException();
    }
    return internalGetHeaders().getMap().containsKey(key);
  }
  /** Use {@link #getHeadersMap()} instead. */
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, java.lang.String> getHeaders() {
    return getHeadersMap();
  }
  /**
   *
   *
   * <pre>
   * HTTP request headers.
   * This map contains the header field names and values.
   * Headers can be set when the
   * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
   * Repeated headers are not supported but a header value can contain commas.
   * Cloud Tasks sets some headers to default values:
   * * `User-Agent`: By default, this header is
   *   `"AppEngine-Google; (+http://code.google.com/appengine)"`.
   *   This header can be modified, but Cloud Tasks will append
   *   `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
   *   modified `User-Agent`.
   * If the task has a
   * [payload][google.cloud.tasks.v2beta2.AppEngineHttpRequest.payload], Cloud
   * Tasks sets the following headers:
   * * `Content-Type`: By default, the `Content-Type` header is set to
   *   `"application/octet-stream"`. The default can be overridden by explicitly
   *   setting `Content-Type` to a particular media type when the
   *   [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
   *   For example, `Content-Type` can be set to `"application/json"`.
   * * `Content-Length`: This is computed by Cloud Tasks. This value is
   *   output only.   It cannot be changed.
   * The headers below cannot be set or overridden:
   * * `Host`
   * * `X-Google-*`
   * * `X-AppEngine-*`
   * In addition, Cloud Tasks sets some headers when the task is dispatched,
   * such as headers containing information about the task; see
   * [request
   * headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers).
   * These headers are set only when the task is dispatched, so they are not
   * visible when the task is returned in a Cloud Tasks response.
   * Although there is no specific limit for the maximum number of headers or
   * the size, there is a limit on the maximum size of the
   * [Task][google.cloud.tasks.v2beta2.Task]. For more information, see the
   * [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]
   * documentation.
   * </pre>
   *
   * <code>map&lt;string, string&gt; headers = 4;</code>
   */
  public java.util.Map<java.lang.String, java.lang.String> getHeadersMap() {
    return internalGetHeaders().getMap();
  }
  /**
   *
   *
   * <pre>
   * HTTP request headers.
   * This map contains the header field names and values.
   * Headers can be set when the
   * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
   * Repeated headers are not supported but a header value can contain commas.
   * Cloud Tasks sets some headers to default values:
   * * `User-Agent`: By default, this header is
   *   `"AppEngine-Google; (+http://code.google.com/appengine)"`.
   *   This header can be modified, but Cloud Tasks will append
   *   `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
   *   modified `User-Agent`.
   * If the task has a
   * [payload][google.cloud.tasks.v2beta2.AppEngineHttpRequest.payload], Cloud
   * Tasks sets the following headers:
   * * `Content-Type`: By default, the `Content-Type` header is set to
   *   `"application/octet-stream"`. The default can be overridden by explicitly
   *   setting `Content-Type` to a particular media type when the
   *   [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
   *   For example, `Content-Type` can be set to `"application/json"`.
   * * `Content-Length`: This is computed by Cloud Tasks. This value is
   *   output only.   It cannot be changed.
   * The headers below cannot be set or overridden:
   * * `Host`
   * * `X-Google-*`
   * * `X-AppEngine-*`
   * In addition, Cloud Tasks sets some headers when the task is dispatched,
   * such as headers containing information about the task; see
   * [request
   * headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers).
   * These headers are set only when the task is dispatched, so they are not
   * visible when the task is returned in a Cloud Tasks response.
   * Although there is no specific limit for the maximum number of headers or
   * the size, there is a limit on the maximum size of the
   * [Task][google.cloud.tasks.v2beta2.Task]. For more information, see the
   * [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]
   * documentation.
   * </pre>
   *
   * <code>map&lt;string, string&gt; headers = 4;</code>
   */
  public java.lang.String getHeadersOrDefault(java.lang.String key, java.lang.String defaultValue) {
    if (key == null) {
      throw new java.lang.NullPointerException();
    }
    java.util.Map<java.lang.String, java.lang.String> map = internalGetHeaders().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   *
   *
   * <pre>
   * HTTP request headers.
   * This map contains the header field names and values.
   * Headers can be set when the
   * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
   * Repeated headers are not supported but a header value can contain commas.
   * Cloud Tasks sets some headers to default values:
   * * `User-Agent`: By default, this header is
   *   `"AppEngine-Google; (+http://code.google.com/appengine)"`.
   *   This header can be modified, but Cloud Tasks will append
   *   `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
   *   modified `User-Agent`.
   * If the task has a
   * [payload][google.cloud.tasks.v2beta2.AppEngineHttpRequest.payload], Cloud
   * Tasks sets the following headers:
   * * `Content-Type`: By default, the `Content-Type` header is set to
   *   `"application/octet-stream"`. The default can be overridden by explicitly
   *   setting `Content-Type` to a particular media type when the
   *   [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
   *   For example, `Content-Type` can be set to `"application/json"`.
   * * `Content-Length`: This is computed by Cloud Tasks. This value is
   *   output only.   It cannot be changed.
   * The headers below cannot be set or overridden:
   * * `Host`
   * * `X-Google-*`
   * * `X-AppEngine-*`
   * In addition, Cloud Tasks sets some headers when the task is dispatched,
   * such as headers containing information about the task; see
   * [request
   * headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers).
   * These headers are set only when the task is dispatched, so they are not
   * visible when the task is returned in a Cloud Tasks response.
   * Although there is no specific limit for the maximum number of headers or
   * the size, there is a limit on the maximum size of the
   * [Task][google.cloud.tasks.v2beta2.Task]. For more information, see the
   * [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]
   * documentation.
   * </pre>
   *
   * <code>map&lt;string, string&gt; headers = 4;</code>
   */
  public java.lang.String getHeadersOrThrow(java.lang.String key) {
    if (key == null) {
      throw new java.lang.NullPointerException();
    }
    java.util.Map<java.lang.String, java.lang.String> map = internalGetHeaders().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  public static final int PAYLOAD_FIELD_NUMBER = 5;
  private com.google.protobuf.ByteString payload_;
  /**
   *
   *
   * <pre>
   * Payload.
   * The payload will be sent as the HTTP message body. A message
   * body, and thus a payload, is allowed only if the HTTP method is
   * POST or PUT. It is an error to set a data payload on a task with
   * an incompatible [HttpMethod][google.cloud.tasks.v2beta2.HttpMethod].
   * </pre>
   *
   * <code>bytes payload = 5;</code>
   */
  public com.google.protobuf.ByteString getPayload() {
    return payload_;
  }

  private byte memoizedIsInitialized = -1;

  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (httpMethod_
        != com.google.cloud.tasks.v2beta2.HttpMethod.HTTP_METHOD_UNSPECIFIED.getNumber()) {
      output.writeEnum(1, httpMethod_);
    }
    if (appEngineRouting_ != null) {
      output.writeMessage(2, getAppEngineRouting());
    }
    if (!getRelativeUrlBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 3, relativeUrl_);
    }
    com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(
        output, internalGetHeaders(), HeadersDefaultEntryHolder.defaultEntry, 4);
    if (!payload_.isEmpty()) {
      output.writeBytes(5, payload_);
    }
    unknownFields.writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (httpMethod_
        != com.google.cloud.tasks.v2beta2.HttpMethod.HTTP_METHOD_UNSPECIFIED.getNumber()) {
      size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, httpMethod_);
    }
    if (appEngineRouting_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getAppEngineRouting());
    }
    if (!getRelativeUrlBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, relativeUrl_);
    }
    for (java.util.Map.Entry<java.lang.String, java.lang.String> entry :
        internalGetHeaders().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.String, java.lang.String> headers__ =
          HeadersDefaultEntryHolder.defaultEntry
              .newBuilderForType()
              .setKey(entry.getKey())
              .setValue(entry.getValue())
              .build();
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, headers__);
    }
    if (!payload_.isEmpty()) {
      size += com.google.protobuf.CodedOutputStream.computeBytesSize(5, payload_);
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.cloud.tasks.v2beta2.AppEngineHttpRequest)) {
      return super.equals(obj);
    }
    com.google.cloud.tasks.v2beta2.AppEngineHttpRequest other =
        (com.google.cloud.tasks.v2beta2.AppEngineHttpRequest) obj;

    if (httpMethod_ != other.httpMethod_) return false;
    if (hasAppEngineRouting() != other.hasAppEngineRouting()) return false;
    if (hasAppEngineRouting()) {
      if (!getAppEngineRouting().equals(other.getAppEngineRouting())) return false;
    }
    if (!getRelativeUrl().equals(other.getRelativeUrl())) return false;
    if (!internalGetHeaders().equals(other.internalGetHeaders())) return false;
    if (!getPayload().equals(other.getPayload())) return false;
    if (!unknownFields.equals(other.unknownFields)) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + HTTP_METHOD_FIELD_NUMBER;
    hash = (53 * hash) + httpMethod_;
    if (hasAppEngineRouting()) {
      hash = (37 * hash) + APP_ENGINE_ROUTING_FIELD_NUMBER;
      hash = (53 * hash) + getAppEngineRouting().hashCode();
    }
    hash = (37 * hash) + RELATIVE_URL_FIELD_NUMBER;
    hash = (53 * hash) + getRelativeUrl().hashCode();
    if (!internalGetHeaders().getMap().isEmpty()) {
      hash = (37 * hash) + HEADERS_FIELD_NUMBER;
      hash = (53 * hash) + internalGetHeaders().hashCode();
    }
    hash = (37 * hash) + PAYLOAD_FIELD_NUMBER;
    hash = (53 * hash) + getPayload().hashCode();
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.tasks.v2beta2.AppEngineHttpRequest parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.tasks.v2beta2.AppEngineHttpRequest parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.tasks.v2beta2.AppEngineHttpRequest parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.tasks.v2beta2.AppEngineHttpRequest parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.tasks.v2beta2.AppEngineHttpRequest parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.tasks.v2beta2.AppEngineHttpRequest parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.tasks.v2beta2.AppEngineHttpRequest parseFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.tasks.v2beta2.AppEngineHttpRequest parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.tasks.v2beta2.AppEngineHttpRequest parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.tasks.v2beta2.AppEngineHttpRequest parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.cloud.tasks.v2beta2.AppEngineHttpRequest parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.tasks.v2beta2.AppEngineHttpRequest parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(com.google.cloud.tasks.v2beta2.AppEngineHttpRequest prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *
   *
   * <pre>
   * App Engine HTTP request.
   * The message defines the HTTP request that is sent to an App Engine app when
   * the task is dispatched.
   * This proto can only be used for tasks in a queue which has
   * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target]
   * set.
   * Using [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest]
   * requires
   * [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control)
   * Google IAM permission for the project
   * and the following scope:
   * `https://www.googleapis.com/auth/cloud-platform`
   * The task will be delivered to the App Engine app which belongs to the same
   * project as the queue. For more information, see
   * [How Requests are
   * Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
   * and how routing is affected by
   * [dispatch
   * files](https://cloud.google.com/appengine/docs/python/config/dispatchref).
   * The [AppEngineRouting][google.cloud.tasks.v2beta2.AppEngineRouting] used to
   * construct the URL that the task is delivered to can be set at the queue-level
   * or task-level:
   * * If set,
   *    [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
   *    is used for all tasks in the queue, no matter what the setting
   *    is for the
   *    [task-level
   *    app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
   * The `url` that the task will be sent to is:
   * * `url =` [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] `+`
   *   [relative_url][google.cloud.tasks.v2beta2.AppEngineHttpRequest.relative_url]
   * The task attempt has succeeded if the app's request handler returns
   * an HTTP response code in the range [`200` - `299`]. `503` is
   * considered an App Engine system error instead of an application
   * error. Requests returning error `503` will be retried regardless of
   * retry configuration and not counted against retry counts.
   * Any other response code or a failure to receive a response before the
   * deadline is a failed attempt.
   * </pre>
   *
   * Protobuf type {@code google.cloud.tasks.v2beta2.AppEngineHttpRequest}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.tasks.v2beta2.AppEngineHttpRequest)
      com.google.cloud.tasks.v2beta2.AppEngineHttpRequestOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.tasks.v2beta2.TargetProto
          .internal_static_google_cloud_tasks_v2beta2_AppEngineHttpRequest_descriptor;
    }

    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMapField(int number) {
      switch (number) {
        case 4:
          return internalGetHeaders();
        default:
          throw new RuntimeException("Invalid map field number: " + number);
      }
    }

    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMutableMapField(int number) {
      switch (number) {
        case 4:
          return internalGetMutableHeaders();
        default:
          throw new RuntimeException("Invalid map field number: " + number);
      }
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.tasks.v2beta2.TargetProto
          .internal_static_google_cloud_tasks_v2beta2_AppEngineHttpRequest_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.class,
              com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.Builder.class);
    }

    // Construct using com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }

    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      httpMethod_ = 0;

      if (appEngineRoutingBuilder_ == null) {
        appEngineRouting_ = null;
      } else {
        appEngineRouting_ = null;
        appEngineRoutingBuilder_ = null;
      }
      relativeUrl_ = "";

      internalGetMutableHeaders().clear();
      payload_ = com.google.protobuf.ByteString.EMPTY;

      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.tasks.v2beta2.TargetProto
          .internal_static_google_cloud_tasks_v2beta2_AppEngineHttpRequest_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.tasks.v2beta2.AppEngineHttpRequest getDefaultInstanceForType() {
      return com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.cloud.tasks.v2beta2.AppEngineHttpRequest build() {
      com.google.cloud.tasks.v2beta2.AppEngineHttpRequest result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.cloud.tasks.v2beta2.AppEngineHttpRequest buildPartial() {
      com.google.cloud.tasks.v2beta2.AppEngineHttpRequest result =
          new com.google.cloud.tasks.v2beta2.AppEngineHttpRequest(this);
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      result.httpMethod_ = httpMethod_;
      if (appEngineRoutingBuilder_ == null) {
        result.appEngineRouting_ = appEngineRouting_;
      } else {
        result.appEngineRouting_ = appEngineRoutingBuilder_.build();
      }
      result.relativeUrl_ = relativeUrl_;
      result.headers_ = internalGetHeaders();
      result.headers_.makeImmutable();
      result.payload_ = payload_;
      result.bitField0_ = to_bitField0_;
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }

    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.setField(field, value);
    }

    @java.lang.Override
    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }

    @java.lang.Override
    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }

    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }

    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.cloud.tasks.v2beta2.AppEngineHttpRequest) {
        return mergeFrom((com.google.cloud.tasks.v2beta2.AppEngineHttpRequest) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.tasks.v2beta2.AppEngineHttpRequest other) {
      if (other == com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.getDefaultInstance())
        return this;
      if (other.httpMethod_ != 0) {
        setHttpMethodValue(other.getHttpMethodValue());
      }
      if (other.hasAppEngineRouting()) {
        mergeAppEngineRouting(other.getAppEngineRouting());
      }
      if (!other.getRelativeUrl().isEmpty()) {
        relativeUrl_ = other.relativeUrl_;
        onChanged();
      }
      internalGetMutableHeaders().mergeFrom(other.internalGetHeaders());
      if (other.getPayload() != com.google.protobuf.ByteString.EMPTY) {
        setPayload(other.getPayload());
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.google.cloud.tasks.v2beta2.AppEngineHttpRequest parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage =
            (com.google.cloud.tasks.v2beta2.AppEngineHttpRequest) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private int bitField0_;

    private int httpMethod_ = 0;
    /**
     *
     *
     * <pre>
     * The HTTP method to use for the request. The default is POST.
     * The app's request handler for the task's target URL must be able to handle
     * HTTP requests with this http_method, otherwise the task attempt will fail
     * with error code 405 (Method Not Allowed). See
     * [Writing a push task request
     * handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler)
     * and the documentation for the request handlers in the language your app is
     * written in e.g.
     * [Python Request
     * Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass).
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.HttpMethod http_method = 1;</code>
     */
    public int getHttpMethodValue() {
      return httpMethod_;
    }
    /**
     *
     *
     * <pre>
     * The HTTP method to use for the request. The default is POST.
     * The app's request handler for the task's target URL must be able to handle
     * HTTP requests with this http_method, otherwise the task attempt will fail
     * with error code 405 (Method Not Allowed). See
     * [Writing a push task request
     * handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler)
     * and the documentation for the request handlers in the language your app is
     * written in e.g.
     * [Python Request
     * Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass).
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.HttpMethod http_method = 1;</code>
     */
    public Builder setHttpMethodValue(int value) {
      httpMethod_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The HTTP method to use for the request. The default is POST.
     * The app's request handler for the task's target URL must be able to handle
     * HTTP requests with this http_method, otherwise the task attempt will fail
     * with error code 405 (Method Not Allowed). See
     * [Writing a push task request
     * handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler)
     * and the documentation for the request handlers in the language your app is
     * written in e.g.
     * [Python Request
     * Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass).
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.HttpMethod http_method = 1;</code>
     */
    public com.google.cloud.tasks.v2beta2.HttpMethod getHttpMethod() {
      @SuppressWarnings("deprecation")
      com.google.cloud.tasks.v2beta2.HttpMethod result =
          com.google.cloud.tasks.v2beta2.HttpMethod.valueOf(httpMethod_);
      return result == null ? com.google.cloud.tasks.v2beta2.HttpMethod.UNRECOGNIZED : result;
    }
    /**
     *
     *
     * <pre>
     * The HTTP method to use for the request. The default is POST.
     * The app's request handler for the task's target URL must be able to handle
     * HTTP requests with this http_method, otherwise the task attempt will fail
     * with error code 405 (Method Not Allowed). See
     * [Writing a push task request
     * handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler)
     * and the documentation for the request handlers in the language your app is
     * written in e.g.
     * [Python Request
     * Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass).
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.HttpMethod http_method = 1;</code>
     */
    public Builder setHttpMethod(com.google.cloud.tasks.v2beta2.HttpMethod value) {
      if (value == null) {
        throw new NullPointerException();
      }

      httpMethod_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The HTTP method to use for the request. The default is POST.
     * The app's request handler for the task's target URL must be able to handle
     * HTTP requests with this http_method, otherwise the task attempt will fail
     * with error code 405 (Method Not Allowed). See
     * [Writing a push task request
     * handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler)
     * and the documentation for the request handlers in the language your app is
     * written in e.g.
     * [Python Request
     * Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass).
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.HttpMethod http_method = 1;</code>
     */
    public Builder clearHttpMethod() {

      httpMethod_ = 0;
      onChanged();
      return this;
    }

    private com.google.cloud.tasks.v2beta2.AppEngineRouting appEngineRouting_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.tasks.v2beta2.AppEngineRouting,
            com.google.cloud.tasks.v2beta2.AppEngineRouting.Builder,
            com.google.cloud.tasks.v2beta2.AppEngineRoutingOrBuilder>
        appEngineRoutingBuilder_;
    /**
     *
     *
     * <pre>
     * Task-level setting for App Engine routing.
     * If set,
     * [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
     * is used for all tasks in the queue, no matter what the setting is for the
     * [task-level
     * app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineRouting app_engine_routing = 2;</code>
     */
    public boolean hasAppEngineRouting() {
      return appEngineRoutingBuilder_ != null || appEngineRouting_ != null;
    }
    /**
     *
     *
     * <pre>
     * Task-level setting for App Engine routing.
     * If set,
     * [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
     * is used for all tasks in the queue, no matter what the setting is for the
     * [task-level
     * app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineRouting app_engine_routing = 2;</code>
     */
    public com.google.cloud.tasks.v2beta2.AppEngineRouting getAppEngineRouting() {
      if (appEngineRoutingBuilder_ == null) {
        return appEngineRouting_ == null
            ? com.google.cloud.tasks.v2beta2.AppEngineRouting.getDefaultInstance()
            : appEngineRouting_;
      } else {
        return appEngineRoutingBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Task-level setting for App Engine routing.
     * If set,
     * [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
     * is used for all tasks in the queue, no matter what the setting is for the
     * [task-level
     * app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineRouting app_engine_routing = 2;</code>
     */
    public Builder setAppEngineRouting(com.google.cloud.tasks.v2beta2.AppEngineRouting value) {
      if (appEngineRoutingBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        appEngineRouting_ = value;
        onChanged();
      } else {
        appEngineRoutingBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Task-level setting for App Engine routing.
     * If set,
     * [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
     * is used for all tasks in the queue, no matter what the setting is for the
     * [task-level
     * app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineRouting app_engine_routing = 2;</code>
     */
    public Builder setAppEngineRouting(
        com.google.cloud.tasks.v2beta2.AppEngineRouting.Builder builderForValue) {
      if (appEngineRoutingBuilder_ == null) {
        appEngineRouting_ = builderForValue.build();
        onChanged();
      } else {
        appEngineRoutingBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Task-level setting for App Engine routing.
     * If set,
     * [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
     * is used for all tasks in the queue, no matter what the setting is for the
     * [task-level
     * app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineRouting app_engine_routing = 2;</code>
     */
    public Builder mergeAppEngineRouting(com.google.cloud.tasks.v2beta2.AppEngineRouting value) {
      if (appEngineRoutingBuilder_ == null) {
        if (appEngineRouting_ != null) {
          appEngineRouting_ =
              com.google.cloud.tasks.v2beta2.AppEngineRouting.newBuilder(appEngineRouting_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          appEngineRouting_ = value;
        }
        onChanged();
      } else {
        appEngineRoutingBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Task-level setting for App Engine routing.
     * If set,
     * [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
     * is used for all tasks in the queue, no matter what the setting is for the
     * [task-level
     * app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineRouting app_engine_routing = 2;</code>
     */
    public Builder clearAppEngineRouting() {
      if (appEngineRoutingBuilder_ == null) {
        appEngineRouting_ = null;
        onChanged();
      } else {
        appEngineRouting_ = null;
        appEngineRoutingBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Task-level setting for App Engine routing.
     * If set,
     * [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
     * is used for all tasks in the queue, no matter what the setting is for the
     * [task-level
     * app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineRouting app_engine_routing = 2;</code>
     */
    public com.google.cloud.tasks.v2beta2.AppEngineRouting.Builder getAppEngineRoutingBuilder() {

      onChanged();
      return getAppEngineRoutingFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Task-level setting for App Engine routing.
     * If set,
     * [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
     * is used for all tasks in the queue, no matter what the setting is for the
     * [task-level
     * app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineRouting app_engine_routing = 2;</code>
     */
    public com.google.cloud.tasks.v2beta2.AppEngineRoutingOrBuilder getAppEngineRoutingOrBuilder() {
      if (appEngineRoutingBuilder_ != null) {
        return appEngineRoutingBuilder_.getMessageOrBuilder();
      } else {
        return appEngineRouting_ == null
            ? com.google.cloud.tasks.v2beta2.AppEngineRouting.getDefaultInstance()
            : appEngineRouting_;
      }
    }
    /**
     *
     *
     * <pre>
     * Task-level setting for App Engine routing.
     * If set,
     * [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override]
     * is used for all tasks in the queue, no matter what the setting is for the
     * [task-level
     * app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineRouting app_engine_routing = 2;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.tasks.v2beta2.AppEngineRouting,
            com.google.cloud.tasks.v2beta2.AppEngineRouting.Builder,
            com.google.cloud.tasks.v2beta2.AppEngineRoutingOrBuilder>
        getAppEngineRoutingFieldBuilder() {
      if (appEngineRoutingBuilder_ == null) {
        appEngineRoutingBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.tasks.v2beta2.AppEngineRouting,
                com.google.cloud.tasks.v2beta2.AppEngineRouting.Builder,
                com.google.cloud.tasks.v2beta2.AppEngineRoutingOrBuilder>(
                getAppEngineRouting(), getParentForChildren(), isClean());
        appEngineRouting_ = null;
      }
      return appEngineRoutingBuilder_;
    }

    private java.lang.Object relativeUrl_ = "";
    /**
     *
     *
     * <pre>
     * The relative URL.
     * The relative URL must begin with "/" and must be a valid HTTP relative URL.
     * It can contain a path and query string arguments.
     * If the relative URL is empty, then the root path "/" will be used.
     * No spaces are allowed, and the maximum length allowed is 2083 characters.
     * </pre>
     *
     * <code>string relative_url = 3;</code>
     */
    public java.lang.String getRelativeUrl() {
      java.lang.Object ref = relativeUrl_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        relativeUrl_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The relative URL.
     * The relative URL must begin with "/" and must be a valid HTTP relative URL.
     * It can contain a path and query string arguments.
     * If the relative URL is empty, then the root path "/" will be used.
     * No spaces are allowed, and the maximum length allowed is 2083 characters.
     * </pre>
     *
     * <code>string relative_url = 3;</code>
     */
    public com.google.protobuf.ByteString getRelativeUrlBytes() {
      java.lang.Object ref = relativeUrl_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        relativeUrl_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The relative URL.
     * The relative URL must begin with "/" and must be a valid HTTP relative URL.
     * It can contain a path and query string arguments.
     * If the relative URL is empty, then the root path "/" will be used.
     * No spaces are allowed, and the maximum length allowed is 2083 characters.
     * </pre>
     *
     * <code>string relative_url = 3;</code>
     */
    public Builder setRelativeUrl(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      relativeUrl_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The relative URL.
     * The relative URL must begin with "/" and must be a valid HTTP relative URL.
     * It can contain a path and query string arguments.
     * If the relative URL is empty, then the root path "/" will be used.
     * No spaces are allowed, and the maximum length allowed is 2083 characters.
     * </pre>
     *
     * <code>string relative_url = 3;</code>
     */
    public Builder clearRelativeUrl() {

      relativeUrl_ = getDefaultInstance().getRelativeUrl();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The relative URL.
     * The relative URL must begin with "/" and must be a valid HTTP relative URL.
     * It can contain a path and query string arguments.
     * If the relative URL is empty, then the root path "/" will be used.
     * No spaces are allowed, and the maximum length allowed is 2083 characters.
     * </pre>
     *
     * <code>string relative_url = 3;</code>
     */
    public Builder setRelativeUrlBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

      relativeUrl_ = value;
      onChanged();
      return this;
    }

    private com.google.protobuf.MapField<java.lang.String, java.lang.String> headers_;

    private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetHeaders() {
      if (headers_ == null) {
        return com.google.protobuf.MapField.emptyMapField(HeadersDefaultEntryHolder.defaultEntry);
      }
      return headers_;
    }

    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
        internalGetMutableHeaders() {
      onChanged();
      ;
      if (headers_ == null) {
        headers_ = com.google.protobuf.MapField.newMapField(HeadersDefaultEntryHolder.defaultEntry);
      }
      if (!headers_.isMutable()) {
        headers_ = headers_.copy();
      }
      return headers_;
    }

    public int getHeadersCount() {
      return internalGetHeaders().getMap().size();
    }
    /**
     *
     *
     * <pre>
     * HTTP request headers.
     * This map contains the header field names and values.
     * Headers can be set when the
     * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     * Repeated headers are not supported but a header value can contain commas.
     * Cloud Tasks sets some headers to default values:
     * * `User-Agent`: By default, this header is
     *   `"AppEngine-Google; (+http://code.google.com/appengine)"`.
     *   This header can be modified, but Cloud Tasks will append
     *   `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
     *   modified `User-Agent`.
     * If the task has a
     * [payload][google.cloud.tasks.v2beta2.AppEngineHttpRequest.payload], Cloud
     * Tasks sets the following headers:
     * * `Content-Type`: By default, the `Content-Type` header is set to
     *   `"application/octet-stream"`. The default can be overridden by explicitly
     *   setting `Content-Type` to a particular media type when the
     *   [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     *   For example, `Content-Type` can be set to `"application/json"`.
     * * `Content-Length`: This is computed by Cloud Tasks. This value is
     *   output only.   It cannot be changed.
     * The headers below cannot be set or overridden:
     * * `Host`
     * * `X-Google-*`
     * * `X-AppEngine-*`
     * In addition, Cloud Tasks sets some headers when the task is dispatched,
     * such as headers containing information about the task; see
     * [request
     * headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers).
     * These headers are set only when the task is dispatched, so they are not
     * visible when the task is returned in a Cloud Tasks response.
     * Although there is no specific limit for the maximum number of headers or
     * the size, there is a limit on the maximum size of the
     * [Task][google.cloud.tasks.v2beta2.Task]. For more information, see the
     * [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]
     * documentation.
     * </pre>
     *
     * <code>map&lt;string, string&gt; headers = 4;</code>
     */
    public boolean containsHeaders(java.lang.String key) {
      if (key == null) {
        throw new java.lang.NullPointerException();
      }
      return internalGetHeaders().getMap().containsKey(key);
    }
    /** Use {@link #getHeadersMap()} instead. */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getHeaders() {
      return getHeadersMap();
    }
    /**
     *
     *
     * <pre>
     * HTTP request headers.
     * This map contains the header field names and values.
     * Headers can be set when the
     * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     * Repeated headers are not supported but a header value can contain commas.
     * Cloud Tasks sets some headers to default values:
     * * `User-Agent`: By default, this header is
     *   `"AppEngine-Google; (+http://code.google.com/appengine)"`.
     *   This header can be modified, but Cloud Tasks will append
     *   `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
     *   modified `User-Agent`.
     * If the task has a
     * [payload][google.cloud.tasks.v2beta2.AppEngineHttpRequest.payload], Cloud
     * Tasks sets the following headers:
     * * `Content-Type`: By default, the `Content-Type` header is set to
     *   `"application/octet-stream"`. The default can be overridden by explicitly
     *   setting `Content-Type` to a particular media type when the
     *   [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     *   For example, `Content-Type` can be set to `"application/json"`.
     * * `Content-Length`: This is computed by Cloud Tasks. This value is
     *   output only.   It cannot be changed.
     * The headers below cannot be set or overridden:
     * * `Host`
     * * `X-Google-*`
     * * `X-AppEngine-*`
     * In addition, Cloud Tasks sets some headers when the task is dispatched,
     * such as headers containing information about the task; see
     * [request
     * headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers).
     * These headers are set only when the task is dispatched, so they are not
     * visible when the task is returned in a Cloud Tasks response.
     * Although there is no specific limit for the maximum number of headers or
     * the size, there is a limit on the maximum size of the
     * [Task][google.cloud.tasks.v2beta2.Task]. For more information, see the
     * [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]
     * documentation.
     * </pre>
     *
     * <code>map&lt;string, string&gt; headers = 4;</code>
     */
    public java.util.Map<java.lang.String, java.lang.String> getHeadersMap() {
      return internalGetHeaders().getMap();
    }
    /**
     *
     *
     * <pre>
     * HTTP request headers.
     * This map contains the header field names and values.
     * Headers can be set when the
     * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     * Repeated headers are not supported but a header value can contain commas.
     * Cloud Tasks sets some headers to default values:
     * * `User-Agent`: By default, this header is
     *   `"AppEngine-Google; (+http://code.google.com/appengine)"`.
     *   This header can be modified, but Cloud Tasks will append
     *   `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
     *   modified `User-Agent`.
     * If the task has a
     * [payload][google.cloud.tasks.v2beta2.AppEngineHttpRequest.payload], Cloud
     * Tasks sets the following headers:
     * * `Content-Type`: By default, the `Content-Type` header is set to
     *   `"application/octet-stream"`. The default can be overridden by explicitly
     *   setting `Content-Type` to a particular media type when the
     *   [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     *   For example, `Content-Type` can be set to `"application/json"`.
     * * `Content-Length`: This is computed by Cloud Tasks. This value is
     *   output only.   It cannot be changed.
     * The headers below cannot be set or overridden:
     * * `Host`
     * * `X-Google-*`
     * * `X-AppEngine-*`
     * In addition, Cloud Tasks sets some headers when the task is dispatched,
     * such as headers containing information about the task; see
     * [request
     * headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers).
     * These headers are set only when the task is dispatched, so they are not
     * visible when the task is returned in a Cloud Tasks response.
     * Although there is no specific limit for the maximum number of headers or
     * the size, there is a limit on the maximum size of the
     * [Task][google.cloud.tasks.v2beta2.Task]. For more information, see the
     * [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]
     * documentation.
     * </pre>
     *
     * <code>map&lt;string, string&gt; headers = 4;</code>
     */
    public java.lang.String getHeadersOrDefault(
        java.lang.String key, java.lang.String defaultValue) {
      if (key == null) {
        throw new java.lang.NullPointerException();
      }
      java.util.Map<java.lang.String, java.lang.String> map = internalGetHeaders().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     *
     *
     * <pre>
     * HTTP request headers.
     * This map contains the header field names and values.
     * Headers can be set when the
     * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     * Repeated headers are not supported but a header value can contain commas.
     * Cloud Tasks sets some headers to default values:
     * * `User-Agent`: By default, this header is
     *   `"AppEngine-Google; (+http://code.google.com/appengine)"`.
     *   This header can be modified, but Cloud Tasks will append
     *   `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
     *   modified `User-Agent`.
     * If the task has a
     * [payload][google.cloud.tasks.v2beta2.AppEngineHttpRequest.payload], Cloud
     * Tasks sets the following headers:
     * * `Content-Type`: By default, the `Content-Type` header is set to
     *   `"application/octet-stream"`. The default can be overridden by explicitly
     *   setting `Content-Type` to a particular media type when the
     *   [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     *   For example, `Content-Type` can be set to `"application/json"`.
     * * `Content-Length`: This is computed by Cloud Tasks. This value is
     *   output only.   It cannot be changed.
     * The headers below cannot be set or overridden:
     * * `Host`
     * * `X-Google-*`
     * * `X-AppEngine-*`
     * In addition, Cloud Tasks sets some headers when the task is dispatched,
     * such as headers containing information about the task; see
     * [request
     * headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers).
     * These headers are set only when the task is dispatched, so they are not
     * visible when the task is returned in a Cloud Tasks response.
     * Although there is no specific limit for the maximum number of headers or
     * the size, there is a limit on the maximum size of the
     * [Task][google.cloud.tasks.v2beta2.Task]. For more information, see the
     * [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]
     * documentation.
     * </pre>
     *
     * <code>map&lt;string, string&gt; headers = 4;</code>
     */
    public java.lang.String getHeadersOrThrow(java.lang.String key) {
      if (key == null) {
        throw new java.lang.NullPointerException();
      }
      java.util.Map<java.lang.String, java.lang.String> map = internalGetHeaders().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearHeaders() {
      internalGetMutableHeaders().getMutableMap().clear();
      return this;
    }
    /**
     *
     *
     * <pre>
     * HTTP request headers.
     * This map contains the header field names and values.
     * Headers can be set when the
     * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     * Repeated headers are not supported but a header value can contain commas.
     * Cloud Tasks sets some headers to default values:
     * * `User-Agent`: By default, this header is
     *   `"AppEngine-Google; (+http://code.google.com/appengine)"`.
     *   This header can be modified, but Cloud Tasks will append
     *   `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
     *   modified `User-Agent`.
     * If the task has a
     * [payload][google.cloud.tasks.v2beta2.AppEngineHttpRequest.payload], Cloud
     * Tasks sets the following headers:
     * * `Content-Type`: By default, the `Content-Type` header is set to
     *   `"application/octet-stream"`. The default can be overridden by explicitly
     *   setting `Content-Type` to a particular media type when the
     *   [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     *   For example, `Content-Type` can be set to `"application/json"`.
     * * `Content-Length`: This is computed by Cloud Tasks. This value is
     *   output only.   It cannot be changed.
     * The headers below cannot be set or overridden:
     * * `Host`
     * * `X-Google-*`
     * * `X-AppEngine-*`
     * In addition, Cloud Tasks sets some headers when the task is dispatched,
     * such as headers containing information about the task; see
     * [request
     * headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers).
     * These headers are set only when the task is dispatched, so they are not
     * visible when the task is returned in a Cloud Tasks response.
     * Although there is no specific limit for the maximum number of headers or
     * the size, there is a limit on the maximum size of the
     * [Task][google.cloud.tasks.v2beta2.Task]. For more information, see the
     * [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]
     * documentation.
     * </pre>
     *
     * <code>map&lt;string, string&gt; headers = 4;</code>
     */
    public Builder removeHeaders(java.lang.String key) {
      if (key == null) {
        throw new java.lang.NullPointerException();
      }
      internalGetMutableHeaders().getMutableMap().remove(key);
      return this;
    }
    /** Use alternate mutation accessors instead. */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getMutableHeaders() {
      return internalGetMutableHeaders().getMutableMap();
    }
    /**
     *
     *
     * <pre>
     * HTTP request headers.
     * This map contains the header field names and values.
     * Headers can be set when the
     * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     * Repeated headers are not supported but a header value can contain commas.
     * Cloud Tasks sets some headers to default values:
     * * `User-Agent`: By default, this header is
     *   `"AppEngine-Google; (+http://code.google.com/appengine)"`.
     *   This header can be modified, but Cloud Tasks will append
     *   `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
     *   modified `User-Agent`.
     * If the task has a
     * [payload][google.cloud.tasks.v2beta2.AppEngineHttpRequest.payload], Cloud
     * Tasks sets the following headers:
     * * `Content-Type`: By default, the `Content-Type` header is set to
     *   `"application/octet-stream"`. The default can be overridden by explicitly
     *   setting `Content-Type` to a particular media type when the
     *   [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     *   For example, `Content-Type` can be set to `"application/json"`.
     * * `Content-Length`: This is computed by Cloud Tasks. This value is
     *   output only.   It cannot be changed.
     * The headers below cannot be set or overridden:
     * * `Host`
     * * `X-Google-*`
     * * `X-AppEngine-*`
     * In addition, Cloud Tasks sets some headers when the task is dispatched,
     * such as headers containing information about the task; see
     * [request
     * headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers).
     * These headers are set only when the task is dispatched, so they are not
     * visible when the task is returned in a Cloud Tasks response.
     * Although there is no specific limit for the maximum number of headers or
     * the size, there is a limit on the maximum size of the
     * [Task][google.cloud.tasks.v2beta2.Task]. For more information, see the
     * [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]
     * documentation.
     * </pre>
     *
     * <code>map&lt;string, string&gt; headers = 4;</code>
     */
    public Builder putHeaders(java.lang.String key, java.lang.String value) {
      if (key == null) {
        throw new java.lang.NullPointerException();
      }
      if (value == null) {
        throw new java.lang.NullPointerException();
      }
      internalGetMutableHeaders().getMutableMap().put(key, value);
      return this;
    }
    /**
     *
     *
     * <pre>
     * HTTP request headers.
     * This map contains the header field names and values.
     * Headers can be set when the
     * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     * Repeated headers are not supported but a header value can contain commas.
     * Cloud Tasks sets some headers to default values:
     * * `User-Agent`: By default, this header is
     *   `"AppEngine-Google; (+http://code.google.com/appengine)"`.
     *   This header can be modified, but Cloud Tasks will append
     *   `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
     *   modified `User-Agent`.
     * If the task has a
     * [payload][google.cloud.tasks.v2beta2.AppEngineHttpRequest.payload], Cloud
     * Tasks sets the following headers:
     * * `Content-Type`: By default, the `Content-Type` header is set to
     *   `"application/octet-stream"`. The default can be overridden by explicitly
     *   setting `Content-Type` to a particular media type when the
     *   [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     *   For example, `Content-Type` can be set to `"application/json"`.
     * * `Content-Length`: This is computed by Cloud Tasks. This value is
     *   output only.   It cannot be changed.
     * The headers below cannot be set or overridden:
     * * `Host`
     * * `X-Google-*`
     * * `X-AppEngine-*`
     * In addition, Cloud Tasks sets some headers when the task is dispatched,
     * such as headers containing information about the task; see
     * [request
     * headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers).
     * These headers are set only when the task is dispatched, so they are not
     * visible when the task is returned in a Cloud Tasks response.
     * Although there is no specific limit for the maximum number of headers or
     * the size, there is a limit on the maximum size of the
     * [Task][google.cloud.tasks.v2beta2.Task]. For more information, see the
     * [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]
     * documentation.
     * </pre>
     *
     * <code>map&lt;string, string&gt; headers = 4;</code>
     */
    public Builder putAllHeaders(java.util.Map<java.lang.String, java.lang.String> values) {
      internalGetMutableHeaders().getMutableMap().putAll(values);
      return this;
    }

    private com.google.protobuf.ByteString payload_ = com.google.protobuf.ByteString.EMPTY;
    /**
     *
     *
     * <pre>
     * Payload.
     * The payload will be sent as the HTTP message body. A message
     * body, and thus a payload, is allowed only if the HTTP method is
     * POST or PUT. It is an error to set a data payload on a task with
     * an incompatible [HttpMethod][google.cloud.tasks.v2beta2.HttpMethod].
     * </pre>
     *
     * <code>bytes payload = 5;</code>
     */
    public com.google.protobuf.ByteString getPayload() {
      return payload_;
    }
    /**
     *
     *
     * <pre>
     * Payload.
     * The payload will be sent as the HTTP message body. A message
     * body, and thus a payload, is allowed only if the HTTP method is
     * POST or PUT. It is an error to set a data payload on a task with
     * an incompatible [HttpMethod][google.cloud.tasks.v2beta2.HttpMethod].
     * </pre>
     *
     * <code>bytes payload = 5;</code>
     */
    public Builder setPayload(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }

      payload_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Payload.
     * The payload will be sent as the HTTP message body. A message
     * body, and thus a payload, is allowed only if the HTTP method is
     * POST or PUT. It is an error to set a data payload on a task with
     * an incompatible [HttpMethod][google.cloud.tasks.v2beta2.HttpMethod].
     * </pre>
     *
     * <code>bytes payload = 5;</code>
     */
    public Builder clearPayload() {

      payload_ = getDefaultInstance().getPayload();
      onChanged();
      return this;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }

    // @@protoc_insertion_point(builder_scope:google.cloud.tasks.v2beta2.AppEngineHttpRequest)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta2.AppEngineHttpRequest)
  private static final com.google.cloud.tasks.v2beta2.AppEngineHttpRequest DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.tasks.v2beta2.AppEngineHttpRequest();
  }

  public static com.google.cloud.tasks.v2beta2.AppEngineHttpRequest getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<AppEngineHttpRequest> PARSER =
      new com.google.protobuf.AbstractParser<AppEngineHttpRequest>() {
        @java.lang.Override
        public AppEngineHttpRequest parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          return new AppEngineHttpRequest(input, extensionRegistry);
        }
      };

  public static com.google.protobuf.Parser<AppEngineHttpRequest> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<AppEngineHttpRequest> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.cloud.tasks.v2beta2.AppEngineHttpRequest getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
