// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/asset/v1beta1/assets.proto

package com.google.cloud.asset.v1beta1;

/**
 * <pre>
 * Representation of a cloud resource.
 * </pre>
 *
 * Protobuf type {@code google.cloud.asset.v1beta1.Resource}
 */
public  final class Resource extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:google.cloud.asset.v1beta1.Resource)
    ResourceOrBuilder {
private static final long serialVersionUID = 0L;
  // Use Resource.newBuilder() to construct.
  private Resource(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private Resource() {
    version_ = "";
    discoveryDocumentUri_ = "";
    discoveryName_ = "";
    resourceUrl_ = "";
    parent_ = "";
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private Resource(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          case 10: {
            java.lang.String s = input.readStringRequireUtf8();

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

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

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

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

            parent_ = s;
            break;
          }
          case 50: {
            com.google.protobuf.Struct.Builder subBuilder = null;
            if (data_ != null) {
              subBuilder = data_.toBuilder();
            }
            data_ = input.readMessage(com.google.protobuf.Struct.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(data_);
              data_ = subBuilder.buildPartial();
            }

            break;
          }
          default: {
            if (!parseUnknownFieldProto3(
                input, unknownFields, extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e).setUnfinishedMessage(this);
    } finally {
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.google.cloud.asset.v1beta1.AssetProto.internal_static_google_cloud_asset_v1beta1_Resource_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.asset.v1beta1.AssetProto.internal_static_google_cloud_asset_v1beta1_Resource_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.asset.v1beta1.Resource.class, com.google.cloud.asset.v1beta1.Resource.Builder.class);
  }

  public static final int VERSION_FIELD_NUMBER = 1;
  private volatile java.lang.Object version_;
  /**
   * <pre>
   * The API version. Example: "v1".
   * </pre>
   *
   * <code>string version = 1;</code>
   */
  public java.lang.String getVersion() {
    java.lang.Object ref = version_;
    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();
      version_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * The API version. Example: "v1".
   * </pre>
   *
   * <code>string version = 1;</code>
   */
  public com.google.protobuf.ByteString
      getVersionBytes() {
    java.lang.Object ref = version_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      version_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int DISCOVERY_DOCUMENT_URI_FIELD_NUMBER = 2;
  private volatile java.lang.Object discoveryDocumentUri_;
  /**
   * <pre>
   * The URL of the discovery document containing the resource's JSON schema.
   * Example:
   * "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest".
   * It will be left unspecified for resources without a discovery-based API,
   * such as Cloud Bigtable.
   * </pre>
   *
   * <code>string discovery_document_uri = 2;</code>
   */
  public java.lang.String getDiscoveryDocumentUri() {
    java.lang.Object ref = discoveryDocumentUri_;
    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();
      discoveryDocumentUri_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * The URL of the discovery document containing the resource's JSON schema.
   * Example:
   * "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest".
   * It will be left unspecified for resources without a discovery-based API,
   * such as Cloud Bigtable.
   * </pre>
   *
   * <code>string discovery_document_uri = 2;</code>
   */
  public com.google.protobuf.ByteString
      getDiscoveryDocumentUriBytes() {
    java.lang.Object ref = discoveryDocumentUri_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      discoveryDocumentUri_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int DISCOVERY_NAME_FIELD_NUMBER = 3;
  private volatile java.lang.Object discoveryName_;
  /**
   * <pre>
   * The JSON schema name listed in the discovery document.
   * Example: "Project". It will be left unspecified for resources (such as
   * Cloud Bigtable) without a discovery-based API.
   * </pre>
   *
   * <code>string discovery_name = 3;</code>
   */
  public java.lang.String getDiscoveryName() {
    java.lang.Object ref = discoveryName_;
    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();
      discoveryName_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * The JSON schema name listed in the discovery document.
   * Example: "Project". It will be left unspecified for resources (such as
   * Cloud Bigtable) without a discovery-based API.
   * </pre>
   *
   * <code>string discovery_name = 3;</code>
   */
  public com.google.protobuf.ByteString
      getDiscoveryNameBytes() {
    java.lang.Object ref = discoveryName_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      discoveryName_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int RESOURCE_URL_FIELD_NUMBER = 4;
  private volatile java.lang.Object resourceUrl_;
  /**
   * <pre>
   * The REST URL for accessing the resource. An HTTP GET operation using this
   * URL returns the resource itself.
   * Example:
   * `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123`.
   * It will be left unspecified for resources without a REST API.
   * </pre>
   *
   * <code>string resource_url = 4;</code>
   */
  public java.lang.String getResourceUrl() {
    java.lang.Object ref = resourceUrl_;
    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();
      resourceUrl_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * The REST URL for accessing the resource. An HTTP GET operation using this
   * URL returns the resource itself.
   * Example:
   * `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123`.
   * It will be left unspecified for resources without a REST API.
   * </pre>
   *
   * <code>string resource_url = 4;</code>
   */
  public com.google.protobuf.ByteString
      getResourceUrlBytes() {
    java.lang.Object ref = resourceUrl_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      resourceUrl_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int PARENT_FIELD_NUMBER = 5;
  private volatile java.lang.Object parent_;
  /**
   * <pre>
   * The full name of the immediate parent of this resource. See:
   * https://cloud.google.com/apis/design/resource_names#full_resource_name
   * For GCP assets, it is the parent resource defined in the IAM policy
   * hierarchy: https://cloud.google.com/iam/docs/overview#policy_hierarchy.
   * Example: "//cloudresourcemanager.googleapis.com/projects/my_project_123".
   * For third-party assets, it is up to the users to define.
   * </pre>
   *
   * <code>string parent = 5;</code>
   */
  public java.lang.String getParent() {
    java.lang.Object ref = parent_;
    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();
      parent_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * The full name of the immediate parent of this resource. See:
   * https://cloud.google.com/apis/design/resource_names#full_resource_name
   * For GCP assets, it is the parent resource defined in the IAM policy
   * hierarchy: https://cloud.google.com/iam/docs/overview#policy_hierarchy.
   * Example: "//cloudresourcemanager.googleapis.com/projects/my_project_123".
   * For third-party assets, it is up to the users to define.
   * </pre>
   *
   * <code>string parent = 5;</code>
   */
  public com.google.protobuf.ByteString
      getParentBytes() {
    java.lang.Object ref = parent_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      parent_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int DATA_FIELD_NUMBER = 6;
  private com.google.protobuf.Struct data_;
  /**
   * <pre>
   * The content of the resource, in which some sensitive fields are scrubbed
   * away and may not be present.
   * </pre>
   *
   * <code>.google.protobuf.Struct data = 6;</code>
   */
  public boolean hasData() {
    return data_ != null;
  }
  /**
   * <pre>
   * The content of the resource, in which some sensitive fields are scrubbed
   * away and may not be present.
   * </pre>
   *
   * <code>.google.protobuf.Struct data = 6;</code>
   */
  public com.google.protobuf.Struct getData() {
    return data_ == null ? com.google.protobuf.Struct.getDefaultInstance() : data_;
  }
  /**
   * <pre>
   * The content of the resource, in which some sensitive fields are scrubbed
   * away and may not be present.
   * </pre>
   *
   * <code>.google.protobuf.Struct data = 6;</code>
   */
  public com.google.protobuf.StructOrBuilder getDataOrBuilder() {
    return getData();
  }

  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 (!getVersionBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, version_);
    }
    if (!getDiscoveryDocumentUriBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, discoveryDocumentUri_);
    }
    if (!getDiscoveryNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 3, discoveryName_);
    }
    if (!getResourceUrlBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 4, resourceUrl_);
    }
    if (!getParentBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 5, parent_);
    }
    if (data_ != null) {
      output.writeMessage(6, getData());
    }
    unknownFields.writeTo(output);
  }

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

    size = 0;
    if (!getVersionBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, version_);
    }
    if (!getDiscoveryDocumentUriBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, discoveryDocumentUri_);
    }
    if (!getDiscoveryNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, discoveryName_);
    }
    if (!getResourceUrlBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, resourceUrl_);
    }
    if (!getParentBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, parent_);
    }
    if (data_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(6, getData());
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

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

    boolean result = true;
    result = result && getVersion()
        .equals(other.getVersion());
    result = result && getDiscoveryDocumentUri()
        .equals(other.getDiscoveryDocumentUri());
    result = result && getDiscoveryName()
        .equals(other.getDiscoveryName());
    result = result && getResourceUrl()
        .equals(other.getResourceUrl());
    result = result && getParent()
        .equals(other.getParent());
    result = result && (hasData() == other.hasData());
    if (hasData()) {
      result = result && getData()
          .equals(other.getData());
    }
    result = result && unknownFields.equals(other.unknownFields);
    return result;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + VERSION_FIELD_NUMBER;
    hash = (53 * hash) + getVersion().hashCode();
    hash = (37 * hash) + DISCOVERY_DOCUMENT_URI_FIELD_NUMBER;
    hash = (53 * hash) + getDiscoveryDocumentUri().hashCode();
    hash = (37 * hash) + DISCOVERY_NAME_FIELD_NUMBER;
    hash = (53 * hash) + getDiscoveryName().hashCode();
    hash = (37 * hash) + RESOURCE_URL_FIELD_NUMBER;
    hash = (53 * hash) + getResourceUrl().hashCode();
    hash = (37 * hash) + PARENT_FIELD_NUMBER;
    hash = (53 * hash) + getParent().hashCode();
    if (hasData()) {
      hash = (37 * hash) + DATA_FIELD_NUMBER;
      hash = (53 * hash) + getData().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.asset.v1beta1.Resource parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.cloud.asset.v1beta1.Resource 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.asset.v1beta1.Resource parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.cloud.asset.v1beta1.Resource 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.asset.v1beta1.Resource parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.cloud.asset.v1beta1.Resource parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.cloud.asset.v1beta1.Resource parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.cloud.asset.v1beta1.Resource 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.asset.v1beta1.Resource parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static com.google.cloud.asset.v1beta1.Resource 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.asset.v1beta1.Resource parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.cloud.asset.v1beta1.Resource 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.asset.v1beta1.Resource 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>
   * Representation of a cloud resource.
   * </pre>
   *
   * Protobuf type {@code google.cloud.asset.v1beta1.Resource}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1beta1.Resource)
      com.google.cloud.asset.v1beta1.ResourceOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.google.cloud.asset.v1beta1.AssetProto.internal_static_google_cloud_asset_v1beta1_Resource_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.asset.v1beta1.AssetProto.internal_static_google_cloud_asset_v1beta1_Resource_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.asset.v1beta1.Resource.class, com.google.cloud.asset.v1beta1.Resource.Builder.class);
    }

    // Construct using com.google.cloud.asset.v1beta1.Resource.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
      }
    }
    @java.lang.Override
    public Builder clear() {
      super.clear();
      version_ = "";

      discoveryDocumentUri_ = "";

      discoveryName_ = "";

      resourceUrl_ = "";

      parent_ = "";

      if (dataBuilder_ == null) {
        data_ = null;
      } else {
        data_ = null;
        dataBuilder_ = null;
      }
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.google.cloud.asset.v1beta1.AssetProto.internal_static_google_cloud_asset_v1beta1_Resource_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.asset.v1beta1.Resource getDefaultInstanceForType() {
      return com.google.cloud.asset.v1beta1.Resource.getDefaultInstance();
    }

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

    @java.lang.Override
    public com.google.cloud.asset.v1beta1.Resource buildPartial() {
      com.google.cloud.asset.v1beta1.Resource result = new com.google.cloud.asset.v1beta1.Resource(this);
      result.version_ = version_;
      result.discoveryDocumentUri_ = discoveryDocumentUri_;
      result.discoveryName_ = discoveryName_;
      result.resourceUrl_ = resourceUrl_;
      result.parent_ = parent_;
      if (dataBuilder_ == null) {
        result.data_ = data_;
      } else {
        result.data_ = dataBuilder_.build();
      }
      onBuilt();
      return result;
    }

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

    public Builder mergeFrom(com.google.cloud.asset.v1beta1.Resource other) {
      if (other == com.google.cloud.asset.v1beta1.Resource.getDefaultInstance()) return this;
      if (!other.getVersion().isEmpty()) {
        version_ = other.version_;
        onChanged();
      }
      if (!other.getDiscoveryDocumentUri().isEmpty()) {
        discoveryDocumentUri_ = other.discoveryDocumentUri_;
        onChanged();
      }
      if (!other.getDiscoveryName().isEmpty()) {
        discoveryName_ = other.discoveryName_;
        onChanged();
      }
      if (!other.getResourceUrl().isEmpty()) {
        resourceUrl_ = other.resourceUrl_;
        onChanged();
      }
      if (!other.getParent().isEmpty()) {
        parent_ = other.parent_;
        onChanged();
      }
      if (other.hasData()) {
        mergeData(other.getData());
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

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

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.google.cloud.asset.v1beta1.Resource parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.cloud.asset.v1beta1.Resource) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private java.lang.Object version_ = "";
    /**
     * <pre>
     * The API version. Example: "v1".
     * </pre>
     *
     * <code>string version = 1;</code>
     */
    public java.lang.String getVersion() {
      java.lang.Object ref = version_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        version_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * The API version. Example: "v1".
     * </pre>
     *
     * <code>string version = 1;</code>
     */
    public com.google.protobuf.ByteString
        getVersionBytes() {
      java.lang.Object ref = version_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        version_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * The API version. Example: "v1".
     * </pre>
     *
     * <code>string version = 1;</code>
     */
    public Builder setVersion(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      version_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The API version. Example: "v1".
     * </pre>
     *
     * <code>string version = 1;</code>
     */
    public Builder clearVersion() {
      
      version_ = getDefaultInstance().getVersion();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The API version. Example: "v1".
     * </pre>
     *
     * <code>string version = 1;</code>
     */
    public Builder setVersionBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      version_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object discoveryDocumentUri_ = "";
    /**
     * <pre>
     * The URL of the discovery document containing the resource's JSON schema.
     * Example:
     * "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest".
     * It will be left unspecified for resources without a discovery-based API,
     * such as Cloud Bigtable.
     * </pre>
     *
     * <code>string discovery_document_uri = 2;</code>
     */
    public java.lang.String getDiscoveryDocumentUri() {
      java.lang.Object ref = discoveryDocumentUri_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        discoveryDocumentUri_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * The URL of the discovery document containing the resource's JSON schema.
     * Example:
     * "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest".
     * It will be left unspecified for resources without a discovery-based API,
     * such as Cloud Bigtable.
     * </pre>
     *
     * <code>string discovery_document_uri = 2;</code>
     */
    public com.google.protobuf.ByteString
        getDiscoveryDocumentUriBytes() {
      java.lang.Object ref = discoveryDocumentUri_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        discoveryDocumentUri_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * The URL of the discovery document containing the resource's JSON schema.
     * Example:
     * "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest".
     * It will be left unspecified for resources without a discovery-based API,
     * such as Cloud Bigtable.
     * </pre>
     *
     * <code>string discovery_document_uri = 2;</code>
     */
    public Builder setDiscoveryDocumentUri(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      discoveryDocumentUri_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The URL of the discovery document containing the resource's JSON schema.
     * Example:
     * "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest".
     * It will be left unspecified for resources without a discovery-based API,
     * such as Cloud Bigtable.
     * </pre>
     *
     * <code>string discovery_document_uri = 2;</code>
     */
    public Builder clearDiscoveryDocumentUri() {
      
      discoveryDocumentUri_ = getDefaultInstance().getDiscoveryDocumentUri();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The URL of the discovery document containing the resource's JSON schema.
     * Example:
     * "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest".
     * It will be left unspecified for resources without a discovery-based API,
     * such as Cloud Bigtable.
     * </pre>
     *
     * <code>string discovery_document_uri = 2;</code>
     */
    public Builder setDiscoveryDocumentUriBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      discoveryDocumentUri_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object discoveryName_ = "";
    /**
     * <pre>
     * The JSON schema name listed in the discovery document.
     * Example: "Project". It will be left unspecified for resources (such as
     * Cloud Bigtable) without a discovery-based API.
     * </pre>
     *
     * <code>string discovery_name = 3;</code>
     */
    public java.lang.String getDiscoveryName() {
      java.lang.Object ref = discoveryName_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        discoveryName_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * The JSON schema name listed in the discovery document.
     * Example: "Project". It will be left unspecified for resources (such as
     * Cloud Bigtable) without a discovery-based API.
     * </pre>
     *
     * <code>string discovery_name = 3;</code>
     */
    public com.google.protobuf.ByteString
        getDiscoveryNameBytes() {
      java.lang.Object ref = discoveryName_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        discoveryName_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * The JSON schema name listed in the discovery document.
     * Example: "Project". It will be left unspecified for resources (such as
     * Cloud Bigtable) without a discovery-based API.
     * </pre>
     *
     * <code>string discovery_name = 3;</code>
     */
    public Builder setDiscoveryName(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      discoveryName_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The JSON schema name listed in the discovery document.
     * Example: "Project". It will be left unspecified for resources (such as
     * Cloud Bigtable) without a discovery-based API.
     * </pre>
     *
     * <code>string discovery_name = 3;</code>
     */
    public Builder clearDiscoveryName() {
      
      discoveryName_ = getDefaultInstance().getDiscoveryName();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The JSON schema name listed in the discovery document.
     * Example: "Project". It will be left unspecified for resources (such as
     * Cloud Bigtable) without a discovery-based API.
     * </pre>
     *
     * <code>string discovery_name = 3;</code>
     */
    public Builder setDiscoveryNameBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      discoveryName_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object resourceUrl_ = "";
    /**
     * <pre>
     * The REST URL for accessing the resource. An HTTP GET operation using this
     * URL returns the resource itself.
     * Example:
     * `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123`.
     * It will be left unspecified for resources without a REST API.
     * </pre>
     *
     * <code>string resource_url = 4;</code>
     */
    public java.lang.String getResourceUrl() {
      java.lang.Object ref = resourceUrl_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        resourceUrl_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * The REST URL for accessing the resource. An HTTP GET operation using this
     * URL returns the resource itself.
     * Example:
     * `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123`.
     * It will be left unspecified for resources without a REST API.
     * </pre>
     *
     * <code>string resource_url = 4;</code>
     */
    public com.google.protobuf.ByteString
        getResourceUrlBytes() {
      java.lang.Object ref = resourceUrl_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        resourceUrl_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * The REST URL for accessing the resource. An HTTP GET operation using this
     * URL returns the resource itself.
     * Example:
     * `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123`.
     * It will be left unspecified for resources without a REST API.
     * </pre>
     *
     * <code>string resource_url = 4;</code>
     */
    public Builder setResourceUrl(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      resourceUrl_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The REST URL for accessing the resource. An HTTP GET operation using this
     * URL returns the resource itself.
     * Example:
     * `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123`.
     * It will be left unspecified for resources without a REST API.
     * </pre>
     *
     * <code>string resource_url = 4;</code>
     */
    public Builder clearResourceUrl() {
      
      resourceUrl_ = getDefaultInstance().getResourceUrl();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The REST URL for accessing the resource. An HTTP GET operation using this
     * URL returns the resource itself.
     * Example:
     * `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123`.
     * It will be left unspecified for resources without a REST API.
     * </pre>
     *
     * <code>string resource_url = 4;</code>
     */
    public Builder setResourceUrlBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      resourceUrl_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object parent_ = "";
    /**
     * <pre>
     * The full name of the immediate parent of this resource. See:
     * https://cloud.google.com/apis/design/resource_names#full_resource_name
     * For GCP assets, it is the parent resource defined in the IAM policy
     * hierarchy: https://cloud.google.com/iam/docs/overview#policy_hierarchy.
     * Example: "//cloudresourcemanager.googleapis.com/projects/my_project_123".
     * For third-party assets, it is up to the users to define.
     * </pre>
     *
     * <code>string parent = 5;</code>
     */
    public java.lang.String getParent() {
      java.lang.Object ref = parent_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        parent_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * The full name of the immediate parent of this resource. See:
     * https://cloud.google.com/apis/design/resource_names#full_resource_name
     * For GCP assets, it is the parent resource defined in the IAM policy
     * hierarchy: https://cloud.google.com/iam/docs/overview#policy_hierarchy.
     * Example: "//cloudresourcemanager.googleapis.com/projects/my_project_123".
     * For third-party assets, it is up to the users to define.
     * </pre>
     *
     * <code>string parent = 5;</code>
     */
    public com.google.protobuf.ByteString
        getParentBytes() {
      java.lang.Object ref = parent_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        parent_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * The full name of the immediate parent of this resource. See:
     * https://cloud.google.com/apis/design/resource_names#full_resource_name
     * For GCP assets, it is the parent resource defined in the IAM policy
     * hierarchy: https://cloud.google.com/iam/docs/overview#policy_hierarchy.
     * Example: "//cloudresourcemanager.googleapis.com/projects/my_project_123".
     * For third-party assets, it is up to the users to define.
     * </pre>
     *
     * <code>string parent = 5;</code>
     */
    public Builder setParent(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      parent_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The full name of the immediate parent of this resource. See:
     * https://cloud.google.com/apis/design/resource_names#full_resource_name
     * For GCP assets, it is the parent resource defined in the IAM policy
     * hierarchy: https://cloud.google.com/iam/docs/overview#policy_hierarchy.
     * Example: "//cloudresourcemanager.googleapis.com/projects/my_project_123".
     * For third-party assets, it is up to the users to define.
     * </pre>
     *
     * <code>string parent = 5;</code>
     */
    public Builder clearParent() {
      
      parent_ = getDefaultInstance().getParent();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The full name of the immediate parent of this resource. See:
     * https://cloud.google.com/apis/design/resource_names#full_resource_name
     * For GCP assets, it is the parent resource defined in the IAM policy
     * hierarchy: https://cloud.google.com/iam/docs/overview#policy_hierarchy.
     * Example: "//cloudresourcemanager.googleapis.com/projects/my_project_123".
     * For third-party assets, it is up to the users to define.
     * </pre>
     *
     * <code>string parent = 5;</code>
     */
    public Builder setParentBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      parent_ = value;
      onChanged();
      return this;
    }

    private com.google.protobuf.Struct data_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> dataBuilder_;
    /**
     * <pre>
     * The content of the resource, in which some sensitive fields are scrubbed
     * away and may not be present.
     * </pre>
     *
     * <code>.google.protobuf.Struct data = 6;</code>
     */
    public boolean hasData() {
      return dataBuilder_ != null || data_ != null;
    }
    /**
     * <pre>
     * The content of the resource, in which some sensitive fields are scrubbed
     * away and may not be present.
     * </pre>
     *
     * <code>.google.protobuf.Struct data = 6;</code>
     */
    public com.google.protobuf.Struct getData() {
      if (dataBuilder_ == null) {
        return data_ == null ? com.google.protobuf.Struct.getDefaultInstance() : data_;
      } else {
        return dataBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * The content of the resource, in which some sensitive fields are scrubbed
     * away and may not be present.
     * </pre>
     *
     * <code>.google.protobuf.Struct data = 6;</code>
     */
    public Builder setData(com.google.protobuf.Struct value) {
      if (dataBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        data_ = value;
        onChanged();
      } else {
        dataBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * The content of the resource, in which some sensitive fields are scrubbed
     * away and may not be present.
     * </pre>
     *
     * <code>.google.protobuf.Struct data = 6;</code>
     */
    public Builder setData(
        com.google.protobuf.Struct.Builder builderForValue) {
      if (dataBuilder_ == null) {
        data_ = builderForValue.build();
        onChanged();
      } else {
        dataBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * The content of the resource, in which some sensitive fields are scrubbed
     * away and may not be present.
     * </pre>
     *
     * <code>.google.protobuf.Struct data = 6;</code>
     */
    public Builder mergeData(com.google.protobuf.Struct value) {
      if (dataBuilder_ == null) {
        if (data_ != null) {
          data_ =
            com.google.protobuf.Struct.newBuilder(data_).mergeFrom(value).buildPartial();
        } else {
          data_ = value;
        }
        onChanged();
      } else {
        dataBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * The content of the resource, in which some sensitive fields are scrubbed
     * away and may not be present.
     * </pre>
     *
     * <code>.google.protobuf.Struct data = 6;</code>
     */
    public Builder clearData() {
      if (dataBuilder_ == null) {
        data_ = null;
        onChanged();
      } else {
        data_ = null;
        dataBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * The content of the resource, in which some sensitive fields are scrubbed
     * away and may not be present.
     * </pre>
     *
     * <code>.google.protobuf.Struct data = 6;</code>
     */
    public com.google.protobuf.Struct.Builder getDataBuilder() {
      
      onChanged();
      return getDataFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * The content of the resource, in which some sensitive fields are scrubbed
     * away and may not be present.
     * </pre>
     *
     * <code>.google.protobuf.Struct data = 6;</code>
     */
    public com.google.protobuf.StructOrBuilder getDataOrBuilder() {
      if (dataBuilder_ != null) {
        return dataBuilder_.getMessageOrBuilder();
      } else {
        return data_ == null ?
            com.google.protobuf.Struct.getDefaultInstance() : data_;
      }
    }
    /**
     * <pre>
     * The content of the resource, in which some sensitive fields are scrubbed
     * away and may not be present.
     * </pre>
     *
     * <code>.google.protobuf.Struct data = 6;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> 
        getDataFieldBuilder() {
      if (dataBuilder_ == null) {
        dataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>(
                getData(),
                getParentForChildren(),
                isClean());
        data_ = null;
      }
      return dataBuilder_;
    }
    @java.lang.Override
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFieldsProto3(unknownFields);
    }

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


    // @@protoc_insertion_point(builder_scope:google.cloud.asset.v1beta1.Resource)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.asset.v1beta1.Resource)
  private static final com.google.cloud.asset.v1beta1.Resource DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new com.google.cloud.asset.v1beta1.Resource();
  }

  public static com.google.cloud.asset.v1beta1.Resource getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

  @java.lang.Override
  public com.google.cloud.asset.v1beta1.Resource getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

