// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/dataproc/v1/workflow_templates.proto

package com.google.cloud.dataproc.v1;

/**
 *
 *
 * <pre>
 * A Cloud Dataproc workflow template resource.
 * </pre>
 *
 * Protobuf type {@code google.cloud.dataproc.v1.WorkflowTemplate}
 */
public final class WorkflowTemplate extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.dataproc.v1.WorkflowTemplate)
    WorkflowTemplateOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use WorkflowTemplate.newBuilder() to construct.
  private WorkflowTemplate(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private WorkflowTemplate() {
    id_ = "";
    name_ = "";
    jobs_ = java.util.Collections.emptyList();
    parameters_ = java.util.Collections.emptyList();
  }

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

  private WorkflowTemplate(
      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 10:
            {
              java.lang.String s = input.readStringRequireUtf8();

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

              id_ = s;
              break;
            }
          case 24:
            {
              version_ = input.readInt32();
              break;
            }
          case 34:
            {
              com.google.protobuf.Timestamp.Builder subBuilder = null;
              if (createTime_ != null) {
                subBuilder = createTime_.toBuilder();
              }
              createTime_ =
                  input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(createTime_);
                createTime_ = subBuilder.buildPartial();
              }

              break;
            }
          case 42:
            {
              com.google.protobuf.Timestamp.Builder subBuilder = null;
              if (updateTime_ != null) {
                subBuilder = updateTime_.toBuilder();
              }
              updateTime_ =
                  input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(updateTime_);
                updateTime_ = subBuilder.buildPartial();
              }

              break;
            }
          case 50:
            {
              if (!((mutable_bitField0_ & 0x00000020) != 0)) {
                labels_ =
                    com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry);
                mutable_bitField0_ |= 0x00000020;
              }
              com.google.protobuf.MapEntry<java.lang.String, java.lang.String> labels__ =
                  input.readMessage(
                      LabelsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
              labels_.getMutableMap().put(labels__.getKey(), labels__.getValue());
              break;
            }
          case 58:
            {
              com.google.cloud.dataproc.v1.WorkflowTemplatePlacement.Builder subBuilder = null;
              if (placement_ != null) {
                subBuilder = placement_.toBuilder();
              }
              placement_ =
                  input.readMessage(
                      com.google.cloud.dataproc.v1.WorkflowTemplatePlacement.parser(),
                      extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(placement_);
                placement_ = subBuilder.buildPartial();
              }

              break;
            }
          case 66:
            {
              if (!((mutable_bitField0_ & 0x00000080) != 0)) {
                jobs_ = new java.util.ArrayList<com.google.cloud.dataproc.v1.OrderedJob>();
                mutable_bitField0_ |= 0x00000080;
              }
              jobs_.add(
                  input.readMessage(
                      com.google.cloud.dataproc.v1.OrderedJob.parser(), extensionRegistry));
              break;
            }
          case 74:
            {
              if (!((mutable_bitField0_ & 0x00000100) != 0)) {
                parameters_ =
                    new java.util.ArrayList<com.google.cloud.dataproc.v1.TemplateParameter>();
                mutable_bitField0_ |= 0x00000100;
              }
              parameters_.add(
                  input.readMessage(
                      com.google.cloud.dataproc.v1.TemplateParameter.parser(), extensionRegistry));
              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 {
      if (((mutable_bitField0_ & 0x00000080) != 0)) {
        jobs_ = java.util.Collections.unmodifiableList(jobs_);
      }
      if (((mutable_bitField0_ & 0x00000100) != 0)) {
        parameters_ = java.util.Collections.unmodifiableList(parameters_);
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.dataproc.v1.WorkflowTemplatesProto
        .internal_static_google_cloud_dataproc_v1_WorkflowTemplate_descriptor;
  }

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

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.dataproc.v1.WorkflowTemplatesProto
        .internal_static_google_cloud_dataproc_v1_WorkflowTemplate_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.dataproc.v1.WorkflowTemplate.class,
            com.google.cloud.dataproc.v1.WorkflowTemplate.Builder.class);
  }

  private int bitField0_;
  public static final int ID_FIELD_NUMBER = 2;
  private volatile java.lang.Object id_;
  /**
   *
   *
   * <pre>
   * Required. The template id.
   * The id must contain only letters (a-z, A-Z), numbers (0-9),
   * underscores (_), and hyphens (-). Cannot begin or end with underscore
   * or hyphen. Must consist of between 3 and 50 characters.
   * </pre>
   *
   * <code>string id = 2;</code>
   */
  public java.lang.String getId() {
    java.lang.Object ref = id_;
    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();
      id_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Required. The template id.
   * The id must contain only letters (a-z, A-Z), numbers (0-9),
   * underscores (_), and hyphens (-). Cannot begin or end with underscore
   * or hyphen. Must consist of between 3 and 50 characters.
   * </pre>
   *
   * <code>string id = 2;</code>
   */
  public com.google.protobuf.ByteString getIdBytes() {
    java.lang.Object ref = id_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      id_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int NAME_FIELD_NUMBER = 1;
  private volatile java.lang.Object name_;
  /**
   *
   *
   * <pre>
   * Output only. The "resource name" of the template, as described
   * in https://cloud.google.com/apis/design/resource_names of the form
   * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
   * </pre>
   *
   * <code>string name = 1;</code>
   */
  public java.lang.String getName() {
    java.lang.Object ref = name_;
    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();
      name_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Output only. The "resource name" of the template, as described
   * in https://cloud.google.com/apis/design/resource_names of the form
   * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
   * </pre>
   *
   * <code>string name = 1;</code>
   */
  public com.google.protobuf.ByteString getNameBytes() {
    java.lang.Object ref = name_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      name_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int VERSION_FIELD_NUMBER = 3;
  private int version_;
  /**
   *
   *
   * <pre>
   * Optional. Used to perform a consistent read-modify-write.
   * This field should be left blank for a `CreateWorkflowTemplate` request. It
   * is required for an `UpdateWorkflowTemplate` request, and must match the
   * current server version. A typical update template flow would fetch the
   * current template with a `GetWorkflowTemplate` request, which will return
   * the current template with the `version` field filled in with the
   * current server version. The user updates other fields in the template,
   * then returns it as part of the `UpdateWorkflowTemplate` request.
   * </pre>
   *
   * <code>int32 version = 3;</code>
   */
  public int getVersion() {
    return version_;
  }

  public static final int CREATE_TIME_FIELD_NUMBER = 4;
  private com.google.protobuf.Timestamp createTime_;
  /**
   *
   *
   * <pre>
   * Output only. The time template was created.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp create_time = 4;</code>
   */
  public boolean hasCreateTime() {
    return createTime_ != null;
  }
  /**
   *
   *
   * <pre>
   * Output only. The time template was created.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp create_time = 4;</code>
   */
  public com.google.protobuf.Timestamp getCreateTime() {
    return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_;
  }
  /**
   *
   *
   * <pre>
   * Output only. The time template was created.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp create_time = 4;</code>
   */
  public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() {
    return getCreateTime();
  }

  public static final int UPDATE_TIME_FIELD_NUMBER = 5;
  private com.google.protobuf.Timestamp updateTime_;
  /**
   *
   *
   * <pre>
   * Output only. The time template was last updated.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp update_time = 5;</code>
   */
  public boolean hasUpdateTime() {
    return updateTime_ != null;
  }
  /**
   *
   *
   * <pre>
   * Output only. The time template was last updated.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp update_time = 5;</code>
   */
  public com.google.protobuf.Timestamp getUpdateTime() {
    return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_;
  }
  /**
   *
   *
   * <pre>
   * Output only. The time template was last updated.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp update_time = 5;</code>
   */
  public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() {
    return getUpdateTime();
  }

  public static final int LABELS_FIELD_NUMBER = 6;

  private static final class LabelsDefaultEntryHolder {
    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.dataproc.v1.WorkflowTemplatesProto
                .internal_static_google_cloud_dataproc_v1_WorkflowTemplate_LabelsEntry_descriptor,
            com.google.protobuf.WireFormat.FieldType.STRING,
            "",
            com.google.protobuf.WireFormat.FieldType.STRING,
            "");
  }

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

  private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetLabels() {
    if (labels_ == null) {
      return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry);
    }
    return labels_;
  }

  public int getLabelsCount() {
    return internalGetLabels().getMap().size();
  }
  /**
   *
   *
   * <pre>
   * Optional. The labels to associate with this template. These labels
   * will be propagated to all jobs and clusters created by the workflow
   * instance.
   * Label **keys** must contain 1 to 63 characters, and must conform to
   * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
   * Label **values** may be empty, but, if present, must contain 1 to 63
   * characters, and must conform to
   * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
   * No more than 32 labels can be associated with a template.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 6;</code>
   */
  public boolean containsLabels(java.lang.String key) {
    if (key == null) {
      throw new java.lang.NullPointerException();
    }
    return internalGetLabels().getMap().containsKey(key);
  }
  /** Use {@link #getLabelsMap()} instead. */
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, java.lang.String> getLabels() {
    return getLabelsMap();
  }
  /**
   *
   *
   * <pre>
   * Optional. The labels to associate with this template. These labels
   * will be propagated to all jobs and clusters created by the workflow
   * instance.
   * Label **keys** must contain 1 to 63 characters, and must conform to
   * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
   * Label **values** may be empty, but, if present, must contain 1 to 63
   * characters, and must conform to
   * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
   * No more than 32 labels can be associated with a template.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 6;</code>
   */
  public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() {
    return internalGetLabels().getMap();
  }
  /**
   *
   *
   * <pre>
   * Optional. The labels to associate with this template. These labels
   * will be propagated to all jobs and clusters created by the workflow
   * instance.
   * Label **keys** must contain 1 to 63 characters, and must conform to
   * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
   * Label **values** may be empty, but, if present, must contain 1 to 63
   * characters, and must conform to
   * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
   * No more than 32 labels can be associated with a template.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 6;</code>
   */
  public java.lang.String getLabelsOrDefault(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 = internalGetLabels().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   *
   *
   * <pre>
   * Optional. The labels to associate with this template. These labels
   * will be propagated to all jobs and clusters created by the workflow
   * instance.
   * Label **keys** must contain 1 to 63 characters, and must conform to
   * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
   * Label **values** may be empty, but, if present, must contain 1 to 63
   * characters, and must conform to
   * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
   * No more than 32 labels can be associated with a template.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 6;</code>
   */
  public java.lang.String getLabelsOrThrow(java.lang.String key) {
    if (key == null) {
      throw new java.lang.NullPointerException();
    }
    java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  public static final int PLACEMENT_FIELD_NUMBER = 7;
  private com.google.cloud.dataproc.v1.WorkflowTemplatePlacement placement_;
  /**
   *
   *
   * <pre>
   * Required. WorkflowTemplate scheduling information.
   * </pre>
   *
   * <code>.google.cloud.dataproc.v1.WorkflowTemplatePlacement placement = 7;</code>
   */
  public boolean hasPlacement() {
    return placement_ != null;
  }
  /**
   *
   *
   * <pre>
   * Required. WorkflowTemplate scheduling information.
   * </pre>
   *
   * <code>.google.cloud.dataproc.v1.WorkflowTemplatePlacement placement = 7;</code>
   */
  public com.google.cloud.dataproc.v1.WorkflowTemplatePlacement getPlacement() {
    return placement_ == null
        ? com.google.cloud.dataproc.v1.WorkflowTemplatePlacement.getDefaultInstance()
        : placement_;
  }
  /**
   *
   *
   * <pre>
   * Required. WorkflowTemplate scheduling information.
   * </pre>
   *
   * <code>.google.cloud.dataproc.v1.WorkflowTemplatePlacement placement = 7;</code>
   */
  public com.google.cloud.dataproc.v1.WorkflowTemplatePlacementOrBuilder getPlacementOrBuilder() {
    return getPlacement();
  }

  public static final int JOBS_FIELD_NUMBER = 8;
  private java.util.List<com.google.cloud.dataproc.v1.OrderedJob> jobs_;
  /**
   *
   *
   * <pre>
   * Required. The Directed Acyclic Graph of Jobs to submit.
   * </pre>
   *
   * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
   */
  public java.util.List<com.google.cloud.dataproc.v1.OrderedJob> getJobsList() {
    return jobs_;
  }
  /**
   *
   *
   * <pre>
   * Required. The Directed Acyclic Graph of Jobs to submit.
   * </pre>
   *
   * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
   */
  public java.util.List<? extends com.google.cloud.dataproc.v1.OrderedJobOrBuilder>
      getJobsOrBuilderList() {
    return jobs_;
  }
  /**
   *
   *
   * <pre>
   * Required. The Directed Acyclic Graph of Jobs to submit.
   * </pre>
   *
   * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
   */
  public int getJobsCount() {
    return jobs_.size();
  }
  /**
   *
   *
   * <pre>
   * Required. The Directed Acyclic Graph of Jobs to submit.
   * </pre>
   *
   * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
   */
  public com.google.cloud.dataproc.v1.OrderedJob getJobs(int index) {
    return jobs_.get(index);
  }
  /**
   *
   *
   * <pre>
   * Required. The Directed Acyclic Graph of Jobs to submit.
   * </pre>
   *
   * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
   */
  public com.google.cloud.dataproc.v1.OrderedJobOrBuilder getJobsOrBuilder(int index) {
    return jobs_.get(index);
  }

  public static final int PARAMETERS_FIELD_NUMBER = 9;
  private java.util.List<com.google.cloud.dataproc.v1.TemplateParameter> parameters_;
  /**
   *
   *
   * <pre>
   * Optional. Template parameters whose values are substituted into the
   * template. Values for parameters must be provided when the template is
   * instantiated.
   * </pre>
   *
   * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
   */
  public java.util.List<com.google.cloud.dataproc.v1.TemplateParameter> getParametersList() {
    return parameters_;
  }
  /**
   *
   *
   * <pre>
   * Optional. Template parameters whose values are substituted into the
   * template. Values for parameters must be provided when the template is
   * instantiated.
   * </pre>
   *
   * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
   */
  public java.util.List<? extends com.google.cloud.dataproc.v1.TemplateParameterOrBuilder>
      getParametersOrBuilderList() {
    return parameters_;
  }
  /**
   *
   *
   * <pre>
   * Optional. Template parameters whose values are substituted into the
   * template. Values for parameters must be provided when the template is
   * instantiated.
   * </pre>
   *
   * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
   */
  public int getParametersCount() {
    return parameters_.size();
  }
  /**
   *
   *
   * <pre>
   * Optional. Template parameters whose values are substituted into the
   * template. Values for parameters must be provided when the template is
   * instantiated.
   * </pre>
   *
   * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
   */
  public com.google.cloud.dataproc.v1.TemplateParameter getParameters(int index) {
    return parameters_.get(index);
  }
  /**
   *
   *
   * <pre>
   * Optional. Template parameters whose values are substituted into the
   * template. Values for parameters must be provided when the template is
   * instantiated.
   * </pre>
   *
   * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
   */
  public com.google.cloud.dataproc.v1.TemplateParameterOrBuilder getParametersOrBuilder(int index) {
    return parameters_.get(index);
  }

  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 (!getNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
    }
    if (!getIdBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, id_);
    }
    if (version_ != 0) {
      output.writeInt32(3, version_);
    }
    if (createTime_ != null) {
      output.writeMessage(4, getCreateTime());
    }
    if (updateTime_ != null) {
      output.writeMessage(5, getUpdateTime());
    }
    com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(
        output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 6);
    if (placement_ != null) {
      output.writeMessage(7, getPlacement());
    }
    for (int i = 0; i < jobs_.size(); i++) {
      output.writeMessage(8, jobs_.get(i));
    }
    for (int i = 0; i < parameters_.size(); i++) {
      output.writeMessage(9, parameters_.get(i));
    }
    unknownFields.writeTo(output);
  }

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

    size = 0;
    if (!getNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
    }
    if (!getIdBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, id_);
    }
    if (version_ != 0) {
      size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, version_);
    }
    if (createTime_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getCreateTime());
    }
    if (updateTime_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getUpdateTime());
    }
    for (java.util.Map.Entry<java.lang.String, java.lang.String> entry :
        internalGetLabels().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.String, java.lang.String> labels__ =
          LabelsDefaultEntryHolder.defaultEntry
              .newBuilderForType()
              .setKey(entry.getKey())
              .setValue(entry.getValue())
              .build();
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, labels__);
    }
    if (placement_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getPlacement());
    }
    for (int i = 0; i < jobs_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, jobs_.get(i));
    }
    for (int i = 0; i < parameters_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, parameters_.get(i));
    }
    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.dataproc.v1.WorkflowTemplate)) {
      return super.equals(obj);
    }
    com.google.cloud.dataproc.v1.WorkflowTemplate other =
        (com.google.cloud.dataproc.v1.WorkflowTemplate) obj;

    if (!getId().equals(other.getId())) return false;
    if (!getName().equals(other.getName())) return false;
    if (getVersion() != other.getVersion()) return false;
    if (hasCreateTime() != other.hasCreateTime()) return false;
    if (hasCreateTime()) {
      if (!getCreateTime().equals(other.getCreateTime())) return false;
    }
    if (hasUpdateTime() != other.hasUpdateTime()) return false;
    if (hasUpdateTime()) {
      if (!getUpdateTime().equals(other.getUpdateTime())) return false;
    }
    if (!internalGetLabels().equals(other.internalGetLabels())) return false;
    if (hasPlacement() != other.hasPlacement()) return false;
    if (hasPlacement()) {
      if (!getPlacement().equals(other.getPlacement())) return false;
    }
    if (!getJobsList().equals(other.getJobsList())) return false;
    if (!getParametersList().equals(other.getParametersList())) 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) + ID_FIELD_NUMBER;
    hash = (53 * hash) + getId().hashCode();
    hash = (37 * hash) + NAME_FIELD_NUMBER;
    hash = (53 * hash) + getName().hashCode();
    hash = (37 * hash) + VERSION_FIELD_NUMBER;
    hash = (53 * hash) + getVersion();
    if (hasCreateTime()) {
      hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER;
      hash = (53 * hash) + getCreateTime().hashCode();
    }
    if (hasUpdateTime()) {
      hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER;
      hash = (53 * hash) + getUpdateTime().hashCode();
    }
    if (!internalGetLabels().getMap().isEmpty()) {
      hash = (37 * hash) + LABELS_FIELD_NUMBER;
      hash = (53 * hash) + internalGetLabels().hashCode();
    }
    if (hasPlacement()) {
      hash = (37 * hash) + PLACEMENT_FIELD_NUMBER;
      hash = (53 * hash) + getPlacement().hashCode();
    }
    if (getJobsCount() > 0) {
      hash = (37 * hash) + JOBS_FIELD_NUMBER;
      hash = (53 * hash) + getJobsList().hashCode();
    }
    if (getParametersCount() > 0) {
      hash = (37 * hash) + PARAMETERS_FIELD_NUMBER;
      hash = (53 * hash) + getParametersList().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.dataproc.v1.WorkflowTemplate parseFrom(java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.dataproc.v1.WorkflowTemplate 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.dataproc.v1.WorkflowTemplate parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.dataproc.v1.WorkflowTemplate 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.dataproc.v1.WorkflowTemplate parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

  public static com.google.cloud.dataproc.v1.WorkflowTemplate 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.dataproc.v1.WorkflowTemplate parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.dataproc.v1.WorkflowTemplate 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.dataproc.v1.WorkflowTemplate parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.dataproc.v1.WorkflowTemplate 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.dataproc.v1.WorkflowTemplate 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>
   * A Cloud Dataproc workflow template resource.
   * </pre>
   *
   * Protobuf type {@code google.cloud.dataproc.v1.WorkflowTemplate}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.dataproc.v1.WorkflowTemplate)
      com.google.cloud.dataproc.v1.WorkflowTemplateOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.dataproc.v1.WorkflowTemplatesProto
          .internal_static_google_cloud_dataproc_v1_WorkflowTemplate_descriptor;
    }

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

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

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.dataproc.v1.WorkflowTemplatesProto
          .internal_static_google_cloud_dataproc_v1_WorkflowTemplate_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.dataproc.v1.WorkflowTemplate.class,
              com.google.cloud.dataproc.v1.WorkflowTemplate.Builder.class);
    }

    // Construct using com.google.cloud.dataproc.v1.WorkflowTemplate.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

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

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      id_ = "";

      name_ = "";

      version_ = 0;

      if (createTimeBuilder_ == null) {
        createTime_ = null;
      } else {
        createTime_ = null;
        createTimeBuilder_ = null;
      }
      if (updateTimeBuilder_ == null) {
        updateTime_ = null;
      } else {
        updateTime_ = null;
        updateTimeBuilder_ = null;
      }
      internalGetMutableLabels().clear();
      if (placementBuilder_ == null) {
        placement_ = null;
      } else {
        placement_ = null;
        placementBuilder_ = null;
      }
      if (jobsBuilder_ == null) {
        jobs_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000080);
      } else {
        jobsBuilder_.clear();
      }
      if (parametersBuilder_ == null) {
        parameters_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000100);
      } else {
        parametersBuilder_.clear();
      }
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.dataproc.v1.WorkflowTemplatesProto
          .internal_static_google_cloud_dataproc_v1_WorkflowTemplate_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.dataproc.v1.WorkflowTemplate getDefaultInstanceForType() {
      return com.google.cloud.dataproc.v1.WorkflowTemplate.getDefaultInstance();
    }

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

    @java.lang.Override
    public com.google.cloud.dataproc.v1.WorkflowTemplate buildPartial() {
      com.google.cloud.dataproc.v1.WorkflowTemplate result =
          new com.google.cloud.dataproc.v1.WorkflowTemplate(this);
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      result.id_ = id_;
      result.name_ = name_;
      result.version_ = version_;
      if (createTimeBuilder_ == null) {
        result.createTime_ = createTime_;
      } else {
        result.createTime_ = createTimeBuilder_.build();
      }
      if (updateTimeBuilder_ == null) {
        result.updateTime_ = updateTime_;
      } else {
        result.updateTime_ = updateTimeBuilder_.build();
      }
      result.labels_ = internalGetLabels();
      result.labels_.makeImmutable();
      if (placementBuilder_ == null) {
        result.placement_ = placement_;
      } else {
        result.placement_ = placementBuilder_.build();
      }
      if (jobsBuilder_ == null) {
        if (((bitField0_ & 0x00000080) != 0)) {
          jobs_ = java.util.Collections.unmodifiableList(jobs_);
          bitField0_ = (bitField0_ & ~0x00000080);
        }
        result.jobs_ = jobs_;
      } else {
        result.jobs_ = jobsBuilder_.build();
      }
      if (parametersBuilder_ == null) {
        if (((bitField0_ & 0x00000100) != 0)) {
          parameters_ = java.util.Collections.unmodifiableList(parameters_);
          bitField0_ = (bitField0_ & ~0x00000100);
        }
        result.parameters_ = parameters_;
      } else {
        result.parameters_ = parametersBuilder_.build();
      }
      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.dataproc.v1.WorkflowTemplate) {
        return mergeFrom((com.google.cloud.dataproc.v1.WorkflowTemplate) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.dataproc.v1.WorkflowTemplate other) {
      if (other == com.google.cloud.dataproc.v1.WorkflowTemplate.getDefaultInstance()) return this;
      if (!other.getId().isEmpty()) {
        id_ = other.id_;
        onChanged();
      }
      if (!other.getName().isEmpty()) {
        name_ = other.name_;
        onChanged();
      }
      if (other.getVersion() != 0) {
        setVersion(other.getVersion());
      }
      if (other.hasCreateTime()) {
        mergeCreateTime(other.getCreateTime());
      }
      if (other.hasUpdateTime()) {
        mergeUpdateTime(other.getUpdateTime());
      }
      internalGetMutableLabels().mergeFrom(other.internalGetLabels());
      if (other.hasPlacement()) {
        mergePlacement(other.getPlacement());
      }
      if (jobsBuilder_ == null) {
        if (!other.jobs_.isEmpty()) {
          if (jobs_.isEmpty()) {
            jobs_ = other.jobs_;
            bitField0_ = (bitField0_ & ~0x00000080);
          } else {
            ensureJobsIsMutable();
            jobs_.addAll(other.jobs_);
          }
          onChanged();
        }
      } else {
        if (!other.jobs_.isEmpty()) {
          if (jobsBuilder_.isEmpty()) {
            jobsBuilder_.dispose();
            jobsBuilder_ = null;
            jobs_ = other.jobs_;
            bitField0_ = (bitField0_ & ~0x00000080);
            jobsBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getJobsFieldBuilder()
                    : null;
          } else {
            jobsBuilder_.addAllMessages(other.jobs_);
          }
        }
      }
      if (parametersBuilder_ == null) {
        if (!other.parameters_.isEmpty()) {
          if (parameters_.isEmpty()) {
            parameters_ = other.parameters_;
            bitField0_ = (bitField0_ & ~0x00000100);
          } else {
            ensureParametersIsMutable();
            parameters_.addAll(other.parameters_);
          }
          onChanged();
        }
      } else {
        if (!other.parameters_.isEmpty()) {
          if (parametersBuilder_.isEmpty()) {
            parametersBuilder_.dispose();
            parametersBuilder_ = null;
            parameters_ = other.parameters_;
            bitField0_ = (bitField0_ & ~0x00000100);
            parametersBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getParametersFieldBuilder()
                    : null;
          } else {
            parametersBuilder_.addAllMessages(other.parameters_);
          }
        }
      }
      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.dataproc.v1.WorkflowTemplate parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.cloud.dataproc.v1.WorkflowTemplate) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private int bitField0_;

    private java.lang.Object id_ = "";
    /**
     *
     *
     * <pre>
     * Required. The template id.
     * The id must contain only letters (a-z, A-Z), numbers (0-9),
     * underscores (_), and hyphens (-). Cannot begin or end with underscore
     * or hyphen. Must consist of between 3 and 50 characters.
     * </pre>
     *
     * <code>string id = 2;</code>
     */
    public java.lang.String getId() {
      java.lang.Object ref = id_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        id_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Required. The template id.
     * The id must contain only letters (a-z, A-Z), numbers (0-9),
     * underscores (_), and hyphens (-). Cannot begin or end with underscore
     * or hyphen. Must consist of between 3 and 50 characters.
     * </pre>
     *
     * <code>string id = 2;</code>
     */
    public com.google.protobuf.ByteString getIdBytes() {
      java.lang.Object ref = id_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        id_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Required. The template id.
     * The id must contain only letters (a-z, A-Z), numbers (0-9),
     * underscores (_), and hyphens (-). Cannot begin or end with underscore
     * or hyphen. Must consist of between 3 and 50 characters.
     * </pre>
     *
     * <code>string id = 2;</code>
     */
    public Builder setId(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      id_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. The template id.
     * The id must contain only letters (a-z, A-Z), numbers (0-9),
     * underscores (_), and hyphens (-). Cannot begin or end with underscore
     * or hyphen. Must consist of between 3 and 50 characters.
     * </pre>
     *
     * <code>string id = 2;</code>
     */
    public Builder clearId() {

      id_ = getDefaultInstance().getId();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. The template id.
     * The id must contain only letters (a-z, A-Z), numbers (0-9),
     * underscores (_), and hyphens (-). Cannot begin or end with underscore
     * or hyphen. Must consist of between 3 and 50 characters.
     * </pre>
     *
     * <code>string id = 2;</code>
     */
    public Builder setIdBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

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

    private java.lang.Object name_ = "";
    /**
     *
     *
     * <pre>
     * Output only. The "resource name" of the template, as described
     * in https://cloud.google.com/apis/design/resource_names of the form
     * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public java.lang.String getName() {
      java.lang.Object ref = name_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        name_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The "resource name" of the template, as described
     * in https://cloud.google.com/apis/design/resource_names of the form
     * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public com.google.protobuf.ByteString getNameBytes() {
      java.lang.Object ref = name_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        name_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The "resource name" of the template, as described
     * in https://cloud.google.com/apis/design/resource_names of the form
     * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public Builder setName(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      name_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The "resource name" of the template, as described
     * in https://cloud.google.com/apis/design/resource_names of the form
     * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public Builder clearName() {

      name_ = getDefaultInstance().getName();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The "resource name" of the template, as described
     * in https://cloud.google.com/apis/design/resource_names of the form
     * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}`
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public Builder setNameBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

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

    private int version_;
    /**
     *
     *
     * <pre>
     * Optional. Used to perform a consistent read-modify-write.
     * This field should be left blank for a `CreateWorkflowTemplate` request. It
     * is required for an `UpdateWorkflowTemplate` request, and must match the
     * current server version. A typical update template flow would fetch the
     * current template with a `GetWorkflowTemplate` request, which will return
     * the current template with the `version` field filled in with the
     * current server version. The user updates other fields in the template,
     * then returns it as part of the `UpdateWorkflowTemplate` request.
     * </pre>
     *
     * <code>int32 version = 3;</code>
     */
    public int getVersion() {
      return version_;
    }
    /**
     *
     *
     * <pre>
     * Optional. Used to perform a consistent read-modify-write.
     * This field should be left blank for a `CreateWorkflowTemplate` request. It
     * is required for an `UpdateWorkflowTemplate` request, and must match the
     * current server version. A typical update template flow would fetch the
     * current template with a `GetWorkflowTemplate` request, which will return
     * the current template with the `version` field filled in with the
     * current server version. The user updates other fields in the template,
     * then returns it as part of the `UpdateWorkflowTemplate` request.
     * </pre>
     *
     * <code>int32 version = 3;</code>
     */
    public Builder setVersion(int value) {

      version_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Used to perform a consistent read-modify-write.
     * This field should be left blank for a `CreateWorkflowTemplate` request. It
     * is required for an `UpdateWorkflowTemplate` request, and must match the
     * current server version. A typical update template flow would fetch the
     * current template with a `GetWorkflowTemplate` request, which will return
     * the current template with the `version` field filled in with the
     * current server version. The user updates other fields in the template,
     * then returns it as part of the `UpdateWorkflowTemplate` request.
     * </pre>
     *
     * <code>int32 version = 3;</code>
     */
    public Builder clearVersion() {

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

    private com.google.protobuf.Timestamp createTime_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp,
            com.google.protobuf.Timestamp.Builder,
            com.google.protobuf.TimestampOrBuilder>
        createTimeBuilder_;
    /**
     *
     *
     * <pre>
     * Output only. The time template was created.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 4;</code>
     */
    public boolean hasCreateTime() {
      return createTimeBuilder_ != null || createTime_ != null;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was created.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 4;</code>
     */
    public com.google.protobuf.Timestamp getCreateTime() {
      if (createTimeBuilder_ == null) {
        return createTime_ == null
            ? com.google.protobuf.Timestamp.getDefaultInstance()
            : createTime_;
      } else {
        return createTimeBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was created.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 4;</code>
     */
    public Builder setCreateTime(com.google.protobuf.Timestamp value) {
      if (createTimeBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        createTime_ = value;
        onChanged();
      } else {
        createTimeBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was created.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 4;</code>
     */
    public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) {
      if (createTimeBuilder_ == null) {
        createTime_ = builderForValue.build();
        onChanged();
      } else {
        createTimeBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was created.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 4;</code>
     */
    public Builder mergeCreateTime(com.google.protobuf.Timestamp value) {
      if (createTimeBuilder_ == null) {
        if (createTime_ != null) {
          createTime_ =
              com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial();
        } else {
          createTime_ = value;
        }
        onChanged();
      } else {
        createTimeBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was created.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 4;</code>
     */
    public Builder clearCreateTime() {
      if (createTimeBuilder_ == null) {
        createTime_ = null;
        onChanged();
      } else {
        createTime_ = null;
        createTimeBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was created.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 4;</code>
     */
    public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() {

      onChanged();
      return getCreateTimeFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was created.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 4;</code>
     */
    public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() {
      if (createTimeBuilder_ != null) {
        return createTimeBuilder_.getMessageOrBuilder();
      } else {
        return createTime_ == null
            ? com.google.protobuf.Timestamp.getDefaultInstance()
            : createTime_;
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was created.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 4;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp,
            com.google.protobuf.Timestamp.Builder,
            com.google.protobuf.TimestampOrBuilder>
        getCreateTimeFieldBuilder() {
      if (createTimeBuilder_ == null) {
        createTimeBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Timestamp,
                com.google.protobuf.Timestamp.Builder,
                com.google.protobuf.TimestampOrBuilder>(
                getCreateTime(), getParentForChildren(), isClean());
        createTime_ = null;
      }
      return createTimeBuilder_;
    }

    private com.google.protobuf.Timestamp updateTime_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp,
            com.google.protobuf.Timestamp.Builder,
            com.google.protobuf.TimestampOrBuilder>
        updateTimeBuilder_;
    /**
     *
     *
     * <pre>
     * Output only. The time template was last updated.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 5;</code>
     */
    public boolean hasUpdateTime() {
      return updateTimeBuilder_ != null || updateTime_ != null;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was last updated.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 5;</code>
     */
    public com.google.protobuf.Timestamp getUpdateTime() {
      if (updateTimeBuilder_ == null) {
        return updateTime_ == null
            ? com.google.protobuf.Timestamp.getDefaultInstance()
            : updateTime_;
      } else {
        return updateTimeBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was last updated.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 5;</code>
     */
    public Builder setUpdateTime(com.google.protobuf.Timestamp value) {
      if (updateTimeBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        updateTime_ = value;
        onChanged();
      } else {
        updateTimeBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was last updated.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 5;</code>
     */
    public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) {
      if (updateTimeBuilder_ == null) {
        updateTime_ = builderForValue.build();
        onChanged();
      } else {
        updateTimeBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was last updated.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 5;</code>
     */
    public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) {
      if (updateTimeBuilder_ == null) {
        if (updateTime_ != null) {
          updateTime_ =
              com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial();
        } else {
          updateTime_ = value;
        }
        onChanged();
      } else {
        updateTimeBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was last updated.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 5;</code>
     */
    public Builder clearUpdateTime() {
      if (updateTimeBuilder_ == null) {
        updateTime_ = null;
        onChanged();
      } else {
        updateTime_ = null;
        updateTimeBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was last updated.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 5;</code>
     */
    public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() {

      onChanged();
      return getUpdateTimeFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was last updated.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 5;</code>
     */
    public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() {
      if (updateTimeBuilder_ != null) {
        return updateTimeBuilder_.getMessageOrBuilder();
      } else {
        return updateTime_ == null
            ? com.google.protobuf.Timestamp.getDefaultInstance()
            : updateTime_;
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The time template was last updated.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp update_time = 5;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp,
            com.google.protobuf.Timestamp.Builder,
            com.google.protobuf.TimestampOrBuilder>
        getUpdateTimeFieldBuilder() {
      if (updateTimeBuilder_ == null) {
        updateTimeBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Timestamp,
                com.google.protobuf.Timestamp.Builder,
                com.google.protobuf.TimestampOrBuilder>(
                getUpdateTime(), getParentForChildren(), isClean());
        updateTime_ = null;
      }
      return updateTimeBuilder_;
    }

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

    private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetLabels() {
      if (labels_ == null) {
        return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry);
      }
      return labels_;
    }

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

    public int getLabelsCount() {
      return internalGetLabels().getMap().size();
    }
    /**
     *
     *
     * <pre>
     * Optional. The labels to associate with this template. These labels
     * will be propagated to all jobs and clusters created by the workflow
     * instance.
     * Label **keys** must contain 1 to 63 characters, and must conform to
     * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
     * Label **values** may be empty, but, if present, must contain 1 to 63
     * characters, and must conform to
     * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
     * No more than 32 labels can be associated with a template.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 6;</code>
     */
    public boolean containsLabels(java.lang.String key) {
      if (key == null) {
        throw new java.lang.NullPointerException();
      }
      return internalGetLabels().getMap().containsKey(key);
    }
    /** Use {@link #getLabelsMap()} instead. */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getLabels() {
      return getLabelsMap();
    }
    /**
     *
     *
     * <pre>
     * Optional. The labels to associate with this template. These labels
     * will be propagated to all jobs and clusters created by the workflow
     * instance.
     * Label **keys** must contain 1 to 63 characters, and must conform to
     * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
     * Label **values** may be empty, but, if present, must contain 1 to 63
     * characters, and must conform to
     * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
     * No more than 32 labels can be associated with a template.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 6;</code>
     */
    public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() {
      return internalGetLabels().getMap();
    }
    /**
     *
     *
     * <pre>
     * Optional. The labels to associate with this template. These labels
     * will be propagated to all jobs and clusters created by the workflow
     * instance.
     * Label **keys** must contain 1 to 63 characters, and must conform to
     * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
     * Label **values** may be empty, but, if present, must contain 1 to 63
     * characters, and must conform to
     * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
     * No more than 32 labels can be associated with a template.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 6;</code>
     */
    public java.lang.String getLabelsOrDefault(
        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 = internalGetLabels().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     *
     *
     * <pre>
     * Optional. The labels to associate with this template. These labels
     * will be propagated to all jobs and clusters created by the workflow
     * instance.
     * Label **keys** must contain 1 to 63 characters, and must conform to
     * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
     * Label **values** may be empty, but, if present, must contain 1 to 63
     * characters, and must conform to
     * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
     * No more than 32 labels can be associated with a template.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 6;</code>
     */
    public java.lang.String getLabelsOrThrow(java.lang.String key) {
      if (key == null) {
        throw new java.lang.NullPointerException();
      }
      java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearLabels() {
      internalGetMutableLabels().getMutableMap().clear();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The labels to associate with this template. These labels
     * will be propagated to all jobs and clusters created by the workflow
     * instance.
     * Label **keys** must contain 1 to 63 characters, and must conform to
     * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
     * Label **values** may be empty, but, if present, must contain 1 to 63
     * characters, and must conform to
     * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
     * No more than 32 labels can be associated with a template.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 6;</code>
     */
    public Builder removeLabels(java.lang.String key) {
      if (key == null) {
        throw new java.lang.NullPointerException();
      }
      internalGetMutableLabels().getMutableMap().remove(key);
      return this;
    }
    /** Use alternate mutation accessors instead. */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getMutableLabels() {
      return internalGetMutableLabels().getMutableMap();
    }
    /**
     *
     *
     * <pre>
     * Optional. The labels to associate with this template. These labels
     * will be propagated to all jobs and clusters created by the workflow
     * instance.
     * Label **keys** must contain 1 to 63 characters, and must conform to
     * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
     * Label **values** may be empty, but, if present, must contain 1 to 63
     * characters, and must conform to
     * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
     * No more than 32 labels can be associated with a template.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 6;</code>
     */
    public Builder putLabels(java.lang.String key, java.lang.String value) {
      if (key == null) {
        throw new java.lang.NullPointerException();
      }
      if (value == null) {
        throw new java.lang.NullPointerException();
      }
      internalGetMutableLabels().getMutableMap().put(key, value);
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The labels to associate with this template. These labels
     * will be propagated to all jobs and clusters created by the workflow
     * instance.
     * Label **keys** must contain 1 to 63 characters, and must conform to
     * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
     * Label **values** may be empty, but, if present, must contain 1 to 63
     * characters, and must conform to
     * [RFC 1035](https://www.ietf.org/rfc/rfc1035.txt).
     * No more than 32 labels can be associated with a template.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 6;</code>
     */
    public Builder putAllLabels(java.util.Map<java.lang.String, java.lang.String> values) {
      internalGetMutableLabels().getMutableMap().putAll(values);
      return this;
    }

    private com.google.cloud.dataproc.v1.WorkflowTemplatePlacement placement_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.dataproc.v1.WorkflowTemplatePlacement,
            com.google.cloud.dataproc.v1.WorkflowTemplatePlacement.Builder,
            com.google.cloud.dataproc.v1.WorkflowTemplatePlacementOrBuilder>
        placementBuilder_;
    /**
     *
     *
     * <pre>
     * Required. WorkflowTemplate scheduling information.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.WorkflowTemplatePlacement placement = 7;</code>
     */
    public boolean hasPlacement() {
      return placementBuilder_ != null || placement_ != null;
    }
    /**
     *
     *
     * <pre>
     * Required. WorkflowTemplate scheduling information.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.WorkflowTemplatePlacement placement = 7;</code>
     */
    public com.google.cloud.dataproc.v1.WorkflowTemplatePlacement getPlacement() {
      if (placementBuilder_ == null) {
        return placement_ == null
            ? com.google.cloud.dataproc.v1.WorkflowTemplatePlacement.getDefaultInstance()
            : placement_;
      } else {
        return placementBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Required. WorkflowTemplate scheduling information.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.WorkflowTemplatePlacement placement = 7;</code>
     */
    public Builder setPlacement(com.google.cloud.dataproc.v1.WorkflowTemplatePlacement value) {
      if (placementBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        placement_ = value;
        onChanged();
      } else {
        placementBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. WorkflowTemplate scheduling information.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.WorkflowTemplatePlacement placement = 7;</code>
     */
    public Builder setPlacement(
        com.google.cloud.dataproc.v1.WorkflowTemplatePlacement.Builder builderForValue) {
      if (placementBuilder_ == null) {
        placement_ = builderForValue.build();
        onChanged();
      } else {
        placementBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. WorkflowTemplate scheduling information.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.WorkflowTemplatePlacement placement = 7;</code>
     */
    public Builder mergePlacement(com.google.cloud.dataproc.v1.WorkflowTemplatePlacement value) {
      if (placementBuilder_ == null) {
        if (placement_ != null) {
          placement_ =
              com.google.cloud.dataproc.v1.WorkflowTemplatePlacement.newBuilder(placement_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          placement_ = value;
        }
        onChanged();
      } else {
        placementBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. WorkflowTemplate scheduling information.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.WorkflowTemplatePlacement placement = 7;</code>
     */
    public Builder clearPlacement() {
      if (placementBuilder_ == null) {
        placement_ = null;
        onChanged();
      } else {
        placement_ = null;
        placementBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. WorkflowTemplate scheduling information.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.WorkflowTemplatePlacement placement = 7;</code>
     */
    public com.google.cloud.dataproc.v1.WorkflowTemplatePlacement.Builder getPlacementBuilder() {

      onChanged();
      return getPlacementFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Required. WorkflowTemplate scheduling information.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.WorkflowTemplatePlacement placement = 7;</code>
     */
    public com.google.cloud.dataproc.v1.WorkflowTemplatePlacementOrBuilder getPlacementOrBuilder() {
      if (placementBuilder_ != null) {
        return placementBuilder_.getMessageOrBuilder();
      } else {
        return placement_ == null
            ? com.google.cloud.dataproc.v1.WorkflowTemplatePlacement.getDefaultInstance()
            : placement_;
      }
    }
    /**
     *
     *
     * <pre>
     * Required. WorkflowTemplate scheduling information.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.WorkflowTemplatePlacement placement = 7;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.dataproc.v1.WorkflowTemplatePlacement,
            com.google.cloud.dataproc.v1.WorkflowTemplatePlacement.Builder,
            com.google.cloud.dataproc.v1.WorkflowTemplatePlacementOrBuilder>
        getPlacementFieldBuilder() {
      if (placementBuilder_ == null) {
        placementBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.dataproc.v1.WorkflowTemplatePlacement,
                com.google.cloud.dataproc.v1.WorkflowTemplatePlacement.Builder,
                com.google.cloud.dataproc.v1.WorkflowTemplatePlacementOrBuilder>(
                getPlacement(), getParentForChildren(), isClean());
        placement_ = null;
      }
      return placementBuilder_;
    }

    private java.util.List<com.google.cloud.dataproc.v1.OrderedJob> jobs_ =
        java.util.Collections.emptyList();

    private void ensureJobsIsMutable() {
      if (!((bitField0_ & 0x00000080) != 0)) {
        jobs_ = new java.util.ArrayList<com.google.cloud.dataproc.v1.OrderedJob>(jobs_);
        bitField0_ |= 0x00000080;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.dataproc.v1.OrderedJob,
            com.google.cloud.dataproc.v1.OrderedJob.Builder,
            com.google.cloud.dataproc.v1.OrderedJobOrBuilder>
        jobsBuilder_;

    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public java.util.List<com.google.cloud.dataproc.v1.OrderedJob> getJobsList() {
      if (jobsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(jobs_);
      } else {
        return jobsBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public int getJobsCount() {
      if (jobsBuilder_ == null) {
        return jobs_.size();
      } else {
        return jobsBuilder_.getCount();
      }
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public com.google.cloud.dataproc.v1.OrderedJob getJobs(int index) {
      if (jobsBuilder_ == null) {
        return jobs_.get(index);
      } else {
        return jobsBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public Builder setJobs(int index, com.google.cloud.dataproc.v1.OrderedJob value) {
      if (jobsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureJobsIsMutable();
        jobs_.set(index, value);
        onChanged();
      } else {
        jobsBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public Builder setJobs(
        int index, com.google.cloud.dataproc.v1.OrderedJob.Builder builderForValue) {
      if (jobsBuilder_ == null) {
        ensureJobsIsMutable();
        jobs_.set(index, builderForValue.build());
        onChanged();
      } else {
        jobsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public Builder addJobs(com.google.cloud.dataproc.v1.OrderedJob value) {
      if (jobsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureJobsIsMutable();
        jobs_.add(value);
        onChanged();
      } else {
        jobsBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public Builder addJobs(int index, com.google.cloud.dataproc.v1.OrderedJob value) {
      if (jobsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureJobsIsMutable();
        jobs_.add(index, value);
        onChanged();
      } else {
        jobsBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public Builder addJobs(com.google.cloud.dataproc.v1.OrderedJob.Builder builderForValue) {
      if (jobsBuilder_ == null) {
        ensureJobsIsMutable();
        jobs_.add(builderForValue.build());
        onChanged();
      } else {
        jobsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public Builder addJobs(
        int index, com.google.cloud.dataproc.v1.OrderedJob.Builder builderForValue) {
      if (jobsBuilder_ == null) {
        ensureJobsIsMutable();
        jobs_.add(index, builderForValue.build());
        onChanged();
      } else {
        jobsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public Builder addAllJobs(
        java.lang.Iterable<? extends com.google.cloud.dataproc.v1.OrderedJob> values) {
      if (jobsBuilder_ == null) {
        ensureJobsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, jobs_);
        onChanged();
      } else {
        jobsBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public Builder clearJobs() {
      if (jobsBuilder_ == null) {
        jobs_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000080);
        onChanged();
      } else {
        jobsBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public Builder removeJobs(int index) {
      if (jobsBuilder_ == null) {
        ensureJobsIsMutable();
        jobs_.remove(index);
        onChanged();
      } else {
        jobsBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public com.google.cloud.dataproc.v1.OrderedJob.Builder getJobsBuilder(int index) {
      return getJobsFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public com.google.cloud.dataproc.v1.OrderedJobOrBuilder getJobsOrBuilder(int index) {
      if (jobsBuilder_ == null) {
        return jobs_.get(index);
      } else {
        return jobsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public java.util.List<? extends com.google.cloud.dataproc.v1.OrderedJobOrBuilder>
        getJobsOrBuilderList() {
      if (jobsBuilder_ != null) {
        return jobsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(jobs_);
      }
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public com.google.cloud.dataproc.v1.OrderedJob.Builder addJobsBuilder() {
      return getJobsFieldBuilder()
          .addBuilder(com.google.cloud.dataproc.v1.OrderedJob.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public com.google.cloud.dataproc.v1.OrderedJob.Builder addJobsBuilder(int index) {
      return getJobsFieldBuilder()
          .addBuilder(index, com.google.cloud.dataproc.v1.OrderedJob.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * Required. The Directed Acyclic Graph of Jobs to submit.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.OrderedJob jobs = 8;</code>
     */
    public java.util.List<com.google.cloud.dataproc.v1.OrderedJob.Builder> getJobsBuilderList() {
      return getJobsFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.dataproc.v1.OrderedJob,
            com.google.cloud.dataproc.v1.OrderedJob.Builder,
            com.google.cloud.dataproc.v1.OrderedJobOrBuilder>
        getJobsFieldBuilder() {
      if (jobsBuilder_ == null) {
        jobsBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.cloud.dataproc.v1.OrderedJob,
                com.google.cloud.dataproc.v1.OrderedJob.Builder,
                com.google.cloud.dataproc.v1.OrderedJobOrBuilder>(
                jobs_, ((bitField0_ & 0x00000080) != 0), getParentForChildren(), isClean());
        jobs_ = null;
      }
      return jobsBuilder_;
    }

    private java.util.List<com.google.cloud.dataproc.v1.TemplateParameter> parameters_ =
        java.util.Collections.emptyList();

    private void ensureParametersIsMutable() {
      if (!((bitField0_ & 0x00000100) != 0)) {
        parameters_ =
            new java.util.ArrayList<com.google.cloud.dataproc.v1.TemplateParameter>(parameters_);
        bitField0_ |= 0x00000100;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.dataproc.v1.TemplateParameter,
            com.google.cloud.dataproc.v1.TemplateParameter.Builder,
            com.google.cloud.dataproc.v1.TemplateParameterOrBuilder>
        parametersBuilder_;

    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public java.util.List<com.google.cloud.dataproc.v1.TemplateParameter> getParametersList() {
      if (parametersBuilder_ == null) {
        return java.util.Collections.unmodifiableList(parameters_);
      } else {
        return parametersBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public int getParametersCount() {
      if (parametersBuilder_ == null) {
        return parameters_.size();
      } else {
        return parametersBuilder_.getCount();
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public com.google.cloud.dataproc.v1.TemplateParameter getParameters(int index) {
      if (parametersBuilder_ == null) {
        return parameters_.get(index);
      } else {
        return parametersBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public Builder setParameters(int index, com.google.cloud.dataproc.v1.TemplateParameter value) {
      if (parametersBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureParametersIsMutable();
        parameters_.set(index, value);
        onChanged();
      } else {
        parametersBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public Builder setParameters(
        int index, com.google.cloud.dataproc.v1.TemplateParameter.Builder builderForValue) {
      if (parametersBuilder_ == null) {
        ensureParametersIsMutable();
        parameters_.set(index, builderForValue.build());
        onChanged();
      } else {
        parametersBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public Builder addParameters(com.google.cloud.dataproc.v1.TemplateParameter value) {
      if (parametersBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureParametersIsMutable();
        parameters_.add(value);
        onChanged();
      } else {
        parametersBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public Builder addParameters(int index, com.google.cloud.dataproc.v1.TemplateParameter value) {
      if (parametersBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureParametersIsMutable();
        parameters_.add(index, value);
        onChanged();
      } else {
        parametersBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public Builder addParameters(
        com.google.cloud.dataproc.v1.TemplateParameter.Builder builderForValue) {
      if (parametersBuilder_ == null) {
        ensureParametersIsMutable();
        parameters_.add(builderForValue.build());
        onChanged();
      } else {
        parametersBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public Builder addParameters(
        int index, com.google.cloud.dataproc.v1.TemplateParameter.Builder builderForValue) {
      if (parametersBuilder_ == null) {
        ensureParametersIsMutable();
        parameters_.add(index, builderForValue.build());
        onChanged();
      } else {
        parametersBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public Builder addAllParameters(
        java.lang.Iterable<? extends com.google.cloud.dataproc.v1.TemplateParameter> values) {
      if (parametersBuilder_ == null) {
        ensureParametersIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, parameters_);
        onChanged();
      } else {
        parametersBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public Builder clearParameters() {
      if (parametersBuilder_ == null) {
        parameters_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000100);
        onChanged();
      } else {
        parametersBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public Builder removeParameters(int index) {
      if (parametersBuilder_ == null) {
        ensureParametersIsMutable();
        parameters_.remove(index);
        onChanged();
      } else {
        parametersBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public com.google.cloud.dataproc.v1.TemplateParameter.Builder getParametersBuilder(int index) {
      return getParametersFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public com.google.cloud.dataproc.v1.TemplateParameterOrBuilder getParametersOrBuilder(
        int index) {
      if (parametersBuilder_ == null) {
        return parameters_.get(index);
      } else {
        return parametersBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public java.util.List<? extends com.google.cloud.dataproc.v1.TemplateParameterOrBuilder>
        getParametersOrBuilderList() {
      if (parametersBuilder_ != null) {
        return parametersBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(parameters_);
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public com.google.cloud.dataproc.v1.TemplateParameter.Builder addParametersBuilder() {
      return getParametersFieldBuilder()
          .addBuilder(com.google.cloud.dataproc.v1.TemplateParameter.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public com.google.cloud.dataproc.v1.TemplateParameter.Builder addParametersBuilder(int index) {
      return getParametersFieldBuilder()
          .addBuilder(index, com.google.cloud.dataproc.v1.TemplateParameter.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * Optional. Template parameters whose values are substituted into the
     * template. Values for parameters must be provided when the template is
     * instantiated.
     * </pre>
     *
     * <code>repeated .google.cloud.dataproc.v1.TemplateParameter parameters = 9;</code>
     */
    public java.util.List<com.google.cloud.dataproc.v1.TemplateParameter.Builder>
        getParametersBuilderList() {
      return getParametersFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.dataproc.v1.TemplateParameter,
            com.google.cloud.dataproc.v1.TemplateParameter.Builder,
            com.google.cloud.dataproc.v1.TemplateParameterOrBuilder>
        getParametersFieldBuilder() {
      if (parametersBuilder_ == null) {
        parametersBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.cloud.dataproc.v1.TemplateParameter,
                com.google.cloud.dataproc.v1.TemplateParameter.Builder,
                com.google.cloud.dataproc.v1.TemplateParameterOrBuilder>(
                parameters_, ((bitField0_ & 0x00000100) != 0), getParentForChildren(), isClean());
        parameters_ = null;
      }
      return parametersBuilder_;
    }

    @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.dataproc.v1.WorkflowTemplate)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.dataproc.v1.WorkflowTemplate)
  private static final com.google.cloud.dataproc.v1.WorkflowTemplate DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.dataproc.v1.WorkflowTemplate();
  }

  public static com.google.cloud.dataproc.v1.WorkflowTemplate getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

  @java.lang.Override
  public com.google.cloud.dataproc.v1.WorkflowTemplate getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
