/*
 * 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/asset/v1/assets.proto

package com.google.cloud.asset.v1;

/**
 *
 *
 * <pre>
 * A result of IAM Policy search, containing information of an IAM policy.
 * </pre>
 *
 * Protobuf type {@code google.cloud.asset.v1.IamPolicySearchResult}
 */
public final class IamPolicySearchResult extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.asset.v1.IamPolicySearchResult)
    IamPolicySearchResultOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use IamPolicySearchResult.newBuilder() to construct.
  private IamPolicySearchResult(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private IamPolicySearchResult() {
    resource_ = "";
    assetType_ = "";
    project_ = "";
    folders_ = com.google.protobuf.LazyStringArrayList.EMPTY;
    organization_ = "";
  }

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

  @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.asset.v1.AssetProto
        .internal_static_google_cloud_asset_v1_IamPolicySearchResult_descriptor;
  }

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

  public interface ExplanationOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1.IamPolicySearchResult.Explanation)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * The map from roles to their included permissions that match the
     * permission query (i.e., a query containing `policy.role.permissions:`).
     * Example: if query `policy.role.permissions:compute.disk.get`
     * matches a policy binding that contains owner role, the
     * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
     * roles can also be found in the returned `policy` bindings. Note that the
     * map is populated only for requests with permission queries.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
     * </code>
     */
    int getMatchedPermissionsCount();
    /**
     *
     *
     * <pre>
     * The map from roles to their included permissions that match the
     * permission query (i.e., a query containing `policy.role.permissions:`).
     * Example: if query `policy.role.permissions:compute.disk.get`
     * matches a policy binding that contains owner role, the
     * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
     * roles can also be found in the returned `policy` bindings. Note that the
     * map is populated only for requests with permission queries.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
     * </code>
     */
    boolean containsMatchedPermissions(java.lang.String key);
    /** Use {@link #getMatchedPermissionsMap()} instead. */
    @java.lang.Deprecated
    java.util.Map<
            java.lang.String,
            com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
        getMatchedPermissions();
    /**
     *
     *
     * <pre>
     * The map from roles to their included permissions that match the
     * permission query (i.e., a query containing `policy.role.permissions:`).
     * Example: if query `policy.role.permissions:compute.disk.get`
     * matches a policy binding that contains owner role, the
     * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
     * roles can also be found in the returned `policy` bindings. Note that the
     * map is populated only for requests with permission queries.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
     * </code>
     */
    java.util.Map<
            java.lang.String,
            com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
        getMatchedPermissionsMap();
    /**
     *
     *
     * <pre>
     * The map from roles to their included permissions that match the
     * permission query (i.e., a query containing `policy.role.permissions:`).
     * Example: if query `policy.role.permissions:compute.disk.get`
     * matches a policy binding that contains owner role, the
     * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
     * roles can also be found in the returned `policy` bindings. Note that the
     * map is populated only for requests with permission queries.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
     * </code>
     */
    /* nullable */
    com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
        getMatchedPermissionsOrDefault(
            java.lang.String key,
            /* nullable */
            com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions defaultValue);
    /**
     *
     *
     * <pre>
     * The map from roles to their included permissions that match the
     * permission query (i.e., a query containing `policy.role.permissions:`).
     * Example: if query `policy.role.permissions:compute.disk.get`
     * matches a policy binding that contains owner role, the
     * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
     * roles can also be found in the returned `policy` bindings. Note that the
     * map is populated only for requests with permission queries.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
     * </code>
     */
    com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
        getMatchedPermissionsOrThrow(java.lang.String key);
  }
  /**
   *
   *
   * <pre>
   * Explanation about the IAM policy search result.
   * </pre>
   *
   * Protobuf type {@code google.cloud.asset.v1.IamPolicySearchResult.Explanation}
   */
  public static final class Explanation extends com.google.protobuf.GeneratedMessageV3
      implements
      // @@protoc_insertion_point(message_implements:google.cloud.asset.v1.IamPolicySearchResult.Explanation)
      ExplanationOrBuilder {
    private static final long serialVersionUID = 0L;
    // Use Explanation.newBuilder() to construct.
    private Explanation(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }

    private Explanation() {}

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

    @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.asset.v1.AssetProto
          .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_descriptor;
    }

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

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.asset.v1.AssetProto
          .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.class,
              com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Builder.class);
    }

    public interface PermissionsOrBuilder
        extends
        // @@protoc_insertion_point(interface_extends:google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions)
        com.google.protobuf.MessageOrBuilder {

      /**
       *
       *
       * <pre>
       * A list of permissions. A sample permission string: `compute.disk.get`.
       * </pre>
       *
       * <code>repeated string permissions = 1;</code>
       *
       * @return A list containing the permissions.
       */
      java.util.List<java.lang.String> getPermissionsList();
      /**
       *
       *
       * <pre>
       * A list of permissions. A sample permission string: `compute.disk.get`.
       * </pre>
       *
       * <code>repeated string permissions = 1;</code>
       *
       * @return The count of permissions.
       */
      int getPermissionsCount();
      /**
       *
       *
       * <pre>
       * A list of permissions. A sample permission string: `compute.disk.get`.
       * </pre>
       *
       * <code>repeated string permissions = 1;</code>
       *
       * @param index The index of the element to return.
       * @return The permissions at the given index.
       */
      java.lang.String getPermissions(int index);
      /**
       *
       *
       * <pre>
       * A list of permissions. A sample permission string: `compute.disk.get`.
       * </pre>
       *
       * <code>repeated string permissions = 1;</code>
       *
       * @param index The index of the value to return.
       * @return The bytes of the permissions at the given index.
       */
      com.google.protobuf.ByteString getPermissionsBytes(int index);
    }
    /**
     *
     *
     * <pre>
     * IAM permissions
     * </pre>
     *
     * Protobuf type {@code google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions}
     */
    public static final class Permissions extends com.google.protobuf.GeneratedMessageV3
        implements
        // @@protoc_insertion_point(message_implements:google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions)
        PermissionsOrBuilder {
      private static final long serialVersionUID = 0L;
      // Use Permissions.newBuilder() to construct.
      private Permissions(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
        super(builder);
      }

      private Permissions() {
        permissions_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      }

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

      @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.asset.v1.AssetProto
            .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_Permissions_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.cloud.asset.v1.AssetProto
            .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_Permissions_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.class,
                com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.Builder
                    .class);
      }

      public static final int PERMISSIONS_FIELD_NUMBER = 1;

      @SuppressWarnings("serial")
      private com.google.protobuf.LazyStringList permissions_;
      /**
       *
       *
       * <pre>
       * A list of permissions. A sample permission string: `compute.disk.get`.
       * </pre>
       *
       * <code>repeated string permissions = 1;</code>
       *
       * @return A list containing the permissions.
       */
      public com.google.protobuf.ProtocolStringList getPermissionsList() {
        return permissions_;
      }
      /**
       *
       *
       * <pre>
       * A list of permissions. A sample permission string: `compute.disk.get`.
       * </pre>
       *
       * <code>repeated string permissions = 1;</code>
       *
       * @return The count of permissions.
       */
      public int getPermissionsCount() {
        return permissions_.size();
      }
      /**
       *
       *
       * <pre>
       * A list of permissions. A sample permission string: `compute.disk.get`.
       * </pre>
       *
       * <code>repeated string permissions = 1;</code>
       *
       * @param index The index of the element to return.
       * @return The permissions at the given index.
       */
      public java.lang.String getPermissions(int index) {
        return permissions_.get(index);
      }
      /**
       *
       *
       * <pre>
       * A list of permissions. A sample permission string: `compute.disk.get`.
       * </pre>
       *
       * <code>repeated string permissions = 1;</code>
       *
       * @param index The index of the value to return.
       * @return The bytes of the permissions at the given index.
       */
      public com.google.protobuf.ByteString getPermissionsBytes(int index) {
        return permissions_.getByteString(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 {
        for (int i = 0; i < permissions_.size(); i++) {
          com.google.protobuf.GeneratedMessageV3.writeString(output, 1, permissions_.getRaw(i));
        }
        getUnknownFields().writeTo(output);
      }

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

        size = 0;
        {
          int dataSize = 0;
          for (int i = 0; i < permissions_.size(); i++) {
            dataSize += computeStringSizeNoTag(permissions_.getRaw(i));
          }
          size += dataSize;
          size += 1 * getPermissionsList().size();
        }
        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.asset.v1.IamPolicySearchResult.Explanation.Permissions)) {
          return super.equals(obj);
        }
        com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions other =
            (com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions) obj;

        if (!getPermissionsList().equals(other.getPermissionsList())) 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();
        if (getPermissionsCount() > 0) {
          hash = (37 * hash) + PERMISSIONS_FIELD_NUMBER;
          hash = (53 * hash) + getPermissionsList().hashCode();
        }
        hash = (29 * hash) + getUnknownFields().hashCode();
        memoizedHashCode = hash;
        return hash;
      }

      public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
          parseFrom(java.nio.ByteBuffer data)
              throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
      }

      public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
          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.v1.IamPolicySearchResult.Explanation.Permissions
          parseFrom(com.google.protobuf.ByteString data)
              throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
      }

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

      public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
          parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
              throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
      }

      public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
          parseFrom(java.io.InputStream input) throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
      }

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

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

      public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
          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.v1.IamPolicySearchResult.Explanation.Permissions 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>
       * IAM permissions
       * </pre>
       *
       * Protobuf type {@code google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions}
       */
      public static final class Builder
          extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
          implements
          // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions)
          com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.PermissionsOrBuilder {
        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
          return com.google.cloud.asset.v1.AssetProto
              .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_Permissions_descriptor;
        }

        @java.lang.Override
        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
            internalGetFieldAccessorTable() {
          return com.google.cloud.asset.v1.AssetProto
              .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_Permissions_fieldAccessorTable
              .ensureFieldAccessorsInitialized(
                  com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.class,
                  com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.Builder
                      .class);
        }

        // Construct using
        // com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions.newBuilder()
        private Builder() {}

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

        @java.lang.Override
        public Builder clear() {
          super.clear();
          bitField0_ = 0;
          permissions_ = com.google.protobuf.LazyStringArrayList.EMPTY;
          bitField0_ = (bitField0_ & ~0x00000001);
          return this;
        }

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

        @java.lang.Override
        public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
            getDefaultInstanceForType() {
          return com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
              .getDefaultInstance();
        }

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

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

        private void buildPartialRepeatedFields(
            com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions result) {
          if (((bitField0_ & 0x00000001) != 0)) {
            permissions_ = permissions_.getUnmodifiableView();
            bitField0_ = (bitField0_ & ~0x00000001);
          }
          result.permissions_ = permissions_;
        }

        private void buildPartial0(
            com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions result) {
          int from_bitField0_ = bitField0_;
        }

        @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.asset.v1.IamPolicySearchResult.Explanation.Permissions) {
            return mergeFrom(
                (com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions) other);
          } else {
            super.mergeFrom(other);
            return this;
          }
        }

        public Builder mergeFrom(
            com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions other) {
          if (other
              == com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
                  .getDefaultInstance()) return this;
          if (!other.permissions_.isEmpty()) {
            if (permissions_.isEmpty()) {
              permissions_ = other.permissions_;
              bitField0_ = (bitField0_ & ~0x00000001);
            } else {
              ensurePermissionsIsMutable();
              permissions_.addAll(other.permissions_);
            }
            onChanged();
          }
          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:
                  {
                    java.lang.String s = input.readStringRequireUtf8();
                    ensurePermissionsIsMutable();
                    permissions_.add(s);
                    break;
                  } // case 10
                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 com.google.protobuf.LazyStringList permissions_ =
            com.google.protobuf.LazyStringArrayList.EMPTY;

        private void ensurePermissionsIsMutable() {
          if (!((bitField0_ & 0x00000001) != 0)) {
            permissions_ = new com.google.protobuf.LazyStringArrayList(permissions_);
            bitField0_ |= 0x00000001;
          }
        }
        /**
         *
         *
         * <pre>
         * A list of permissions. A sample permission string: `compute.disk.get`.
         * </pre>
         *
         * <code>repeated string permissions = 1;</code>
         *
         * @return A list containing the permissions.
         */
        public com.google.protobuf.ProtocolStringList getPermissionsList() {
          return permissions_.getUnmodifiableView();
        }
        /**
         *
         *
         * <pre>
         * A list of permissions. A sample permission string: `compute.disk.get`.
         * </pre>
         *
         * <code>repeated string permissions = 1;</code>
         *
         * @return The count of permissions.
         */
        public int getPermissionsCount() {
          return permissions_.size();
        }
        /**
         *
         *
         * <pre>
         * A list of permissions. A sample permission string: `compute.disk.get`.
         * </pre>
         *
         * <code>repeated string permissions = 1;</code>
         *
         * @param index The index of the element to return.
         * @return The permissions at the given index.
         */
        public java.lang.String getPermissions(int index) {
          return permissions_.get(index);
        }
        /**
         *
         *
         * <pre>
         * A list of permissions. A sample permission string: `compute.disk.get`.
         * </pre>
         *
         * <code>repeated string permissions = 1;</code>
         *
         * @param index The index of the value to return.
         * @return The bytes of the permissions at the given index.
         */
        public com.google.protobuf.ByteString getPermissionsBytes(int index) {
          return permissions_.getByteString(index);
        }
        /**
         *
         *
         * <pre>
         * A list of permissions. A sample permission string: `compute.disk.get`.
         * </pre>
         *
         * <code>repeated string permissions = 1;</code>
         *
         * @param index The index to set the value at.
         * @param value The permissions to set.
         * @return This builder for chaining.
         */
        public Builder setPermissions(int index, java.lang.String value) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensurePermissionsIsMutable();
          permissions_.set(index, value);
          onChanged();
          return this;
        }
        /**
         *
         *
         * <pre>
         * A list of permissions. A sample permission string: `compute.disk.get`.
         * </pre>
         *
         * <code>repeated string permissions = 1;</code>
         *
         * @param value The permissions to add.
         * @return This builder for chaining.
         */
        public Builder addPermissions(java.lang.String value) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensurePermissionsIsMutable();
          permissions_.add(value);
          onChanged();
          return this;
        }
        /**
         *
         *
         * <pre>
         * A list of permissions. A sample permission string: `compute.disk.get`.
         * </pre>
         *
         * <code>repeated string permissions = 1;</code>
         *
         * @param values The permissions to add.
         * @return This builder for chaining.
         */
        public Builder addAllPermissions(java.lang.Iterable<java.lang.String> values) {
          ensurePermissionsIsMutable();
          com.google.protobuf.AbstractMessageLite.Builder.addAll(values, permissions_);
          onChanged();
          return this;
        }
        /**
         *
         *
         * <pre>
         * A list of permissions. A sample permission string: `compute.disk.get`.
         * </pre>
         *
         * <code>repeated string permissions = 1;</code>
         *
         * @return This builder for chaining.
         */
        public Builder clearPermissions() {
          permissions_ = com.google.protobuf.LazyStringArrayList.EMPTY;
          bitField0_ = (bitField0_ & ~0x00000001);
          onChanged();
          return this;
        }
        /**
         *
         *
         * <pre>
         * A list of permissions. A sample permission string: `compute.disk.get`.
         * </pre>
         *
         * <code>repeated string permissions = 1;</code>
         *
         * @param value The bytes of the permissions to add.
         * @return This builder for chaining.
         */
        public Builder addPermissionsBytes(com.google.protobuf.ByteString value) {
          if (value == null) {
            throw new NullPointerException();
          }
          checkByteStringIsUtf8(value);
          ensurePermissionsIsMutable();
          permissions_.add(value);
          onChanged();
          return this;
        }

        @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.asset.v1.IamPolicySearchResult.Explanation.Permissions)
      }

      // @@protoc_insertion_point(class_scope:google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions)
      private static final com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
          DEFAULT_INSTANCE;

      static {
        DEFAULT_INSTANCE =
            new com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions();
      }

      public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
          getDefaultInstance() {
        return DEFAULT_INSTANCE;
      }

      private static final com.google.protobuf.Parser<Permissions> PARSER =
          new com.google.protobuf.AbstractParser<Permissions>() {
            @java.lang.Override
            public Permissions 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<Permissions> parser() {
        return PARSER;
      }

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

      @java.lang.Override
      public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
          getDefaultInstanceForType() {
        return DEFAULT_INSTANCE;
      }
    }

    public static final int MATCHED_PERMISSIONS_FIELD_NUMBER = 1;

    private static final class MatchedPermissionsDefaultEntryHolder {
      static final com.google.protobuf.MapEntry<
              java.lang.String,
              com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
          defaultEntry =
              com.google.protobuf.MapEntry
                  .<java.lang.String,
                      com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
                      newDefaultInstance(
                          com.google.cloud.asset.v1.AssetProto
                              .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_MatchedPermissionsEntry_descriptor,
                          com.google.protobuf.WireFormat.FieldType.STRING,
                          "",
                          com.google.protobuf.WireFormat.FieldType.MESSAGE,
                          com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
                              .getDefaultInstance());
    }

    @SuppressWarnings("serial")
    private com.google.protobuf.MapField<
            java.lang.String,
            com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
        matchedPermissions_;

    private com.google.protobuf.MapField<
            java.lang.String,
            com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
        internalGetMatchedPermissions() {
      if (matchedPermissions_ == null) {
        return com.google.protobuf.MapField.emptyMapField(
            MatchedPermissionsDefaultEntryHolder.defaultEntry);
      }
      return matchedPermissions_;
    }

    public int getMatchedPermissionsCount() {
      return internalGetMatchedPermissions().getMap().size();
    }
    /**
     *
     *
     * <pre>
     * The map from roles to their included permissions that match the
     * permission query (i.e., a query containing `policy.role.permissions:`).
     * Example: if query `policy.role.permissions:compute.disk.get`
     * matches a policy binding that contains owner role, the
     * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
     * roles can also be found in the returned `policy` bindings. Note that the
     * map is populated only for requests with permission queries.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
     * </code>
     */
    @java.lang.Override
    public boolean containsMatchedPermissions(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      return internalGetMatchedPermissions().getMap().containsKey(key);
    }
    /** Use {@link #getMatchedPermissionsMap()} instead. */
    @java.lang.Override
    @java.lang.Deprecated
    public java.util.Map<
            java.lang.String,
            com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
        getMatchedPermissions() {
      return getMatchedPermissionsMap();
    }
    /**
     *
     *
     * <pre>
     * The map from roles to their included permissions that match the
     * permission query (i.e., a query containing `policy.role.permissions:`).
     * Example: if query `policy.role.permissions:compute.disk.get`
     * matches a policy binding that contains owner role, the
     * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
     * roles can also be found in the returned `policy` bindings. Note that the
     * map is populated only for requests with permission queries.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
     * </code>
     */
    @java.lang.Override
    public java.util.Map<
            java.lang.String,
            com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
        getMatchedPermissionsMap() {
      return internalGetMatchedPermissions().getMap();
    }
    /**
     *
     *
     * <pre>
     * The map from roles to their included permissions that match the
     * permission query (i.e., a query containing `policy.role.permissions:`).
     * Example: if query `policy.role.permissions:compute.disk.get`
     * matches a policy binding that contains owner role, the
     * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
     * roles can also be found in the returned `policy` bindings. Note that the
     * map is populated only for requests with permission queries.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
     * </code>
     */
    @java.lang.Override
    public /* nullable */ com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
        getMatchedPermissionsOrDefault(
            java.lang.String key,
            /* nullable */
            com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions defaultValue) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<
              java.lang.String,
              com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
          map = internalGetMatchedPermissions().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     *
     *
     * <pre>
     * The map from roles to their included permissions that match the
     * permission query (i.e., a query containing `policy.role.permissions:`).
     * Example: if query `policy.role.permissions:compute.disk.get`
     * matches a policy binding that contains owner role, the
     * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
     * roles can also be found in the returned `policy` bindings. Note that the
     * map is populated only for requests with permission queries.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
     * </code>
     */
    @java.lang.Override
    public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
        getMatchedPermissionsOrThrow(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<
              java.lang.String,
              com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
          map = internalGetMatchedPermissions().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    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 {
      com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(
          output,
          internalGetMatchedPermissions(),
          MatchedPermissionsDefaultEntryHolder.defaultEntry,
          1);
      getUnknownFields().writeTo(output);
    }

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

      size = 0;
      for (java.util.Map.Entry<
              java.lang.String,
              com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
          entry : internalGetMatchedPermissions().getMap().entrySet()) {
        com.google.protobuf.MapEntry<
                java.lang.String,
                com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
            matchedPermissions__ =
                MatchedPermissionsDefaultEntryHolder.defaultEntry
                    .newBuilderForType()
                    .setKey(entry.getKey())
                    .setValue(entry.getValue())
                    .build();
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, matchedPermissions__);
      }
      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.asset.v1.IamPolicySearchResult.Explanation)) {
        return super.equals(obj);
      }
      com.google.cloud.asset.v1.IamPolicySearchResult.Explanation other =
          (com.google.cloud.asset.v1.IamPolicySearchResult.Explanation) obj;

      if (!internalGetMatchedPermissions().equals(other.internalGetMatchedPermissions()))
        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();
      if (!internalGetMatchedPermissions().getMap().isEmpty()) {
        hash = (37 * hash) + MATCHED_PERMISSIONS_FIELD_NUMBER;
        hash = (53 * hash) + internalGetMatchedPermissions().hashCode();
      }
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation parseFrom(
        java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation 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.v1.IamPolicySearchResult.Explanation parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

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

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

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

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

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

    public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation 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.v1.IamPolicySearchResult.Explanation 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>
     * Explanation about the IAM policy search result.
     * </pre>
     *
     * Protobuf type {@code google.cloud.asset.v1.IamPolicySearchResult.Explanation}
     */
    public static final class Builder
        extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1.IamPolicySearchResult.Explanation)
        com.google.cloud.asset.v1.IamPolicySearchResult.ExplanationOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.cloud.asset.v1.AssetProto
            .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_descriptor;
      }

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

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

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.cloud.asset.v1.AssetProto
            .internal_static_google_cloud_asset_v1_IamPolicySearchResult_Explanation_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.class,
                com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Builder.class);
      }

      // Construct using com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.newBuilder()
      private Builder() {}

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

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        internalGetMutableMatchedPermissions().clear();
        return this;
      }

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

      @java.lang.Override
      public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation
          getDefaultInstanceForType() {
        return com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.getDefaultInstance();
      }

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

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

      private void buildPartial0(
          com.google.cloud.asset.v1.IamPolicySearchResult.Explanation result) {
        int from_bitField0_ = bitField0_;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.matchedPermissions_ = internalGetMatchedPermissions();
          result.matchedPermissions_.makeImmutable();
        }
      }

      @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.asset.v1.IamPolicySearchResult.Explanation) {
          return mergeFrom((com.google.cloud.asset.v1.IamPolicySearchResult.Explanation) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.google.cloud.asset.v1.IamPolicySearchResult.Explanation other) {
        if (other
            == com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.getDefaultInstance())
          return this;
        internalGetMutableMatchedPermissions().mergeFrom(other.internalGetMatchedPermissions());
        bitField0_ |= 0x00000001;
        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:
                {
                  com.google.protobuf.MapEntry<
                          java.lang.String,
                          com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
                      matchedPermissions__ =
                          input.readMessage(
                              MatchedPermissionsDefaultEntryHolder.defaultEntry.getParserForType(),
                              extensionRegistry);
                  internalGetMutableMatchedPermissions()
                      .getMutableMap()
                      .put(matchedPermissions__.getKey(), matchedPermissions__.getValue());
                  bitField0_ |= 0x00000001;
                  break;
                } // case 10
              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 com.google.protobuf.MapField<
              java.lang.String,
              com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
          matchedPermissions_;

      private com.google.protobuf.MapField<
              java.lang.String,
              com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
          internalGetMatchedPermissions() {
        if (matchedPermissions_ == null) {
          return com.google.protobuf.MapField.emptyMapField(
              MatchedPermissionsDefaultEntryHolder.defaultEntry);
        }
        return matchedPermissions_;
      }

      private com.google.protobuf.MapField<
              java.lang.String,
              com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
          internalGetMutableMatchedPermissions() {
        if (matchedPermissions_ == null) {
          matchedPermissions_ =
              com.google.protobuf.MapField.newMapField(
                  MatchedPermissionsDefaultEntryHolder.defaultEntry);
        }
        if (!matchedPermissions_.isMutable()) {
          matchedPermissions_ = matchedPermissions_.copy();
        }
        bitField0_ |= 0x00000001;
        onChanged();
        return matchedPermissions_;
      }

      public int getMatchedPermissionsCount() {
        return internalGetMatchedPermissions().getMap().size();
      }
      /**
       *
       *
       * <pre>
       * The map from roles to their included permissions that match the
       * permission query (i.e., a query containing `policy.role.permissions:`).
       * Example: if query `policy.role.permissions:compute.disk.get`
       * matches a policy binding that contains owner role, the
       * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
       * roles can also be found in the returned `policy` bindings. Note that the
       * map is populated only for requests with permission queries.
       * </pre>
       *
       * <code>
       * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
       * </code>
       */
      @java.lang.Override
      public boolean containsMatchedPermissions(java.lang.String key) {
        if (key == null) {
          throw new NullPointerException("map key");
        }
        return internalGetMatchedPermissions().getMap().containsKey(key);
      }
      /** Use {@link #getMatchedPermissionsMap()} instead. */
      @java.lang.Override
      @java.lang.Deprecated
      public java.util.Map<
              java.lang.String,
              com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
          getMatchedPermissions() {
        return getMatchedPermissionsMap();
      }
      /**
       *
       *
       * <pre>
       * The map from roles to their included permissions that match the
       * permission query (i.e., a query containing `policy.role.permissions:`).
       * Example: if query `policy.role.permissions:compute.disk.get`
       * matches a policy binding that contains owner role, the
       * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
       * roles can also be found in the returned `policy` bindings. Note that the
       * map is populated only for requests with permission queries.
       * </pre>
       *
       * <code>
       * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
       * </code>
       */
      @java.lang.Override
      public java.util.Map<
              java.lang.String,
              com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
          getMatchedPermissionsMap() {
        return internalGetMatchedPermissions().getMap();
      }
      /**
       *
       *
       * <pre>
       * The map from roles to their included permissions that match the
       * permission query (i.e., a query containing `policy.role.permissions:`).
       * Example: if query `policy.role.permissions:compute.disk.get`
       * matches a policy binding that contains owner role, the
       * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
       * roles can also be found in the returned `policy` bindings. Note that the
       * map is populated only for requests with permission queries.
       * </pre>
       *
       * <code>
       * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
       * </code>
       */
      @java.lang.Override
      public /* nullable */ com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
          getMatchedPermissionsOrDefault(
              java.lang.String key,
              /* nullable */
              com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
                  defaultValue) {
        if (key == null) {
          throw new NullPointerException("map key");
        }
        java.util.Map<
                java.lang.String,
                com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
            map = internalGetMatchedPermissions().getMap();
        return map.containsKey(key) ? map.get(key) : defaultValue;
      }
      /**
       *
       *
       * <pre>
       * The map from roles to their included permissions that match the
       * permission query (i.e., a query containing `policy.role.permissions:`).
       * Example: if query `policy.role.permissions:compute.disk.get`
       * matches a policy binding that contains owner role, the
       * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
       * roles can also be found in the returned `policy` bindings. Note that the
       * map is populated only for requests with permission queries.
       * </pre>
       *
       * <code>
       * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
       * </code>
       */
      @java.lang.Override
      public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions
          getMatchedPermissionsOrThrow(java.lang.String key) {
        if (key == null) {
          throw new NullPointerException("map key");
        }
        java.util.Map<
                java.lang.String,
                com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
            map = internalGetMatchedPermissions().getMap();
        if (!map.containsKey(key)) {
          throw new java.lang.IllegalArgumentException();
        }
        return map.get(key);
      }

      public Builder clearMatchedPermissions() {
        bitField0_ = (bitField0_ & ~0x00000001);
        internalGetMutableMatchedPermissions().getMutableMap().clear();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The map from roles to their included permissions that match the
       * permission query (i.e., a query containing `policy.role.permissions:`).
       * Example: if query `policy.role.permissions:compute.disk.get`
       * matches a policy binding that contains owner role, the
       * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
       * roles can also be found in the returned `policy` bindings. Note that the
       * map is populated only for requests with permission queries.
       * </pre>
       *
       * <code>
       * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
       * </code>
       */
      public Builder removeMatchedPermissions(java.lang.String key) {
        if (key == null) {
          throw new NullPointerException("map key");
        }
        internalGetMutableMatchedPermissions().getMutableMap().remove(key);
        return this;
      }
      /** Use alternate mutation accessors instead. */
      @java.lang.Deprecated
      public java.util.Map<
              java.lang.String,
              com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
          getMutableMatchedPermissions() {
        bitField0_ |= 0x00000001;
        return internalGetMutableMatchedPermissions().getMutableMap();
      }
      /**
       *
       *
       * <pre>
       * The map from roles to their included permissions that match the
       * permission query (i.e., a query containing `policy.role.permissions:`).
       * Example: if query `policy.role.permissions:compute.disk.get`
       * matches a policy binding that contains owner role, the
       * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
       * roles can also be found in the returned `policy` bindings. Note that the
       * map is populated only for requests with permission queries.
       * </pre>
       *
       * <code>
       * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
       * </code>
       */
      public Builder putMatchedPermissions(
          java.lang.String key,
          com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions value) {
        if (key == null) {
          throw new NullPointerException("map key");
        }
        if (value == null) {
          throw new NullPointerException("map value");
        }
        internalGetMutableMatchedPermissions().getMutableMap().put(key, value);
        bitField0_ |= 0x00000001;
        return this;
      }
      /**
       *
       *
       * <pre>
       * The map from roles to their included permissions that match the
       * permission query (i.e., a query containing `policy.role.permissions:`).
       * Example: if query `policy.role.permissions:compute.disk.get`
       * matches a policy binding that contains owner role, the
       * matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
       * roles can also be found in the returned `policy` bindings. Note that the
       * map is populated only for requests with permission queries.
       * </pre>
       *
       * <code>
       * map&lt;string, .google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions&gt; matched_permissions = 1;
       * </code>
       */
      public Builder putAllMatchedPermissions(
          java.util.Map<
                  java.lang.String,
                  com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions>
              values) {
        internalGetMutableMatchedPermissions().getMutableMap().putAll(values);
        bitField0_ |= 0x00000001;
        return this;
      }

      @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.asset.v1.IamPolicySearchResult.Explanation)
    }

    // @@protoc_insertion_point(class_scope:google.cloud.asset.v1.IamPolicySearchResult.Explanation)
    private static final com.google.cloud.asset.v1.IamPolicySearchResult.Explanation
        DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.cloud.asset.v1.IamPolicySearchResult.Explanation();
    }

    public static com.google.cloud.asset.v1.IamPolicySearchResult.Explanation getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<Explanation> PARSER =
        new com.google.protobuf.AbstractParser<Explanation>() {
          @java.lang.Override
          public Explanation 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<Explanation> parser() {
      return PARSER;
    }

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

    @java.lang.Override
    public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public static final int RESOURCE_FIELD_NUMBER = 1;

  @SuppressWarnings("serial")
  private volatile java.lang.Object resource_ = "";
  /**
   *
   *
   * <pre>
   * The full resource name of the resource associated with this IAM policy.
   * Example:
   * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
   * See [Cloud Asset Inventory Resource Name
   * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
   * for more information.
   * To search against the `resource`:
   * * use a field query. Example: `resource:organizations/123`
   * </pre>
   *
   * <code>string resource = 1;</code>
   *
   * @return The resource.
   */
  @java.lang.Override
  public java.lang.String getResource() {
    java.lang.Object ref = resource_;
    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();
      resource_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The full resource name of the resource associated with this IAM policy.
   * Example:
   * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
   * See [Cloud Asset Inventory Resource Name
   * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
   * for more information.
   * To search against the `resource`:
   * * use a field query. Example: `resource:organizations/123`
   * </pre>
   *
   * <code>string resource = 1;</code>
   *
   * @return The bytes for resource.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getResourceBytes() {
    java.lang.Object ref = resource_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      resource_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int ASSET_TYPE_FIELD_NUMBER = 5;

  @SuppressWarnings("serial")
  private volatile java.lang.Object assetType_ = "";
  /**
   *
   *
   * <pre>
   * The type of the resource associated with this IAM policy. Example:
   * `compute.googleapis.com/Disk`.
   * To search against the `asset_type`:
   * * specify the `asset_types` field in your search request.
   * </pre>
   *
   * <code>string asset_type = 5;</code>
   *
   * @return The assetType.
   */
  @java.lang.Override
  public java.lang.String getAssetType() {
    java.lang.Object ref = assetType_;
    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();
      assetType_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The type of the resource associated with this IAM policy. Example:
   * `compute.googleapis.com/Disk`.
   * To search against the `asset_type`:
   * * specify the `asset_types` field in your search request.
   * </pre>
   *
   * <code>string asset_type = 5;</code>
   *
   * @return The bytes for assetType.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getAssetTypeBytes() {
    java.lang.Object ref = assetType_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      assetType_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int PROJECT_FIELD_NUMBER = 2;

  @SuppressWarnings("serial")
  private volatile java.lang.Object project_ = "";
  /**
   *
   *
   * <pre>
   * The project that the associated Google Cloud resource belongs to, in the
   * form of projects/{PROJECT_NUMBER}. If an IAM policy is set on a resource
   * (like VM instance, Cloud Storage bucket), the project field will indicate
   * the project that contains the resource. If an IAM policy is set on a folder
   * or orgnization, this field will be empty.
   * To search against the `project`:
   * * specify the `scope` field as this project in your search request.
   * </pre>
   *
   * <code>string project = 2;</code>
   *
   * @return The project.
   */
  @java.lang.Override
  public java.lang.String getProject() {
    java.lang.Object ref = project_;
    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();
      project_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The project that the associated Google Cloud resource belongs to, in the
   * form of projects/{PROJECT_NUMBER}. If an IAM policy is set on a resource
   * (like VM instance, Cloud Storage bucket), the project field will indicate
   * the project that contains the resource. If an IAM policy is set on a folder
   * or orgnization, this field will be empty.
   * To search against the `project`:
   * * specify the `scope` field as this project in your search request.
   * </pre>
   *
   * <code>string project = 2;</code>
   *
   * @return The bytes for project.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getProjectBytes() {
    java.lang.Object ref = project_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      project_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int FOLDERS_FIELD_NUMBER = 6;

  @SuppressWarnings("serial")
  private com.google.protobuf.LazyStringList folders_;
  /**
   *
   *
   * <pre>
   * The folder(s) that the IAM policy belongs to, in the form of
   * folders/{FOLDER_NUMBER}. This field is available when the IAM policy
   * belongs to one or more folders.
   * To search against `folders`:
   * * use a field query. Example: `folders:(123 OR 456)`
   * * use a free text query. Example: `123`
   * * specify the `scope` field as this folder in your search request.
   * </pre>
   *
   * <code>repeated string folders = 6;</code>
   *
   * @return A list containing the folders.
   */
  public com.google.protobuf.ProtocolStringList getFoldersList() {
    return folders_;
  }
  /**
   *
   *
   * <pre>
   * The folder(s) that the IAM policy belongs to, in the form of
   * folders/{FOLDER_NUMBER}. This field is available when the IAM policy
   * belongs to one or more folders.
   * To search against `folders`:
   * * use a field query. Example: `folders:(123 OR 456)`
   * * use a free text query. Example: `123`
   * * specify the `scope` field as this folder in your search request.
   * </pre>
   *
   * <code>repeated string folders = 6;</code>
   *
   * @return The count of folders.
   */
  public int getFoldersCount() {
    return folders_.size();
  }
  /**
   *
   *
   * <pre>
   * The folder(s) that the IAM policy belongs to, in the form of
   * folders/{FOLDER_NUMBER}. This field is available when the IAM policy
   * belongs to one or more folders.
   * To search against `folders`:
   * * use a field query. Example: `folders:(123 OR 456)`
   * * use a free text query. Example: `123`
   * * specify the `scope` field as this folder in your search request.
   * </pre>
   *
   * <code>repeated string folders = 6;</code>
   *
   * @param index The index of the element to return.
   * @return The folders at the given index.
   */
  public java.lang.String getFolders(int index) {
    return folders_.get(index);
  }
  /**
   *
   *
   * <pre>
   * The folder(s) that the IAM policy belongs to, in the form of
   * folders/{FOLDER_NUMBER}. This field is available when the IAM policy
   * belongs to one or more folders.
   * To search against `folders`:
   * * use a field query. Example: `folders:(123 OR 456)`
   * * use a free text query. Example: `123`
   * * specify the `scope` field as this folder in your search request.
   * </pre>
   *
   * <code>repeated string folders = 6;</code>
   *
   * @param index The index of the value to return.
   * @return The bytes of the folders at the given index.
   */
  public com.google.protobuf.ByteString getFoldersBytes(int index) {
    return folders_.getByteString(index);
  }

  public static final int ORGANIZATION_FIELD_NUMBER = 7;

  @SuppressWarnings("serial")
  private volatile java.lang.Object organization_ = "";
  /**
   *
   *
   * <pre>
   * The organization that the IAM policy belongs to, in the form
   * of organizations/{ORGANIZATION_NUMBER}. This field is available when the
   * IAM policy belongs to an organization.
   * To search against `organization`:
   * * use a field query. Example: `organization:123`
   * * use a free text query. Example: `123`
   * * specify the `scope` field as this organization in your search request.
   * </pre>
   *
   * <code>string organization = 7;</code>
   *
   * @return The organization.
   */
  @java.lang.Override
  public java.lang.String getOrganization() {
    java.lang.Object ref = organization_;
    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();
      organization_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The organization that the IAM policy belongs to, in the form
   * of organizations/{ORGANIZATION_NUMBER}. This field is available when the
   * IAM policy belongs to an organization.
   * To search against `organization`:
   * * use a field query. Example: `organization:123`
   * * use a free text query. Example: `123`
   * * specify the `scope` field as this organization in your search request.
   * </pre>
   *
   * <code>string organization = 7;</code>
   *
   * @return The bytes for organization.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getOrganizationBytes() {
    java.lang.Object ref = organization_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      organization_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int POLICY_FIELD_NUMBER = 3;
  private com.google.iam.v1.Policy policy_;
  /**
   *
   *
   * <pre>
   * The IAM policy directly set on the given resource. Note that the original
   * IAM policy can contain multiple bindings. This only contains the bindings
   * that match the given query. For queries that don't contain a constrain on
   * policies (e.g., an empty query), this contains all the bindings.
   * To search against the `policy` bindings:
   * * use a field query:
   *     - query by the policy contained members. Example:
   *       `policy:amy&#64;gmail.com`
   *     - query by the policy contained roles. Example:
   *       `policy:roles/compute.admin`
   *     - query by the policy contained roles' included permissions. Example:
   *       `policy.role.permissions:compute.instances.create`
   * </pre>
   *
   * <code>.google.iam.v1.Policy policy = 3;</code>
   *
   * @return Whether the policy field is set.
   */
  @java.lang.Override
  public boolean hasPolicy() {
    return policy_ != null;
  }
  /**
   *
   *
   * <pre>
   * The IAM policy directly set on the given resource. Note that the original
   * IAM policy can contain multiple bindings. This only contains the bindings
   * that match the given query. For queries that don't contain a constrain on
   * policies (e.g., an empty query), this contains all the bindings.
   * To search against the `policy` bindings:
   * * use a field query:
   *     - query by the policy contained members. Example:
   *       `policy:amy&#64;gmail.com`
   *     - query by the policy contained roles. Example:
   *       `policy:roles/compute.admin`
   *     - query by the policy contained roles' included permissions. Example:
   *       `policy.role.permissions:compute.instances.create`
   * </pre>
   *
   * <code>.google.iam.v1.Policy policy = 3;</code>
   *
   * @return The policy.
   */
  @java.lang.Override
  public com.google.iam.v1.Policy getPolicy() {
    return policy_ == null ? com.google.iam.v1.Policy.getDefaultInstance() : policy_;
  }
  /**
   *
   *
   * <pre>
   * The IAM policy directly set on the given resource. Note that the original
   * IAM policy can contain multiple bindings. This only contains the bindings
   * that match the given query. For queries that don't contain a constrain on
   * policies (e.g., an empty query), this contains all the bindings.
   * To search against the `policy` bindings:
   * * use a field query:
   *     - query by the policy contained members. Example:
   *       `policy:amy&#64;gmail.com`
   *     - query by the policy contained roles. Example:
   *       `policy:roles/compute.admin`
   *     - query by the policy contained roles' included permissions. Example:
   *       `policy.role.permissions:compute.instances.create`
   * </pre>
   *
   * <code>.google.iam.v1.Policy policy = 3;</code>
   */
  @java.lang.Override
  public com.google.iam.v1.PolicyOrBuilder getPolicyOrBuilder() {
    return policy_ == null ? com.google.iam.v1.Policy.getDefaultInstance() : policy_;
  }

  public static final int EXPLANATION_FIELD_NUMBER = 4;
  private com.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation_;
  /**
   *
   *
   * <pre>
   * Explanation about the IAM policy search result. It contains additional
   * information to explain why the search result matches the query.
   * </pre>
   *
   * <code>.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4;</code>
   *
   * @return Whether the explanation field is set.
   */
  @java.lang.Override
  public boolean hasExplanation() {
    return explanation_ != null;
  }
  /**
   *
   *
   * <pre>
   * Explanation about the IAM policy search result. It contains additional
   * information to explain why the search result matches the query.
   * </pre>
   *
   * <code>.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4;</code>
   *
   * @return The explanation.
   */
  @java.lang.Override
  public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation getExplanation() {
    return explanation_ == null
        ? com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.getDefaultInstance()
        : explanation_;
  }
  /**
   *
   *
   * <pre>
   * Explanation about the IAM policy search result. It contains additional
   * information to explain why the search result matches the query.
   * </pre>
   *
   * <code>.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4;</code>
   */
  @java.lang.Override
  public com.google.cloud.asset.v1.IamPolicySearchResult.ExplanationOrBuilder
      getExplanationOrBuilder() {
    return explanation_ == null
        ? com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.getDefaultInstance()
        : explanation_;
  }

  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(resource_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, resource_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(project_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, project_);
    }
    if (policy_ != null) {
      output.writeMessage(3, getPolicy());
    }
    if (explanation_ != null) {
      output.writeMessage(4, getExplanation());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(assetType_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 5, assetType_);
    }
    for (int i = 0; i < folders_.size(); i++) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 6, folders_.getRaw(i));
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(organization_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 7, organization_);
    }
    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(resource_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, resource_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(project_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, project_);
    }
    if (policy_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getPolicy());
    }
    if (explanation_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getExplanation());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(assetType_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, assetType_);
    }
    {
      int dataSize = 0;
      for (int i = 0; i < folders_.size(); i++) {
        dataSize += computeStringSizeNoTag(folders_.getRaw(i));
      }
      size += dataSize;
      size += 1 * getFoldersList().size();
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(organization_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, organization_);
    }
    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.asset.v1.IamPolicySearchResult)) {
      return super.equals(obj);
    }
    com.google.cloud.asset.v1.IamPolicySearchResult other =
        (com.google.cloud.asset.v1.IamPolicySearchResult) obj;

    if (!getResource().equals(other.getResource())) return false;
    if (!getAssetType().equals(other.getAssetType())) return false;
    if (!getProject().equals(other.getProject())) return false;
    if (!getFoldersList().equals(other.getFoldersList())) return false;
    if (!getOrganization().equals(other.getOrganization())) return false;
    if (hasPolicy() != other.hasPolicy()) return false;
    if (hasPolicy()) {
      if (!getPolicy().equals(other.getPolicy())) return false;
    }
    if (hasExplanation() != other.hasExplanation()) return false;
    if (hasExplanation()) {
      if (!getExplanation().equals(other.getExplanation())) 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) + RESOURCE_FIELD_NUMBER;
    hash = (53 * hash) + getResource().hashCode();
    hash = (37 * hash) + ASSET_TYPE_FIELD_NUMBER;
    hash = (53 * hash) + getAssetType().hashCode();
    hash = (37 * hash) + PROJECT_FIELD_NUMBER;
    hash = (53 * hash) + getProject().hashCode();
    if (getFoldersCount() > 0) {
      hash = (37 * hash) + FOLDERS_FIELD_NUMBER;
      hash = (53 * hash) + getFoldersList().hashCode();
    }
    hash = (37 * hash) + ORGANIZATION_FIELD_NUMBER;
    hash = (53 * hash) + getOrganization().hashCode();
    if (hasPolicy()) {
      hash = (37 * hash) + POLICY_FIELD_NUMBER;
      hash = (53 * hash) + getPolicy().hashCode();
    }
    if (hasExplanation()) {
      hash = (37 * hash) + EXPLANATION_FIELD_NUMBER;
      hash = (53 * hash) + getExplanation().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

  public static com.google.cloud.asset.v1.IamPolicySearchResult 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.v1.IamPolicySearchResult parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

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

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

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

  public static com.google.cloud.asset.v1.IamPolicySearchResult 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.v1.IamPolicySearchResult 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 result of IAM Policy search, containing information of an IAM policy.
   * </pre>
   *
   * Protobuf type {@code google.cloud.asset.v1.IamPolicySearchResult}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.asset.v1.IamPolicySearchResult)
      com.google.cloud.asset.v1.IamPolicySearchResultOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.asset.v1.AssetProto
          .internal_static_google_cloud_asset_v1_IamPolicySearchResult_descriptor;
    }

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

    // Construct using com.google.cloud.asset.v1.IamPolicySearchResult.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      resource_ = "";
      assetType_ = "";
      project_ = "";
      folders_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000008);
      organization_ = "";
      policy_ = null;
      if (policyBuilder_ != null) {
        policyBuilder_.dispose();
        policyBuilder_ = null;
      }
      explanation_ = null;
      if (explanationBuilder_ != null) {
        explanationBuilder_.dispose();
        explanationBuilder_ = null;
      }
      return this;
    }

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

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

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

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

    private void buildPartialRepeatedFields(
        com.google.cloud.asset.v1.IamPolicySearchResult result) {
      if (((bitField0_ & 0x00000008) != 0)) {
        folders_ = folders_.getUnmodifiableView();
        bitField0_ = (bitField0_ & ~0x00000008);
      }
      result.folders_ = folders_;
    }

    private void buildPartial0(com.google.cloud.asset.v1.IamPolicySearchResult result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.resource_ = resource_;
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.assetType_ = assetType_;
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.project_ = project_;
      }
      if (((from_bitField0_ & 0x00000010) != 0)) {
        result.organization_ = organization_;
      }
      if (((from_bitField0_ & 0x00000020) != 0)) {
        result.policy_ = policyBuilder_ == null ? policy_ : policyBuilder_.build();
      }
      if (((from_bitField0_ & 0x00000040) != 0)) {
        result.explanation_ =
            explanationBuilder_ == null ? explanation_ : explanationBuilder_.build();
      }
    }

    @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.asset.v1.IamPolicySearchResult) {
        return mergeFrom((com.google.cloud.asset.v1.IamPolicySearchResult) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.asset.v1.IamPolicySearchResult other) {
      if (other == com.google.cloud.asset.v1.IamPolicySearchResult.getDefaultInstance())
        return this;
      if (!other.getResource().isEmpty()) {
        resource_ = other.resource_;
        bitField0_ |= 0x00000001;
        onChanged();
      }
      if (!other.getAssetType().isEmpty()) {
        assetType_ = other.assetType_;
        bitField0_ |= 0x00000002;
        onChanged();
      }
      if (!other.getProject().isEmpty()) {
        project_ = other.project_;
        bitField0_ |= 0x00000004;
        onChanged();
      }
      if (!other.folders_.isEmpty()) {
        if (folders_.isEmpty()) {
          folders_ = other.folders_;
          bitField0_ = (bitField0_ & ~0x00000008);
        } else {
          ensureFoldersIsMutable();
          folders_.addAll(other.folders_);
        }
        onChanged();
      }
      if (!other.getOrganization().isEmpty()) {
        organization_ = other.organization_;
        bitField0_ |= 0x00000010;
        onChanged();
      }
      if (other.hasPolicy()) {
        mergePolicy(other.getPolicy());
      }
      if (other.hasExplanation()) {
        mergeExplanation(other.getExplanation());
      }
      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:
              {
                resource_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000001;
                break;
              } // case 10
            case 18:
              {
                project_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000004;
                break;
              } // case 18
            case 26:
              {
                input.readMessage(getPolicyFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000020;
                break;
              } // case 26
            case 34:
              {
                input.readMessage(getExplanationFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000040;
                break;
              } // case 34
            case 42:
              {
                assetType_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000002;
                break;
              } // case 42
            case 50:
              {
                java.lang.String s = input.readStringRequireUtf8();
                ensureFoldersIsMutable();
                folders_.add(s);
                break;
              } // case 50
            case 58:
              {
                organization_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000010;
                break;
              } // case 58
            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 resource_ = "";
    /**
     *
     *
     * <pre>
     * The full resource name of the resource associated with this IAM policy.
     * Example:
     * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
     * See [Cloud Asset Inventory Resource Name
     * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
     * for more information.
     * To search against the `resource`:
     * * use a field query. Example: `resource:organizations/123`
     * </pre>
     *
     * <code>string resource = 1;</code>
     *
     * @return The resource.
     */
    public java.lang.String getResource() {
      java.lang.Object ref = resource_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        resource_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The full resource name of the resource associated with this IAM policy.
     * Example:
     * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
     * See [Cloud Asset Inventory Resource Name
     * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
     * for more information.
     * To search against the `resource`:
     * * use a field query. Example: `resource:organizations/123`
     * </pre>
     *
     * <code>string resource = 1;</code>
     *
     * @return The bytes for resource.
     */
    public com.google.protobuf.ByteString getResourceBytes() {
      java.lang.Object ref = resource_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        resource_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The full resource name of the resource associated with this IAM policy.
     * Example:
     * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
     * See [Cloud Asset Inventory Resource Name
     * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
     * for more information.
     * To search against the `resource`:
     * * use a field query. Example: `resource:organizations/123`
     * </pre>
     *
     * <code>string resource = 1;</code>
     *
     * @param value The resource to set.
     * @return This builder for chaining.
     */
    public Builder setResource(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      resource_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The full resource name of the resource associated with this IAM policy.
     * Example:
     * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
     * See [Cloud Asset Inventory Resource Name
     * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
     * for more information.
     * To search against the `resource`:
     * * use a field query. Example: `resource:organizations/123`
     * </pre>
     *
     * <code>string resource = 1;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearResource() {
      resource_ = getDefaultInstance().getResource();
      bitField0_ = (bitField0_ & ~0x00000001);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The full resource name of the resource associated with this IAM policy.
     * Example:
     * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
     * See [Cloud Asset Inventory Resource Name
     * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
     * for more information.
     * To search against the `resource`:
     * * use a field query. Example: `resource:organizations/123`
     * </pre>
     *
     * <code>string resource = 1;</code>
     *
     * @param value The bytes for resource to set.
     * @return This builder for chaining.
     */
    public Builder setResourceBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      resource_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    private java.lang.Object assetType_ = "";
    /**
     *
     *
     * <pre>
     * The type of the resource associated with this IAM policy. Example:
     * `compute.googleapis.com/Disk`.
     * To search against the `asset_type`:
     * * specify the `asset_types` field in your search request.
     * </pre>
     *
     * <code>string asset_type = 5;</code>
     *
     * @return The assetType.
     */
    public java.lang.String getAssetType() {
      java.lang.Object ref = assetType_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        assetType_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The type of the resource associated with this IAM policy. Example:
     * `compute.googleapis.com/Disk`.
     * To search against the `asset_type`:
     * * specify the `asset_types` field in your search request.
     * </pre>
     *
     * <code>string asset_type = 5;</code>
     *
     * @return The bytes for assetType.
     */
    public com.google.protobuf.ByteString getAssetTypeBytes() {
      java.lang.Object ref = assetType_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        assetType_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The type of the resource associated with this IAM policy. Example:
     * `compute.googleapis.com/Disk`.
     * To search against the `asset_type`:
     * * specify the `asset_types` field in your search request.
     * </pre>
     *
     * <code>string asset_type = 5;</code>
     *
     * @param value The assetType to set.
     * @return This builder for chaining.
     */
    public Builder setAssetType(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      assetType_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The type of the resource associated with this IAM policy. Example:
     * `compute.googleapis.com/Disk`.
     * To search against the `asset_type`:
     * * specify the `asset_types` field in your search request.
     * </pre>
     *
     * <code>string asset_type = 5;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearAssetType() {
      assetType_ = getDefaultInstance().getAssetType();
      bitField0_ = (bitField0_ & ~0x00000002);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The type of the resource associated with this IAM policy. Example:
     * `compute.googleapis.com/Disk`.
     * To search against the `asset_type`:
     * * specify the `asset_types` field in your search request.
     * </pre>
     *
     * <code>string asset_type = 5;</code>
     *
     * @param value The bytes for assetType to set.
     * @return This builder for chaining.
     */
    public Builder setAssetTypeBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      assetType_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    private java.lang.Object project_ = "";
    /**
     *
     *
     * <pre>
     * The project that the associated Google Cloud resource belongs to, in the
     * form of projects/{PROJECT_NUMBER}. If an IAM policy is set on a resource
     * (like VM instance, Cloud Storage bucket), the project field will indicate
     * the project that contains the resource. If an IAM policy is set on a folder
     * or orgnization, this field will be empty.
     * To search against the `project`:
     * * specify the `scope` field as this project in your search request.
     * </pre>
     *
     * <code>string project = 2;</code>
     *
     * @return The project.
     */
    public java.lang.String getProject() {
      java.lang.Object ref = project_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        project_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The project that the associated Google Cloud resource belongs to, in the
     * form of projects/{PROJECT_NUMBER}. If an IAM policy is set on a resource
     * (like VM instance, Cloud Storage bucket), the project field will indicate
     * the project that contains the resource. If an IAM policy is set on a folder
     * or orgnization, this field will be empty.
     * To search against the `project`:
     * * specify the `scope` field as this project in your search request.
     * </pre>
     *
     * <code>string project = 2;</code>
     *
     * @return The bytes for project.
     */
    public com.google.protobuf.ByteString getProjectBytes() {
      java.lang.Object ref = project_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        project_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The project that the associated Google Cloud resource belongs to, in the
     * form of projects/{PROJECT_NUMBER}. If an IAM policy is set on a resource
     * (like VM instance, Cloud Storage bucket), the project field will indicate
     * the project that contains the resource. If an IAM policy is set on a folder
     * or orgnization, this field will be empty.
     * To search against the `project`:
     * * specify the `scope` field as this project in your search request.
     * </pre>
     *
     * <code>string project = 2;</code>
     *
     * @param value The project to set.
     * @return This builder for chaining.
     */
    public Builder setProject(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      project_ = value;
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The project that the associated Google Cloud resource belongs to, in the
     * form of projects/{PROJECT_NUMBER}. If an IAM policy is set on a resource
     * (like VM instance, Cloud Storage bucket), the project field will indicate
     * the project that contains the resource. If an IAM policy is set on a folder
     * or orgnization, this field will be empty.
     * To search against the `project`:
     * * specify the `scope` field as this project in your search request.
     * </pre>
     *
     * <code>string project = 2;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearProject() {
      project_ = getDefaultInstance().getProject();
      bitField0_ = (bitField0_ & ~0x00000004);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The project that the associated Google Cloud resource belongs to, in the
     * form of projects/{PROJECT_NUMBER}. If an IAM policy is set on a resource
     * (like VM instance, Cloud Storage bucket), the project field will indicate
     * the project that contains the resource. If an IAM policy is set on a folder
     * or orgnization, this field will be empty.
     * To search against the `project`:
     * * specify the `scope` field as this project in your search request.
     * </pre>
     *
     * <code>string project = 2;</code>
     *
     * @param value The bytes for project to set.
     * @return This builder for chaining.
     */
    public Builder setProjectBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      project_ = value;
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }

    private com.google.protobuf.LazyStringList folders_ =
        com.google.protobuf.LazyStringArrayList.EMPTY;

    private void ensureFoldersIsMutable() {
      if (!((bitField0_ & 0x00000008) != 0)) {
        folders_ = new com.google.protobuf.LazyStringArrayList(folders_);
        bitField0_ |= 0x00000008;
      }
    }
    /**
     *
     *
     * <pre>
     * The folder(s) that the IAM policy belongs to, in the form of
     * folders/{FOLDER_NUMBER}. This field is available when the IAM policy
     * belongs to one or more folders.
     * To search against `folders`:
     * * use a field query. Example: `folders:(123 OR 456)`
     * * use a free text query. Example: `123`
     * * specify the `scope` field as this folder in your search request.
     * </pre>
     *
     * <code>repeated string folders = 6;</code>
     *
     * @return A list containing the folders.
     */
    public com.google.protobuf.ProtocolStringList getFoldersList() {
      return folders_.getUnmodifiableView();
    }
    /**
     *
     *
     * <pre>
     * The folder(s) that the IAM policy belongs to, in the form of
     * folders/{FOLDER_NUMBER}. This field is available when the IAM policy
     * belongs to one or more folders.
     * To search against `folders`:
     * * use a field query. Example: `folders:(123 OR 456)`
     * * use a free text query. Example: `123`
     * * specify the `scope` field as this folder in your search request.
     * </pre>
     *
     * <code>repeated string folders = 6;</code>
     *
     * @return The count of folders.
     */
    public int getFoldersCount() {
      return folders_.size();
    }
    /**
     *
     *
     * <pre>
     * The folder(s) that the IAM policy belongs to, in the form of
     * folders/{FOLDER_NUMBER}. This field is available when the IAM policy
     * belongs to one or more folders.
     * To search against `folders`:
     * * use a field query. Example: `folders:(123 OR 456)`
     * * use a free text query. Example: `123`
     * * specify the `scope` field as this folder in your search request.
     * </pre>
     *
     * <code>repeated string folders = 6;</code>
     *
     * @param index The index of the element to return.
     * @return The folders at the given index.
     */
    public java.lang.String getFolders(int index) {
      return folders_.get(index);
    }
    /**
     *
     *
     * <pre>
     * The folder(s) that the IAM policy belongs to, in the form of
     * folders/{FOLDER_NUMBER}. This field is available when the IAM policy
     * belongs to one or more folders.
     * To search against `folders`:
     * * use a field query. Example: `folders:(123 OR 456)`
     * * use a free text query. Example: `123`
     * * specify the `scope` field as this folder in your search request.
     * </pre>
     *
     * <code>repeated string folders = 6;</code>
     *
     * @param index The index of the value to return.
     * @return The bytes of the folders at the given index.
     */
    public com.google.protobuf.ByteString getFoldersBytes(int index) {
      return folders_.getByteString(index);
    }
    /**
     *
     *
     * <pre>
     * The folder(s) that the IAM policy belongs to, in the form of
     * folders/{FOLDER_NUMBER}. This field is available when the IAM policy
     * belongs to one or more folders.
     * To search against `folders`:
     * * use a field query. Example: `folders:(123 OR 456)`
     * * use a free text query. Example: `123`
     * * specify the `scope` field as this folder in your search request.
     * </pre>
     *
     * <code>repeated string folders = 6;</code>
     *
     * @param index The index to set the value at.
     * @param value The folders to set.
     * @return This builder for chaining.
     */
    public Builder setFolders(int index, java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureFoldersIsMutable();
      folders_.set(index, value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The folder(s) that the IAM policy belongs to, in the form of
     * folders/{FOLDER_NUMBER}. This field is available when the IAM policy
     * belongs to one or more folders.
     * To search against `folders`:
     * * use a field query. Example: `folders:(123 OR 456)`
     * * use a free text query. Example: `123`
     * * specify the `scope` field as this folder in your search request.
     * </pre>
     *
     * <code>repeated string folders = 6;</code>
     *
     * @param value The folders to add.
     * @return This builder for chaining.
     */
    public Builder addFolders(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureFoldersIsMutable();
      folders_.add(value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The folder(s) that the IAM policy belongs to, in the form of
     * folders/{FOLDER_NUMBER}. This field is available when the IAM policy
     * belongs to one or more folders.
     * To search against `folders`:
     * * use a field query. Example: `folders:(123 OR 456)`
     * * use a free text query. Example: `123`
     * * specify the `scope` field as this folder in your search request.
     * </pre>
     *
     * <code>repeated string folders = 6;</code>
     *
     * @param values The folders to add.
     * @return This builder for chaining.
     */
    public Builder addAllFolders(java.lang.Iterable<java.lang.String> values) {
      ensureFoldersIsMutable();
      com.google.protobuf.AbstractMessageLite.Builder.addAll(values, folders_);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The folder(s) that the IAM policy belongs to, in the form of
     * folders/{FOLDER_NUMBER}. This field is available when the IAM policy
     * belongs to one or more folders.
     * To search against `folders`:
     * * use a field query. Example: `folders:(123 OR 456)`
     * * use a free text query. Example: `123`
     * * specify the `scope` field as this folder in your search request.
     * </pre>
     *
     * <code>repeated string folders = 6;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearFolders() {
      folders_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000008);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The folder(s) that the IAM policy belongs to, in the form of
     * folders/{FOLDER_NUMBER}. This field is available when the IAM policy
     * belongs to one or more folders.
     * To search against `folders`:
     * * use a field query. Example: `folders:(123 OR 456)`
     * * use a free text query. Example: `123`
     * * specify the `scope` field as this folder in your search request.
     * </pre>
     *
     * <code>repeated string folders = 6;</code>
     *
     * @param value The bytes of the folders to add.
     * @return This builder for chaining.
     */
    public Builder addFoldersBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      ensureFoldersIsMutable();
      folders_.add(value);
      onChanged();
      return this;
    }

    private java.lang.Object organization_ = "";
    /**
     *
     *
     * <pre>
     * The organization that the IAM policy belongs to, in the form
     * of organizations/{ORGANIZATION_NUMBER}. This field is available when the
     * IAM policy belongs to an organization.
     * To search against `organization`:
     * * use a field query. Example: `organization:123`
     * * use a free text query. Example: `123`
     * * specify the `scope` field as this organization in your search request.
     * </pre>
     *
     * <code>string organization = 7;</code>
     *
     * @return The organization.
     */
    public java.lang.String getOrganization() {
      java.lang.Object ref = organization_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        organization_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The organization that the IAM policy belongs to, in the form
     * of organizations/{ORGANIZATION_NUMBER}. This field is available when the
     * IAM policy belongs to an organization.
     * To search against `organization`:
     * * use a field query. Example: `organization:123`
     * * use a free text query. Example: `123`
     * * specify the `scope` field as this organization in your search request.
     * </pre>
     *
     * <code>string organization = 7;</code>
     *
     * @return The bytes for organization.
     */
    public com.google.protobuf.ByteString getOrganizationBytes() {
      java.lang.Object ref = organization_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        organization_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The organization that the IAM policy belongs to, in the form
     * of organizations/{ORGANIZATION_NUMBER}. This field is available when the
     * IAM policy belongs to an organization.
     * To search against `organization`:
     * * use a field query. Example: `organization:123`
     * * use a free text query. Example: `123`
     * * specify the `scope` field as this organization in your search request.
     * </pre>
     *
     * <code>string organization = 7;</code>
     *
     * @param value The organization to set.
     * @return This builder for chaining.
     */
    public Builder setOrganization(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      organization_ = value;
      bitField0_ |= 0x00000010;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The organization that the IAM policy belongs to, in the form
     * of organizations/{ORGANIZATION_NUMBER}. This field is available when the
     * IAM policy belongs to an organization.
     * To search against `organization`:
     * * use a field query. Example: `organization:123`
     * * use a free text query. Example: `123`
     * * specify the `scope` field as this organization in your search request.
     * </pre>
     *
     * <code>string organization = 7;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearOrganization() {
      organization_ = getDefaultInstance().getOrganization();
      bitField0_ = (bitField0_ & ~0x00000010);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The organization that the IAM policy belongs to, in the form
     * of organizations/{ORGANIZATION_NUMBER}. This field is available when the
     * IAM policy belongs to an organization.
     * To search against `organization`:
     * * use a field query. Example: `organization:123`
     * * use a free text query. Example: `123`
     * * specify the `scope` field as this organization in your search request.
     * </pre>
     *
     * <code>string organization = 7;</code>
     *
     * @param value The bytes for organization to set.
     * @return This builder for chaining.
     */
    public Builder setOrganizationBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      organization_ = value;
      bitField0_ |= 0x00000010;
      onChanged();
      return this;
    }

    private com.google.iam.v1.Policy policy_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.iam.v1.Policy,
            com.google.iam.v1.Policy.Builder,
            com.google.iam.v1.PolicyOrBuilder>
        policyBuilder_;
    /**
     *
     *
     * <pre>
     * The IAM policy directly set on the given resource. Note that the original
     * IAM policy can contain multiple bindings. This only contains the bindings
     * that match the given query. For queries that don't contain a constrain on
     * policies (e.g., an empty query), this contains all the bindings.
     * To search against the `policy` bindings:
     * * use a field query:
     *     - query by the policy contained members. Example:
     *       `policy:amy&#64;gmail.com`
     *     - query by the policy contained roles. Example:
     *       `policy:roles/compute.admin`
     *     - query by the policy contained roles' included permissions. Example:
     *       `policy.role.permissions:compute.instances.create`
     * </pre>
     *
     * <code>.google.iam.v1.Policy policy = 3;</code>
     *
     * @return Whether the policy field is set.
     */
    public boolean hasPolicy() {
      return ((bitField0_ & 0x00000020) != 0);
    }
    /**
     *
     *
     * <pre>
     * The IAM policy directly set on the given resource. Note that the original
     * IAM policy can contain multiple bindings. This only contains the bindings
     * that match the given query. For queries that don't contain a constrain on
     * policies (e.g., an empty query), this contains all the bindings.
     * To search against the `policy` bindings:
     * * use a field query:
     *     - query by the policy contained members. Example:
     *       `policy:amy&#64;gmail.com`
     *     - query by the policy contained roles. Example:
     *       `policy:roles/compute.admin`
     *     - query by the policy contained roles' included permissions. Example:
     *       `policy.role.permissions:compute.instances.create`
     * </pre>
     *
     * <code>.google.iam.v1.Policy policy = 3;</code>
     *
     * @return The policy.
     */
    public com.google.iam.v1.Policy getPolicy() {
      if (policyBuilder_ == null) {
        return policy_ == null ? com.google.iam.v1.Policy.getDefaultInstance() : policy_;
      } else {
        return policyBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * The IAM policy directly set on the given resource. Note that the original
     * IAM policy can contain multiple bindings. This only contains the bindings
     * that match the given query. For queries that don't contain a constrain on
     * policies (e.g., an empty query), this contains all the bindings.
     * To search against the `policy` bindings:
     * * use a field query:
     *     - query by the policy contained members. Example:
     *       `policy:amy&#64;gmail.com`
     *     - query by the policy contained roles. Example:
     *       `policy:roles/compute.admin`
     *     - query by the policy contained roles' included permissions. Example:
     *       `policy.role.permissions:compute.instances.create`
     * </pre>
     *
     * <code>.google.iam.v1.Policy policy = 3;</code>
     */
    public Builder setPolicy(com.google.iam.v1.Policy value) {
      if (policyBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        policy_ = value;
      } else {
        policyBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000020;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The IAM policy directly set on the given resource. Note that the original
     * IAM policy can contain multiple bindings. This only contains the bindings
     * that match the given query. For queries that don't contain a constrain on
     * policies (e.g., an empty query), this contains all the bindings.
     * To search against the `policy` bindings:
     * * use a field query:
     *     - query by the policy contained members. Example:
     *       `policy:amy&#64;gmail.com`
     *     - query by the policy contained roles. Example:
     *       `policy:roles/compute.admin`
     *     - query by the policy contained roles' included permissions. Example:
     *       `policy.role.permissions:compute.instances.create`
     * </pre>
     *
     * <code>.google.iam.v1.Policy policy = 3;</code>
     */
    public Builder setPolicy(com.google.iam.v1.Policy.Builder builderForValue) {
      if (policyBuilder_ == null) {
        policy_ = builderForValue.build();
      } else {
        policyBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000020;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The IAM policy directly set on the given resource. Note that the original
     * IAM policy can contain multiple bindings. This only contains the bindings
     * that match the given query. For queries that don't contain a constrain on
     * policies (e.g., an empty query), this contains all the bindings.
     * To search against the `policy` bindings:
     * * use a field query:
     *     - query by the policy contained members. Example:
     *       `policy:amy&#64;gmail.com`
     *     - query by the policy contained roles. Example:
     *       `policy:roles/compute.admin`
     *     - query by the policy contained roles' included permissions. Example:
     *       `policy.role.permissions:compute.instances.create`
     * </pre>
     *
     * <code>.google.iam.v1.Policy policy = 3;</code>
     */
    public Builder mergePolicy(com.google.iam.v1.Policy value) {
      if (policyBuilder_ == null) {
        if (((bitField0_ & 0x00000020) != 0)
            && policy_ != null
            && policy_ != com.google.iam.v1.Policy.getDefaultInstance()) {
          getPolicyBuilder().mergeFrom(value);
        } else {
          policy_ = value;
        }
      } else {
        policyBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000020;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The IAM policy directly set on the given resource. Note that the original
     * IAM policy can contain multiple bindings. This only contains the bindings
     * that match the given query. For queries that don't contain a constrain on
     * policies (e.g., an empty query), this contains all the bindings.
     * To search against the `policy` bindings:
     * * use a field query:
     *     - query by the policy contained members. Example:
     *       `policy:amy&#64;gmail.com`
     *     - query by the policy contained roles. Example:
     *       `policy:roles/compute.admin`
     *     - query by the policy contained roles' included permissions. Example:
     *       `policy.role.permissions:compute.instances.create`
     * </pre>
     *
     * <code>.google.iam.v1.Policy policy = 3;</code>
     */
    public Builder clearPolicy() {
      bitField0_ = (bitField0_ & ~0x00000020);
      policy_ = null;
      if (policyBuilder_ != null) {
        policyBuilder_.dispose();
        policyBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The IAM policy directly set on the given resource. Note that the original
     * IAM policy can contain multiple bindings. This only contains the bindings
     * that match the given query. For queries that don't contain a constrain on
     * policies (e.g., an empty query), this contains all the bindings.
     * To search against the `policy` bindings:
     * * use a field query:
     *     - query by the policy contained members. Example:
     *       `policy:amy&#64;gmail.com`
     *     - query by the policy contained roles. Example:
     *       `policy:roles/compute.admin`
     *     - query by the policy contained roles' included permissions. Example:
     *       `policy.role.permissions:compute.instances.create`
     * </pre>
     *
     * <code>.google.iam.v1.Policy policy = 3;</code>
     */
    public com.google.iam.v1.Policy.Builder getPolicyBuilder() {
      bitField0_ |= 0x00000020;
      onChanged();
      return getPolicyFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * The IAM policy directly set on the given resource. Note that the original
     * IAM policy can contain multiple bindings. This only contains the bindings
     * that match the given query. For queries that don't contain a constrain on
     * policies (e.g., an empty query), this contains all the bindings.
     * To search against the `policy` bindings:
     * * use a field query:
     *     - query by the policy contained members. Example:
     *       `policy:amy&#64;gmail.com`
     *     - query by the policy contained roles. Example:
     *       `policy:roles/compute.admin`
     *     - query by the policy contained roles' included permissions. Example:
     *       `policy.role.permissions:compute.instances.create`
     * </pre>
     *
     * <code>.google.iam.v1.Policy policy = 3;</code>
     */
    public com.google.iam.v1.PolicyOrBuilder getPolicyOrBuilder() {
      if (policyBuilder_ != null) {
        return policyBuilder_.getMessageOrBuilder();
      } else {
        return policy_ == null ? com.google.iam.v1.Policy.getDefaultInstance() : policy_;
      }
    }
    /**
     *
     *
     * <pre>
     * The IAM policy directly set on the given resource. Note that the original
     * IAM policy can contain multiple bindings. This only contains the bindings
     * that match the given query. For queries that don't contain a constrain on
     * policies (e.g., an empty query), this contains all the bindings.
     * To search against the `policy` bindings:
     * * use a field query:
     *     - query by the policy contained members. Example:
     *       `policy:amy&#64;gmail.com`
     *     - query by the policy contained roles. Example:
     *       `policy:roles/compute.admin`
     *     - query by the policy contained roles' included permissions. Example:
     *       `policy.role.permissions:compute.instances.create`
     * </pre>
     *
     * <code>.google.iam.v1.Policy policy = 3;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.iam.v1.Policy,
            com.google.iam.v1.Policy.Builder,
            com.google.iam.v1.PolicyOrBuilder>
        getPolicyFieldBuilder() {
      if (policyBuilder_ == null) {
        policyBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.iam.v1.Policy,
                com.google.iam.v1.Policy.Builder,
                com.google.iam.v1.PolicyOrBuilder>(getPolicy(), getParentForChildren(), isClean());
        policy_ = null;
      }
      return policyBuilder_;
    }

    private com.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.asset.v1.IamPolicySearchResult.Explanation,
            com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Builder,
            com.google.cloud.asset.v1.IamPolicySearchResult.ExplanationOrBuilder>
        explanationBuilder_;
    /**
     *
     *
     * <pre>
     * Explanation about the IAM policy search result. It contains additional
     * information to explain why the search result matches the query.
     * </pre>
     *
     * <code>.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4;</code>
     *
     * @return Whether the explanation field is set.
     */
    public boolean hasExplanation() {
      return ((bitField0_ & 0x00000040) != 0);
    }
    /**
     *
     *
     * <pre>
     * Explanation about the IAM policy search result. It contains additional
     * information to explain why the search result matches the query.
     * </pre>
     *
     * <code>.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4;</code>
     *
     * @return The explanation.
     */
    public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation getExplanation() {
      if (explanationBuilder_ == null) {
        return explanation_ == null
            ? com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.getDefaultInstance()
            : explanation_;
      } else {
        return explanationBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Explanation about the IAM policy search result. It contains additional
     * information to explain why the search result matches the query.
     * </pre>
     *
     * <code>.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4;</code>
     */
    public Builder setExplanation(
        com.google.cloud.asset.v1.IamPolicySearchResult.Explanation value) {
      if (explanationBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        explanation_ = value;
      } else {
        explanationBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000040;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Explanation about the IAM policy search result. It contains additional
     * information to explain why the search result matches the query.
     * </pre>
     *
     * <code>.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4;</code>
     */
    public Builder setExplanation(
        com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Builder builderForValue) {
      if (explanationBuilder_ == null) {
        explanation_ = builderForValue.build();
      } else {
        explanationBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000040;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Explanation about the IAM policy search result. It contains additional
     * information to explain why the search result matches the query.
     * </pre>
     *
     * <code>.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4;</code>
     */
    public Builder mergeExplanation(
        com.google.cloud.asset.v1.IamPolicySearchResult.Explanation value) {
      if (explanationBuilder_ == null) {
        if (((bitField0_ & 0x00000040) != 0)
            && explanation_ != null
            && explanation_
                != com.google.cloud.asset.v1.IamPolicySearchResult.Explanation
                    .getDefaultInstance()) {
          getExplanationBuilder().mergeFrom(value);
        } else {
          explanation_ = value;
        }
      } else {
        explanationBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000040;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Explanation about the IAM policy search result. It contains additional
     * information to explain why the search result matches the query.
     * </pre>
     *
     * <code>.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4;</code>
     */
    public Builder clearExplanation() {
      bitField0_ = (bitField0_ & ~0x00000040);
      explanation_ = null;
      if (explanationBuilder_ != null) {
        explanationBuilder_.dispose();
        explanationBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Explanation about the IAM policy search result. It contains additional
     * information to explain why the search result matches the query.
     * </pre>
     *
     * <code>.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4;</code>
     */
    public com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Builder
        getExplanationBuilder() {
      bitField0_ |= 0x00000040;
      onChanged();
      return getExplanationFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Explanation about the IAM policy search result. It contains additional
     * information to explain why the search result matches the query.
     * </pre>
     *
     * <code>.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4;</code>
     */
    public com.google.cloud.asset.v1.IamPolicySearchResult.ExplanationOrBuilder
        getExplanationOrBuilder() {
      if (explanationBuilder_ != null) {
        return explanationBuilder_.getMessageOrBuilder();
      } else {
        return explanation_ == null
            ? com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.getDefaultInstance()
            : explanation_;
      }
    }
    /**
     *
     *
     * <pre>
     * Explanation about the IAM policy search result. It contains additional
     * information to explain why the search result matches the query.
     * </pre>
     *
     * <code>.google.cloud.asset.v1.IamPolicySearchResult.Explanation explanation = 4;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.asset.v1.IamPolicySearchResult.Explanation,
            com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Builder,
            com.google.cloud.asset.v1.IamPolicySearchResult.ExplanationOrBuilder>
        getExplanationFieldBuilder() {
      if (explanationBuilder_ == null) {
        explanationBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.asset.v1.IamPolicySearchResult.Explanation,
                com.google.cloud.asset.v1.IamPolicySearchResult.Explanation.Builder,
                com.google.cloud.asset.v1.IamPolicySearchResult.ExplanationOrBuilder>(
                getExplanation(), getParentForChildren(), isClean());
        explanation_ = null;
      }
      return explanationBuilder_;
    }

    @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.asset.v1.IamPolicySearchResult)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.asset.v1.IamPolicySearchResult)
  private static final com.google.cloud.asset.v1.IamPolicySearchResult DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.asset.v1.IamPolicySearchResult();
  }

  public static com.google.cloud.asset.v1.IamPolicySearchResult getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<IamPolicySearchResult> PARSER =
      new com.google.protobuf.AbstractParser<IamPolicySearchResult>() {
        @java.lang.Override
        public IamPolicySearchResult 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<IamPolicySearchResult> parser() {
    return PARSER;
  }

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

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