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

package com.google.cloud.iot.v1;

/**
 * <pre>
 * A container for a group of devices.
 * </pre>
 *
 * Protobuf type {@code google.cloud.iot.v1.DeviceRegistry}
 */
public  final class DeviceRegistry extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.DeviceRegistry)
    DeviceRegistryOrBuilder {
private static final long serialVersionUID = 0L;
  // Use DeviceRegistry.newBuilder() to construct.
  private DeviceRegistry(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private DeviceRegistry() {
    id_ = "";
    name_ = "";
    eventNotificationConfigs_ = java.util.Collections.emptyList();
    credentials_ = java.util.Collections.emptyList();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private DeviceRegistry(
      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();

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

            name_ = s;
            break;
          }
          case 34: {
            com.google.cloud.iot.v1.MqttConfig.Builder subBuilder = null;
            if (mqttConfig_ != null) {
              subBuilder = mqttConfig_.toBuilder();
            }
            mqttConfig_ = input.readMessage(com.google.cloud.iot.v1.MqttConfig.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(mqttConfig_);
              mqttConfig_ = subBuilder.buildPartial();
            }

            break;
          }
          case 58: {
            com.google.cloud.iot.v1.StateNotificationConfig.Builder subBuilder = null;
            if (stateNotificationConfig_ != null) {
              subBuilder = stateNotificationConfig_.toBuilder();
            }
            stateNotificationConfig_ = input.readMessage(com.google.cloud.iot.v1.StateNotificationConfig.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(stateNotificationConfig_);
              stateNotificationConfig_ = subBuilder.buildPartial();
            }

            break;
          }
          case 66: {
            if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
              credentials_ = new java.util.ArrayList<com.google.cloud.iot.v1.RegistryCredential>();
              mutable_bitField0_ |= 0x00000040;
            }
            credentials_.add(
                input.readMessage(com.google.cloud.iot.v1.RegistryCredential.parser(), extensionRegistry));
            break;
          }
          case 74: {
            com.google.cloud.iot.v1.HttpConfig.Builder subBuilder = null;
            if (httpConfig_ != null) {
              subBuilder = httpConfig_.toBuilder();
            }
            httpConfig_ = input.readMessage(com.google.cloud.iot.v1.HttpConfig.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(httpConfig_);
              httpConfig_ = subBuilder.buildPartial();
            }

            break;
          }
          case 82: {
            if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
              eventNotificationConfigs_ = new java.util.ArrayList<com.google.cloud.iot.v1.EventNotificationConfig>();
              mutable_bitField0_ |= 0x00000004;
            }
            eventNotificationConfigs_.add(
                input.readMessage(com.google.cloud.iot.v1.EventNotificationConfig.parser(), extensionRegistry));
            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e).setUnfinishedMessage(this);
    } finally {
      if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
        credentials_ = java.util.Collections.unmodifiableList(credentials_);
      }
      if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
        eventNotificationConfigs_ = java.util.Collections.unmodifiableList(eventNotificationConfigs_);
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.google.cloud.iot.v1.ResourcesProto.internal_static_google_cloud_iot_v1_DeviceRegistry_descriptor;
  }

  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.iot.v1.ResourcesProto.internal_static_google_cloud_iot_v1_DeviceRegistry_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.iot.v1.DeviceRegistry.class, com.google.cloud.iot.v1.DeviceRegistry.Builder.class);
  }

  private int bitField0_;
  public static final int ID_FIELD_NUMBER = 1;
  private volatile java.lang.Object id_;
  /**
   * <pre>
   * The identifier of this device registry. For example, `myRegistry`.
   * </pre>
   *
   * <code>string id = 1;</code>
   */
  public java.lang.String getId() {
    java.lang.Object ref = id_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      id_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * The identifier of this device registry. For example, `myRegistry`.
   * </pre>
   *
   * <code>string id = 1;</code>
   */
  public com.google.protobuf.ByteString
      getIdBytes() {
    java.lang.Object ref = id_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      id_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int NAME_FIELD_NUMBER = 2;
  private volatile java.lang.Object name_;
  /**
   * <pre>
   * The resource path name. For example,
   * `projects/example-project/locations/us-central1/registries/my-registry`.
   * </pre>
   *
   * <code>string name = 2;</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 resource path name. For example,
   * `projects/example-project/locations/us-central1/registries/my-registry`.
   * </pre>
   *
   * <code>string name = 2;</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 EVENT_NOTIFICATION_CONFIGS_FIELD_NUMBER = 10;
  private java.util.List<com.google.cloud.iot.v1.EventNotificationConfig> eventNotificationConfigs_;
  /**
   * <pre>
   * The configuration for notification of telemetry events received from the
   * device. All telemetry events that were successfully published by the
   * device and acknowledged by Cloud IoT Core are guaranteed to be
   * delivered to Cloud Pub/Sub. If multiple configurations match a message,
   * only the first matching configuration is used. If you try to publish a
   * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
   * for the device's registry, the connection closes automatically. If you try
   * to do so using an HTTP connection, an error is returned. Up to 10
   * configurations may be provided.
   * </pre>
   *
   * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
   */
  public java.util.List<com.google.cloud.iot.v1.EventNotificationConfig> getEventNotificationConfigsList() {
    return eventNotificationConfigs_;
  }
  /**
   * <pre>
   * The configuration for notification of telemetry events received from the
   * device. All telemetry events that were successfully published by the
   * device and acknowledged by Cloud IoT Core are guaranteed to be
   * delivered to Cloud Pub/Sub. If multiple configurations match a message,
   * only the first matching configuration is used. If you try to publish a
   * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
   * for the device's registry, the connection closes automatically. If you try
   * to do so using an HTTP connection, an error is returned. Up to 10
   * configurations may be provided.
   * </pre>
   *
   * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
   */
  public java.util.List<? extends com.google.cloud.iot.v1.EventNotificationConfigOrBuilder> 
      getEventNotificationConfigsOrBuilderList() {
    return eventNotificationConfigs_;
  }
  /**
   * <pre>
   * The configuration for notification of telemetry events received from the
   * device. All telemetry events that were successfully published by the
   * device and acknowledged by Cloud IoT Core are guaranteed to be
   * delivered to Cloud Pub/Sub. If multiple configurations match a message,
   * only the first matching configuration is used. If you try to publish a
   * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
   * for the device's registry, the connection closes automatically. If you try
   * to do so using an HTTP connection, an error is returned. Up to 10
   * configurations may be provided.
   * </pre>
   *
   * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
   */
  public int getEventNotificationConfigsCount() {
    return eventNotificationConfigs_.size();
  }
  /**
   * <pre>
   * The configuration for notification of telemetry events received from the
   * device. All telemetry events that were successfully published by the
   * device and acknowledged by Cloud IoT Core are guaranteed to be
   * delivered to Cloud Pub/Sub. If multiple configurations match a message,
   * only the first matching configuration is used. If you try to publish a
   * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
   * for the device's registry, the connection closes automatically. If you try
   * to do so using an HTTP connection, an error is returned. Up to 10
   * configurations may be provided.
   * </pre>
   *
   * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
   */
  public com.google.cloud.iot.v1.EventNotificationConfig getEventNotificationConfigs(int index) {
    return eventNotificationConfigs_.get(index);
  }
  /**
   * <pre>
   * The configuration for notification of telemetry events received from the
   * device. All telemetry events that were successfully published by the
   * device and acknowledged by Cloud IoT Core are guaranteed to be
   * delivered to Cloud Pub/Sub. If multiple configurations match a message,
   * only the first matching configuration is used. If you try to publish a
   * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
   * for the device's registry, the connection closes automatically. If you try
   * to do so using an HTTP connection, an error is returned. Up to 10
   * configurations may be provided.
   * </pre>
   *
   * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
   */
  public com.google.cloud.iot.v1.EventNotificationConfigOrBuilder getEventNotificationConfigsOrBuilder(
      int index) {
    return eventNotificationConfigs_.get(index);
  }

  public static final int STATE_NOTIFICATION_CONFIG_FIELD_NUMBER = 7;
  private com.google.cloud.iot.v1.StateNotificationConfig stateNotificationConfig_;
  /**
   * <pre>
   * The configuration for notification of new states received from the device.
   * State updates are guaranteed to be stored in the state history, but
   * notifications to Cloud Pub/Sub are not guaranteed. For example, if
   * permissions are misconfigured or the specified topic doesn't exist, no
   * notification will be published but the state will still be stored in Cloud
   * IoT Core.
   * </pre>
   *
   * <code>.google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7;</code>
   */
  public boolean hasStateNotificationConfig() {
    return stateNotificationConfig_ != null;
  }
  /**
   * <pre>
   * The configuration for notification of new states received from the device.
   * State updates are guaranteed to be stored in the state history, but
   * notifications to Cloud Pub/Sub are not guaranteed. For example, if
   * permissions are misconfigured or the specified topic doesn't exist, no
   * notification will be published but the state will still be stored in Cloud
   * IoT Core.
   * </pre>
   *
   * <code>.google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7;</code>
   */
  public com.google.cloud.iot.v1.StateNotificationConfig getStateNotificationConfig() {
    return stateNotificationConfig_ == null ? com.google.cloud.iot.v1.StateNotificationConfig.getDefaultInstance() : stateNotificationConfig_;
  }
  /**
   * <pre>
   * The configuration for notification of new states received from the device.
   * State updates are guaranteed to be stored in the state history, but
   * notifications to Cloud Pub/Sub are not guaranteed. For example, if
   * permissions are misconfigured or the specified topic doesn't exist, no
   * notification will be published but the state will still be stored in Cloud
   * IoT Core.
   * </pre>
   *
   * <code>.google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7;</code>
   */
  public com.google.cloud.iot.v1.StateNotificationConfigOrBuilder getStateNotificationConfigOrBuilder() {
    return getStateNotificationConfig();
  }

  public static final int MQTT_CONFIG_FIELD_NUMBER = 4;
  private com.google.cloud.iot.v1.MqttConfig mqttConfig_;
  /**
   * <pre>
   * The MQTT configuration for this device registry.
   * </pre>
   *
   * <code>.google.cloud.iot.v1.MqttConfig mqtt_config = 4;</code>
   */
  public boolean hasMqttConfig() {
    return mqttConfig_ != null;
  }
  /**
   * <pre>
   * The MQTT configuration for this device registry.
   * </pre>
   *
   * <code>.google.cloud.iot.v1.MqttConfig mqtt_config = 4;</code>
   */
  public com.google.cloud.iot.v1.MqttConfig getMqttConfig() {
    return mqttConfig_ == null ? com.google.cloud.iot.v1.MqttConfig.getDefaultInstance() : mqttConfig_;
  }
  /**
   * <pre>
   * The MQTT configuration for this device registry.
   * </pre>
   *
   * <code>.google.cloud.iot.v1.MqttConfig mqtt_config = 4;</code>
   */
  public com.google.cloud.iot.v1.MqttConfigOrBuilder getMqttConfigOrBuilder() {
    return getMqttConfig();
  }

  public static final int HTTP_CONFIG_FIELD_NUMBER = 9;
  private com.google.cloud.iot.v1.HttpConfig httpConfig_;
  /**
   * <pre>
   * The DeviceService (HTTP) configuration for this device registry.
   * </pre>
   *
   * <code>.google.cloud.iot.v1.HttpConfig http_config = 9;</code>
   */
  public boolean hasHttpConfig() {
    return httpConfig_ != null;
  }
  /**
   * <pre>
   * The DeviceService (HTTP) configuration for this device registry.
   * </pre>
   *
   * <code>.google.cloud.iot.v1.HttpConfig http_config = 9;</code>
   */
  public com.google.cloud.iot.v1.HttpConfig getHttpConfig() {
    return httpConfig_ == null ? com.google.cloud.iot.v1.HttpConfig.getDefaultInstance() : httpConfig_;
  }
  /**
   * <pre>
   * The DeviceService (HTTP) configuration for this device registry.
   * </pre>
   *
   * <code>.google.cloud.iot.v1.HttpConfig http_config = 9;</code>
   */
  public com.google.cloud.iot.v1.HttpConfigOrBuilder getHttpConfigOrBuilder() {
    return getHttpConfig();
  }

  public static final int CREDENTIALS_FIELD_NUMBER = 8;
  private java.util.List<com.google.cloud.iot.v1.RegistryCredential> credentials_;
  /**
   * <pre>
   * The credentials used to verify the device credentials. No more than 10
   * credentials can be bound to a single registry at a time. The verification
   * process occurs at the time of device creation or update. If this field is
   * empty, no verification is performed. Otherwise, the credentials of a newly
   * created device or added credentials of an updated device should be signed
   * with one of these registry credentials.
   * Note, however, that existing devices will never be affected by
   * modifications to this list of credentials: after a device has been
   * successfully created in a registry, it should be able to connect even if
   * its registry credentials are revoked, deleted, or modified.
   * </pre>
   *
   * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
   */
  public java.util.List<com.google.cloud.iot.v1.RegistryCredential> getCredentialsList() {
    return credentials_;
  }
  /**
   * <pre>
   * The credentials used to verify the device credentials. No more than 10
   * credentials can be bound to a single registry at a time. The verification
   * process occurs at the time of device creation or update. If this field is
   * empty, no verification is performed. Otherwise, the credentials of a newly
   * created device or added credentials of an updated device should be signed
   * with one of these registry credentials.
   * Note, however, that existing devices will never be affected by
   * modifications to this list of credentials: after a device has been
   * successfully created in a registry, it should be able to connect even if
   * its registry credentials are revoked, deleted, or modified.
   * </pre>
   *
   * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
   */
  public java.util.List<? extends com.google.cloud.iot.v1.RegistryCredentialOrBuilder> 
      getCredentialsOrBuilderList() {
    return credentials_;
  }
  /**
   * <pre>
   * The credentials used to verify the device credentials. No more than 10
   * credentials can be bound to a single registry at a time. The verification
   * process occurs at the time of device creation or update. If this field is
   * empty, no verification is performed. Otherwise, the credentials of a newly
   * created device or added credentials of an updated device should be signed
   * with one of these registry credentials.
   * Note, however, that existing devices will never be affected by
   * modifications to this list of credentials: after a device has been
   * successfully created in a registry, it should be able to connect even if
   * its registry credentials are revoked, deleted, or modified.
   * </pre>
   *
   * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
   */
  public int getCredentialsCount() {
    return credentials_.size();
  }
  /**
   * <pre>
   * The credentials used to verify the device credentials. No more than 10
   * credentials can be bound to a single registry at a time. The verification
   * process occurs at the time of device creation or update. If this field is
   * empty, no verification is performed. Otherwise, the credentials of a newly
   * created device or added credentials of an updated device should be signed
   * with one of these registry credentials.
   * Note, however, that existing devices will never be affected by
   * modifications to this list of credentials: after a device has been
   * successfully created in a registry, it should be able to connect even if
   * its registry credentials are revoked, deleted, or modified.
   * </pre>
   *
   * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
   */
  public com.google.cloud.iot.v1.RegistryCredential getCredentials(int index) {
    return credentials_.get(index);
  }
  /**
   * <pre>
   * The credentials used to verify the device credentials. No more than 10
   * credentials can be bound to a single registry at a time. The verification
   * process occurs at the time of device creation or update. If this field is
   * empty, no verification is performed. Otherwise, the credentials of a newly
   * created device or added credentials of an updated device should be signed
   * with one of these registry credentials.
   * Note, however, that existing devices will never be affected by
   * modifications to this list of credentials: after a device has been
   * successfully created in a registry, it should be able to connect even if
   * its registry credentials are revoked, deleted, or modified.
   * </pre>
   *
   * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
   */
  public com.google.cloud.iot.v1.RegistryCredentialOrBuilder getCredentialsOrBuilder(
      int index) {
    return credentials_.get(index);
  }

  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 (!getIdBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, id_);
    }
    if (!getNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, name_);
    }
    if (mqttConfig_ != null) {
      output.writeMessage(4, getMqttConfig());
    }
    if (stateNotificationConfig_ != null) {
      output.writeMessage(7, getStateNotificationConfig());
    }
    for (int i = 0; i < credentials_.size(); i++) {
      output.writeMessage(8, credentials_.get(i));
    }
    if (httpConfig_ != null) {
      output.writeMessage(9, getHttpConfig());
    }
    for (int i = 0; i < eventNotificationConfigs_.size(); i++) {
      output.writeMessage(10, eventNotificationConfigs_.get(i));
    }
    unknownFields.writeTo(output);
  }

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

    size = 0;
    if (!getIdBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, id_);
    }
    if (!getNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, name_);
    }
    if (mqttConfig_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(4, getMqttConfig());
    }
    if (stateNotificationConfig_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(7, getStateNotificationConfig());
    }
    for (int i = 0; i < credentials_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(8, credentials_.get(i));
    }
    if (httpConfig_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(9, getHttpConfig());
    }
    for (int i = 0; i < eventNotificationConfigs_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(10, eventNotificationConfigs_.get(i));
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

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

    boolean result = true;
    result = result && getId()
        .equals(other.getId());
    result = result && getName()
        .equals(other.getName());
    result = result && getEventNotificationConfigsList()
        .equals(other.getEventNotificationConfigsList());
    result = result && (hasStateNotificationConfig() == other.hasStateNotificationConfig());
    if (hasStateNotificationConfig()) {
      result = result && getStateNotificationConfig()
          .equals(other.getStateNotificationConfig());
    }
    result = result && (hasMqttConfig() == other.hasMqttConfig());
    if (hasMqttConfig()) {
      result = result && getMqttConfig()
          .equals(other.getMqttConfig());
    }
    result = result && (hasHttpConfig() == other.hasHttpConfig());
    if (hasHttpConfig()) {
      result = result && getHttpConfig()
          .equals(other.getHttpConfig());
    }
    result = result && getCredentialsList()
        .equals(other.getCredentialsList());
    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) + ID_FIELD_NUMBER;
    hash = (53 * hash) + getId().hashCode();
    hash = (37 * hash) + NAME_FIELD_NUMBER;
    hash = (53 * hash) + getName().hashCode();
    if (getEventNotificationConfigsCount() > 0) {
      hash = (37 * hash) + EVENT_NOTIFICATION_CONFIGS_FIELD_NUMBER;
      hash = (53 * hash) + getEventNotificationConfigsList().hashCode();
    }
    if (hasStateNotificationConfig()) {
      hash = (37 * hash) + STATE_NOTIFICATION_CONFIG_FIELD_NUMBER;
      hash = (53 * hash) + getStateNotificationConfig().hashCode();
    }
    if (hasMqttConfig()) {
      hash = (37 * hash) + MQTT_CONFIG_FIELD_NUMBER;
      hash = (53 * hash) + getMqttConfig().hashCode();
    }
    if (hasHttpConfig()) {
      hash = (37 * hash) + HTTP_CONFIG_FIELD_NUMBER;
      hash = (53 * hash) + getHttpConfig().hashCode();
    }
    if (getCredentialsCount() > 0) {
      hash = (37 * hash) + CREDENTIALS_FIELD_NUMBER;
      hash = (53 * hash) + getCredentialsList().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.iot.v1.DeviceRegistry parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.cloud.iot.v1.DeviceRegistry parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.cloud.iot.v1.DeviceRegistry parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.cloud.iot.v1.DeviceRegistry parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.cloud.iot.v1.DeviceRegistry parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.cloud.iot.v1.DeviceRegistry parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.cloud.iot.v1.DeviceRegistry parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.cloud.iot.v1.DeviceRegistry parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }
  public static com.google.cloud.iot.v1.DeviceRegistry parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static com.google.cloud.iot.v1.DeviceRegistry parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
  }
  public static com.google.cloud.iot.v1.DeviceRegistry parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.cloud.iot.v1.DeviceRegistry 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.cloud.iot.v1.DeviceRegistry 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>
   * A container for a group of devices.
   * </pre>
   *
   * Protobuf type {@code google.cloud.iot.v1.DeviceRegistry}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.DeviceRegistry)
      com.google.cloud.iot.v1.DeviceRegistryOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.google.cloud.iot.v1.ResourcesProto.internal_static_google_cloud_iot_v1_DeviceRegistry_descriptor;
    }

    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.iot.v1.ResourcesProto.internal_static_google_cloud_iot_v1_DeviceRegistry_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.iot.v1.DeviceRegistry.class, com.google.cloud.iot.v1.DeviceRegistry.Builder.class);
    }

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

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

      name_ = "";

      if (eventNotificationConfigsBuilder_ == null) {
        eventNotificationConfigs_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000004);
      } else {
        eventNotificationConfigsBuilder_.clear();
      }
      if (stateNotificationConfigBuilder_ == null) {
        stateNotificationConfig_ = null;
      } else {
        stateNotificationConfig_ = null;
        stateNotificationConfigBuilder_ = null;
      }
      if (mqttConfigBuilder_ == null) {
        mqttConfig_ = null;
      } else {
        mqttConfig_ = null;
        mqttConfigBuilder_ = null;
      }
      if (httpConfigBuilder_ == null) {
        httpConfig_ = null;
      } else {
        httpConfig_ = null;
        httpConfigBuilder_ = null;
      }
      if (credentialsBuilder_ == null) {
        credentials_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000040);
      } else {
        credentialsBuilder_.clear();
      }
      return this;
    }

    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.google.cloud.iot.v1.ResourcesProto.internal_static_google_cloud_iot_v1_DeviceRegistry_descriptor;
    }

    public com.google.cloud.iot.v1.DeviceRegistry getDefaultInstanceForType() {
      return com.google.cloud.iot.v1.DeviceRegistry.getDefaultInstance();
    }

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

    public com.google.cloud.iot.v1.DeviceRegistry buildPartial() {
      com.google.cloud.iot.v1.DeviceRegistry result = new com.google.cloud.iot.v1.DeviceRegistry(this);
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      result.id_ = id_;
      result.name_ = name_;
      if (eventNotificationConfigsBuilder_ == null) {
        if (((bitField0_ & 0x00000004) == 0x00000004)) {
          eventNotificationConfigs_ = java.util.Collections.unmodifiableList(eventNotificationConfigs_);
          bitField0_ = (bitField0_ & ~0x00000004);
        }
        result.eventNotificationConfigs_ = eventNotificationConfigs_;
      } else {
        result.eventNotificationConfigs_ = eventNotificationConfigsBuilder_.build();
      }
      if (stateNotificationConfigBuilder_ == null) {
        result.stateNotificationConfig_ = stateNotificationConfig_;
      } else {
        result.stateNotificationConfig_ = stateNotificationConfigBuilder_.build();
      }
      if (mqttConfigBuilder_ == null) {
        result.mqttConfig_ = mqttConfig_;
      } else {
        result.mqttConfig_ = mqttConfigBuilder_.build();
      }
      if (httpConfigBuilder_ == null) {
        result.httpConfig_ = httpConfig_;
      } else {
        result.httpConfig_ = httpConfigBuilder_.build();
      }
      if (credentialsBuilder_ == null) {
        if (((bitField0_ & 0x00000040) == 0x00000040)) {
          credentials_ = java.util.Collections.unmodifiableList(credentials_);
          bitField0_ = (bitField0_ & ~0x00000040);
        }
        result.credentials_ = credentials_;
      } else {
        result.credentials_ = credentialsBuilder_.build();
      }
      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.cloud.iot.v1.DeviceRegistry) {
        return mergeFrom((com.google.cloud.iot.v1.DeviceRegistry)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.iot.v1.DeviceRegistry other) {
      if (other == com.google.cloud.iot.v1.DeviceRegistry.getDefaultInstance()) return this;
      if (!other.getId().isEmpty()) {
        id_ = other.id_;
        onChanged();
      }
      if (!other.getName().isEmpty()) {
        name_ = other.name_;
        onChanged();
      }
      if (eventNotificationConfigsBuilder_ == null) {
        if (!other.eventNotificationConfigs_.isEmpty()) {
          if (eventNotificationConfigs_.isEmpty()) {
            eventNotificationConfigs_ = other.eventNotificationConfigs_;
            bitField0_ = (bitField0_ & ~0x00000004);
          } else {
            ensureEventNotificationConfigsIsMutable();
            eventNotificationConfigs_.addAll(other.eventNotificationConfigs_);
          }
          onChanged();
        }
      } else {
        if (!other.eventNotificationConfigs_.isEmpty()) {
          if (eventNotificationConfigsBuilder_.isEmpty()) {
            eventNotificationConfigsBuilder_.dispose();
            eventNotificationConfigsBuilder_ = null;
            eventNotificationConfigs_ = other.eventNotificationConfigs_;
            bitField0_ = (bitField0_ & ~0x00000004);
            eventNotificationConfigsBuilder_ = 
              com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
                 getEventNotificationConfigsFieldBuilder() : null;
          } else {
            eventNotificationConfigsBuilder_.addAllMessages(other.eventNotificationConfigs_);
          }
        }
      }
      if (other.hasStateNotificationConfig()) {
        mergeStateNotificationConfig(other.getStateNotificationConfig());
      }
      if (other.hasMqttConfig()) {
        mergeMqttConfig(other.getMqttConfig());
      }
      if (other.hasHttpConfig()) {
        mergeHttpConfig(other.getHttpConfig());
      }
      if (credentialsBuilder_ == null) {
        if (!other.credentials_.isEmpty()) {
          if (credentials_.isEmpty()) {
            credentials_ = other.credentials_;
            bitField0_ = (bitField0_ & ~0x00000040);
          } else {
            ensureCredentialsIsMutable();
            credentials_.addAll(other.credentials_);
          }
          onChanged();
        }
      } else {
        if (!other.credentials_.isEmpty()) {
          if (credentialsBuilder_.isEmpty()) {
            credentialsBuilder_.dispose();
            credentialsBuilder_ = null;
            credentials_ = other.credentials_;
            bitField0_ = (bitField0_ & ~0x00000040);
            credentialsBuilder_ = 
              com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
                 getCredentialsFieldBuilder() : null;
          } else {
            credentialsBuilder_.addAllMessages(other.credentials_);
          }
        }
      }
      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.cloud.iot.v1.DeviceRegistry parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.cloud.iot.v1.DeviceRegistry) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int bitField0_;

    private java.lang.Object id_ = "";
    /**
     * <pre>
     * The identifier of this device registry. For example, `myRegistry`.
     * </pre>
     *
     * <code>string id = 1;</code>
     */
    public java.lang.String getId() {
      java.lang.Object ref = id_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        id_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * The identifier of this device registry. For example, `myRegistry`.
     * </pre>
     *
     * <code>string id = 1;</code>
     */
    public com.google.protobuf.ByteString
        getIdBytes() {
      java.lang.Object ref = id_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        id_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * The identifier of this device registry. For example, `myRegistry`.
     * </pre>
     *
     * <code>string id = 1;</code>
     */
    public Builder setId(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      id_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The identifier of this device registry. For example, `myRegistry`.
     * </pre>
     *
     * <code>string id = 1;</code>
     */
    public Builder clearId() {
      
      id_ = getDefaultInstance().getId();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The identifier of this device registry. For example, `myRegistry`.
     * </pre>
     *
     * <code>string id = 1;</code>
     */
    public Builder setIdBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      id_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object name_ = "";
    /**
     * <pre>
     * The resource path name. For example,
     * `projects/example-project/locations/us-central1/registries/my-registry`.
     * </pre>
     *
     * <code>string name = 2;</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 resource path name. For example,
     * `projects/example-project/locations/us-central1/registries/my-registry`.
     * </pre>
     *
     * <code>string name = 2;</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 resource path name. For example,
     * `projects/example-project/locations/us-central1/registries/my-registry`.
     * </pre>
     *
     * <code>string name = 2;</code>
     */
    public Builder setName(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      name_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The resource path name. For example,
     * `projects/example-project/locations/us-central1/registries/my-registry`.
     * </pre>
     *
     * <code>string name = 2;</code>
     */
    public Builder clearName() {
      
      name_ = getDefaultInstance().getName();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The resource path name. For example,
     * `projects/example-project/locations/us-central1/registries/my-registry`.
     * </pre>
     *
     * <code>string name = 2;</code>
     */
    public Builder setNameBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      name_ = value;
      onChanged();
      return this;
    }

    private java.util.List<com.google.cloud.iot.v1.EventNotificationConfig> eventNotificationConfigs_ =
      java.util.Collections.emptyList();
    private void ensureEventNotificationConfigsIsMutable() {
      if (!((bitField0_ & 0x00000004) == 0x00000004)) {
        eventNotificationConfigs_ = new java.util.ArrayList<com.google.cloud.iot.v1.EventNotificationConfig>(eventNotificationConfigs_);
        bitField0_ |= 0x00000004;
       }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
        com.google.cloud.iot.v1.EventNotificationConfig, com.google.cloud.iot.v1.EventNotificationConfig.Builder, com.google.cloud.iot.v1.EventNotificationConfigOrBuilder> eventNotificationConfigsBuilder_;

    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public java.util.List<com.google.cloud.iot.v1.EventNotificationConfig> getEventNotificationConfigsList() {
      if (eventNotificationConfigsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(eventNotificationConfigs_);
      } else {
        return eventNotificationConfigsBuilder_.getMessageList();
      }
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public int getEventNotificationConfigsCount() {
      if (eventNotificationConfigsBuilder_ == null) {
        return eventNotificationConfigs_.size();
      } else {
        return eventNotificationConfigsBuilder_.getCount();
      }
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public com.google.cloud.iot.v1.EventNotificationConfig getEventNotificationConfigs(int index) {
      if (eventNotificationConfigsBuilder_ == null) {
        return eventNotificationConfigs_.get(index);
      } else {
        return eventNotificationConfigsBuilder_.getMessage(index);
      }
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public Builder setEventNotificationConfigs(
        int index, com.google.cloud.iot.v1.EventNotificationConfig value) {
      if (eventNotificationConfigsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureEventNotificationConfigsIsMutable();
        eventNotificationConfigs_.set(index, value);
        onChanged();
      } else {
        eventNotificationConfigsBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public Builder setEventNotificationConfigs(
        int index, com.google.cloud.iot.v1.EventNotificationConfig.Builder builderForValue) {
      if (eventNotificationConfigsBuilder_ == null) {
        ensureEventNotificationConfigsIsMutable();
        eventNotificationConfigs_.set(index, builderForValue.build());
        onChanged();
      } else {
        eventNotificationConfigsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public Builder addEventNotificationConfigs(com.google.cloud.iot.v1.EventNotificationConfig value) {
      if (eventNotificationConfigsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureEventNotificationConfigsIsMutable();
        eventNotificationConfigs_.add(value);
        onChanged();
      } else {
        eventNotificationConfigsBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public Builder addEventNotificationConfigs(
        int index, com.google.cloud.iot.v1.EventNotificationConfig value) {
      if (eventNotificationConfigsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureEventNotificationConfigsIsMutable();
        eventNotificationConfigs_.add(index, value);
        onChanged();
      } else {
        eventNotificationConfigsBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public Builder addEventNotificationConfigs(
        com.google.cloud.iot.v1.EventNotificationConfig.Builder builderForValue) {
      if (eventNotificationConfigsBuilder_ == null) {
        ensureEventNotificationConfigsIsMutable();
        eventNotificationConfigs_.add(builderForValue.build());
        onChanged();
      } else {
        eventNotificationConfigsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public Builder addEventNotificationConfigs(
        int index, com.google.cloud.iot.v1.EventNotificationConfig.Builder builderForValue) {
      if (eventNotificationConfigsBuilder_ == null) {
        ensureEventNotificationConfigsIsMutable();
        eventNotificationConfigs_.add(index, builderForValue.build());
        onChanged();
      } else {
        eventNotificationConfigsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public Builder addAllEventNotificationConfigs(
        java.lang.Iterable<? extends com.google.cloud.iot.v1.EventNotificationConfig> values) {
      if (eventNotificationConfigsBuilder_ == null) {
        ensureEventNotificationConfigsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, eventNotificationConfigs_);
        onChanged();
      } else {
        eventNotificationConfigsBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public Builder clearEventNotificationConfigs() {
      if (eventNotificationConfigsBuilder_ == null) {
        eventNotificationConfigs_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000004);
        onChanged();
      } else {
        eventNotificationConfigsBuilder_.clear();
      }
      return this;
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public Builder removeEventNotificationConfigs(int index) {
      if (eventNotificationConfigsBuilder_ == null) {
        ensureEventNotificationConfigsIsMutable();
        eventNotificationConfigs_.remove(index);
        onChanged();
      } else {
        eventNotificationConfigsBuilder_.remove(index);
      }
      return this;
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public com.google.cloud.iot.v1.EventNotificationConfig.Builder getEventNotificationConfigsBuilder(
        int index) {
      return getEventNotificationConfigsFieldBuilder().getBuilder(index);
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public com.google.cloud.iot.v1.EventNotificationConfigOrBuilder getEventNotificationConfigsOrBuilder(
        int index) {
      if (eventNotificationConfigsBuilder_ == null) {
        return eventNotificationConfigs_.get(index);  } else {
        return eventNotificationConfigsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public java.util.List<? extends com.google.cloud.iot.v1.EventNotificationConfigOrBuilder> 
         getEventNotificationConfigsOrBuilderList() {
      if (eventNotificationConfigsBuilder_ != null) {
        return eventNotificationConfigsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(eventNotificationConfigs_);
      }
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public com.google.cloud.iot.v1.EventNotificationConfig.Builder addEventNotificationConfigsBuilder() {
      return getEventNotificationConfigsFieldBuilder().addBuilder(
          com.google.cloud.iot.v1.EventNotificationConfig.getDefaultInstance());
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public com.google.cloud.iot.v1.EventNotificationConfig.Builder addEventNotificationConfigsBuilder(
        int index) {
      return getEventNotificationConfigsFieldBuilder().addBuilder(
          index, com.google.cloud.iot.v1.EventNotificationConfig.getDefaultInstance());
    }
    /**
     * <pre>
     * The configuration for notification of telemetry events received from the
     * device. All telemetry events that were successfully published by the
     * device and acknowledged by Cloud IoT Core are guaranteed to be
     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
     * only the first matching configuration is used. If you try to publish a
     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
     * for the device's registry, the connection closes automatically. If you try
     * to do so using an HTTP connection, an error is returned. Up to 10
     * configurations may be provided.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10;</code>
     */
    public java.util.List<com.google.cloud.iot.v1.EventNotificationConfig.Builder> 
         getEventNotificationConfigsBuilderList() {
      return getEventNotificationConfigsFieldBuilder().getBuilderList();
    }
    private com.google.protobuf.RepeatedFieldBuilderV3<
        com.google.cloud.iot.v1.EventNotificationConfig, com.google.cloud.iot.v1.EventNotificationConfig.Builder, com.google.cloud.iot.v1.EventNotificationConfigOrBuilder> 
        getEventNotificationConfigsFieldBuilder() {
      if (eventNotificationConfigsBuilder_ == null) {
        eventNotificationConfigsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.iot.v1.EventNotificationConfig, com.google.cloud.iot.v1.EventNotificationConfig.Builder, com.google.cloud.iot.v1.EventNotificationConfigOrBuilder>(
                eventNotificationConfigs_,
                ((bitField0_ & 0x00000004) == 0x00000004),
                getParentForChildren(),
                isClean());
        eventNotificationConfigs_ = null;
      }
      return eventNotificationConfigsBuilder_;
    }

    private com.google.cloud.iot.v1.StateNotificationConfig stateNotificationConfig_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.iot.v1.StateNotificationConfig, com.google.cloud.iot.v1.StateNotificationConfig.Builder, com.google.cloud.iot.v1.StateNotificationConfigOrBuilder> stateNotificationConfigBuilder_;
    /**
     * <pre>
     * The configuration for notification of new states received from the device.
     * State updates are guaranteed to be stored in the state history, but
     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
     * permissions are misconfigured or the specified topic doesn't exist, no
     * notification will be published but the state will still be stored in Cloud
     * IoT Core.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7;</code>
     */
    public boolean hasStateNotificationConfig() {
      return stateNotificationConfigBuilder_ != null || stateNotificationConfig_ != null;
    }
    /**
     * <pre>
     * The configuration for notification of new states received from the device.
     * State updates are guaranteed to be stored in the state history, but
     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
     * permissions are misconfigured or the specified topic doesn't exist, no
     * notification will be published but the state will still be stored in Cloud
     * IoT Core.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7;</code>
     */
    public com.google.cloud.iot.v1.StateNotificationConfig getStateNotificationConfig() {
      if (stateNotificationConfigBuilder_ == null) {
        return stateNotificationConfig_ == null ? com.google.cloud.iot.v1.StateNotificationConfig.getDefaultInstance() : stateNotificationConfig_;
      } else {
        return stateNotificationConfigBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * The configuration for notification of new states received from the device.
     * State updates are guaranteed to be stored in the state history, but
     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
     * permissions are misconfigured or the specified topic doesn't exist, no
     * notification will be published but the state will still be stored in Cloud
     * IoT Core.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7;</code>
     */
    public Builder setStateNotificationConfig(com.google.cloud.iot.v1.StateNotificationConfig value) {
      if (stateNotificationConfigBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        stateNotificationConfig_ = value;
        onChanged();
      } else {
        stateNotificationConfigBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * The configuration for notification of new states received from the device.
     * State updates are guaranteed to be stored in the state history, but
     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
     * permissions are misconfigured or the specified topic doesn't exist, no
     * notification will be published but the state will still be stored in Cloud
     * IoT Core.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7;</code>
     */
    public Builder setStateNotificationConfig(
        com.google.cloud.iot.v1.StateNotificationConfig.Builder builderForValue) {
      if (stateNotificationConfigBuilder_ == null) {
        stateNotificationConfig_ = builderForValue.build();
        onChanged();
      } else {
        stateNotificationConfigBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * The configuration for notification of new states received from the device.
     * State updates are guaranteed to be stored in the state history, but
     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
     * permissions are misconfigured or the specified topic doesn't exist, no
     * notification will be published but the state will still be stored in Cloud
     * IoT Core.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7;</code>
     */
    public Builder mergeStateNotificationConfig(com.google.cloud.iot.v1.StateNotificationConfig value) {
      if (stateNotificationConfigBuilder_ == null) {
        if (stateNotificationConfig_ != null) {
          stateNotificationConfig_ =
            com.google.cloud.iot.v1.StateNotificationConfig.newBuilder(stateNotificationConfig_).mergeFrom(value).buildPartial();
        } else {
          stateNotificationConfig_ = value;
        }
        onChanged();
      } else {
        stateNotificationConfigBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * The configuration for notification of new states received from the device.
     * State updates are guaranteed to be stored in the state history, but
     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
     * permissions are misconfigured or the specified topic doesn't exist, no
     * notification will be published but the state will still be stored in Cloud
     * IoT Core.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7;</code>
     */
    public Builder clearStateNotificationConfig() {
      if (stateNotificationConfigBuilder_ == null) {
        stateNotificationConfig_ = null;
        onChanged();
      } else {
        stateNotificationConfig_ = null;
        stateNotificationConfigBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * The configuration for notification of new states received from the device.
     * State updates are guaranteed to be stored in the state history, but
     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
     * permissions are misconfigured or the specified topic doesn't exist, no
     * notification will be published but the state will still be stored in Cloud
     * IoT Core.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7;</code>
     */
    public com.google.cloud.iot.v1.StateNotificationConfig.Builder getStateNotificationConfigBuilder() {
      
      onChanged();
      return getStateNotificationConfigFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * The configuration for notification of new states received from the device.
     * State updates are guaranteed to be stored in the state history, but
     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
     * permissions are misconfigured or the specified topic doesn't exist, no
     * notification will be published but the state will still be stored in Cloud
     * IoT Core.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7;</code>
     */
    public com.google.cloud.iot.v1.StateNotificationConfigOrBuilder getStateNotificationConfigOrBuilder() {
      if (stateNotificationConfigBuilder_ != null) {
        return stateNotificationConfigBuilder_.getMessageOrBuilder();
      } else {
        return stateNotificationConfig_ == null ?
            com.google.cloud.iot.v1.StateNotificationConfig.getDefaultInstance() : stateNotificationConfig_;
      }
    }
    /**
     * <pre>
     * The configuration for notification of new states received from the device.
     * State updates are guaranteed to be stored in the state history, but
     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
     * permissions are misconfigured or the specified topic doesn't exist, no
     * notification will be published but the state will still be stored in Cloud
     * IoT Core.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.iot.v1.StateNotificationConfig, com.google.cloud.iot.v1.StateNotificationConfig.Builder, com.google.cloud.iot.v1.StateNotificationConfigOrBuilder> 
        getStateNotificationConfigFieldBuilder() {
      if (stateNotificationConfigBuilder_ == null) {
        stateNotificationConfigBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.iot.v1.StateNotificationConfig, com.google.cloud.iot.v1.StateNotificationConfig.Builder, com.google.cloud.iot.v1.StateNotificationConfigOrBuilder>(
                getStateNotificationConfig(),
                getParentForChildren(),
                isClean());
        stateNotificationConfig_ = null;
      }
      return stateNotificationConfigBuilder_;
    }

    private com.google.cloud.iot.v1.MqttConfig mqttConfig_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.iot.v1.MqttConfig, com.google.cloud.iot.v1.MqttConfig.Builder, com.google.cloud.iot.v1.MqttConfigOrBuilder> mqttConfigBuilder_;
    /**
     * <pre>
     * The MQTT configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.MqttConfig mqtt_config = 4;</code>
     */
    public boolean hasMqttConfig() {
      return mqttConfigBuilder_ != null || mqttConfig_ != null;
    }
    /**
     * <pre>
     * The MQTT configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.MqttConfig mqtt_config = 4;</code>
     */
    public com.google.cloud.iot.v1.MqttConfig getMqttConfig() {
      if (mqttConfigBuilder_ == null) {
        return mqttConfig_ == null ? com.google.cloud.iot.v1.MqttConfig.getDefaultInstance() : mqttConfig_;
      } else {
        return mqttConfigBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * The MQTT configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.MqttConfig mqtt_config = 4;</code>
     */
    public Builder setMqttConfig(com.google.cloud.iot.v1.MqttConfig value) {
      if (mqttConfigBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        mqttConfig_ = value;
        onChanged();
      } else {
        mqttConfigBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * The MQTT configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.MqttConfig mqtt_config = 4;</code>
     */
    public Builder setMqttConfig(
        com.google.cloud.iot.v1.MqttConfig.Builder builderForValue) {
      if (mqttConfigBuilder_ == null) {
        mqttConfig_ = builderForValue.build();
        onChanged();
      } else {
        mqttConfigBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * The MQTT configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.MqttConfig mqtt_config = 4;</code>
     */
    public Builder mergeMqttConfig(com.google.cloud.iot.v1.MqttConfig value) {
      if (mqttConfigBuilder_ == null) {
        if (mqttConfig_ != null) {
          mqttConfig_ =
            com.google.cloud.iot.v1.MqttConfig.newBuilder(mqttConfig_).mergeFrom(value).buildPartial();
        } else {
          mqttConfig_ = value;
        }
        onChanged();
      } else {
        mqttConfigBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * The MQTT configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.MqttConfig mqtt_config = 4;</code>
     */
    public Builder clearMqttConfig() {
      if (mqttConfigBuilder_ == null) {
        mqttConfig_ = null;
        onChanged();
      } else {
        mqttConfig_ = null;
        mqttConfigBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * The MQTT configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.MqttConfig mqtt_config = 4;</code>
     */
    public com.google.cloud.iot.v1.MqttConfig.Builder getMqttConfigBuilder() {
      
      onChanged();
      return getMqttConfigFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * The MQTT configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.MqttConfig mqtt_config = 4;</code>
     */
    public com.google.cloud.iot.v1.MqttConfigOrBuilder getMqttConfigOrBuilder() {
      if (mqttConfigBuilder_ != null) {
        return mqttConfigBuilder_.getMessageOrBuilder();
      } else {
        return mqttConfig_ == null ?
            com.google.cloud.iot.v1.MqttConfig.getDefaultInstance() : mqttConfig_;
      }
    }
    /**
     * <pre>
     * The MQTT configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.MqttConfig mqtt_config = 4;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.iot.v1.MqttConfig, com.google.cloud.iot.v1.MqttConfig.Builder, com.google.cloud.iot.v1.MqttConfigOrBuilder> 
        getMqttConfigFieldBuilder() {
      if (mqttConfigBuilder_ == null) {
        mqttConfigBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.iot.v1.MqttConfig, com.google.cloud.iot.v1.MqttConfig.Builder, com.google.cloud.iot.v1.MqttConfigOrBuilder>(
                getMqttConfig(),
                getParentForChildren(),
                isClean());
        mqttConfig_ = null;
      }
      return mqttConfigBuilder_;
    }

    private com.google.cloud.iot.v1.HttpConfig httpConfig_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.iot.v1.HttpConfig, com.google.cloud.iot.v1.HttpConfig.Builder, com.google.cloud.iot.v1.HttpConfigOrBuilder> httpConfigBuilder_;
    /**
     * <pre>
     * The DeviceService (HTTP) configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.HttpConfig http_config = 9;</code>
     */
    public boolean hasHttpConfig() {
      return httpConfigBuilder_ != null || httpConfig_ != null;
    }
    /**
     * <pre>
     * The DeviceService (HTTP) configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.HttpConfig http_config = 9;</code>
     */
    public com.google.cloud.iot.v1.HttpConfig getHttpConfig() {
      if (httpConfigBuilder_ == null) {
        return httpConfig_ == null ? com.google.cloud.iot.v1.HttpConfig.getDefaultInstance() : httpConfig_;
      } else {
        return httpConfigBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * The DeviceService (HTTP) configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.HttpConfig http_config = 9;</code>
     */
    public Builder setHttpConfig(com.google.cloud.iot.v1.HttpConfig value) {
      if (httpConfigBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        httpConfig_ = value;
        onChanged();
      } else {
        httpConfigBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * The DeviceService (HTTP) configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.HttpConfig http_config = 9;</code>
     */
    public Builder setHttpConfig(
        com.google.cloud.iot.v1.HttpConfig.Builder builderForValue) {
      if (httpConfigBuilder_ == null) {
        httpConfig_ = builderForValue.build();
        onChanged();
      } else {
        httpConfigBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * The DeviceService (HTTP) configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.HttpConfig http_config = 9;</code>
     */
    public Builder mergeHttpConfig(com.google.cloud.iot.v1.HttpConfig value) {
      if (httpConfigBuilder_ == null) {
        if (httpConfig_ != null) {
          httpConfig_ =
            com.google.cloud.iot.v1.HttpConfig.newBuilder(httpConfig_).mergeFrom(value).buildPartial();
        } else {
          httpConfig_ = value;
        }
        onChanged();
      } else {
        httpConfigBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * The DeviceService (HTTP) configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.HttpConfig http_config = 9;</code>
     */
    public Builder clearHttpConfig() {
      if (httpConfigBuilder_ == null) {
        httpConfig_ = null;
        onChanged();
      } else {
        httpConfig_ = null;
        httpConfigBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * The DeviceService (HTTP) configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.HttpConfig http_config = 9;</code>
     */
    public com.google.cloud.iot.v1.HttpConfig.Builder getHttpConfigBuilder() {
      
      onChanged();
      return getHttpConfigFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * The DeviceService (HTTP) configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.HttpConfig http_config = 9;</code>
     */
    public com.google.cloud.iot.v1.HttpConfigOrBuilder getHttpConfigOrBuilder() {
      if (httpConfigBuilder_ != null) {
        return httpConfigBuilder_.getMessageOrBuilder();
      } else {
        return httpConfig_ == null ?
            com.google.cloud.iot.v1.HttpConfig.getDefaultInstance() : httpConfig_;
      }
    }
    /**
     * <pre>
     * The DeviceService (HTTP) configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.HttpConfig http_config = 9;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.cloud.iot.v1.HttpConfig, com.google.cloud.iot.v1.HttpConfig.Builder, com.google.cloud.iot.v1.HttpConfigOrBuilder> 
        getHttpConfigFieldBuilder() {
      if (httpConfigBuilder_ == null) {
        httpConfigBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.iot.v1.HttpConfig, com.google.cloud.iot.v1.HttpConfig.Builder, com.google.cloud.iot.v1.HttpConfigOrBuilder>(
                getHttpConfig(),
                getParentForChildren(),
                isClean());
        httpConfig_ = null;
      }
      return httpConfigBuilder_;
    }

    private java.util.List<com.google.cloud.iot.v1.RegistryCredential> credentials_ =
      java.util.Collections.emptyList();
    private void ensureCredentialsIsMutable() {
      if (!((bitField0_ & 0x00000040) == 0x00000040)) {
        credentials_ = new java.util.ArrayList<com.google.cloud.iot.v1.RegistryCredential>(credentials_);
        bitField0_ |= 0x00000040;
       }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
        com.google.cloud.iot.v1.RegistryCredential, com.google.cloud.iot.v1.RegistryCredential.Builder, com.google.cloud.iot.v1.RegistryCredentialOrBuilder> credentialsBuilder_;

    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public java.util.List<com.google.cloud.iot.v1.RegistryCredential> getCredentialsList() {
      if (credentialsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(credentials_);
      } else {
        return credentialsBuilder_.getMessageList();
      }
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public int getCredentialsCount() {
      if (credentialsBuilder_ == null) {
        return credentials_.size();
      } else {
        return credentialsBuilder_.getCount();
      }
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public com.google.cloud.iot.v1.RegistryCredential getCredentials(int index) {
      if (credentialsBuilder_ == null) {
        return credentials_.get(index);
      } else {
        return credentialsBuilder_.getMessage(index);
      }
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public Builder setCredentials(
        int index, com.google.cloud.iot.v1.RegistryCredential value) {
      if (credentialsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureCredentialsIsMutable();
        credentials_.set(index, value);
        onChanged();
      } else {
        credentialsBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public Builder setCredentials(
        int index, com.google.cloud.iot.v1.RegistryCredential.Builder builderForValue) {
      if (credentialsBuilder_ == null) {
        ensureCredentialsIsMutable();
        credentials_.set(index, builderForValue.build());
        onChanged();
      } else {
        credentialsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public Builder addCredentials(com.google.cloud.iot.v1.RegistryCredential value) {
      if (credentialsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureCredentialsIsMutable();
        credentials_.add(value);
        onChanged();
      } else {
        credentialsBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public Builder addCredentials(
        int index, com.google.cloud.iot.v1.RegistryCredential value) {
      if (credentialsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureCredentialsIsMutable();
        credentials_.add(index, value);
        onChanged();
      } else {
        credentialsBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public Builder addCredentials(
        com.google.cloud.iot.v1.RegistryCredential.Builder builderForValue) {
      if (credentialsBuilder_ == null) {
        ensureCredentialsIsMutable();
        credentials_.add(builderForValue.build());
        onChanged();
      } else {
        credentialsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public Builder addCredentials(
        int index, com.google.cloud.iot.v1.RegistryCredential.Builder builderForValue) {
      if (credentialsBuilder_ == null) {
        ensureCredentialsIsMutable();
        credentials_.add(index, builderForValue.build());
        onChanged();
      } else {
        credentialsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public Builder addAllCredentials(
        java.lang.Iterable<? extends com.google.cloud.iot.v1.RegistryCredential> values) {
      if (credentialsBuilder_ == null) {
        ensureCredentialsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, credentials_);
        onChanged();
      } else {
        credentialsBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public Builder clearCredentials() {
      if (credentialsBuilder_ == null) {
        credentials_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000040);
        onChanged();
      } else {
        credentialsBuilder_.clear();
      }
      return this;
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public Builder removeCredentials(int index) {
      if (credentialsBuilder_ == null) {
        ensureCredentialsIsMutable();
        credentials_.remove(index);
        onChanged();
      } else {
        credentialsBuilder_.remove(index);
      }
      return this;
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public com.google.cloud.iot.v1.RegistryCredential.Builder getCredentialsBuilder(
        int index) {
      return getCredentialsFieldBuilder().getBuilder(index);
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public com.google.cloud.iot.v1.RegistryCredentialOrBuilder getCredentialsOrBuilder(
        int index) {
      if (credentialsBuilder_ == null) {
        return credentials_.get(index);  } else {
        return credentialsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public java.util.List<? extends com.google.cloud.iot.v1.RegistryCredentialOrBuilder> 
         getCredentialsOrBuilderList() {
      if (credentialsBuilder_ != null) {
        return credentialsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(credentials_);
      }
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public com.google.cloud.iot.v1.RegistryCredential.Builder addCredentialsBuilder() {
      return getCredentialsFieldBuilder().addBuilder(
          com.google.cloud.iot.v1.RegistryCredential.getDefaultInstance());
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public com.google.cloud.iot.v1.RegistryCredential.Builder addCredentialsBuilder(
        int index) {
      return getCredentialsFieldBuilder().addBuilder(
          index, com.google.cloud.iot.v1.RegistryCredential.getDefaultInstance());
    }
    /**
     * <pre>
     * The credentials used to verify the device credentials. No more than 10
     * credentials can be bound to a single registry at a time. The verification
     * process occurs at the time of device creation or update. If this field is
     * empty, no verification is performed. Otherwise, the credentials of a newly
     * created device or added credentials of an updated device should be signed
     * with one of these registry credentials.
     * Note, however, that existing devices will never be affected by
     * modifications to this list of credentials: after a device has been
     * successfully created in a registry, it should be able to connect even if
     * its registry credentials are revoked, deleted, or modified.
     * </pre>
     *
     * <code>repeated .google.cloud.iot.v1.RegistryCredential credentials = 8;</code>
     */
    public java.util.List<com.google.cloud.iot.v1.RegistryCredential.Builder> 
         getCredentialsBuilderList() {
      return getCredentialsFieldBuilder().getBuilderList();
    }
    private com.google.protobuf.RepeatedFieldBuilderV3<
        com.google.cloud.iot.v1.RegistryCredential, com.google.cloud.iot.v1.RegistryCredential.Builder, com.google.cloud.iot.v1.RegistryCredentialOrBuilder> 
        getCredentialsFieldBuilder() {
      if (credentialsBuilder_ == null) {
        credentialsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.cloud.iot.v1.RegistryCredential, com.google.cloud.iot.v1.RegistryCredential.Builder, com.google.cloud.iot.v1.RegistryCredentialOrBuilder>(
                credentials_,
                ((bitField0_ & 0x00000040) == 0x00000040),
                getParentForChildren(),
                isClean());
        credentials_ = null;
      }
      return credentialsBuilder_;
    }
    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.cloud.iot.v1.DeviceRegistry)
  }

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

  public static com.google.cloud.iot.v1.DeviceRegistry getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

  public com.google.cloud.iot.v1.DeviceRegistry getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

