/*
 * Copyright 2020 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// 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();
    logLevel_ = 0;
    credentials_ = java.util.Collections.emptyList();
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
    return new DeviceRegistry();
  }

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

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

  @java.lang.Override
  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);
  }

  public static final int ID_FIELD_NUMBER = 1;

  @SuppressWarnings("serial")
  private volatile java.lang.Object id_ = "";
  /**
   *
   *
   * <pre>
   * The identifier of this device registry. For example, `myRegistry`.
   * </pre>
   *
   * <code>string id = 1;</code>
   *
   * @return The id.
   */
  @java.lang.Override
  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>
   *
   * @return The bytes for id.
   */
  @java.lang.Override
  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;

  @SuppressWarnings("serial")
  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>
   *
   * @return The name.
   */
  @java.lang.Override
  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>
   *
   * @return The bytes for name.
   */
  @java.lang.Override
  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;

  @SuppressWarnings("serial")
  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>
   */
  @java.lang.Override
  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>
   */
  @java.lang.Override
  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>
   */
  @java.lang.Override
  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>
   */
  @java.lang.Override
  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>
   */
  @java.lang.Override
  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>
   *
   * @return Whether the stateNotificationConfig field is set.
   */
  @java.lang.Override
  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>
   *
   * @return The stateNotificationConfig.
   */
  @java.lang.Override
  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>
   */
  @java.lang.Override
  public com.google.cloud.iot.v1.StateNotificationConfigOrBuilder
      getStateNotificationConfigOrBuilder() {
    return stateNotificationConfig_ == null
        ? com.google.cloud.iot.v1.StateNotificationConfig.getDefaultInstance()
        : stateNotificationConfig_;
  }

  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>
   *
   * @return Whether the mqttConfig field is set.
   */
  @java.lang.Override
  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>
   *
   * @return The mqttConfig.
   */
  @java.lang.Override
  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>
   */
  @java.lang.Override
  public com.google.cloud.iot.v1.MqttConfigOrBuilder getMqttConfigOrBuilder() {
    return mqttConfig_ == null
        ? com.google.cloud.iot.v1.MqttConfig.getDefaultInstance()
        : mqttConfig_;
  }

  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>
   *
   * @return Whether the httpConfig field is set.
   */
  @java.lang.Override
  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>
   *
   * @return The httpConfig.
   */
  @java.lang.Override
  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>
   */
  @java.lang.Override
  public com.google.cloud.iot.v1.HttpConfigOrBuilder getHttpConfigOrBuilder() {
    return httpConfig_ == null
        ? com.google.cloud.iot.v1.HttpConfig.getDefaultInstance()
        : httpConfig_;
  }

  public static final int LOG_LEVEL_FIELD_NUMBER = 11;
  private int logLevel_ = 0;
  /**
   *
   *
   * <pre>
   * **Beta Feature**
   * The default logging verbosity for activity from devices in this registry.
   * The verbosity level can be overridden by Device.log_level.
   * </pre>
   *
   * <code>.google.cloud.iot.v1.LogLevel log_level = 11;</code>
   *
   * @return The enum numeric value on the wire for logLevel.
   */
  @java.lang.Override
  public int getLogLevelValue() {
    return logLevel_;
  }
  /**
   *
   *
   * <pre>
   * **Beta Feature**
   * The default logging verbosity for activity from devices in this registry.
   * The verbosity level can be overridden by Device.log_level.
   * </pre>
   *
   * <code>.google.cloud.iot.v1.LogLevel log_level = 11;</code>
   *
   * @return The logLevel.
   */
  @java.lang.Override
  public com.google.cloud.iot.v1.LogLevel getLogLevel() {
    com.google.cloud.iot.v1.LogLevel result = com.google.cloud.iot.v1.LogLevel.forNumber(logLevel_);
    return result == null ? com.google.cloud.iot.v1.LogLevel.UNRECOGNIZED : result;
  }

  public static final int CREDENTIALS_FIELD_NUMBER = 8;

  @SuppressWarnings("serial")
  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>
   */
  @java.lang.Override
  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>
   */
  @java.lang.Override
  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>
   */
  @java.lang.Override
  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>
   */
  @java.lang.Override
  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>
   */
  @java.lang.Override
  public com.google.cloud.iot.v1.RegistryCredentialOrBuilder getCredentialsOrBuilder(int index) {
    return credentials_.get(index);
  }

  private byte memoizedIsInitialized = -1;

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

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, id_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
      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));
    }
    if (logLevel_ != com.google.cloud.iot.v1.LogLevel.LOG_LEVEL_UNSPECIFIED.getNumber()) {
      output.writeEnum(11, logLevel_);
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, id_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
      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));
    }
    if (logLevel_ != com.google.cloud.iot.v1.LogLevel.LOG_LEVEL_UNSPECIFIED.getNumber()) {
      size += com.google.protobuf.CodedOutputStream.computeEnumSize(11, logLevel_);
    }
    size += getUnknownFields().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;

    if (!getId().equals(other.getId())) return false;
    if (!getName().equals(other.getName())) return false;
    if (!getEventNotificationConfigsList().equals(other.getEventNotificationConfigsList()))
      return false;
    if (hasStateNotificationConfig() != other.hasStateNotificationConfig()) return false;
    if (hasStateNotificationConfig()) {
      if (!getStateNotificationConfig().equals(other.getStateNotificationConfig())) return false;
    }
    if (hasMqttConfig() != other.hasMqttConfig()) return false;
    if (hasMqttConfig()) {
      if (!getMqttConfig().equals(other.getMqttConfig())) return false;
    }
    if (hasHttpConfig() != other.hasHttpConfig()) return false;
    if (hasHttpConfig()) {
      if (!getHttpConfig().equals(other.getHttpConfig())) return false;
    }
    if (logLevel_ != other.logLevel_) return false;
    if (!getCredentialsList().equals(other.getCredentialsList())) return false;
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + ID_FIELD_NUMBER;
    hash = (53 * hash) + getId().hashCode();
    hash = (37 * hash) + NAME_FIELD_NUMBER;
    hash = (53 * hash) + getName().hashCode();
    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();
    }
    hash = (37 * hash) + LOG_LEVEL_FIELD_NUMBER;
    hash = (53 * hash) + logLevel_;
    if (getCredentialsCount() > 0) {
      hash = (37 * hash) + CREDENTIALS_FIELD_NUMBER;
      hash = (53 * hash) + getCredentialsList().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().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);
  }

  @java.lang.Override
  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);
  }

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

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *
   *
   * <pre>
   * A 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;
    }

    @java.lang.Override
    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() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      id_ = "";
      name_ = "";
      if (eventNotificationConfigsBuilder_ == null) {
        eventNotificationConfigs_ = java.util.Collections.emptyList();
      } else {
        eventNotificationConfigs_ = null;
        eventNotificationConfigsBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000004);
      stateNotificationConfig_ = null;
      if (stateNotificationConfigBuilder_ != null) {
        stateNotificationConfigBuilder_.dispose();
        stateNotificationConfigBuilder_ = null;
      }
      mqttConfig_ = null;
      if (mqttConfigBuilder_ != null) {
        mqttConfigBuilder_.dispose();
        mqttConfigBuilder_ = null;
      }
      httpConfig_ = null;
      if (httpConfigBuilder_ != null) {
        httpConfigBuilder_.dispose();
        httpConfigBuilder_ = null;
      }
      logLevel_ = 0;
      if (credentialsBuilder_ == null) {
        credentials_ = java.util.Collections.emptyList();
      } else {
        credentials_ = null;
        credentialsBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000080);
      return this;
    }

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

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

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

    @java.lang.Override
    public com.google.cloud.iot.v1.DeviceRegistry buildPartial() {
      com.google.cloud.iot.v1.DeviceRegistry result =
          new com.google.cloud.iot.v1.DeviceRegistry(this);
      buildPartialRepeatedFields(result);
      if (bitField0_ != 0) {
        buildPartial0(result);
      }
      onBuilt();
      return result;
    }

    private void buildPartialRepeatedFields(com.google.cloud.iot.v1.DeviceRegistry result) {
      if (eventNotificationConfigsBuilder_ == null) {
        if (((bitField0_ & 0x00000004) != 0)) {
          eventNotificationConfigs_ =
              java.util.Collections.unmodifiableList(eventNotificationConfigs_);
          bitField0_ = (bitField0_ & ~0x00000004);
        }
        result.eventNotificationConfigs_ = eventNotificationConfigs_;
      } else {
        result.eventNotificationConfigs_ = eventNotificationConfigsBuilder_.build();
      }
      if (credentialsBuilder_ == null) {
        if (((bitField0_ & 0x00000080) != 0)) {
          credentials_ = java.util.Collections.unmodifiableList(credentials_);
          bitField0_ = (bitField0_ & ~0x00000080);
        }
        result.credentials_ = credentials_;
      } else {
        result.credentials_ = credentialsBuilder_.build();
      }
    }

    private void buildPartial0(com.google.cloud.iot.v1.DeviceRegistry result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.id_ = id_;
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.name_ = name_;
      }
      if (((from_bitField0_ & 0x00000008) != 0)) {
        result.stateNotificationConfig_ =
            stateNotificationConfigBuilder_ == null
                ? stateNotificationConfig_
                : stateNotificationConfigBuilder_.build();
      }
      if (((from_bitField0_ & 0x00000010) != 0)) {
        result.mqttConfig_ = mqttConfigBuilder_ == null ? mqttConfig_ : mqttConfigBuilder_.build();
      }
      if (((from_bitField0_ & 0x00000020) != 0)) {
        result.httpConfig_ = httpConfigBuilder_ == null ? httpConfig_ : httpConfigBuilder_.build();
      }
      if (((from_bitField0_ & 0x00000040) != 0)) {
        result.logLevel_ = logLevel_;
      }
    }

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

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

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

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

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

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

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.cloud.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_;
        bitField0_ |= 0x00000001;
        onChanged();
      }
      if (!other.getName().isEmpty()) {
        name_ = other.name_;
        bitField0_ |= 0x00000002;
        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 (other.logLevel_ != 0) {
        setLogLevelValue(other.getLogLevelValue());
      }
      if (credentialsBuilder_ == null) {
        if (!other.credentials_.isEmpty()) {
          if (credentials_.isEmpty()) {
            credentials_ = other.credentials_;
            bitField0_ = (bitField0_ & ~0x00000080);
          } else {
            ensureCredentialsIsMutable();
            credentials_.addAll(other.credentials_);
          }
          onChanged();
        }
      } else {
        if (!other.credentials_.isEmpty()) {
          if (credentialsBuilder_.isEmpty()) {
            credentialsBuilder_.dispose();
            credentialsBuilder_ = null;
            credentials_ = other.credentials_;
            bitField0_ = (bitField0_ & ~0x00000080);
            credentialsBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getCredentialsFieldBuilder()
                    : null;
          } else {
            credentialsBuilder_.addAllMessages(other.credentials_);
          }
        }
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

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

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                id_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000001;
                break;
              } // case 10
            case 18:
              {
                name_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000002;
                break;
              } // case 18
            case 34:
              {
                input.readMessage(getMqttConfigFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000010;
                break;
              } // case 34
            case 58:
              {
                input.readMessage(
                    getStateNotificationConfigFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000008;
                break;
              } // case 58
            case 66:
              {
                com.google.cloud.iot.v1.RegistryCredential m =
                    input.readMessage(
                        com.google.cloud.iot.v1.RegistryCredential.parser(), extensionRegistry);
                if (credentialsBuilder_ == null) {
                  ensureCredentialsIsMutable();
                  credentials_.add(m);
                } else {
                  credentialsBuilder_.addMessage(m);
                }
                break;
              } // case 66
            case 74:
              {
                input.readMessage(getHttpConfigFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000020;
                break;
              } // case 74
            case 82:
              {
                com.google.cloud.iot.v1.EventNotificationConfig m =
                    input.readMessage(
                        com.google.cloud.iot.v1.EventNotificationConfig.parser(),
                        extensionRegistry);
                if (eventNotificationConfigsBuilder_ == null) {
                  ensureEventNotificationConfigsIsMutable();
                  eventNotificationConfigs_.add(m);
                } else {
                  eventNotificationConfigsBuilder_.addMessage(m);
                }
                break;
              } // case 82
            case 88:
              {
                logLevel_ = input.readEnum();
                bitField0_ |= 0x00000040;
                break;
              } // case 88
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      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>
     *
     * @return The id.
     */
    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>
     *
     * @return The bytes for id.
     */
    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>
     *
     * @param value The id to set.
     * @return This builder for chaining.
     */
    public Builder setId(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      id_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The identifier of this device registry. For example, `myRegistry`.
     * </pre>
     *
     * <code>string id = 1;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearId() {
      id_ = getDefaultInstance().getId();
      bitField0_ = (bitField0_ & ~0x00000001);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The identifier of this device registry. For example, `myRegistry`.
     * </pre>
     *
     * <code>string id = 1;</code>
     *
     * @param value The bytes for id to set.
     * @return This builder for chaining.
     */
    public Builder setIdBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      id_ = value;
      bitField0_ |= 0x00000001;
      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>
     *
     * @return The name.
     */
    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>
     *
     * @return The bytes for name.
     */
    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>
     *
     * @param value The name to set.
     * @return This builder for chaining.
     */
    public Builder setName(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      name_ = value;
      bitField0_ |= 0x00000002;
      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>
     *
     * @return This builder for chaining.
     */
    public Builder clearName() {
      name_ = getDefaultInstance().getName();
      bitField0_ = (bitField0_ & ~0x00000002);
      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>
     *
     * @param value The bytes for name to set.
     * @return This builder for chaining.
     */
    public Builder setNameBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      name_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    private java.util.List<com.google.cloud.iot.v1.EventNotificationConfig>
        eventNotificationConfigs_ = java.util.Collections.emptyList();

    private void ensureEventNotificationConfigsIsMutable() {
      if (!((bitField0_ & 0x00000004) != 0)) {
        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) != 0),
                getParentForChildren(),
                isClean());
        eventNotificationConfigs_ = null;
      }
      return eventNotificationConfigsBuilder_;
    }

    private com.google.cloud.iot.v1.StateNotificationConfig stateNotificationConfig_;
    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>
     *
     * @return Whether the stateNotificationConfig field is set.
     */
    public boolean hasStateNotificationConfig() {
      return ((bitField0_ & 0x00000008) != 0);
    }
    /**
     *
     *
     * <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>
     *
     * @return The stateNotificationConfig.
     */
    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;
      } else {
        stateNotificationConfigBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000008;
      onChanged();
      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();
      } else {
        stateNotificationConfigBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000008;
      onChanged();
      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 (((bitField0_ & 0x00000008) != 0)
            && stateNotificationConfig_ != null
            && stateNotificationConfig_
                != com.google.cloud.iot.v1.StateNotificationConfig.getDefaultInstance()) {
          getStateNotificationConfigBuilder().mergeFrom(value);
        } else {
          stateNotificationConfig_ = value;
        }
      } else {
        stateNotificationConfigBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000008;
      onChanged();
      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() {
      bitField0_ = (bitField0_ & ~0x00000008);
      stateNotificationConfig_ = null;
      if (stateNotificationConfigBuilder_ != null) {
        stateNotificationConfigBuilder_.dispose();
        stateNotificationConfigBuilder_ = null;
      }
      onChanged();
      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() {
      bitField0_ |= 0x00000008;
      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_;
    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>
     *
     * @return Whether the mqttConfig field is set.
     */
    public boolean hasMqttConfig() {
      return ((bitField0_ & 0x00000010) != 0);
    }
    /**
     *
     *
     * <pre>
     * The MQTT configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.MqttConfig mqtt_config = 4;</code>
     *
     * @return The mqttConfig.
     */
    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;
      } else {
        mqttConfigBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000010;
      onChanged();
      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();
      } else {
        mqttConfigBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000010;
      onChanged();
      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 (((bitField0_ & 0x00000010) != 0)
            && mqttConfig_ != null
            && mqttConfig_ != com.google.cloud.iot.v1.MqttConfig.getDefaultInstance()) {
          getMqttConfigBuilder().mergeFrom(value);
        } else {
          mqttConfig_ = value;
        }
      } else {
        mqttConfigBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000010;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The MQTT configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.MqttConfig mqtt_config = 4;</code>
     */
    public Builder clearMqttConfig() {
      bitField0_ = (bitField0_ & ~0x00000010);
      mqttConfig_ = null;
      if (mqttConfigBuilder_ != null) {
        mqttConfigBuilder_.dispose();
        mqttConfigBuilder_ = null;
      }
      onChanged();
      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() {
      bitField0_ |= 0x00000010;
      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_;
    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>
     *
     * @return Whether the httpConfig field is set.
     */
    public boolean hasHttpConfig() {
      return ((bitField0_ & 0x00000020) != 0);
    }
    /**
     *
     *
     * <pre>
     * The DeviceService (HTTP) configuration for this device registry.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.HttpConfig http_config = 9;</code>
     *
     * @return The httpConfig.
     */
    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;
      } else {
        httpConfigBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000020;
      onChanged();
      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();
      } else {
        httpConfigBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000020;
      onChanged();
      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 (((bitField0_ & 0x00000020) != 0)
            && httpConfig_ != null
            && httpConfig_ != com.google.cloud.iot.v1.HttpConfig.getDefaultInstance()) {
          getHttpConfigBuilder().mergeFrom(value);
        } else {
          httpConfig_ = value;
        }
      } else {
        httpConfigBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000020;
      onChanged();
      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() {
      bitField0_ = (bitField0_ & ~0x00000020);
      httpConfig_ = null;
      if (httpConfigBuilder_ != null) {
        httpConfigBuilder_.dispose();
        httpConfigBuilder_ = null;
      }
      onChanged();
      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() {
      bitField0_ |= 0x00000020;
      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 int logLevel_ = 0;
    /**
     *
     *
     * <pre>
     * **Beta Feature**
     * The default logging verbosity for activity from devices in this registry.
     * The verbosity level can be overridden by Device.log_level.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.LogLevel log_level = 11;</code>
     *
     * @return The enum numeric value on the wire for logLevel.
     */
    @java.lang.Override
    public int getLogLevelValue() {
      return logLevel_;
    }
    /**
     *
     *
     * <pre>
     * **Beta Feature**
     * The default logging verbosity for activity from devices in this registry.
     * The verbosity level can be overridden by Device.log_level.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.LogLevel log_level = 11;</code>
     *
     * @param value The enum numeric value on the wire for logLevel to set.
     * @return This builder for chaining.
     */
    public Builder setLogLevelValue(int value) {
      logLevel_ = value;
      bitField0_ |= 0x00000040;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * **Beta Feature**
     * The default logging verbosity for activity from devices in this registry.
     * The verbosity level can be overridden by Device.log_level.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.LogLevel log_level = 11;</code>
     *
     * @return The logLevel.
     */
    @java.lang.Override
    public com.google.cloud.iot.v1.LogLevel getLogLevel() {
      com.google.cloud.iot.v1.LogLevel result =
          com.google.cloud.iot.v1.LogLevel.forNumber(logLevel_);
      return result == null ? com.google.cloud.iot.v1.LogLevel.UNRECOGNIZED : result;
    }
    /**
     *
     *
     * <pre>
     * **Beta Feature**
     * The default logging verbosity for activity from devices in this registry.
     * The verbosity level can be overridden by Device.log_level.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.LogLevel log_level = 11;</code>
     *
     * @param value The logLevel to set.
     * @return This builder for chaining.
     */
    public Builder setLogLevel(com.google.cloud.iot.v1.LogLevel value) {
      if (value == null) {
        throw new NullPointerException();
      }
      bitField0_ |= 0x00000040;
      logLevel_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * **Beta Feature**
     * The default logging verbosity for activity from devices in this registry.
     * The verbosity level can be overridden by Device.log_level.
     * </pre>
     *
     * <code>.google.cloud.iot.v1.LogLevel log_level = 11;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearLogLevel() {
      bitField0_ = (bitField0_ & ~0x00000040);
      logLevel_ = 0;
      onChanged();
      return this;
    }

    private java.util.List<com.google.cloud.iot.v1.RegistryCredential> credentials_ =
        java.util.Collections.emptyList();

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

    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_ & ~0x00000080);
        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_ & 0x00000080) != 0), getParentForChildren(), isClean());
        credentials_ = null;
      }
      return credentialsBuilder_;
    }

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

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

    // @@protoc_insertion_point(builder_scope:google.cloud.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>() {
        @java.lang.Override
        public DeviceRegistry parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          Builder builder = newBuilder();
          try {
            builder.mergeFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(builder.buildPartial());
          } catch (com.google.protobuf.UninitializedMessageException e) {
            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
          } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(e)
                .setUnfinishedMessage(builder.buildPartial());
          }
          return builder.buildPartial();
        }
      };

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

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

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