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

package com.google.pubsub.v1;

/**
 *
 *
 * <pre>
 * A subscription resource.
 * </pre>
 *
 * Protobuf type {@code google.pubsub.v1.Subscription}
 */
public final class Subscription extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.pubsub.v1.Subscription)
    SubscriptionOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use Subscription.newBuilder() to construct.
  private Subscription(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private Subscription() {
    name_ = "";
    topic_ = "";
    ackDeadlineSeconds_ = 0;
    retainAckedMessages_ = false;
  }

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

  private Subscription(
      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();

              topic_ = s;
              break;
            }
          case 34:
            {
              com.google.pubsub.v1.PushConfig.Builder subBuilder = null;
              if (pushConfig_ != null) {
                subBuilder = pushConfig_.toBuilder();
              }
              pushConfig_ =
                  input.readMessage(com.google.pubsub.v1.PushConfig.parser(), extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(pushConfig_);
                pushConfig_ = subBuilder.buildPartial();
              }

              break;
            }
          case 40:
            {
              ackDeadlineSeconds_ = input.readInt32();
              break;
            }
          case 56:
            {
              retainAckedMessages_ = input.readBool();
              break;
            }
          case 66:
            {
              com.google.protobuf.Duration.Builder subBuilder = null;
              if (messageRetentionDuration_ != null) {
                subBuilder = messageRetentionDuration_.toBuilder();
              }
              messageRetentionDuration_ =
                  input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(messageRetentionDuration_);
                messageRetentionDuration_ = subBuilder.buildPartial();
              }

              break;
            }
          case 74:
            {
              if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
                labels_ =
                    com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry);
                mutable_bitField0_ |= 0x00000040;
              }
              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 90:
            {
              com.google.pubsub.v1.ExpirationPolicy.Builder subBuilder = null;
              if (expirationPolicy_ != null) {
                subBuilder = expirationPolicy_.toBuilder();
              }
              expirationPolicy_ =
                  input.readMessage(
                      com.google.pubsub.v1.ExpirationPolicy.parser(), extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(expirationPolicy_);
                expirationPolicy_ = subBuilder.buildPartial();
              }

              break;
            }
          default:
            {
              if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
    } finally {
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.pubsub.v1.PubsubProto
        .internal_static_google_pubsub_v1_Subscription_descriptor;
  }

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

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.pubsub.v1.PubsubProto
        .internal_static_google_pubsub_v1_Subscription_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.pubsub.v1.Subscription.class,
            com.google.pubsub.v1.Subscription.Builder.class);
  }

  private int bitField0_;
  public static final int NAME_FIELD_NUMBER = 1;
  private volatile java.lang.Object name_;
  /**
   *
   *
   * <pre>
   * The name of the subscription. It must have the format
   * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
   * start with a letter, and contain only letters (`[A-Za-z]`), numbers
   * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
   * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
   * in length, and it must not start with `"goog"`.
   * </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>
   * The name of the subscription. It must have the format
   * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
   * start with a letter, and contain only letters (`[A-Za-z]`), numbers
   * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
   * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
   * in length, and it must not start with `"goog"`.
   * </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 TOPIC_FIELD_NUMBER = 2;
  private volatile java.lang.Object topic_;
  /**
   *
   *
   * <pre>
   * The name of the topic from which this subscription is receiving messages.
   * Format is `projects/{project}/topics/{topic}`.
   * The value of this field will be `_deleted-topic_` if the topic has been
   * deleted.
   * </pre>
   *
   * <code>string topic = 2;</code>
   */
  public java.lang.String getTopic() {
    java.lang.Object ref = topic_;
    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();
      topic_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The name of the topic from which this subscription is receiving messages.
   * Format is `projects/{project}/topics/{topic}`.
   * The value of this field will be `_deleted-topic_` if the topic has been
   * deleted.
   * </pre>
   *
   * <code>string topic = 2;</code>
   */
  public com.google.protobuf.ByteString getTopicBytes() {
    java.lang.Object ref = topic_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      topic_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int PUSH_CONFIG_FIELD_NUMBER = 4;
  private com.google.pubsub.v1.PushConfig pushConfig_;
  /**
   *
   *
   * <pre>
   * If push delivery is used with this subscription, this field is
   * used to configure it. An empty `pushConfig` signifies that the subscriber
   * will pull and ack messages using API methods.
   * </pre>
   *
   * <code>.google.pubsub.v1.PushConfig push_config = 4;</code>
   */
  public boolean hasPushConfig() {
    return pushConfig_ != null;
  }
  /**
   *
   *
   * <pre>
   * If push delivery is used with this subscription, this field is
   * used to configure it. An empty `pushConfig` signifies that the subscriber
   * will pull and ack messages using API methods.
   * </pre>
   *
   * <code>.google.pubsub.v1.PushConfig push_config = 4;</code>
   */
  public com.google.pubsub.v1.PushConfig getPushConfig() {
    return pushConfig_ == null ? com.google.pubsub.v1.PushConfig.getDefaultInstance() : pushConfig_;
  }
  /**
   *
   *
   * <pre>
   * If push delivery is used with this subscription, this field is
   * used to configure it. An empty `pushConfig` signifies that the subscriber
   * will pull and ack messages using API methods.
   * </pre>
   *
   * <code>.google.pubsub.v1.PushConfig push_config = 4;</code>
   */
  public com.google.pubsub.v1.PushConfigOrBuilder getPushConfigOrBuilder() {
    return getPushConfig();
  }

  public static final int ACK_DEADLINE_SECONDS_FIELD_NUMBER = 5;
  private int ackDeadlineSeconds_;
  /**
   *
   *
   * <pre>
   * This value is the maximum time after a subscriber receives a message
   * before the subscriber should acknowledge the message. After message
   * delivery but before the ack deadline expires and before the message is
   * acknowledged, it is an outstanding message and will not be delivered
   * again during that time (on a best-effort basis).
   * For pull subscriptions, this value is used as the initial value for the ack
   * deadline. To override this value for a given message, call
   * `ModifyAckDeadline` with the corresponding `ack_id` if using
   * non-streaming pull or send the `ack_id` in a
   * `StreamingModifyAckDeadlineRequest` if using streaming pull.
   * The minimum custom deadline you can specify is 10 seconds.
   * The maximum custom deadline you can specify is 600 seconds (10 minutes).
   * If this parameter is 0, a default value of 10 seconds is used.
   * For push delivery, this value is also used to set the request timeout for
   * the call to the push endpoint.
   * If the subscriber never acknowledges the message, the Pub/Sub
   * system will eventually redeliver the message.
   * </pre>
   *
   * <code>int32 ack_deadline_seconds = 5;</code>
   */
  public int getAckDeadlineSeconds() {
    return ackDeadlineSeconds_;
  }

  public static final int RETAIN_ACKED_MESSAGES_FIELD_NUMBER = 7;
  private boolean retainAckedMessages_;
  /**
   *
   *
   * <pre>
   * Indicates whether to retain acknowledged messages. If true, then
   * messages are not expunged from the subscription's backlog, even if they are
   * acknowledged, until they fall out of the `message_retention_duration`
   * window.&lt;br&gt;&lt;br&gt;
   * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
   * changed in backward-incompatible ways and is not recommended for production
   * use. It is not subject to any SLA or deprecation policy.
   * </pre>
   *
   * <code>bool retain_acked_messages = 7;</code>
   */
  public boolean getRetainAckedMessages() {
    return retainAckedMessages_;
  }

  public static final int MESSAGE_RETENTION_DURATION_FIELD_NUMBER = 8;
  private com.google.protobuf.Duration messageRetentionDuration_;
  /**
   *
   *
   * <pre>
   * How long to retain unacknowledged messages in the subscription's backlog,
   * from the moment a message is published.
   * If `retain_acked_messages` is true, then this also configures the retention
   * of acknowledged messages, and thus configures how far back in time a `Seek`
   * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
   * minutes.&lt;br&gt;&lt;br&gt;
   * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
   * changed in backward-incompatible ways and is not recommended for production
   * use. It is not subject to any SLA or deprecation policy.
   * </pre>
   *
   * <code>.google.protobuf.Duration message_retention_duration = 8;</code>
   */
  public boolean hasMessageRetentionDuration() {
    return messageRetentionDuration_ != null;
  }
  /**
   *
   *
   * <pre>
   * How long to retain unacknowledged messages in the subscription's backlog,
   * from the moment a message is published.
   * If `retain_acked_messages` is true, then this also configures the retention
   * of acknowledged messages, and thus configures how far back in time a `Seek`
   * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
   * minutes.&lt;br&gt;&lt;br&gt;
   * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
   * changed in backward-incompatible ways and is not recommended for production
   * use. It is not subject to any SLA or deprecation policy.
   * </pre>
   *
   * <code>.google.protobuf.Duration message_retention_duration = 8;</code>
   */
  public com.google.protobuf.Duration getMessageRetentionDuration() {
    return messageRetentionDuration_ == null
        ? com.google.protobuf.Duration.getDefaultInstance()
        : messageRetentionDuration_;
  }
  /**
   *
   *
   * <pre>
   * How long to retain unacknowledged messages in the subscription's backlog,
   * from the moment a message is published.
   * If `retain_acked_messages` is true, then this also configures the retention
   * of acknowledged messages, and thus configures how far back in time a `Seek`
   * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
   * minutes.&lt;br&gt;&lt;br&gt;
   * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
   * changed in backward-incompatible ways and is not recommended for production
   * use. It is not subject to any SLA or deprecation policy.
   * </pre>
   *
   * <code>.google.protobuf.Duration message_retention_duration = 8;</code>
   */
  public com.google.protobuf.DurationOrBuilder getMessageRetentionDurationOrBuilder() {
    return getMessageRetentionDuration();
  }

  public static final int LABELS_FIELD_NUMBER = 9;

  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.pubsub.v1.PubsubProto
                .internal_static_google_pubsub_v1_Subscription_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>
   * See &lt;a href="/pubsub/docs/labels"&gt; Creating and managing labels&lt;/a&gt;.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 9;</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>
   * See &lt;a href="/pubsub/docs/labels"&gt; Creating and managing labels&lt;/a&gt;.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 9;</code>
   */
  public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() {
    return internalGetLabels().getMap();
  }
  /**
   *
   *
   * <pre>
   * See &lt;a href="/pubsub/docs/labels"&gt; Creating and managing labels&lt;/a&gt;.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 9;</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>
   * See &lt;a href="/pubsub/docs/labels"&gt; Creating and managing labels&lt;/a&gt;.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 9;</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 EXPIRATION_POLICY_FIELD_NUMBER = 11;
  private com.google.pubsub.v1.ExpirationPolicy expirationPolicy_;
  /**
   *
   *
   * <pre>
   * A policy that specifies the conditions for this subscription's expiration.
   * A subscription is considered active as long as any connected subscriber is
   * successfully consuming messages from the subscription or is issuing
   * operations on the subscription. If `expiration_policy` is not set, a
   * *default policy* with `ttl` of 31 days will be used. The minimum allowed
   * value for `expiration_policy.ttl` is 1 day.
   * &lt;b&gt;BETA:&lt;/b&gt; This feature is part of a beta release. This API might be
   * changed in backward-incompatible ways and is not recommended for production
   * use. It is not subject to any SLA or deprecation policy.
   * </pre>
   *
   * <code>.google.pubsub.v1.ExpirationPolicy expiration_policy = 11;</code>
   */
  public boolean hasExpirationPolicy() {
    return expirationPolicy_ != null;
  }
  /**
   *
   *
   * <pre>
   * A policy that specifies the conditions for this subscription's expiration.
   * A subscription is considered active as long as any connected subscriber is
   * successfully consuming messages from the subscription or is issuing
   * operations on the subscription. If `expiration_policy` is not set, a
   * *default policy* with `ttl` of 31 days will be used. The minimum allowed
   * value for `expiration_policy.ttl` is 1 day.
   * &lt;b&gt;BETA:&lt;/b&gt; This feature is part of a beta release. This API might be
   * changed in backward-incompatible ways and is not recommended for production
   * use. It is not subject to any SLA or deprecation policy.
   * </pre>
   *
   * <code>.google.pubsub.v1.ExpirationPolicy expiration_policy = 11;</code>
   */
  public com.google.pubsub.v1.ExpirationPolicy getExpirationPolicy() {
    return expirationPolicy_ == null
        ? com.google.pubsub.v1.ExpirationPolicy.getDefaultInstance()
        : expirationPolicy_;
  }
  /**
   *
   *
   * <pre>
   * A policy that specifies the conditions for this subscription's expiration.
   * A subscription is considered active as long as any connected subscriber is
   * successfully consuming messages from the subscription or is issuing
   * operations on the subscription. If `expiration_policy` is not set, a
   * *default policy* with `ttl` of 31 days will be used. The minimum allowed
   * value for `expiration_policy.ttl` is 1 day.
   * &lt;b&gt;BETA:&lt;/b&gt; This feature is part of a beta release. This API might be
   * changed in backward-incompatible ways and is not recommended for production
   * use. It is not subject to any SLA or deprecation policy.
   * </pre>
   *
   * <code>.google.pubsub.v1.ExpirationPolicy expiration_policy = 11;</code>
   */
  public com.google.pubsub.v1.ExpirationPolicyOrBuilder getExpirationPolicyOrBuilder() {
    return getExpirationPolicy();
  }

  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 (!getTopicBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, topic_);
    }
    if (pushConfig_ != null) {
      output.writeMessage(4, getPushConfig());
    }
    if (ackDeadlineSeconds_ != 0) {
      output.writeInt32(5, ackDeadlineSeconds_);
    }
    if (retainAckedMessages_ != false) {
      output.writeBool(7, retainAckedMessages_);
    }
    if (messageRetentionDuration_ != null) {
      output.writeMessage(8, getMessageRetentionDuration());
    }
    com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(
        output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 9);
    if (expirationPolicy_ != null) {
      output.writeMessage(11, getExpirationPolicy());
    }
    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 (!getTopicBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, topic_);
    }
    if (pushConfig_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getPushConfig());
    }
    if (ackDeadlineSeconds_ != 0) {
      size += com.google.protobuf.CodedOutputStream.computeInt32Size(5, ackDeadlineSeconds_);
    }
    if (retainAckedMessages_ != false) {
      size += com.google.protobuf.CodedOutputStream.computeBoolSize(7, retainAckedMessages_);
    }
    if (messageRetentionDuration_ != null) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(
              8, getMessageRetentionDuration());
    }
    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(9, labels__);
    }
    if (expirationPolicy_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(11, getExpirationPolicy());
    }
    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.pubsub.v1.Subscription)) {
      return super.equals(obj);
    }
    com.google.pubsub.v1.Subscription other = (com.google.pubsub.v1.Subscription) obj;

    boolean result = true;
    result = result && getName().equals(other.getName());
    result = result && getTopic().equals(other.getTopic());
    result = result && (hasPushConfig() == other.hasPushConfig());
    if (hasPushConfig()) {
      result = result && getPushConfig().equals(other.getPushConfig());
    }
    result = result && (getAckDeadlineSeconds() == other.getAckDeadlineSeconds());
    result = result && (getRetainAckedMessages() == other.getRetainAckedMessages());
    result = result && (hasMessageRetentionDuration() == other.hasMessageRetentionDuration());
    if (hasMessageRetentionDuration()) {
      result = result && getMessageRetentionDuration().equals(other.getMessageRetentionDuration());
    }
    result = result && internalGetLabels().equals(other.internalGetLabels());
    result = result && (hasExpirationPolicy() == other.hasExpirationPolicy());
    if (hasExpirationPolicy()) {
      result = result && getExpirationPolicy().equals(other.getExpirationPolicy());
    }
    result = result && unknownFields.equals(other.unknownFields);
    return result;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + NAME_FIELD_NUMBER;
    hash = (53 * hash) + getName().hashCode();
    hash = (37 * hash) + TOPIC_FIELD_NUMBER;
    hash = (53 * hash) + getTopic().hashCode();
    if (hasPushConfig()) {
      hash = (37 * hash) + PUSH_CONFIG_FIELD_NUMBER;
      hash = (53 * hash) + getPushConfig().hashCode();
    }
    hash = (37 * hash) + ACK_DEADLINE_SECONDS_FIELD_NUMBER;
    hash = (53 * hash) + getAckDeadlineSeconds();
    hash = (37 * hash) + RETAIN_ACKED_MESSAGES_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getRetainAckedMessages());
    if (hasMessageRetentionDuration()) {
      hash = (37 * hash) + MESSAGE_RETENTION_DURATION_FIELD_NUMBER;
      hash = (53 * hash) + getMessageRetentionDuration().hashCode();
    }
    if (!internalGetLabels().getMap().isEmpty()) {
      hash = (37 * hash) + LABELS_FIELD_NUMBER;
      hash = (53 * hash) + internalGetLabels().hashCode();
    }
    if (hasExpirationPolicy()) {
      hash = (37 * hash) + EXPIRATION_POLICY_FIELD_NUMBER;
      hash = (53 * hash) + getExpirationPolicy().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

  public static com.google.pubsub.v1.Subscription parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.pubsub.v1.Subscription parseFrom(com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

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

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

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

  public static com.google.pubsub.v1.Subscription 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.pubsub.v1.Subscription 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 subscription resource.
   * </pre>
   *
   * Protobuf type {@code google.pubsub.v1.Subscription}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.pubsub.v1.Subscription)
      com.google.pubsub.v1.SubscriptionOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.pubsub.v1.PubsubProto
          .internal_static_google_pubsub_v1_Subscription_descriptor;
    }

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

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

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.pubsub.v1.PubsubProto
          .internal_static_google_pubsub_v1_Subscription_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.pubsub.v1.Subscription.class,
              com.google.pubsub.v1.Subscription.Builder.class);
    }

    // Construct using com.google.pubsub.v1.Subscription.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

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

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

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

      topic_ = "";

      if (pushConfigBuilder_ == null) {
        pushConfig_ = null;
      } else {
        pushConfig_ = null;
        pushConfigBuilder_ = null;
      }
      ackDeadlineSeconds_ = 0;

      retainAckedMessages_ = false;

      if (messageRetentionDurationBuilder_ == null) {
        messageRetentionDuration_ = null;
      } else {
        messageRetentionDuration_ = null;
        messageRetentionDurationBuilder_ = null;
      }
      internalGetMutableLabels().clear();
      if (expirationPolicyBuilder_ == null) {
        expirationPolicy_ = null;
      } else {
        expirationPolicy_ = null;
        expirationPolicyBuilder_ = null;
      }
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.pubsub.v1.PubsubProto
          .internal_static_google_pubsub_v1_Subscription_descriptor;
    }

    @java.lang.Override
    public com.google.pubsub.v1.Subscription getDefaultInstanceForType() {
      return com.google.pubsub.v1.Subscription.getDefaultInstance();
    }

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

    @java.lang.Override
    public com.google.pubsub.v1.Subscription buildPartial() {
      com.google.pubsub.v1.Subscription result = new com.google.pubsub.v1.Subscription(this);
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      result.name_ = name_;
      result.topic_ = topic_;
      if (pushConfigBuilder_ == null) {
        result.pushConfig_ = pushConfig_;
      } else {
        result.pushConfig_ = pushConfigBuilder_.build();
      }
      result.ackDeadlineSeconds_ = ackDeadlineSeconds_;
      result.retainAckedMessages_ = retainAckedMessages_;
      if (messageRetentionDurationBuilder_ == null) {
        result.messageRetentionDuration_ = messageRetentionDuration_;
      } else {
        result.messageRetentionDuration_ = messageRetentionDurationBuilder_.build();
      }
      result.labels_ = internalGetLabels();
      result.labels_.makeImmutable();
      if (expirationPolicyBuilder_ == null) {
        result.expirationPolicy_ = expirationPolicy_;
      } else {
        result.expirationPolicy_ = expirationPolicyBuilder_.build();
      }
      result.bitField0_ = to_bitField0_;
      onBuilt();
      return result;
    }

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

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

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

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

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

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

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.pubsub.v1.Subscription) {
        return mergeFrom((com.google.pubsub.v1.Subscription) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.pubsub.v1.Subscription other) {
      if (other == com.google.pubsub.v1.Subscription.getDefaultInstance()) return this;
      if (!other.getName().isEmpty()) {
        name_ = other.name_;
        onChanged();
      }
      if (!other.getTopic().isEmpty()) {
        topic_ = other.topic_;
        onChanged();
      }
      if (other.hasPushConfig()) {
        mergePushConfig(other.getPushConfig());
      }
      if (other.getAckDeadlineSeconds() != 0) {
        setAckDeadlineSeconds(other.getAckDeadlineSeconds());
      }
      if (other.getRetainAckedMessages() != false) {
        setRetainAckedMessages(other.getRetainAckedMessages());
      }
      if (other.hasMessageRetentionDuration()) {
        mergeMessageRetentionDuration(other.getMessageRetentionDuration());
      }
      internalGetMutableLabels().mergeFrom(other.internalGetLabels());
      if (other.hasExpirationPolicy()) {
        mergeExpirationPolicy(other.getExpirationPolicy());
      }
      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.pubsub.v1.Subscription parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.pubsub.v1.Subscription) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private int bitField0_;

    private java.lang.Object name_ = "";
    /**
     *
     *
     * <pre>
     * The name of the subscription. It must have the format
     * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
     * start with a letter, and contain only letters (`[A-Za-z]`), numbers
     * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
     * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
     * in length, and it must not start with `"goog"`.
     * </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>
     * The name of the subscription. It must have the format
     * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
     * start with a letter, and contain only letters (`[A-Za-z]`), numbers
     * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
     * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
     * in length, and it must not start with `"goog"`.
     * </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>
     * The name of the subscription. It must have the format
     * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
     * start with a letter, and contain only letters (`[A-Za-z]`), numbers
     * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
     * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
     * in length, and it must not start with `"goog"`.
     * </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>
     * The name of the subscription. It must have the format
     * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
     * start with a letter, and contain only letters (`[A-Za-z]`), numbers
     * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
     * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
     * in length, and it must not start with `"goog"`.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public Builder clearName() {

      name_ = getDefaultInstance().getName();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The name of the subscription. It must have the format
     * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
     * start with a letter, and contain only letters (`[A-Za-z]`), numbers
     * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
     * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
     * in length, and it must not start with `"goog"`.
     * </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 java.lang.Object topic_ = "";
    /**
     *
     *
     * <pre>
     * The name of the topic from which this subscription is receiving messages.
     * Format is `projects/{project}/topics/{topic}`.
     * The value of this field will be `_deleted-topic_` if the topic has been
     * deleted.
     * </pre>
     *
     * <code>string topic = 2;</code>
     */
    public java.lang.String getTopic() {
      java.lang.Object ref = topic_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        topic_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The name of the topic from which this subscription is receiving messages.
     * Format is `projects/{project}/topics/{topic}`.
     * The value of this field will be `_deleted-topic_` if the topic has been
     * deleted.
     * </pre>
     *
     * <code>string topic = 2;</code>
     */
    public com.google.protobuf.ByteString getTopicBytes() {
      java.lang.Object ref = topic_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        topic_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The name of the topic from which this subscription is receiving messages.
     * Format is `projects/{project}/topics/{topic}`.
     * The value of this field will be `_deleted-topic_` if the topic has been
     * deleted.
     * </pre>
     *
     * <code>string topic = 2;</code>
     */
    public Builder setTopic(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      topic_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The name of the topic from which this subscription is receiving messages.
     * Format is `projects/{project}/topics/{topic}`.
     * The value of this field will be `_deleted-topic_` if the topic has been
     * deleted.
     * </pre>
     *
     * <code>string topic = 2;</code>
     */
    public Builder clearTopic() {

      topic_ = getDefaultInstance().getTopic();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The name of the topic from which this subscription is receiving messages.
     * Format is `projects/{project}/topics/{topic}`.
     * The value of this field will be `_deleted-topic_` if the topic has been
     * deleted.
     * </pre>
     *
     * <code>string topic = 2;</code>
     */
    public Builder setTopicBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

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

    private com.google.pubsub.v1.PushConfig pushConfig_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.pubsub.v1.PushConfig,
            com.google.pubsub.v1.PushConfig.Builder,
            com.google.pubsub.v1.PushConfigOrBuilder>
        pushConfigBuilder_;
    /**
     *
     *
     * <pre>
     * If push delivery is used with this subscription, this field is
     * used to configure it. An empty `pushConfig` signifies that the subscriber
     * will pull and ack messages using API methods.
     * </pre>
     *
     * <code>.google.pubsub.v1.PushConfig push_config = 4;</code>
     */
    public boolean hasPushConfig() {
      return pushConfigBuilder_ != null || pushConfig_ != null;
    }
    /**
     *
     *
     * <pre>
     * If push delivery is used with this subscription, this field is
     * used to configure it. An empty `pushConfig` signifies that the subscriber
     * will pull and ack messages using API methods.
     * </pre>
     *
     * <code>.google.pubsub.v1.PushConfig push_config = 4;</code>
     */
    public com.google.pubsub.v1.PushConfig getPushConfig() {
      if (pushConfigBuilder_ == null) {
        return pushConfig_ == null
            ? com.google.pubsub.v1.PushConfig.getDefaultInstance()
            : pushConfig_;
      } else {
        return pushConfigBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * If push delivery is used with this subscription, this field is
     * used to configure it. An empty `pushConfig` signifies that the subscriber
     * will pull and ack messages using API methods.
     * </pre>
     *
     * <code>.google.pubsub.v1.PushConfig push_config = 4;</code>
     */
    public Builder setPushConfig(com.google.pubsub.v1.PushConfig value) {
      if (pushConfigBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        pushConfig_ = value;
        onChanged();
      } else {
        pushConfigBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * If push delivery is used with this subscription, this field is
     * used to configure it. An empty `pushConfig` signifies that the subscriber
     * will pull and ack messages using API methods.
     * </pre>
     *
     * <code>.google.pubsub.v1.PushConfig push_config = 4;</code>
     */
    public Builder setPushConfig(com.google.pubsub.v1.PushConfig.Builder builderForValue) {
      if (pushConfigBuilder_ == null) {
        pushConfig_ = builderForValue.build();
        onChanged();
      } else {
        pushConfigBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * If push delivery is used with this subscription, this field is
     * used to configure it. An empty `pushConfig` signifies that the subscriber
     * will pull and ack messages using API methods.
     * </pre>
     *
     * <code>.google.pubsub.v1.PushConfig push_config = 4;</code>
     */
    public Builder mergePushConfig(com.google.pubsub.v1.PushConfig value) {
      if (pushConfigBuilder_ == null) {
        if (pushConfig_ != null) {
          pushConfig_ =
              com.google.pubsub.v1.PushConfig.newBuilder(pushConfig_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          pushConfig_ = value;
        }
        onChanged();
      } else {
        pushConfigBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * If push delivery is used with this subscription, this field is
     * used to configure it. An empty `pushConfig` signifies that the subscriber
     * will pull and ack messages using API methods.
     * </pre>
     *
     * <code>.google.pubsub.v1.PushConfig push_config = 4;</code>
     */
    public Builder clearPushConfig() {
      if (pushConfigBuilder_ == null) {
        pushConfig_ = null;
        onChanged();
      } else {
        pushConfig_ = null;
        pushConfigBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * If push delivery is used with this subscription, this field is
     * used to configure it. An empty `pushConfig` signifies that the subscriber
     * will pull and ack messages using API methods.
     * </pre>
     *
     * <code>.google.pubsub.v1.PushConfig push_config = 4;</code>
     */
    public com.google.pubsub.v1.PushConfig.Builder getPushConfigBuilder() {

      onChanged();
      return getPushConfigFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * If push delivery is used with this subscription, this field is
     * used to configure it. An empty `pushConfig` signifies that the subscriber
     * will pull and ack messages using API methods.
     * </pre>
     *
     * <code>.google.pubsub.v1.PushConfig push_config = 4;</code>
     */
    public com.google.pubsub.v1.PushConfigOrBuilder getPushConfigOrBuilder() {
      if (pushConfigBuilder_ != null) {
        return pushConfigBuilder_.getMessageOrBuilder();
      } else {
        return pushConfig_ == null
            ? com.google.pubsub.v1.PushConfig.getDefaultInstance()
            : pushConfig_;
      }
    }
    /**
     *
     *
     * <pre>
     * If push delivery is used with this subscription, this field is
     * used to configure it. An empty `pushConfig` signifies that the subscriber
     * will pull and ack messages using API methods.
     * </pre>
     *
     * <code>.google.pubsub.v1.PushConfig push_config = 4;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.pubsub.v1.PushConfig,
            com.google.pubsub.v1.PushConfig.Builder,
            com.google.pubsub.v1.PushConfigOrBuilder>
        getPushConfigFieldBuilder() {
      if (pushConfigBuilder_ == null) {
        pushConfigBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.pubsub.v1.PushConfig,
                com.google.pubsub.v1.PushConfig.Builder,
                com.google.pubsub.v1.PushConfigOrBuilder>(
                getPushConfig(), getParentForChildren(), isClean());
        pushConfig_ = null;
      }
      return pushConfigBuilder_;
    }

    private int ackDeadlineSeconds_;
    /**
     *
     *
     * <pre>
     * This value is the maximum time after a subscriber receives a message
     * before the subscriber should acknowledge the message. After message
     * delivery but before the ack deadline expires and before the message is
     * acknowledged, it is an outstanding message and will not be delivered
     * again during that time (on a best-effort basis).
     * For pull subscriptions, this value is used as the initial value for the ack
     * deadline. To override this value for a given message, call
     * `ModifyAckDeadline` with the corresponding `ack_id` if using
     * non-streaming pull or send the `ack_id` in a
     * `StreamingModifyAckDeadlineRequest` if using streaming pull.
     * The minimum custom deadline you can specify is 10 seconds.
     * The maximum custom deadline you can specify is 600 seconds (10 minutes).
     * If this parameter is 0, a default value of 10 seconds is used.
     * For push delivery, this value is also used to set the request timeout for
     * the call to the push endpoint.
     * If the subscriber never acknowledges the message, the Pub/Sub
     * system will eventually redeliver the message.
     * </pre>
     *
     * <code>int32 ack_deadline_seconds = 5;</code>
     */
    public int getAckDeadlineSeconds() {
      return ackDeadlineSeconds_;
    }
    /**
     *
     *
     * <pre>
     * This value is the maximum time after a subscriber receives a message
     * before the subscriber should acknowledge the message. After message
     * delivery but before the ack deadline expires and before the message is
     * acknowledged, it is an outstanding message and will not be delivered
     * again during that time (on a best-effort basis).
     * For pull subscriptions, this value is used as the initial value for the ack
     * deadline. To override this value for a given message, call
     * `ModifyAckDeadline` with the corresponding `ack_id` if using
     * non-streaming pull or send the `ack_id` in a
     * `StreamingModifyAckDeadlineRequest` if using streaming pull.
     * The minimum custom deadline you can specify is 10 seconds.
     * The maximum custom deadline you can specify is 600 seconds (10 minutes).
     * If this parameter is 0, a default value of 10 seconds is used.
     * For push delivery, this value is also used to set the request timeout for
     * the call to the push endpoint.
     * If the subscriber never acknowledges the message, the Pub/Sub
     * system will eventually redeliver the message.
     * </pre>
     *
     * <code>int32 ack_deadline_seconds = 5;</code>
     */
    public Builder setAckDeadlineSeconds(int value) {

      ackDeadlineSeconds_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * This value is the maximum time after a subscriber receives a message
     * before the subscriber should acknowledge the message. After message
     * delivery but before the ack deadline expires and before the message is
     * acknowledged, it is an outstanding message and will not be delivered
     * again during that time (on a best-effort basis).
     * For pull subscriptions, this value is used as the initial value for the ack
     * deadline. To override this value for a given message, call
     * `ModifyAckDeadline` with the corresponding `ack_id` if using
     * non-streaming pull or send the `ack_id` in a
     * `StreamingModifyAckDeadlineRequest` if using streaming pull.
     * The minimum custom deadline you can specify is 10 seconds.
     * The maximum custom deadline you can specify is 600 seconds (10 minutes).
     * If this parameter is 0, a default value of 10 seconds is used.
     * For push delivery, this value is also used to set the request timeout for
     * the call to the push endpoint.
     * If the subscriber never acknowledges the message, the Pub/Sub
     * system will eventually redeliver the message.
     * </pre>
     *
     * <code>int32 ack_deadline_seconds = 5;</code>
     */
    public Builder clearAckDeadlineSeconds() {

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

    private boolean retainAckedMessages_;
    /**
     *
     *
     * <pre>
     * Indicates whether to retain acknowledged messages. If true, then
     * messages are not expunged from the subscription's backlog, even if they are
     * acknowledged, until they fall out of the `message_retention_duration`
     * window.&lt;br&gt;&lt;br&gt;
     * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>bool retain_acked_messages = 7;</code>
     */
    public boolean getRetainAckedMessages() {
      return retainAckedMessages_;
    }
    /**
     *
     *
     * <pre>
     * Indicates whether to retain acknowledged messages. If true, then
     * messages are not expunged from the subscription's backlog, even if they are
     * acknowledged, until they fall out of the `message_retention_duration`
     * window.&lt;br&gt;&lt;br&gt;
     * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>bool retain_acked_messages = 7;</code>
     */
    public Builder setRetainAckedMessages(boolean value) {

      retainAckedMessages_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Indicates whether to retain acknowledged messages. If true, then
     * messages are not expunged from the subscription's backlog, even if they are
     * acknowledged, until they fall out of the `message_retention_duration`
     * window.&lt;br&gt;&lt;br&gt;
     * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>bool retain_acked_messages = 7;</code>
     */
    public Builder clearRetainAckedMessages() {

      retainAckedMessages_ = false;
      onChanged();
      return this;
    }

    private com.google.protobuf.Duration messageRetentionDuration_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Duration,
            com.google.protobuf.Duration.Builder,
            com.google.protobuf.DurationOrBuilder>
        messageRetentionDurationBuilder_;
    /**
     *
     *
     * <pre>
     * How long to retain unacknowledged messages in the subscription's backlog,
     * from the moment a message is published.
     * If `retain_acked_messages` is true, then this also configures the retention
     * of acknowledged messages, and thus configures how far back in time a `Seek`
     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
     * minutes.&lt;br&gt;&lt;br&gt;
     * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.protobuf.Duration message_retention_duration = 8;</code>
     */
    public boolean hasMessageRetentionDuration() {
      return messageRetentionDurationBuilder_ != null || messageRetentionDuration_ != null;
    }
    /**
     *
     *
     * <pre>
     * How long to retain unacknowledged messages in the subscription's backlog,
     * from the moment a message is published.
     * If `retain_acked_messages` is true, then this also configures the retention
     * of acknowledged messages, and thus configures how far back in time a `Seek`
     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
     * minutes.&lt;br&gt;&lt;br&gt;
     * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.protobuf.Duration message_retention_duration = 8;</code>
     */
    public com.google.protobuf.Duration getMessageRetentionDuration() {
      if (messageRetentionDurationBuilder_ == null) {
        return messageRetentionDuration_ == null
            ? com.google.protobuf.Duration.getDefaultInstance()
            : messageRetentionDuration_;
      } else {
        return messageRetentionDurationBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * How long to retain unacknowledged messages in the subscription's backlog,
     * from the moment a message is published.
     * If `retain_acked_messages` is true, then this also configures the retention
     * of acknowledged messages, and thus configures how far back in time a `Seek`
     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
     * minutes.&lt;br&gt;&lt;br&gt;
     * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.protobuf.Duration message_retention_duration = 8;</code>
     */
    public Builder setMessageRetentionDuration(com.google.protobuf.Duration value) {
      if (messageRetentionDurationBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        messageRetentionDuration_ = value;
        onChanged();
      } else {
        messageRetentionDurationBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * How long to retain unacknowledged messages in the subscription's backlog,
     * from the moment a message is published.
     * If `retain_acked_messages` is true, then this also configures the retention
     * of acknowledged messages, and thus configures how far back in time a `Seek`
     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
     * minutes.&lt;br&gt;&lt;br&gt;
     * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.protobuf.Duration message_retention_duration = 8;</code>
     */
    public Builder setMessageRetentionDuration(
        com.google.protobuf.Duration.Builder builderForValue) {
      if (messageRetentionDurationBuilder_ == null) {
        messageRetentionDuration_ = builderForValue.build();
        onChanged();
      } else {
        messageRetentionDurationBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * How long to retain unacknowledged messages in the subscription's backlog,
     * from the moment a message is published.
     * If `retain_acked_messages` is true, then this also configures the retention
     * of acknowledged messages, and thus configures how far back in time a `Seek`
     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
     * minutes.&lt;br&gt;&lt;br&gt;
     * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.protobuf.Duration message_retention_duration = 8;</code>
     */
    public Builder mergeMessageRetentionDuration(com.google.protobuf.Duration value) {
      if (messageRetentionDurationBuilder_ == null) {
        if (messageRetentionDuration_ != null) {
          messageRetentionDuration_ =
              com.google.protobuf.Duration.newBuilder(messageRetentionDuration_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          messageRetentionDuration_ = value;
        }
        onChanged();
      } else {
        messageRetentionDurationBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * How long to retain unacknowledged messages in the subscription's backlog,
     * from the moment a message is published.
     * If `retain_acked_messages` is true, then this also configures the retention
     * of acknowledged messages, and thus configures how far back in time a `Seek`
     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
     * minutes.&lt;br&gt;&lt;br&gt;
     * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.protobuf.Duration message_retention_duration = 8;</code>
     */
    public Builder clearMessageRetentionDuration() {
      if (messageRetentionDurationBuilder_ == null) {
        messageRetentionDuration_ = null;
        onChanged();
      } else {
        messageRetentionDuration_ = null;
        messageRetentionDurationBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * How long to retain unacknowledged messages in the subscription's backlog,
     * from the moment a message is published.
     * If `retain_acked_messages` is true, then this also configures the retention
     * of acknowledged messages, and thus configures how far back in time a `Seek`
     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
     * minutes.&lt;br&gt;&lt;br&gt;
     * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.protobuf.Duration message_retention_duration = 8;</code>
     */
    public com.google.protobuf.Duration.Builder getMessageRetentionDurationBuilder() {

      onChanged();
      return getMessageRetentionDurationFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * How long to retain unacknowledged messages in the subscription's backlog,
     * from the moment a message is published.
     * If `retain_acked_messages` is true, then this also configures the retention
     * of acknowledged messages, and thus configures how far back in time a `Seek`
     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
     * minutes.&lt;br&gt;&lt;br&gt;
     * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.protobuf.Duration message_retention_duration = 8;</code>
     */
    public com.google.protobuf.DurationOrBuilder getMessageRetentionDurationOrBuilder() {
      if (messageRetentionDurationBuilder_ != null) {
        return messageRetentionDurationBuilder_.getMessageOrBuilder();
      } else {
        return messageRetentionDuration_ == null
            ? com.google.protobuf.Duration.getDefaultInstance()
            : messageRetentionDuration_;
      }
    }
    /**
     *
     *
     * <pre>
     * How long to retain unacknowledged messages in the subscription's backlog,
     * from the moment a message is published.
     * If `retain_acked_messages` is true, then this also configures the retention
     * of acknowledged messages, and thus configures how far back in time a `Seek`
     * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
     * minutes.&lt;br&gt;&lt;br&gt;
     * &lt;b&gt;ALPHA:&lt;/b&gt; This feature is part of an alpha release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.protobuf.Duration message_retention_duration = 8;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Duration,
            com.google.protobuf.Duration.Builder,
            com.google.protobuf.DurationOrBuilder>
        getMessageRetentionDurationFieldBuilder() {
      if (messageRetentionDurationBuilder_ == null) {
        messageRetentionDurationBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Duration,
                com.google.protobuf.Duration.Builder,
                com.google.protobuf.DurationOrBuilder>(
                getMessageRetentionDuration(), getParentForChildren(), isClean());
        messageRetentionDuration_ = null;
      }
      return messageRetentionDurationBuilder_;
    }

    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>
     * See &lt;a href="/pubsub/docs/labels"&gt; Creating and managing labels&lt;/a&gt;.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 9;</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>
     * See &lt;a href="/pubsub/docs/labels"&gt; Creating and managing labels&lt;/a&gt;.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 9;</code>
     */
    public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() {
      return internalGetLabels().getMap();
    }
    /**
     *
     *
     * <pre>
     * See &lt;a href="/pubsub/docs/labels"&gt; Creating and managing labels&lt;/a&gt;.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 9;</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>
     * See &lt;a href="/pubsub/docs/labels"&gt; Creating and managing labels&lt;/a&gt;.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 9;</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>
     * See &lt;a href="/pubsub/docs/labels"&gt; Creating and managing labels&lt;/a&gt;.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 9;</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>
     * See &lt;a href="/pubsub/docs/labels"&gt; Creating and managing labels&lt;/a&gt;.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 9;</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>
     * See &lt;a href="/pubsub/docs/labels"&gt; Creating and managing labels&lt;/a&gt;.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 9;</code>
     */
    public Builder putAllLabels(java.util.Map<java.lang.String, java.lang.String> values) {
      internalGetMutableLabels().getMutableMap().putAll(values);
      return this;
    }

    private com.google.pubsub.v1.ExpirationPolicy expirationPolicy_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.pubsub.v1.ExpirationPolicy,
            com.google.pubsub.v1.ExpirationPolicy.Builder,
            com.google.pubsub.v1.ExpirationPolicyOrBuilder>
        expirationPolicyBuilder_;
    /**
     *
     *
     * <pre>
     * A policy that specifies the conditions for this subscription's expiration.
     * A subscription is considered active as long as any connected subscriber is
     * successfully consuming messages from the subscription or is issuing
     * operations on the subscription. If `expiration_policy` is not set, a
     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
     * value for `expiration_policy.ttl` is 1 day.
     * &lt;b&gt;BETA:&lt;/b&gt; This feature is part of a beta release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.pubsub.v1.ExpirationPolicy expiration_policy = 11;</code>
     */
    public boolean hasExpirationPolicy() {
      return expirationPolicyBuilder_ != null || expirationPolicy_ != null;
    }
    /**
     *
     *
     * <pre>
     * A policy that specifies the conditions for this subscription's expiration.
     * A subscription is considered active as long as any connected subscriber is
     * successfully consuming messages from the subscription or is issuing
     * operations on the subscription. If `expiration_policy` is not set, a
     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
     * value for `expiration_policy.ttl` is 1 day.
     * &lt;b&gt;BETA:&lt;/b&gt; This feature is part of a beta release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.pubsub.v1.ExpirationPolicy expiration_policy = 11;</code>
     */
    public com.google.pubsub.v1.ExpirationPolicy getExpirationPolicy() {
      if (expirationPolicyBuilder_ == null) {
        return expirationPolicy_ == null
            ? com.google.pubsub.v1.ExpirationPolicy.getDefaultInstance()
            : expirationPolicy_;
      } else {
        return expirationPolicyBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * A policy that specifies the conditions for this subscription's expiration.
     * A subscription is considered active as long as any connected subscriber is
     * successfully consuming messages from the subscription or is issuing
     * operations on the subscription. If `expiration_policy` is not set, a
     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
     * value for `expiration_policy.ttl` is 1 day.
     * &lt;b&gt;BETA:&lt;/b&gt; This feature is part of a beta release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.pubsub.v1.ExpirationPolicy expiration_policy = 11;</code>
     */
    public Builder setExpirationPolicy(com.google.pubsub.v1.ExpirationPolicy value) {
      if (expirationPolicyBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        expirationPolicy_ = value;
        onChanged();
      } else {
        expirationPolicyBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A policy that specifies the conditions for this subscription's expiration.
     * A subscription is considered active as long as any connected subscriber is
     * successfully consuming messages from the subscription or is issuing
     * operations on the subscription. If `expiration_policy` is not set, a
     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
     * value for `expiration_policy.ttl` is 1 day.
     * &lt;b&gt;BETA:&lt;/b&gt; This feature is part of a beta release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.pubsub.v1.ExpirationPolicy expiration_policy = 11;</code>
     */
    public Builder setExpirationPolicy(
        com.google.pubsub.v1.ExpirationPolicy.Builder builderForValue) {
      if (expirationPolicyBuilder_ == null) {
        expirationPolicy_ = builderForValue.build();
        onChanged();
      } else {
        expirationPolicyBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A policy that specifies the conditions for this subscription's expiration.
     * A subscription is considered active as long as any connected subscriber is
     * successfully consuming messages from the subscription or is issuing
     * operations on the subscription. If `expiration_policy` is not set, a
     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
     * value for `expiration_policy.ttl` is 1 day.
     * &lt;b&gt;BETA:&lt;/b&gt; This feature is part of a beta release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.pubsub.v1.ExpirationPolicy expiration_policy = 11;</code>
     */
    public Builder mergeExpirationPolicy(com.google.pubsub.v1.ExpirationPolicy value) {
      if (expirationPolicyBuilder_ == null) {
        if (expirationPolicy_ != null) {
          expirationPolicy_ =
              com.google.pubsub.v1.ExpirationPolicy.newBuilder(expirationPolicy_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          expirationPolicy_ = value;
        }
        onChanged();
      } else {
        expirationPolicyBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A policy that specifies the conditions for this subscription's expiration.
     * A subscription is considered active as long as any connected subscriber is
     * successfully consuming messages from the subscription or is issuing
     * operations on the subscription. If `expiration_policy` is not set, a
     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
     * value for `expiration_policy.ttl` is 1 day.
     * &lt;b&gt;BETA:&lt;/b&gt; This feature is part of a beta release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.pubsub.v1.ExpirationPolicy expiration_policy = 11;</code>
     */
    public Builder clearExpirationPolicy() {
      if (expirationPolicyBuilder_ == null) {
        expirationPolicy_ = null;
        onChanged();
      } else {
        expirationPolicy_ = null;
        expirationPolicyBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A policy that specifies the conditions for this subscription's expiration.
     * A subscription is considered active as long as any connected subscriber is
     * successfully consuming messages from the subscription or is issuing
     * operations on the subscription. If `expiration_policy` is not set, a
     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
     * value for `expiration_policy.ttl` is 1 day.
     * &lt;b&gt;BETA:&lt;/b&gt; This feature is part of a beta release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.pubsub.v1.ExpirationPolicy expiration_policy = 11;</code>
     */
    public com.google.pubsub.v1.ExpirationPolicy.Builder getExpirationPolicyBuilder() {

      onChanged();
      return getExpirationPolicyFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * A policy that specifies the conditions for this subscription's expiration.
     * A subscription is considered active as long as any connected subscriber is
     * successfully consuming messages from the subscription or is issuing
     * operations on the subscription. If `expiration_policy` is not set, a
     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
     * value for `expiration_policy.ttl` is 1 day.
     * &lt;b&gt;BETA:&lt;/b&gt; This feature is part of a beta release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.pubsub.v1.ExpirationPolicy expiration_policy = 11;</code>
     */
    public com.google.pubsub.v1.ExpirationPolicyOrBuilder getExpirationPolicyOrBuilder() {
      if (expirationPolicyBuilder_ != null) {
        return expirationPolicyBuilder_.getMessageOrBuilder();
      } else {
        return expirationPolicy_ == null
            ? com.google.pubsub.v1.ExpirationPolicy.getDefaultInstance()
            : expirationPolicy_;
      }
    }
    /**
     *
     *
     * <pre>
     * A policy that specifies the conditions for this subscription's expiration.
     * A subscription is considered active as long as any connected subscriber is
     * successfully consuming messages from the subscription or is issuing
     * operations on the subscription. If `expiration_policy` is not set, a
     * *default policy* with `ttl` of 31 days will be used. The minimum allowed
     * value for `expiration_policy.ttl` is 1 day.
     * &lt;b&gt;BETA:&lt;/b&gt; This feature is part of a beta release. This API might be
     * changed in backward-incompatible ways and is not recommended for production
     * use. It is not subject to any SLA or deprecation policy.
     * </pre>
     *
     * <code>.google.pubsub.v1.ExpirationPolicy expiration_policy = 11;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.pubsub.v1.ExpirationPolicy,
            com.google.pubsub.v1.ExpirationPolicy.Builder,
            com.google.pubsub.v1.ExpirationPolicyOrBuilder>
        getExpirationPolicyFieldBuilder() {
      if (expirationPolicyBuilder_ == null) {
        expirationPolicyBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.pubsub.v1.ExpirationPolicy,
                com.google.pubsub.v1.ExpirationPolicy.Builder,
                com.google.pubsub.v1.ExpirationPolicyOrBuilder>(
                getExpirationPolicy(), getParentForChildren(), isClean());
        expirationPolicy_ = null;
      }
      return expirationPolicyBuilder_;
    }

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

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

    // @@protoc_insertion_point(builder_scope:google.pubsub.v1.Subscription)
  }

  // @@protoc_insertion_point(class_scope:google.pubsub.v1.Subscription)
  private static final com.google.pubsub.v1.Subscription DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.pubsub.v1.Subscription();
  }

  public static com.google.pubsub.v1.Subscription getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

  @java.lang.Override
  public com.google.pubsub.v1.Subscription getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
