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

package com.google.pubsub.v1;

/**
 * <pre>
 * Configuration for a push delivery endpoint.
 * </pre>
 *
 * Protobuf type {@code google.pubsub.v1.PushConfig}
 */
public  final class PushConfig extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:google.pubsub.v1.PushConfig)
    PushConfigOrBuilder {
private static final long serialVersionUID = 0L;
  // Use PushConfig.newBuilder() to construct.
  private PushConfig(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private PushConfig() {
    pushEndpoint_ = "";
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private PushConfig(
      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;
          default: {
            if (!parseUnknownFieldProto3(
                input, unknownFields, extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
          case 10: {
            java.lang.String s = input.readStringRequireUtf8();

            pushEndpoint_ = s;
            break;
          }
          case 18: {
            if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
              attributes_ = com.google.protobuf.MapField.newMapField(
                  AttributesDefaultEntryHolder.defaultEntry);
              mutable_bitField0_ |= 0x00000002;
            }
            com.google.protobuf.MapEntry<java.lang.String, java.lang.String>
            attributes__ = input.readMessage(
                AttributesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
            attributes_.getMutableMap().put(
                attributes__.getKey(), attributes__.getValue());
            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_PushConfig_descriptor;
  }

  @SuppressWarnings({"rawtypes"})
  protected com.google.protobuf.MapField internalGetMapField(
      int number) {
    switch (number) {
      case 2:
        return internalGetAttributes();
      default:
        throw new RuntimeException(
            "Invalid map field number: " + number);
    }
  }
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.pubsub.v1.PubsubProto.internal_static_google_pubsub_v1_PushConfig_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.pubsub.v1.PushConfig.class, com.google.pubsub.v1.PushConfig.Builder.class);
  }

  private int bitField0_;
  public static final int PUSH_ENDPOINT_FIELD_NUMBER = 1;
  private volatile java.lang.Object pushEndpoint_;
  /**
   * <pre>
   * A URL locating the endpoint to which messages should be pushed.
   * For example, a Webhook endpoint might use "https://example.com/push".
   * </pre>
   *
   * <code>string push_endpoint = 1;</code>
   */
  public java.lang.String getPushEndpoint() {
    java.lang.Object ref = pushEndpoint_;
    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();
      pushEndpoint_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * A URL locating the endpoint to which messages should be pushed.
   * For example, a Webhook endpoint might use "https://example.com/push".
   * </pre>
   *
   * <code>string push_endpoint = 1;</code>
   */
  public com.google.protobuf.ByteString
      getPushEndpointBytes() {
    java.lang.Object ref = pushEndpoint_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      pushEndpoint_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int ATTRIBUTES_FIELD_NUMBER = 2;
  private static final class AttributesDefaultEntryHolder {
    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_PushConfig_AttributesEntry_descriptor, 
                com.google.protobuf.WireFormat.FieldType.STRING,
                "",
                com.google.protobuf.WireFormat.FieldType.STRING,
                "");
  }
  private com.google.protobuf.MapField<
      java.lang.String, java.lang.String> attributes_;
  private com.google.protobuf.MapField<java.lang.String, java.lang.String>
  internalGetAttributes() {
    if (attributes_ == null) {
      return com.google.protobuf.MapField.emptyMapField(
          AttributesDefaultEntryHolder.defaultEntry);
    }
    return attributes_;
  }

  public int getAttributesCount() {
    return internalGetAttributes().getMap().size();
  }
  /**
   * <pre>
   * Endpoint configuration attributes.
   * Every endpoint has a set of API supported attributes that can be used to
   * control different aspects of the message delivery.
   * The currently supported attribute is `x-goog-version`, which you can
   * use to change the format of the pushed message. This attribute
   * indicates the version of the data expected by the endpoint. This
   * controls the shape of the pushed message (i.e., its fields and metadata).
   * The endpoint version is based on the version of the Pub/Sub API.
   * If not present during the `CreateSubscription` call, it will default to
   * the version of the API used to make such call. If not present during a
   * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
   * calls will always return a valid version, even if the subscription was
   * created without this attribute.
   * The possible values for this attribute are:
   * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
   * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
   * </pre>
   *
   * <code>map&lt;string, string&gt; attributes = 2;</code>
   */

  public boolean containsAttributes(
      java.lang.String key) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    return internalGetAttributes().getMap().containsKey(key);
  }
  /**
   * Use {@link #getAttributesMap()} instead.
   */
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, java.lang.String> getAttributes() {
    return getAttributesMap();
  }
  /**
   * <pre>
   * Endpoint configuration attributes.
   * Every endpoint has a set of API supported attributes that can be used to
   * control different aspects of the message delivery.
   * The currently supported attribute is `x-goog-version`, which you can
   * use to change the format of the pushed message. This attribute
   * indicates the version of the data expected by the endpoint. This
   * controls the shape of the pushed message (i.e., its fields and metadata).
   * The endpoint version is based on the version of the Pub/Sub API.
   * If not present during the `CreateSubscription` call, it will default to
   * the version of the API used to make such call. If not present during a
   * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
   * calls will always return a valid version, even if the subscription was
   * created without this attribute.
   * The possible values for this attribute are:
   * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
   * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
   * </pre>
   *
   * <code>map&lt;string, string&gt; attributes = 2;</code>
   */

  public java.util.Map<java.lang.String, java.lang.String> getAttributesMap() {
    return internalGetAttributes().getMap();
  }
  /**
   * <pre>
   * Endpoint configuration attributes.
   * Every endpoint has a set of API supported attributes that can be used to
   * control different aspects of the message delivery.
   * The currently supported attribute is `x-goog-version`, which you can
   * use to change the format of the pushed message. This attribute
   * indicates the version of the data expected by the endpoint. This
   * controls the shape of the pushed message (i.e., its fields and metadata).
   * The endpoint version is based on the version of the Pub/Sub API.
   * If not present during the `CreateSubscription` call, it will default to
   * the version of the API used to make such call. If not present during a
   * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
   * calls will always return a valid version, even if the subscription was
   * created without this attribute.
   * The possible values for this attribute are:
   * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
   * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
   * </pre>
   *
   * <code>map&lt;string, string&gt; attributes = 2;</code>
   */

  public java.lang.String getAttributesOrDefault(
      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 =
        internalGetAttributes().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   * <pre>
   * Endpoint configuration attributes.
   * Every endpoint has a set of API supported attributes that can be used to
   * control different aspects of the message delivery.
   * The currently supported attribute is `x-goog-version`, which you can
   * use to change the format of the pushed message. This attribute
   * indicates the version of the data expected by the endpoint. This
   * controls the shape of the pushed message (i.e., its fields and metadata).
   * The endpoint version is based on the version of the Pub/Sub API.
   * If not present during the `CreateSubscription` call, it will default to
   * the version of the API used to make such call. If not present during a
   * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
   * calls will always return a valid version, even if the subscription was
   * created without this attribute.
   * The possible values for this attribute are:
   * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
   * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
   * </pre>
   *
   * <code>map&lt;string, string&gt; attributes = 2;</code>
   */

  public java.lang.String getAttributesOrThrow(
      java.lang.String key) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, java.lang.String> map =
        internalGetAttributes().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  private byte memoizedIsInitialized = -1;
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (!getPushEndpointBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, pushEndpoint_);
    }
    com.google.protobuf.GeneratedMessageV3
      .serializeStringMapTo(
        output,
        internalGetAttributes(),
        AttributesDefaultEntryHolder.defaultEntry,
        2);
    unknownFields.writeTo(output);
  }

  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (!getPushEndpointBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, pushEndpoint_);
    }
    for (java.util.Map.Entry<java.lang.String, java.lang.String> entry
         : internalGetAttributes().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.String, java.lang.String>
      attributes__ = AttributesDefaultEntryHolder.defaultEntry.newBuilderForType()
          .setKey(entry.getKey())
          .setValue(entry.getValue())
          .build();
      size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(2, attributes__);
    }
    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.PushConfig)) {
      return super.equals(obj);
    }
    com.google.pubsub.v1.PushConfig other = (com.google.pubsub.v1.PushConfig) obj;

    boolean result = true;
    result = result && getPushEndpoint()
        .equals(other.getPushEndpoint());
    result = result && internalGetAttributes().equals(
        other.internalGetAttributes());
    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) + PUSH_ENDPOINT_FIELD_NUMBER;
    hash = (53 * hash) + getPushEndpoint().hashCode();
    if (!internalGetAttributes().getMap().isEmpty()) {
      hash = (37 * hash) + ATTRIBUTES_FIELD_NUMBER;
      hash = (53 * hash) + internalGetAttributes().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.pubsub.v1.PushConfig parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.pubsub.v1.PushConfig 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.PushConfig parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.pubsub.v1.PushConfig 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.PushConfig parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.pubsub.v1.PushConfig parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.pubsub.v1.PushConfig parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.pubsub.v1.PushConfig 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.PushConfig parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static com.google.pubsub.v1.PushConfig 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.PushConfig parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.pubsub.v1.PushConfig parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(com.google.pubsub.v1.PushConfig prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  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>
   * Configuration for a push delivery endpoint.
   * </pre>
   *
   * Protobuf type {@code google.pubsub.v1.PushConfig}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:google.pubsub.v1.PushConfig)
      com.google.pubsub.v1.PushConfigOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.google.pubsub.v1.PubsubProto.internal_static_google_pubsub_v1_PushConfig_descriptor;
    }

    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMapField(
        int number) {
      switch (number) {
        case 2:
          return internalGetAttributes();
        default:
          throw new RuntimeException(
              "Invalid map field number: " + number);
      }
    }
    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMutableMapField(
        int number) {
      switch (number) {
        case 2:
          return internalGetMutableAttributes();
        default:
          throw new RuntimeException(
              "Invalid map field number: " + number);
      }
    }
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.pubsub.v1.PubsubProto.internal_static_google_pubsub_v1_PushConfig_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.pubsub.v1.PushConfig.class, com.google.pubsub.v1.PushConfig.Builder.class);
    }

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

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
      }
    }
    public Builder clear() {
      super.clear();
      pushEndpoint_ = "";

      internalGetMutableAttributes().clear();
      return this;
    }

    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.google.pubsub.v1.PubsubProto.internal_static_google_pubsub_v1_PushConfig_descriptor;
    }

    public com.google.pubsub.v1.PushConfig getDefaultInstanceForType() {
      return com.google.pubsub.v1.PushConfig.getDefaultInstance();
    }

    public com.google.pubsub.v1.PushConfig build() {
      com.google.pubsub.v1.PushConfig result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    public com.google.pubsub.v1.PushConfig buildPartial() {
      com.google.pubsub.v1.PushConfig result = new com.google.pubsub.v1.PushConfig(this);
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      result.pushEndpoint_ = pushEndpoint_;
      result.attributes_ = internalGetAttributes();
      result.attributes_.makeImmutable();
      result.bitField0_ = to_bitField0_;
      onBuilt();
      return result;
    }

    public Builder clone() {
      return (Builder) super.clone();
    }
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return (Builder) super.setField(field, value);
    }
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return (Builder) super.clearField(field);
    }
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return (Builder) super.clearOneof(oneof);
    }
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, java.lang.Object value) {
      return (Builder) super.setRepeatedField(field, index, value);
    }
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return (Builder) super.addRepeatedField(field, value);
    }
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.pubsub.v1.PushConfig) {
        return mergeFrom((com.google.pubsub.v1.PushConfig)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.pubsub.v1.PushConfig other) {
      if (other == com.google.pubsub.v1.PushConfig.getDefaultInstance()) return this;
      if (!other.getPushEndpoint().isEmpty()) {
        pushEndpoint_ = other.pushEndpoint_;
        onChanged();
      }
      internalGetMutableAttributes().mergeFrom(
          other.internalGetAttributes());
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    public final boolean isInitialized() {
      return true;
    }

    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.google.pubsub.v1.PushConfig parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.pubsub.v1.PushConfig) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int bitField0_;

    private java.lang.Object pushEndpoint_ = "";
    /**
     * <pre>
     * A URL locating the endpoint to which messages should be pushed.
     * For example, a Webhook endpoint might use "https://example.com/push".
     * </pre>
     *
     * <code>string push_endpoint = 1;</code>
     */
    public java.lang.String getPushEndpoint() {
      java.lang.Object ref = pushEndpoint_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        pushEndpoint_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * A URL locating the endpoint to which messages should be pushed.
     * For example, a Webhook endpoint might use "https://example.com/push".
     * </pre>
     *
     * <code>string push_endpoint = 1;</code>
     */
    public com.google.protobuf.ByteString
        getPushEndpointBytes() {
      java.lang.Object ref = pushEndpoint_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        pushEndpoint_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * A URL locating the endpoint to which messages should be pushed.
     * For example, a Webhook endpoint might use "https://example.com/push".
     * </pre>
     *
     * <code>string push_endpoint = 1;</code>
     */
    public Builder setPushEndpoint(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      pushEndpoint_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * A URL locating the endpoint to which messages should be pushed.
     * For example, a Webhook endpoint might use "https://example.com/push".
     * </pre>
     *
     * <code>string push_endpoint = 1;</code>
     */
    public Builder clearPushEndpoint() {
      
      pushEndpoint_ = getDefaultInstance().getPushEndpoint();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * A URL locating the endpoint to which messages should be pushed.
     * For example, a Webhook endpoint might use "https://example.com/push".
     * </pre>
     *
     * <code>string push_endpoint = 1;</code>
     */
    public Builder setPushEndpointBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      pushEndpoint_ = value;
      onChanged();
      return this;
    }

    private com.google.protobuf.MapField<
        java.lang.String, java.lang.String> attributes_;
    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
    internalGetAttributes() {
      if (attributes_ == null) {
        return com.google.protobuf.MapField.emptyMapField(
            AttributesDefaultEntryHolder.defaultEntry);
      }
      return attributes_;
    }
    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
    internalGetMutableAttributes() {
      onChanged();;
      if (attributes_ == null) {
        attributes_ = com.google.protobuf.MapField.newMapField(
            AttributesDefaultEntryHolder.defaultEntry);
      }
      if (!attributes_.isMutable()) {
        attributes_ = attributes_.copy();
      }
      return attributes_;
    }

    public int getAttributesCount() {
      return internalGetAttributes().getMap().size();
    }
    /**
     * <pre>
     * Endpoint configuration attributes.
     * Every endpoint has a set of API supported attributes that can be used to
     * control different aspects of the message delivery.
     * The currently supported attribute is `x-goog-version`, which you can
     * use to change the format of the pushed message. This attribute
     * indicates the version of the data expected by the endpoint. This
     * controls the shape of the pushed message (i.e., its fields and metadata).
     * The endpoint version is based on the version of the Pub/Sub API.
     * If not present during the `CreateSubscription` call, it will default to
     * the version of the API used to make such call. If not present during a
     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
     * calls will always return a valid version, even if the subscription was
     * created without this attribute.
     * The possible values for this attribute are:
     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
     * </pre>
     *
     * <code>map&lt;string, string&gt; attributes = 2;</code>
     */

    public boolean containsAttributes(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      return internalGetAttributes().getMap().containsKey(key);
    }
    /**
     * Use {@link #getAttributesMap()} instead.
     */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getAttributes() {
      return getAttributesMap();
    }
    /**
     * <pre>
     * Endpoint configuration attributes.
     * Every endpoint has a set of API supported attributes that can be used to
     * control different aspects of the message delivery.
     * The currently supported attribute is `x-goog-version`, which you can
     * use to change the format of the pushed message. This attribute
     * indicates the version of the data expected by the endpoint. This
     * controls the shape of the pushed message (i.e., its fields and metadata).
     * The endpoint version is based on the version of the Pub/Sub API.
     * If not present during the `CreateSubscription` call, it will default to
     * the version of the API used to make such call. If not present during a
     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
     * calls will always return a valid version, even if the subscription was
     * created without this attribute.
     * The possible values for this attribute are:
     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
     * </pre>
     *
     * <code>map&lt;string, string&gt; attributes = 2;</code>
     */

    public java.util.Map<java.lang.String, java.lang.String> getAttributesMap() {
      return internalGetAttributes().getMap();
    }
    /**
     * <pre>
     * Endpoint configuration attributes.
     * Every endpoint has a set of API supported attributes that can be used to
     * control different aspects of the message delivery.
     * The currently supported attribute is `x-goog-version`, which you can
     * use to change the format of the pushed message. This attribute
     * indicates the version of the data expected by the endpoint. This
     * controls the shape of the pushed message (i.e., its fields and metadata).
     * The endpoint version is based on the version of the Pub/Sub API.
     * If not present during the `CreateSubscription` call, it will default to
     * the version of the API used to make such call. If not present during a
     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
     * calls will always return a valid version, even if the subscription was
     * created without this attribute.
     * The possible values for this attribute are:
     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
     * </pre>
     *
     * <code>map&lt;string, string&gt; attributes = 2;</code>
     */

    public java.lang.String getAttributesOrDefault(
        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 =
          internalGetAttributes().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     * <pre>
     * Endpoint configuration attributes.
     * Every endpoint has a set of API supported attributes that can be used to
     * control different aspects of the message delivery.
     * The currently supported attribute is `x-goog-version`, which you can
     * use to change the format of the pushed message. This attribute
     * indicates the version of the data expected by the endpoint. This
     * controls the shape of the pushed message (i.e., its fields and metadata).
     * The endpoint version is based on the version of the Pub/Sub API.
     * If not present during the `CreateSubscription` call, it will default to
     * the version of the API used to make such call. If not present during a
     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
     * calls will always return a valid version, even if the subscription was
     * created without this attribute.
     * The possible values for this attribute are:
     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
     * </pre>
     *
     * <code>map&lt;string, string&gt; attributes = 2;</code>
     */

    public java.lang.String getAttributesOrThrow(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      java.util.Map<java.lang.String, java.lang.String> map =
          internalGetAttributes().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearAttributes() {
      internalGetMutableAttributes().getMutableMap()
          .clear();
      return this;
    }
    /**
     * <pre>
     * Endpoint configuration attributes.
     * Every endpoint has a set of API supported attributes that can be used to
     * control different aspects of the message delivery.
     * The currently supported attribute is `x-goog-version`, which you can
     * use to change the format of the pushed message. This attribute
     * indicates the version of the data expected by the endpoint. This
     * controls the shape of the pushed message (i.e., its fields and metadata).
     * The endpoint version is based on the version of the Pub/Sub API.
     * If not present during the `CreateSubscription` call, it will default to
     * the version of the API used to make such call. If not present during a
     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
     * calls will always return a valid version, even if the subscription was
     * created without this attribute.
     * The possible values for this attribute are:
     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
     * </pre>
     *
     * <code>map&lt;string, string&gt; attributes = 2;</code>
     */

    public Builder removeAttributes(
        java.lang.String key) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      internalGetMutableAttributes().getMutableMap()
          .remove(key);
      return this;
    }
    /**
     * Use alternate mutation accessors instead.
     */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String>
    getMutableAttributes() {
      return internalGetMutableAttributes().getMutableMap();
    }
    /**
     * <pre>
     * Endpoint configuration attributes.
     * Every endpoint has a set of API supported attributes that can be used to
     * control different aspects of the message delivery.
     * The currently supported attribute is `x-goog-version`, which you can
     * use to change the format of the pushed message. This attribute
     * indicates the version of the data expected by the endpoint. This
     * controls the shape of the pushed message (i.e., its fields and metadata).
     * The endpoint version is based on the version of the Pub/Sub API.
     * If not present during the `CreateSubscription` call, it will default to
     * the version of the API used to make such call. If not present during a
     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
     * calls will always return a valid version, even if the subscription was
     * created without this attribute.
     * The possible values for this attribute are:
     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
     * </pre>
     *
     * <code>map&lt;string, string&gt; attributes = 2;</code>
     */
    public Builder putAttributes(
        java.lang.String key,
        java.lang.String value) {
      if (key == null) { throw new java.lang.NullPointerException(); }
      if (value == null) { throw new java.lang.NullPointerException(); }
      internalGetMutableAttributes().getMutableMap()
          .put(key, value);
      return this;
    }
    /**
     * <pre>
     * Endpoint configuration attributes.
     * Every endpoint has a set of API supported attributes that can be used to
     * control different aspects of the message delivery.
     * The currently supported attribute is `x-goog-version`, which you can
     * use to change the format of the pushed message. This attribute
     * indicates the version of the data expected by the endpoint. This
     * controls the shape of the pushed message (i.e., its fields and metadata).
     * The endpoint version is based on the version of the Pub/Sub API.
     * If not present during the `CreateSubscription` call, it will default to
     * the version of the API used to make such call. If not present during a
     * `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
     * calls will always return a valid version, even if the subscription was
     * created without this attribute.
     * The possible values for this attribute are:
     * * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
     * * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
     * </pre>
     *
     * <code>map&lt;string, string&gt; attributes = 2;</code>
     */

    public Builder putAllAttributes(
        java.util.Map<java.lang.String, java.lang.String> values) {
      internalGetMutableAttributes().getMutableMap()
          .putAll(values);
      return this;
    }
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFieldsProto3(unknownFields);
    }

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


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

  // @@protoc_insertion_point(class_scope:google.pubsub.v1.PushConfig)
  private static final com.google.pubsub.v1.PushConfig DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new com.google.pubsub.v1.PushConfig();
  }

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

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

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

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

  public com.google.pubsub.v1.PushConfig getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

