// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/monitoring/v3/alert.proto

package com.google.monitoring.v3;

/**
 *
 *
 * <pre>
 * A description of the conditions under which some aspect of your system is
 * considered to be "unhealthy" and the ways to notify people or services about
 * this state. For an overview of alert policies, see
 * [Introduction to Alerting](/monitoring/alerts/).
 * </pre>
 *
 * Protobuf type {@code google.monitoring.v3.AlertPolicy}
 */
public final class AlertPolicy extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.monitoring.v3.AlertPolicy)
    AlertPolicyOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use AlertPolicy.newBuilder() to construct.
  private AlertPolicy(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private AlertPolicy() {
    name_ = "";
    displayName_ = "";
    conditions_ = java.util.Collections.emptyList();
    combiner_ = 0;
    notificationChannels_ = com.google.protobuf.LazyStringArrayList.EMPTY;
  }

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

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

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

              displayName_ = s;
              break;
            }
          case 48:
            {
              int rawValue = input.readEnum();

              combiner_ = rawValue;
              break;
            }
          case 82:
            {
              com.google.monitoring.v3.MutationRecord.Builder subBuilder = null;
              if (creationRecord_ != null) {
                subBuilder = creationRecord_.toBuilder();
              }
              creationRecord_ =
                  input.readMessage(
                      com.google.monitoring.v3.MutationRecord.parser(), extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(creationRecord_);
                creationRecord_ = subBuilder.buildPartial();
              }

              break;
            }
          case 90:
            {
              com.google.monitoring.v3.MutationRecord.Builder subBuilder = null;
              if (mutationRecord_ != null) {
                subBuilder = mutationRecord_.toBuilder();
              }
              mutationRecord_ =
                  input.readMessage(
                      com.google.monitoring.v3.MutationRecord.parser(), extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(mutationRecord_);
                mutationRecord_ = subBuilder.buildPartial();
              }

              break;
            }
          case 98:
            {
              if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
                conditions_ =
                    new java.util.ArrayList<com.google.monitoring.v3.AlertPolicy.Condition>();
                mutable_bitField0_ |= 0x00000010;
              }
              conditions_.add(
                  input.readMessage(
                      com.google.monitoring.v3.AlertPolicy.Condition.parser(), extensionRegistry));
              break;
            }
          case 106:
            {
              com.google.monitoring.v3.AlertPolicy.Documentation.Builder subBuilder = null;
              if (documentation_ != null) {
                subBuilder = documentation_.toBuilder();
              }
              documentation_ =
                  input.readMessage(
                      com.google.monitoring.v3.AlertPolicy.Documentation.parser(),
                      extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(documentation_);
                documentation_ = subBuilder.buildPartial();
              }

              break;
            }
          case 114:
            {
              java.lang.String s = input.readStringRequireUtf8();
              if (!((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
                notificationChannels_ = new com.google.protobuf.LazyStringArrayList();
                mutable_bitField0_ |= 0x00000080;
              }
              notificationChannels_.add(s);
              break;
            }
          case 130:
            {
              if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
                userLabels_ =
                    com.google.protobuf.MapField.newMapField(
                        UserLabelsDefaultEntryHolder.defaultEntry);
                mutable_bitField0_ |= 0x00000008;
              }
              com.google.protobuf.MapEntry<java.lang.String, java.lang.String> userLabels__ =
                  input.readMessage(
                      UserLabelsDefaultEntryHolder.defaultEntry.getParserForType(),
                      extensionRegistry);
              userLabels_.getMutableMap().put(userLabels__.getKey(), userLabels__.getValue());
              break;
            }
          case 138:
            {
              com.google.protobuf.BoolValue.Builder subBuilder = null;
              if (enabled_ != null) {
                subBuilder = enabled_.toBuilder();
              }
              enabled_ =
                  input.readMessage(com.google.protobuf.BoolValue.parser(), extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(enabled_);
                enabled_ = subBuilder.buildPartial();
              }

              break;
            }
          default:
            {
              if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
    } finally {
      if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
        conditions_ = java.util.Collections.unmodifiableList(conditions_);
      }
      if (((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
        notificationChannels_ = notificationChannels_.getUnmodifiableView();
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.monitoring.v3.AlertProto
        .internal_static_google_monitoring_v3_AlertPolicy_descriptor;
  }

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

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.monitoring.v3.AlertProto
        .internal_static_google_monitoring_v3_AlertPolicy_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.monitoring.v3.AlertPolicy.class,
            com.google.monitoring.v3.AlertPolicy.Builder.class);
  }

  /**
   *
   *
   * <pre>
   * Operators for combining conditions.
   * </pre>
   *
   * Protobuf enum {@code google.monitoring.v3.AlertPolicy.ConditionCombinerType}
   */
  public enum ConditionCombinerType implements com.google.protobuf.ProtocolMessageEnum {
    /**
     *
     *
     * <pre>
     * An unspecified combiner.
     * </pre>
     *
     * <code>COMBINE_UNSPECIFIED = 0;</code>
     */
    COMBINE_UNSPECIFIED(0),
    /**
     *
     *
     * <pre>
     * Combine conditions using the logical `AND` operator. An
     * incident is created only if all conditions are met
     * simultaneously. This combiner is satisfied if all conditions are
     * met, even if they are met on completely different resources.
     * </pre>
     *
     * <code>AND = 1;</code>
     */
    AND(1),
    /**
     *
     *
     * <pre>
     * Combine conditions using the logical `OR` operator. An incident
     * is created if any of the listed conditions is met.
     * </pre>
     *
     * <code>OR = 2;</code>
     */
    OR(2),
    /**
     *
     *
     * <pre>
     * Combine conditions using logical `AND` operator, but unlike the regular
     * `AND` option, an incident is created only if all conditions are met
     * simultaneously on at least one resource.
     * </pre>
     *
     * <code>AND_WITH_MATCHING_RESOURCE = 3;</code>
     */
    AND_WITH_MATCHING_RESOURCE(3),
    UNRECOGNIZED(-1),
    ;

    /**
     *
     *
     * <pre>
     * An unspecified combiner.
     * </pre>
     *
     * <code>COMBINE_UNSPECIFIED = 0;</code>
     */
    public static final int COMBINE_UNSPECIFIED_VALUE = 0;
    /**
     *
     *
     * <pre>
     * Combine conditions using the logical `AND` operator. An
     * incident is created only if all conditions are met
     * simultaneously. This combiner is satisfied if all conditions are
     * met, even if they are met on completely different resources.
     * </pre>
     *
     * <code>AND = 1;</code>
     */
    public static final int AND_VALUE = 1;
    /**
     *
     *
     * <pre>
     * Combine conditions using the logical `OR` operator. An incident
     * is created if any of the listed conditions is met.
     * </pre>
     *
     * <code>OR = 2;</code>
     */
    public static final int OR_VALUE = 2;
    /**
     *
     *
     * <pre>
     * Combine conditions using logical `AND` operator, but unlike the regular
     * `AND` option, an incident is created only if all conditions are met
     * simultaneously on at least one resource.
     * </pre>
     *
     * <code>AND_WITH_MATCHING_RESOURCE = 3;</code>
     */
    public static final int AND_WITH_MATCHING_RESOURCE_VALUE = 3;

    public final int getNumber() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalArgumentException(
            "Can't get the number of an unknown enum value.");
      }
      return value;
    }

    /** @deprecated Use {@link #forNumber(int)} instead. */
    @java.lang.Deprecated
    public static ConditionCombinerType valueOf(int value) {
      return forNumber(value);
    }

    public static ConditionCombinerType forNumber(int value) {
      switch (value) {
        case 0:
          return COMBINE_UNSPECIFIED;
        case 1:
          return AND;
        case 2:
          return OR;
        case 3:
          return AND_WITH_MATCHING_RESOURCE;
        default:
          return null;
      }
    }

    public static com.google.protobuf.Internal.EnumLiteMap<ConditionCombinerType>
        internalGetValueMap() {
      return internalValueMap;
    }

    private static final com.google.protobuf.Internal.EnumLiteMap<ConditionCombinerType>
        internalValueMap =
            new com.google.protobuf.Internal.EnumLiteMap<ConditionCombinerType>() {
              public ConditionCombinerType findValueByNumber(int number) {
                return ConditionCombinerType.forNumber(number);
              }
            };

    public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
      return getDescriptor().getValues().get(ordinal());
    }

    public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
      return getDescriptor();
    }

    public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
      return com.google.monitoring.v3.AlertPolicy.getDescriptor().getEnumTypes().get(0);
    }

    private static final ConditionCombinerType[] VALUES = values();

    public static ConditionCombinerType valueOf(
        com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
      if (desc.getType() != getDescriptor()) {
        throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type.");
      }
      if (desc.getIndex() == -1) {
        return UNRECOGNIZED;
      }
      return VALUES[desc.getIndex()];
    }

    private final int value;

    private ConditionCombinerType(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:google.monitoring.v3.AlertPolicy.ConditionCombinerType)
  }

  public interface DocumentationOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.monitoring.v3.AlertPolicy.Documentation)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * The text of the documentation, interpreted according to `mime_type`.
     * The content may not exceed 8,192 Unicode characters and may not exceed
     * more than 10,240 bytes when encoded in UTF-8 format, whichever is
     * smaller.
     * </pre>
     *
     * <code>string content = 1;</code>
     */
    java.lang.String getContent();
    /**
     *
     *
     * <pre>
     * The text of the documentation, interpreted according to `mime_type`.
     * The content may not exceed 8,192 Unicode characters and may not exceed
     * more than 10,240 bytes when encoded in UTF-8 format, whichever is
     * smaller.
     * </pre>
     *
     * <code>string content = 1;</code>
     */
    com.google.protobuf.ByteString getContentBytes();

    /**
     *
     *
     * <pre>
     * The format of the `content` field. Presently, only the value
     * `"text/markdown"` is supported. See
     * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
     * </pre>
     *
     * <code>string mime_type = 2;</code>
     */
    java.lang.String getMimeType();
    /**
     *
     *
     * <pre>
     * The format of the `content` field. Presently, only the value
     * `"text/markdown"` is supported. See
     * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
     * </pre>
     *
     * <code>string mime_type = 2;</code>
     */
    com.google.protobuf.ByteString getMimeTypeBytes();
  }
  /**
   *
   *
   * <pre>
   * A content string and a MIME type that describes the content string's
   * format.
   * </pre>
   *
   * Protobuf type {@code google.monitoring.v3.AlertPolicy.Documentation}
   */
  public static final class Documentation extends com.google.protobuf.GeneratedMessageV3
      implements
      // @@protoc_insertion_point(message_implements:google.monitoring.v3.AlertPolicy.Documentation)
      DocumentationOrBuilder {
    private static final long serialVersionUID = 0L;
    // Use Documentation.newBuilder() to construct.
    private Documentation(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }

    private Documentation() {
      content_ = "";
      mimeType_ = "";
    }

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

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

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

                mimeType_ = s;
                break;
              }
            default:
              {
                if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) {
                  done = true;
                }
                break;
              }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
      } finally {
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.monitoring.v3.AlertProto
          .internal_static_google_monitoring_v3_AlertPolicy_Documentation_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.monitoring.v3.AlertProto
          .internal_static_google_monitoring_v3_AlertPolicy_Documentation_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.monitoring.v3.AlertPolicy.Documentation.class,
              com.google.monitoring.v3.AlertPolicy.Documentation.Builder.class);
    }

    public static final int CONTENT_FIELD_NUMBER = 1;
    private volatile java.lang.Object content_;
    /**
     *
     *
     * <pre>
     * The text of the documentation, interpreted according to `mime_type`.
     * The content may not exceed 8,192 Unicode characters and may not exceed
     * more than 10,240 bytes when encoded in UTF-8 format, whichever is
     * smaller.
     * </pre>
     *
     * <code>string content = 1;</code>
     */
    public java.lang.String getContent() {
      java.lang.Object ref = content_;
      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();
        content_ = s;
        return s;
      }
    }
    /**
     *
     *
     * <pre>
     * The text of the documentation, interpreted according to `mime_type`.
     * The content may not exceed 8,192 Unicode characters and may not exceed
     * more than 10,240 bytes when encoded in UTF-8 format, whichever is
     * smaller.
     * </pre>
     *
     * <code>string content = 1;</code>
     */
    public com.google.protobuf.ByteString getContentBytes() {
      java.lang.Object ref = content_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        content_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int MIME_TYPE_FIELD_NUMBER = 2;
    private volatile java.lang.Object mimeType_;
    /**
     *
     *
     * <pre>
     * The format of the `content` field. Presently, only the value
     * `"text/markdown"` is supported. See
     * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
     * </pre>
     *
     * <code>string mime_type = 2;</code>
     */
    public java.lang.String getMimeType() {
      java.lang.Object ref = mimeType_;
      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();
        mimeType_ = s;
        return s;
      }
    }
    /**
     *
     *
     * <pre>
     * The format of the `content` field. Presently, only the value
     * `"text/markdown"` is supported. See
     * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
     * </pre>
     *
     * <code>string mime_type = 2;</code>
     */
    public com.google.protobuf.ByteString getMimeTypeBytes() {
      java.lang.Object ref = mimeType_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        mimeType_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    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 (!getContentBytes().isEmpty()) {
        com.google.protobuf.GeneratedMessageV3.writeString(output, 1, content_);
      }
      if (!getMimeTypeBytes().isEmpty()) {
        com.google.protobuf.GeneratedMessageV3.writeString(output, 2, mimeType_);
      }
      unknownFields.writeTo(output);
    }

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

      size = 0;
      if (!getContentBytes().isEmpty()) {
        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, content_);
      }
      if (!getMimeTypeBytes().isEmpty()) {
        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, mimeType_);
      }
      size += unknownFields.getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
      if (obj == this) {
        return true;
      }
      if (!(obj instanceof com.google.monitoring.v3.AlertPolicy.Documentation)) {
        return super.equals(obj);
      }
      com.google.monitoring.v3.AlertPolicy.Documentation other =
          (com.google.monitoring.v3.AlertPolicy.Documentation) obj;

      boolean result = true;
      result = result && getContent().equals(other.getContent());
      result = result && getMimeType().equals(other.getMimeType());
      result = result && unknownFields.equals(other.unknownFields);
      return result;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      hash = (37 * hash) + CONTENT_FIELD_NUMBER;
      hash = (53 * hash) + getContent().hashCode();
      hash = (37 * hash) + MIME_TYPE_FIELD_NUMBER;
      hash = (53 * hash) + getMimeType().hashCode();
      hash = (29 * hash) + unknownFields.hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.monitoring.v3.AlertPolicy.Documentation parseFrom(
        java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.monitoring.v3.AlertPolicy.Documentation parseFrom(
        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.monitoring.v3.AlertPolicy.Documentation parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.monitoring.v3.AlertPolicy.Documentation 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.monitoring.v3.AlertPolicy.Documentation parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.monitoring.v3.AlertPolicy.Documentation parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.monitoring.v3.AlertPolicy.Documentation parseFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static com.google.monitoring.v3.AlertPolicy.Documentation 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.monitoring.v3.AlertPolicy.Documentation parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.monitoring.v3.AlertPolicy.Documentation 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.monitoring.v3.AlertPolicy.Documentation parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static com.google.monitoring.v3.AlertPolicy.Documentation 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.monitoring.v3.AlertPolicy.Documentation 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 content string and a MIME type that describes the content string's
     * format.
     * </pre>
     *
     * Protobuf type {@code google.monitoring.v3.AlertPolicy.Documentation}
     */
    public static final class Builder
        extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.monitoring.v3.AlertPolicy.Documentation)
        com.google.monitoring.v3.AlertPolicy.DocumentationOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.monitoring.v3.AlertProto
            .internal_static_google_monitoring_v3_AlertPolicy_Documentation_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.monitoring.v3.AlertProto
            .internal_static_google_monitoring_v3_AlertPolicy_Documentation_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.monitoring.v3.AlertPolicy.Documentation.class,
                com.google.monitoring.v3.AlertPolicy.Documentation.Builder.class);
      }

      // Construct using com.google.monitoring.v3.AlertPolicy.Documentation.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

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

      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        content_ = "";

        mimeType_ = "";

        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.monitoring.v3.AlertProto
            .internal_static_google_monitoring_v3_AlertPolicy_Documentation_descriptor;
      }

      @java.lang.Override
      public com.google.monitoring.v3.AlertPolicy.Documentation getDefaultInstanceForType() {
        return com.google.monitoring.v3.AlertPolicy.Documentation.getDefaultInstance();
      }

      @java.lang.Override
      public com.google.monitoring.v3.AlertPolicy.Documentation build() {
        com.google.monitoring.v3.AlertPolicy.Documentation result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.monitoring.v3.AlertPolicy.Documentation buildPartial() {
        com.google.monitoring.v3.AlertPolicy.Documentation result =
            new com.google.monitoring.v3.AlertPolicy.Documentation(this);
        result.content_ = content_;
        result.mimeType_ = mimeType_;
        onBuilt();
        return result;
      }

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

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

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

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

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

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

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.google.monitoring.v3.AlertPolicy.Documentation) {
          return mergeFrom((com.google.monitoring.v3.AlertPolicy.Documentation) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.google.monitoring.v3.AlertPolicy.Documentation other) {
        if (other == com.google.monitoring.v3.AlertPolicy.Documentation.getDefaultInstance())
          return this;
        if (!other.getContent().isEmpty()) {
          content_ = other.content_;
          onChanged();
        }
        if (!other.getMimeType().isEmpty()) {
          mimeType_ = other.mimeType_;
          onChanged();
        }
        this.mergeUnknownFields(other.unknownFields);
        onChanged();
        return this;
      }

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

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

      private java.lang.Object content_ = "";
      /**
       *
       *
       * <pre>
       * The text of the documentation, interpreted according to `mime_type`.
       * The content may not exceed 8,192 Unicode characters and may not exceed
       * more than 10,240 bytes when encoded in UTF-8 format, whichever is
       * smaller.
       * </pre>
       *
       * <code>string content = 1;</code>
       */
      public java.lang.String getContent() {
        java.lang.Object ref = content_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          content_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }
      /**
       *
       *
       * <pre>
       * The text of the documentation, interpreted according to `mime_type`.
       * The content may not exceed 8,192 Unicode characters and may not exceed
       * more than 10,240 bytes when encoded in UTF-8 format, whichever is
       * smaller.
       * </pre>
       *
       * <code>string content = 1;</code>
       */
      public com.google.protobuf.ByteString getContentBytes() {
        java.lang.Object ref = content_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          content_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       *
       *
       * <pre>
       * The text of the documentation, interpreted according to `mime_type`.
       * The content may not exceed 8,192 Unicode characters and may not exceed
       * more than 10,240 bytes when encoded in UTF-8 format, whichever is
       * smaller.
       * </pre>
       *
       * <code>string content = 1;</code>
       */
      public Builder setContent(java.lang.String value) {
        if (value == null) {
          throw new NullPointerException();
        }

        content_ = value;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The text of the documentation, interpreted according to `mime_type`.
       * The content may not exceed 8,192 Unicode characters and may not exceed
       * more than 10,240 bytes when encoded in UTF-8 format, whichever is
       * smaller.
       * </pre>
       *
       * <code>string content = 1;</code>
       */
      public Builder clearContent() {

        content_ = getDefaultInstance().getContent();
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The text of the documentation, interpreted according to `mime_type`.
       * The content may not exceed 8,192 Unicode characters and may not exceed
       * more than 10,240 bytes when encoded in UTF-8 format, whichever is
       * smaller.
       * </pre>
       *
       * <code>string content = 1;</code>
       */
      public Builder setContentBytes(com.google.protobuf.ByteString value) {
        if (value == null) {
          throw new NullPointerException();
        }
        checkByteStringIsUtf8(value);

        content_ = value;
        onChanged();
        return this;
      }

      private java.lang.Object mimeType_ = "";
      /**
       *
       *
       * <pre>
       * The format of the `content` field. Presently, only the value
       * `"text/markdown"` is supported. See
       * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
       * </pre>
       *
       * <code>string mime_type = 2;</code>
       */
      public java.lang.String getMimeType() {
        java.lang.Object ref = mimeType_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          mimeType_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }
      /**
       *
       *
       * <pre>
       * The format of the `content` field. Presently, only the value
       * `"text/markdown"` is supported. See
       * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
       * </pre>
       *
       * <code>string mime_type = 2;</code>
       */
      public com.google.protobuf.ByteString getMimeTypeBytes() {
        java.lang.Object ref = mimeType_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          mimeType_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       *
       *
       * <pre>
       * The format of the `content` field. Presently, only the value
       * `"text/markdown"` is supported. See
       * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
       * </pre>
       *
       * <code>string mime_type = 2;</code>
       */
      public Builder setMimeType(java.lang.String value) {
        if (value == null) {
          throw new NullPointerException();
        }

        mimeType_ = value;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The format of the `content` field. Presently, only the value
       * `"text/markdown"` is supported. See
       * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
       * </pre>
       *
       * <code>string mime_type = 2;</code>
       */
      public Builder clearMimeType() {

        mimeType_ = getDefaultInstance().getMimeType();
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The format of the `content` field. Presently, only the value
       * `"text/markdown"` is supported. See
       * [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
       * </pre>
       *
       * <code>string mime_type = 2;</code>
       */
      public Builder setMimeTypeBytes(com.google.protobuf.ByteString value) {
        if (value == null) {
          throw new NullPointerException();
        }
        checkByteStringIsUtf8(value);

        mimeType_ = value;
        onChanged();
        return this;
      }

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

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

      // @@protoc_insertion_point(builder_scope:google.monitoring.v3.AlertPolicy.Documentation)
    }

    // @@protoc_insertion_point(class_scope:google.monitoring.v3.AlertPolicy.Documentation)
    private static final com.google.monitoring.v3.AlertPolicy.Documentation DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.monitoring.v3.AlertPolicy.Documentation();
    }

    public static com.google.monitoring.v3.AlertPolicy.Documentation getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

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

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

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

    @java.lang.Override
    public com.google.monitoring.v3.AlertPolicy.Documentation getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  public interface ConditionOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.monitoring.v3.AlertPolicy.Condition)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * Required if the condition exists. The unique resource name for this
     * condition. Its syntax is:
     *     projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
     * `[CONDITION_ID]` is assigned by Stackdriver Monitoring when the
     * condition is created as part of a new or updated alerting policy.
     * When calling the
     * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
     * method, do not include the `name` field in the conditions of the
     * requested alerting policy. Stackdriver Monitoring creates the
     * condition identifiers and includes them in the new policy.
     * When calling the
     * [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]
     * method to update a policy, including a condition `name` causes the
     * existing condition to be updated. Conditions without names are added to
     * the updated policy. Existing conditions are deleted if they are not
     * updated.
     * Best practice is to preserve `[CONDITION_ID]` if you make only small
     * changes, such as those to condition thresholds, durations, or trigger
     * values.  Otherwise, treat the change as a new condition and let the
     * existing condition be deleted.
     * </pre>
     *
     * <code>string name = 12;</code>
     */
    java.lang.String getName();
    /**
     *
     *
     * <pre>
     * Required if the condition exists. The unique resource name for this
     * condition. Its syntax is:
     *     projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
     * `[CONDITION_ID]` is assigned by Stackdriver Monitoring when the
     * condition is created as part of a new or updated alerting policy.
     * When calling the
     * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
     * method, do not include the `name` field in the conditions of the
     * requested alerting policy. Stackdriver Monitoring creates the
     * condition identifiers and includes them in the new policy.
     * When calling the
     * [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]
     * method to update a policy, including a condition `name` causes the
     * existing condition to be updated. Conditions without names are added to
     * the updated policy. Existing conditions are deleted if they are not
     * updated.
     * Best practice is to preserve `[CONDITION_ID]` if you make only small
     * changes, such as those to condition thresholds, durations, or trigger
     * values.  Otherwise, treat the change as a new condition and let the
     * existing condition be deleted.
     * </pre>
     *
     * <code>string name = 12;</code>
     */
    com.google.protobuf.ByteString getNameBytes();

    /**
     *
     *
     * <pre>
     * A short name or phrase used to identify the condition in dashboards,
     * notifications, and incidents. To avoid confusion, don't use the same
     * display name for multiple conditions in the same policy.
     * </pre>
     *
     * <code>string display_name = 6;</code>
     */
    java.lang.String getDisplayName();
    /**
     *
     *
     * <pre>
     * A short name or phrase used to identify the condition in dashboards,
     * notifications, and incidents. To avoid confusion, don't use the same
     * display name for multiple conditions in the same policy.
     * </pre>
     *
     * <code>string display_name = 6;</code>
     */
    com.google.protobuf.ByteString getDisplayNameBytes();

    /**
     *
     *
     * <pre>
     * A condition that compares a time series against a threshold.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;
     * </code>
     */
    boolean hasConditionThreshold();
    /**
     *
     *
     * <pre>
     * A condition that compares a time series against a threshold.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;
     * </code>
     */
    com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold getConditionThreshold();
    /**
     *
     *
     * <pre>
     * A condition that compares a time series against a threshold.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;
     * </code>
     */
    com.google.monitoring.v3.AlertPolicy.Condition.MetricThresholdOrBuilder
        getConditionThresholdOrBuilder();

    /**
     *
     *
     * <pre>
     * A condition that checks that a time series continues to
     * receive new data points.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;</code>
     */
    boolean hasConditionAbsent();
    /**
     *
     *
     * <pre>
     * A condition that checks that a time series continues to
     * receive new data points.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;</code>
     */
    com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence getConditionAbsent();
    /**
     *
     *
     * <pre>
     * A condition that checks that a time series continues to
     * receive new data points.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;</code>
     */
    com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsenceOrBuilder
        getConditionAbsentOrBuilder();

    public com.google.monitoring.v3.AlertPolicy.Condition.ConditionCase getConditionCase();
  }
  /**
   *
   *
   * <pre>
   * A condition is a true/false test that determines when an alerting policy
   * should open an incident. If a condition evaluates to true, it signifies
   * that something is wrong.
   * </pre>
   *
   * Protobuf type {@code google.monitoring.v3.AlertPolicy.Condition}
   */
  public static final class Condition extends com.google.protobuf.GeneratedMessageV3
      implements
      // @@protoc_insertion_point(message_implements:google.monitoring.v3.AlertPolicy.Condition)
      ConditionOrBuilder {
    private static final long serialVersionUID = 0L;
    // Use Condition.newBuilder() to construct.
    private Condition(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }

    private Condition() {
      name_ = "";
      displayName_ = "";
    }

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

    private Condition(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      this();
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.Builder subBuilder =
                    null;
                if (conditionCase_ == 1) {
                  subBuilder =
                      ((com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold) condition_)
                          .toBuilder();
                }
                condition_ =
                    input.readMessage(
                        com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.parser(),
                        extensionRegistry);
                if (subBuilder != null) {
                  subBuilder.mergeFrom(
                      (com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold) condition_);
                  condition_ = subBuilder.buildPartial();
                }
                conditionCase_ = 1;
                break;
              }
            case 18:
              {
                com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.Builder subBuilder =
                    null;
                if (conditionCase_ == 2) {
                  subBuilder =
                      ((com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence) condition_)
                          .toBuilder();
                }
                condition_ =
                    input.readMessage(
                        com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.parser(),
                        extensionRegistry);
                if (subBuilder != null) {
                  subBuilder.mergeFrom(
                      (com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence) condition_);
                  condition_ = subBuilder.buildPartial();
                }
                conditionCase_ = 2;
                break;
              }
            case 50:
              {
                java.lang.String s = input.readStringRequireUtf8();

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

                name_ = s;
                break;
              }
            default:
              {
                if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) {
                  done = true;
                }
                break;
              }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
      } finally {
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }

    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.monitoring.v3.AlertProto
          .internal_static_google_monitoring_v3_AlertPolicy_Condition_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.monitoring.v3.AlertProto
          .internal_static_google_monitoring_v3_AlertPolicy_Condition_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.monitoring.v3.AlertPolicy.Condition.class,
              com.google.monitoring.v3.AlertPolicy.Condition.Builder.class);
    }

    public interface TriggerOrBuilder
        extends
        // @@protoc_insertion_point(interface_extends:google.monitoring.v3.AlertPolicy.Condition.Trigger)
        com.google.protobuf.MessageOrBuilder {

      /**
       *
       *
       * <pre>
       * The absolute number of time series that must fail
       * the predicate for the condition to be triggered.
       * </pre>
       *
       * <code>int32 count = 1;</code>
       */
      int getCount();

      /**
       *
       *
       * <pre>
       * The percentage of time series that must fail the
       * predicate for the condition to be triggered.
       * </pre>
       *
       * <code>double percent = 2;</code>
       */
      double getPercent();

      public com.google.monitoring.v3.AlertPolicy.Condition.Trigger.TypeCase getTypeCase();
    }
    /**
     *
     *
     * <pre>
     * Specifies how many time series must fail a predicate to trigger a
     * condition. If not specified, then a `{count: 1}` trigger is used.
     * </pre>
     *
     * Protobuf type {@code google.monitoring.v3.AlertPolicy.Condition.Trigger}
     */
    public static final class Trigger extends com.google.protobuf.GeneratedMessageV3
        implements
        // @@protoc_insertion_point(message_implements:google.monitoring.v3.AlertPolicy.Condition.Trigger)
        TriggerOrBuilder {
      private static final long serialVersionUID = 0L;
      // Use Trigger.newBuilder() to construct.
      private Trigger(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
        super(builder);
      }

      private Trigger() {}

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

      private Trigger(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        this();
        if (extensionRegistry == null) {
          throw new java.lang.NullPointerException();
        }
        int mutable_bitField0_ = 0;
        com.google.protobuf.UnknownFieldSet.Builder unknownFields =
            com.google.protobuf.UnknownFieldSet.newBuilder();
        try {
          boolean done = false;
          while (!done) {
            int tag = input.readTag();
            switch (tag) {
              case 0:
                done = true;
                break;
              case 8:
                {
                  typeCase_ = 1;
                  type_ = input.readInt32();
                  break;
                }
              case 17:
                {
                  typeCase_ = 2;
                  type_ = input.readDouble();
                  break;
                }
              default:
                {
                  if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) {
                    done = true;
                  }
                  break;
                }
            }
          }
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.setUnfinishedMessage(this);
        } catch (java.io.IOException e) {
          throw new com.google.protobuf.InvalidProtocolBufferException(e)
              .setUnfinishedMessage(this);
        } finally {
          this.unknownFields = unknownFields.build();
          makeExtensionsImmutable();
        }
      }

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.monitoring.v3.AlertProto
            .internal_static_google_monitoring_v3_AlertPolicy_Condition_Trigger_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.monitoring.v3.AlertProto
            .internal_static_google_monitoring_v3_AlertPolicy_Condition_Trigger_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.monitoring.v3.AlertPolicy.Condition.Trigger.class,
                com.google.monitoring.v3.AlertPolicy.Condition.Trigger.Builder.class);
      }

      private int typeCase_ = 0;
      private java.lang.Object type_;

      public enum TypeCase implements com.google.protobuf.Internal.EnumLite {
        COUNT(1),
        PERCENT(2),
        TYPE_NOT_SET(0);
        private final int value;

        private TypeCase(int value) {
          this.value = value;
        }
        /** @deprecated Use {@link #forNumber(int)} instead. */
        @java.lang.Deprecated
        public static TypeCase valueOf(int value) {
          return forNumber(value);
        }

        public static TypeCase forNumber(int value) {
          switch (value) {
            case 1:
              return COUNT;
            case 2:
              return PERCENT;
            case 0:
              return TYPE_NOT_SET;
            default:
              return null;
          }
        }

        public int getNumber() {
          return this.value;
        }
      };

      public TypeCase getTypeCase() {
        return TypeCase.forNumber(typeCase_);
      }

      public static final int COUNT_FIELD_NUMBER = 1;
      /**
       *
       *
       * <pre>
       * The absolute number of time series that must fail
       * the predicate for the condition to be triggered.
       * </pre>
       *
       * <code>int32 count = 1;</code>
       */
      public int getCount() {
        if (typeCase_ == 1) {
          return (java.lang.Integer) type_;
        }
        return 0;
      }

      public static final int PERCENT_FIELD_NUMBER = 2;
      /**
       *
       *
       * <pre>
       * The percentage of time series that must fail the
       * predicate for the condition to be triggered.
       * </pre>
       *
       * <code>double percent = 2;</code>
       */
      public double getPercent() {
        if (typeCase_ == 2) {
          return (java.lang.Double) type_;
        }
        return 0D;
      }

      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 (typeCase_ == 1) {
          output.writeInt32(1, (int) ((java.lang.Integer) type_));
        }
        if (typeCase_ == 2) {
          output.writeDouble(2, (double) ((java.lang.Double) type_));
        }
        unknownFields.writeTo(output);
      }

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

        size = 0;
        if (typeCase_ == 1) {
          size +=
              com.google.protobuf.CodedOutputStream.computeInt32Size(
                  1, (int) ((java.lang.Integer) type_));
        }
        if (typeCase_ == 2) {
          size +=
              com.google.protobuf.CodedOutputStream.computeDoubleSize(
                  2, (double) ((java.lang.Double) type_));
        }
        size += unknownFields.getSerializedSize();
        memoizedSize = size;
        return size;
      }

      @java.lang.Override
      public boolean equals(final java.lang.Object obj) {
        if (obj == this) {
          return true;
        }
        if (!(obj instanceof com.google.monitoring.v3.AlertPolicy.Condition.Trigger)) {
          return super.equals(obj);
        }
        com.google.monitoring.v3.AlertPolicy.Condition.Trigger other =
            (com.google.monitoring.v3.AlertPolicy.Condition.Trigger) obj;

        boolean result = true;
        result = result && getTypeCase().equals(other.getTypeCase());
        if (!result) return false;
        switch (typeCase_) {
          case 1:
            result = result && (getCount() == other.getCount());
            break;
          case 2:
            result =
                result
                    && (java.lang.Double.doubleToLongBits(getPercent())
                        == java.lang.Double.doubleToLongBits(other.getPercent()));
            break;
          case 0:
          default:
        }
        result = result && unknownFields.equals(other.unknownFields);
        return result;
      }

      @java.lang.Override
      public int hashCode() {
        if (memoizedHashCode != 0) {
          return memoizedHashCode;
        }
        int hash = 41;
        hash = (19 * hash) + getDescriptor().hashCode();
        switch (typeCase_) {
          case 1:
            hash = (37 * hash) + COUNT_FIELD_NUMBER;
            hash = (53 * hash) + getCount();
            break;
          case 2:
            hash = (37 * hash) + PERCENT_FIELD_NUMBER;
            hash =
                (53 * hash)
                    + com.google.protobuf.Internal.hashLong(
                        java.lang.Double.doubleToLongBits(getPercent()));
            break;
          case 0:
          default:
        }
        hash = (29 * hash) + unknownFields.hashCode();
        memoizedHashCode = hash;
        return hash;
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.Trigger parseFrom(
          java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.Trigger parseFrom(
          java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.Trigger parseFrom(
          com.google.protobuf.ByteString data)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.Trigger 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.monitoring.v3.AlertPolicy.Condition.Trigger parseFrom(byte[] data)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.Trigger parseFrom(
          byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.Trigger parseFrom(
          java.io.InputStream input) throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.Trigger 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.monitoring.v3.AlertPolicy.Condition.Trigger parseDelimitedFrom(
          java.io.InputStream input) throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.Trigger 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.monitoring.v3.AlertPolicy.Condition.Trigger parseFrom(
          com.google.protobuf.CodedInputStream input) throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.Trigger 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.monitoring.v3.AlertPolicy.Condition.Trigger 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>
       * Specifies how many time series must fail a predicate to trigger a
       * condition. If not specified, then a `{count: 1}` trigger is used.
       * </pre>
       *
       * Protobuf type {@code google.monitoring.v3.AlertPolicy.Condition.Trigger}
       */
      public static final class Builder
          extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
          implements
          // @@protoc_insertion_point(builder_implements:google.monitoring.v3.AlertPolicy.Condition.Trigger)
          com.google.monitoring.v3.AlertPolicy.Condition.TriggerOrBuilder {
        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
          return com.google.monitoring.v3.AlertProto
              .internal_static_google_monitoring_v3_AlertPolicy_Condition_Trigger_descriptor;
        }

        @java.lang.Override
        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
            internalGetFieldAccessorTable() {
          return com.google.monitoring.v3.AlertProto
              .internal_static_google_monitoring_v3_AlertPolicy_Condition_Trigger_fieldAccessorTable
              .ensureFieldAccessorsInitialized(
                  com.google.monitoring.v3.AlertPolicy.Condition.Trigger.class,
                  com.google.monitoring.v3.AlertPolicy.Condition.Trigger.Builder.class);
        }

        // Construct using com.google.monitoring.v3.AlertPolicy.Condition.Trigger.newBuilder()
        private Builder() {
          maybeForceBuilderInitialization();
        }

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

        private void maybeForceBuilderInitialization() {
          if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
        }

        @java.lang.Override
        public Builder clear() {
          super.clear();
          typeCase_ = 0;
          type_ = null;
          return this;
        }

        @java.lang.Override
        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
          return com.google.monitoring.v3.AlertProto
              .internal_static_google_monitoring_v3_AlertPolicy_Condition_Trigger_descriptor;
        }

        @java.lang.Override
        public com.google.monitoring.v3.AlertPolicy.Condition.Trigger getDefaultInstanceForType() {
          return com.google.monitoring.v3.AlertPolicy.Condition.Trigger.getDefaultInstance();
        }

        @java.lang.Override
        public com.google.monitoring.v3.AlertPolicy.Condition.Trigger build() {
          com.google.monitoring.v3.AlertPolicy.Condition.Trigger result = buildPartial();
          if (!result.isInitialized()) {
            throw newUninitializedMessageException(result);
          }
          return result;
        }

        @java.lang.Override
        public com.google.monitoring.v3.AlertPolicy.Condition.Trigger buildPartial() {
          com.google.monitoring.v3.AlertPolicy.Condition.Trigger result =
              new com.google.monitoring.v3.AlertPolicy.Condition.Trigger(this);
          if (typeCase_ == 1) {
            result.type_ = type_;
          }
          if (typeCase_ == 2) {
            result.type_ = type_;
          }
          result.typeCase_ = typeCase_;
          onBuilt();
          return result;
        }

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

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

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

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

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

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

        @java.lang.Override
        public Builder mergeFrom(com.google.protobuf.Message other) {
          if (other instanceof com.google.monitoring.v3.AlertPolicy.Condition.Trigger) {
            return mergeFrom((com.google.monitoring.v3.AlertPolicy.Condition.Trigger) other);
          } else {
            super.mergeFrom(other);
            return this;
          }
        }

        public Builder mergeFrom(com.google.monitoring.v3.AlertPolicy.Condition.Trigger other) {
          if (other == com.google.monitoring.v3.AlertPolicy.Condition.Trigger.getDefaultInstance())
            return this;
          switch (other.getTypeCase()) {
            case COUNT:
              {
                setCount(other.getCount());
                break;
              }
            case PERCENT:
              {
                setPercent(other.getPercent());
                break;
              }
            case TYPE_NOT_SET:
              {
                break;
              }
          }
          this.mergeUnknownFields(other.unknownFields);
          onChanged();
          return this;
        }

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

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

        private int typeCase_ = 0;
        private java.lang.Object type_;

        public TypeCase getTypeCase() {
          return TypeCase.forNumber(typeCase_);
        }

        public Builder clearType() {
          typeCase_ = 0;
          type_ = null;
          onChanged();
          return this;
        }

        /**
         *
         *
         * <pre>
         * The absolute number of time series that must fail
         * the predicate for the condition to be triggered.
         * </pre>
         *
         * <code>int32 count = 1;</code>
         */
        public int getCount() {
          if (typeCase_ == 1) {
            return (java.lang.Integer) type_;
          }
          return 0;
        }
        /**
         *
         *
         * <pre>
         * The absolute number of time series that must fail
         * the predicate for the condition to be triggered.
         * </pre>
         *
         * <code>int32 count = 1;</code>
         */
        public Builder setCount(int value) {
          typeCase_ = 1;
          type_ = value;
          onChanged();
          return this;
        }
        /**
         *
         *
         * <pre>
         * The absolute number of time series that must fail
         * the predicate for the condition to be triggered.
         * </pre>
         *
         * <code>int32 count = 1;</code>
         */
        public Builder clearCount() {
          if (typeCase_ == 1) {
            typeCase_ = 0;
            type_ = null;
            onChanged();
          }
          return this;
        }

        /**
         *
         *
         * <pre>
         * The percentage of time series that must fail the
         * predicate for the condition to be triggered.
         * </pre>
         *
         * <code>double percent = 2;</code>
         */
        public double getPercent() {
          if (typeCase_ == 2) {
            return (java.lang.Double) type_;
          }
          return 0D;
        }
        /**
         *
         *
         * <pre>
         * The percentage of time series that must fail the
         * predicate for the condition to be triggered.
         * </pre>
         *
         * <code>double percent = 2;</code>
         */
        public Builder setPercent(double value) {
          typeCase_ = 2;
          type_ = value;
          onChanged();
          return this;
        }
        /**
         *
         *
         * <pre>
         * The percentage of time series that must fail the
         * predicate for the condition to be triggered.
         * </pre>
         *
         * <code>double percent = 2;</code>
         */
        public Builder clearPercent() {
          if (typeCase_ == 2) {
            typeCase_ = 0;
            type_ = null;
            onChanged();
          }
          return this;
        }

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

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

        // @@protoc_insertion_point(builder_scope:google.monitoring.v3.AlertPolicy.Condition.Trigger)
      }

      // @@protoc_insertion_point(class_scope:google.monitoring.v3.AlertPolicy.Condition.Trigger)
      private static final com.google.monitoring.v3.AlertPolicy.Condition.Trigger DEFAULT_INSTANCE;

      static {
        DEFAULT_INSTANCE = new com.google.monitoring.v3.AlertPolicy.Condition.Trigger();
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.Trigger getDefaultInstance() {
        return DEFAULT_INSTANCE;
      }

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

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

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

      @java.lang.Override
      public com.google.monitoring.v3.AlertPolicy.Condition.Trigger getDefaultInstanceForType() {
        return DEFAULT_INSTANCE;
      }
    }

    public interface MetricThresholdOrBuilder
        extends
        // @@protoc_insertion_point(interface_extends:google.monitoring.v3.AlertPolicy.Condition.MetricThreshold)
        com.google.protobuf.MessageOrBuilder {

      /**
       *
       *
       * <pre>
       * A [filter](/monitoring/api/v3/filters) that
       * identifies which time series should be compared with the threshold.
       * The filter is similar to the one that is specified in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
       * call is useful to verify the time series that will be retrieved /
       * processed) and must specify the metric type and optionally may contain
       * restrictions on resource type, resource labels, and metric labels.
       * This field may not exceed 2048 Unicode characters in length.
       * </pre>
       *
       * <code>string filter = 2;</code>
       */
      java.lang.String getFilter();
      /**
       *
       *
       * <pre>
       * A [filter](/monitoring/api/v3/filters) that
       * identifies which time series should be compared with the threshold.
       * The filter is similar to the one that is specified in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
       * call is useful to verify the time series that will be retrieved /
       * processed) and must specify the metric type and optionally may contain
       * restrictions on resource type, resource labels, and metric labels.
       * This field may not exceed 2048 Unicode characters in length.
       * </pre>
       *
       * <code>string filter = 2;</code>
       */
      com.google.protobuf.ByteString getFilterBytes();

      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
       */
      java.util.List<com.google.monitoring.v3.Aggregation> getAggregationsList();
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
       */
      com.google.monitoring.v3.Aggregation getAggregations(int index);
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
       */
      int getAggregationsCount();
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
       */
      java.util.List<? extends com.google.monitoring.v3.AggregationOrBuilder>
          getAggregationsOrBuilderList();
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
       */
      com.google.monitoring.v3.AggregationOrBuilder getAggregationsOrBuilder(int index);

      /**
       *
       *
       * <pre>
       * A [filter](/monitoring/api/v3/filters) that identifies a time
       * series that should be used as the denominator of a ratio that will be
       * compared with the threshold. If a `denominator_filter` is specified,
       * the time series specified by the `filter` field will be used as the
       * numerator.
       * The filter is similar to the one that is specified in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
       * call is useful to verify the time series that will be retrieved /
       * processed) and must specify the metric type and optionally may contain
       * restrictions on resource type, resource labels, and metric labels.
       * This field may not exceed 2048 Unicode characters in length.
       * </pre>
       *
       * <code>string denominator_filter = 9;</code>
       */
      java.lang.String getDenominatorFilter();
      /**
       *
       *
       * <pre>
       * A [filter](/monitoring/api/v3/filters) that identifies a time
       * series that should be used as the denominator of a ratio that will be
       * compared with the threshold. If a `denominator_filter` is specified,
       * the time series specified by the `filter` field will be used as the
       * numerator.
       * The filter is similar to the one that is specified in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
       * call is useful to verify the time series that will be retrieved /
       * processed) and must specify the metric type and optionally may contain
       * restrictions on resource type, resource labels, and metric labels.
       * This field may not exceed 2048 Unicode characters in length.
       * </pre>
       *
       * <code>string denominator_filter = 9;</code>
       */
      com.google.protobuf.ByteString getDenominatorFilterBytes();

      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series
       * selected by `denominatorFilter` as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resources).
       * When computing ratios, the `aggregations` and
       * `denominator_aggregations` fields must use the same alignment period
       * and produce time series that have the same periodicity and labels.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
       * is advisable to use the `ListTimeSeries` method when debugging this
       * field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
       */
      java.util.List<com.google.monitoring.v3.Aggregation> getDenominatorAggregationsList();
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series
       * selected by `denominatorFilter` as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resources).
       * When computing ratios, the `aggregations` and
       * `denominator_aggregations` fields must use the same alignment period
       * and produce time series that have the same periodicity and labels.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
       * is advisable to use the `ListTimeSeries` method when debugging this
       * field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
       */
      com.google.monitoring.v3.Aggregation getDenominatorAggregations(int index);
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series
       * selected by `denominatorFilter` as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resources).
       * When computing ratios, the `aggregations` and
       * `denominator_aggregations` fields must use the same alignment period
       * and produce time series that have the same periodicity and labels.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
       * is advisable to use the `ListTimeSeries` method when debugging this
       * field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
       */
      int getDenominatorAggregationsCount();
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series
       * selected by `denominatorFilter` as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resources).
       * When computing ratios, the `aggregations` and
       * `denominator_aggregations` fields must use the same alignment period
       * and produce time series that have the same periodicity and labels.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
       * is advisable to use the `ListTimeSeries` method when debugging this
       * field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
       */
      java.util.List<? extends com.google.monitoring.v3.AggregationOrBuilder>
          getDenominatorAggregationsOrBuilderList();
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series
       * selected by `denominatorFilter` as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resources).
       * When computing ratios, the `aggregations` and
       * `denominator_aggregations` fields must use the same alignment period
       * and produce time series that have the same periodicity and labels.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
       * is advisable to use the `ListTimeSeries` method when debugging this
       * field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
       */
      com.google.monitoring.v3.AggregationOrBuilder getDenominatorAggregationsOrBuilder(int index);

      /**
       *
       *
       * <pre>
       * The comparison to apply between the time series (indicated by `filter`
       * and `aggregation`) and the threshold (indicated by `threshold_value`).
       * The comparison is applied on each time series, with the time series
       * on the left-hand side and the threshold on the right-hand side.
       * Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
       * </pre>
       *
       * <code>.google.monitoring.v3.ComparisonType comparison = 4;</code>
       */
      int getComparisonValue();
      /**
       *
       *
       * <pre>
       * The comparison to apply between the time series (indicated by `filter`
       * and `aggregation`) and the threshold (indicated by `threshold_value`).
       * The comparison is applied on each time series, with the time series
       * on the left-hand side and the threshold on the right-hand side.
       * Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
       * </pre>
       *
       * <code>.google.monitoring.v3.ComparisonType comparison = 4;</code>
       */
      com.google.monitoring.v3.ComparisonType getComparison();

      /**
       *
       *
       * <pre>
       * A value against which to compare the time series.
       * </pre>
       *
       * <code>double threshold_value = 5;</code>
       */
      double getThresholdValue();

      /**
       *
       *
       * <pre>
       * The amount of time that a time series must violate the
       * threshold to be considered failing. Currently, only values
       * that are a multiple of a minute--e.g., 0, 60, 120, or 300
       * seconds--are supported. If an invalid value is given, an
       * error will be returned. When choosing a duration, it is useful to
       * keep in mind the frequency of the underlying time series data
       * (which may also be affected by any alignments specified in the
       * `aggregations` field); a good duration is long enough so that a single
       * outlier does not generate spurious alerts, but short enough that
       * unhealthy states are detected and alerted on quickly.
       * </pre>
       *
       * <code>.google.protobuf.Duration duration = 6;</code>
       */
      boolean hasDuration();
      /**
       *
       *
       * <pre>
       * The amount of time that a time series must violate the
       * threshold to be considered failing. Currently, only values
       * that are a multiple of a minute--e.g., 0, 60, 120, or 300
       * seconds--are supported. If an invalid value is given, an
       * error will be returned. When choosing a duration, it is useful to
       * keep in mind the frequency of the underlying time series data
       * (which may also be affected by any alignments specified in the
       * `aggregations` field); a good duration is long enough so that a single
       * outlier does not generate spurious alerts, but short enough that
       * unhealthy states are detected and alerted on quickly.
       * </pre>
       *
       * <code>.google.protobuf.Duration duration = 6;</code>
       */
      com.google.protobuf.Duration getDuration();
      /**
       *
       *
       * <pre>
       * The amount of time that a time series must violate the
       * threshold to be considered failing. Currently, only values
       * that are a multiple of a minute--e.g., 0, 60, 120, or 300
       * seconds--are supported. If an invalid value is given, an
       * error will be returned. When choosing a duration, it is useful to
       * keep in mind the frequency of the underlying time series data
       * (which may also be affected by any alignments specified in the
       * `aggregations` field); a good duration is long enough so that a single
       * outlier does not generate spurious alerts, but short enough that
       * unhealthy states are detected and alerted on quickly.
       * </pre>
       *
       * <code>.google.protobuf.Duration duration = 6;</code>
       */
      com.google.protobuf.DurationOrBuilder getDurationOrBuilder();

      /**
       *
       *
       * <pre>
       * The number/percent of time series for which the comparison must hold
       * in order for the condition to trigger. If unspecified, then the
       * condition will trigger if the comparison is true for any of the
       * time series that have been identified by `filter` and `aggregations`,
       * or by the ratio, if `denominator_filter` and `denominator_aggregations`
       * are specified.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7;</code>
       */
      boolean hasTrigger();
      /**
       *
       *
       * <pre>
       * The number/percent of time series for which the comparison must hold
       * in order for the condition to trigger. If unspecified, then the
       * condition will trigger if the comparison is true for any of the
       * time series that have been identified by `filter` and `aggregations`,
       * or by the ratio, if `denominator_filter` and `denominator_aggregations`
       * are specified.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7;</code>
       */
      com.google.monitoring.v3.AlertPolicy.Condition.Trigger getTrigger();
      /**
       *
       *
       * <pre>
       * The number/percent of time series for which the comparison must hold
       * in order for the condition to trigger. If unspecified, then the
       * condition will trigger if the comparison is true for any of the
       * time series that have been identified by `filter` and `aggregations`,
       * or by the ratio, if `denominator_filter` and `denominator_aggregations`
       * are specified.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7;</code>
       */
      com.google.monitoring.v3.AlertPolicy.Condition.TriggerOrBuilder getTriggerOrBuilder();
    }
    /**
     *
     *
     * <pre>
     * A condition type that compares a collection of time series
     * against a threshold.
     * </pre>
     *
     * Protobuf type {@code google.monitoring.v3.AlertPolicy.Condition.MetricThreshold}
     */
    public static final class MetricThreshold extends com.google.protobuf.GeneratedMessageV3
        implements
        // @@protoc_insertion_point(message_implements:google.monitoring.v3.AlertPolicy.Condition.MetricThreshold)
        MetricThresholdOrBuilder {
      private static final long serialVersionUID = 0L;
      // Use MetricThreshold.newBuilder() to construct.
      private MetricThreshold(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
        super(builder);
      }

      private MetricThreshold() {
        filter_ = "";
        aggregations_ = java.util.Collections.emptyList();
        denominatorFilter_ = "";
        denominatorAggregations_ = java.util.Collections.emptyList();
        comparison_ = 0;
        thresholdValue_ = 0D;
      }

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

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

                  filter_ = s;
                  break;
                }
              case 32:
                {
                  int rawValue = input.readEnum();

                  comparison_ = rawValue;
                  break;
                }
              case 41:
                {
                  thresholdValue_ = input.readDouble();
                  break;
                }
              case 50:
                {
                  com.google.protobuf.Duration.Builder subBuilder = null;
                  if (duration_ != null) {
                    subBuilder = duration_.toBuilder();
                  }
                  duration_ =
                      input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry);
                  if (subBuilder != null) {
                    subBuilder.mergeFrom(duration_);
                    duration_ = subBuilder.buildPartial();
                  }

                  break;
                }
              case 58:
                {
                  com.google.monitoring.v3.AlertPolicy.Condition.Trigger.Builder subBuilder = null;
                  if (trigger_ != null) {
                    subBuilder = trigger_.toBuilder();
                  }
                  trigger_ =
                      input.readMessage(
                          com.google.monitoring.v3.AlertPolicy.Condition.Trigger.parser(),
                          extensionRegistry);
                  if (subBuilder != null) {
                    subBuilder.mergeFrom(trigger_);
                    trigger_ = subBuilder.buildPartial();
                  }

                  break;
                }
              case 66:
                {
                  if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
                    aggregations_ = new java.util.ArrayList<com.google.monitoring.v3.Aggregation>();
                    mutable_bitField0_ |= 0x00000002;
                  }
                  aggregations_.add(
                      input.readMessage(
                          com.google.monitoring.v3.Aggregation.parser(), extensionRegistry));
                  break;
                }
              case 74:
                {
                  java.lang.String s = input.readStringRequireUtf8();

                  denominatorFilter_ = s;
                  break;
                }
              case 82:
                {
                  if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
                    denominatorAggregations_ =
                        new java.util.ArrayList<com.google.monitoring.v3.Aggregation>();
                    mutable_bitField0_ |= 0x00000008;
                  }
                  denominatorAggregations_.add(
                      input.readMessage(
                          com.google.monitoring.v3.Aggregation.parser(), extensionRegistry));
                  break;
                }
              default:
                {
                  if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) {
                    done = true;
                  }
                  break;
                }
            }
          }
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.setUnfinishedMessage(this);
        } catch (java.io.IOException e) {
          throw new com.google.protobuf.InvalidProtocolBufferException(e)
              .setUnfinishedMessage(this);
        } finally {
          if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
            aggregations_ = java.util.Collections.unmodifiableList(aggregations_);
          }
          if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
            denominatorAggregations_ =
                java.util.Collections.unmodifiableList(denominatorAggregations_);
          }
          this.unknownFields = unknownFields.build();
          makeExtensionsImmutable();
        }
      }

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.monitoring.v3.AlertProto
            .internal_static_google_monitoring_v3_AlertPolicy_Condition_MetricThreshold_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.monitoring.v3.AlertProto
            .internal_static_google_monitoring_v3_AlertPolicy_Condition_MetricThreshold_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.class,
                com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.Builder.class);
      }

      private int bitField0_;
      public static final int FILTER_FIELD_NUMBER = 2;
      private volatile java.lang.Object filter_;
      /**
       *
       *
       * <pre>
       * A [filter](/monitoring/api/v3/filters) that
       * identifies which time series should be compared with the threshold.
       * The filter is similar to the one that is specified in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
       * call is useful to verify the time series that will be retrieved /
       * processed) and must specify the metric type and optionally may contain
       * restrictions on resource type, resource labels, and metric labels.
       * This field may not exceed 2048 Unicode characters in length.
       * </pre>
       *
       * <code>string filter = 2;</code>
       */
      public java.lang.String getFilter() {
        java.lang.Object ref = filter_;
        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();
          filter_ = s;
          return s;
        }
      }
      /**
       *
       *
       * <pre>
       * A [filter](/monitoring/api/v3/filters) that
       * identifies which time series should be compared with the threshold.
       * The filter is similar to the one that is specified in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
       * call is useful to verify the time series that will be retrieved /
       * processed) and must specify the metric type and optionally may contain
       * restrictions on resource type, resource labels, and metric labels.
       * This field may not exceed 2048 Unicode characters in length.
       * </pre>
       *
       * <code>string filter = 2;</code>
       */
      public com.google.protobuf.ByteString getFilterBytes() {
        java.lang.Object ref = filter_;
        if (ref instanceof java.lang.String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          filter_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }

      public static final int AGGREGATIONS_FIELD_NUMBER = 8;
      private java.util.List<com.google.monitoring.v3.Aggregation> aggregations_;
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
       */
      public java.util.List<com.google.monitoring.v3.Aggregation> getAggregationsList() {
        return aggregations_;
      }
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
       */
      public java.util.List<? extends com.google.monitoring.v3.AggregationOrBuilder>
          getAggregationsOrBuilderList() {
        return aggregations_;
      }
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
       */
      public int getAggregationsCount() {
        return aggregations_.size();
      }
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
       */
      public com.google.monitoring.v3.Aggregation getAggregations(int index) {
        return aggregations_.get(index);
      }
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
       */
      public com.google.monitoring.v3.AggregationOrBuilder getAggregationsOrBuilder(int index) {
        return aggregations_.get(index);
      }

      public static final int DENOMINATOR_FILTER_FIELD_NUMBER = 9;
      private volatile java.lang.Object denominatorFilter_;
      /**
       *
       *
       * <pre>
       * A [filter](/monitoring/api/v3/filters) that identifies a time
       * series that should be used as the denominator of a ratio that will be
       * compared with the threshold. If a `denominator_filter` is specified,
       * the time series specified by the `filter` field will be used as the
       * numerator.
       * The filter is similar to the one that is specified in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
       * call is useful to verify the time series that will be retrieved /
       * processed) and must specify the metric type and optionally may contain
       * restrictions on resource type, resource labels, and metric labels.
       * This field may not exceed 2048 Unicode characters in length.
       * </pre>
       *
       * <code>string denominator_filter = 9;</code>
       */
      public java.lang.String getDenominatorFilter() {
        java.lang.Object ref = denominatorFilter_;
        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();
          denominatorFilter_ = s;
          return s;
        }
      }
      /**
       *
       *
       * <pre>
       * A [filter](/monitoring/api/v3/filters) that identifies a time
       * series that should be used as the denominator of a ratio that will be
       * compared with the threshold. If a `denominator_filter` is specified,
       * the time series specified by the `filter` field will be used as the
       * numerator.
       * The filter is similar to the one that is specified in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
       * call is useful to verify the time series that will be retrieved /
       * processed) and must specify the metric type and optionally may contain
       * restrictions on resource type, resource labels, and metric labels.
       * This field may not exceed 2048 Unicode characters in length.
       * </pre>
       *
       * <code>string denominator_filter = 9;</code>
       */
      public com.google.protobuf.ByteString getDenominatorFilterBytes() {
        java.lang.Object ref = denominatorFilter_;
        if (ref instanceof java.lang.String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          denominatorFilter_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }

      public static final int DENOMINATOR_AGGREGATIONS_FIELD_NUMBER = 10;
      private java.util.List<com.google.monitoring.v3.Aggregation> denominatorAggregations_;
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series
       * selected by `denominatorFilter` as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resources).
       * When computing ratios, the `aggregations` and
       * `denominator_aggregations` fields must use the same alignment period
       * and produce time series that have the same periodicity and labels.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
       * is advisable to use the `ListTimeSeries` method when debugging this
       * field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
       */
      public java.util.List<com.google.monitoring.v3.Aggregation> getDenominatorAggregationsList() {
        return denominatorAggregations_;
      }
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series
       * selected by `denominatorFilter` as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resources).
       * When computing ratios, the `aggregations` and
       * `denominator_aggregations` fields must use the same alignment period
       * and produce time series that have the same periodicity and labels.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
       * is advisable to use the `ListTimeSeries` method when debugging this
       * field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
       */
      public java.util.List<? extends com.google.monitoring.v3.AggregationOrBuilder>
          getDenominatorAggregationsOrBuilderList() {
        return denominatorAggregations_;
      }
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series
       * selected by `denominatorFilter` as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resources).
       * When computing ratios, the `aggregations` and
       * `denominator_aggregations` fields must use the same alignment period
       * and produce time series that have the same periodicity and labels.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
       * is advisable to use the `ListTimeSeries` method when debugging this
       * field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
       */
      public int getDenominatorAggregationsCount() {
        return denominatorAggregations_.size();
      }
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series
       * selected by `denominatorFilter` as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resources).
       * When computing ratios, the `aggregations` and
       * `denominator_aggregations` fields must use the same alignment period
       * and produce time series that have the same periodicity and labels.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
       * is advisable to use the `ListTimeSeries` method when debugging this
       * field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
       */
      public com.google.monitoring.v3.Aggregation getDenominatorAggregations(int index) {
        return denominatorAggregations_.get(index);
      }
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series
       * selected by `denominatorFilter` as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resources).
       * When computing ratios, the `aggregations` and
       * `denominator_aggregations` fields must use the same alignment period
       * and produce time series that have the same periodicity and labels.
       * This field is similar to the one in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
       * is advisable to use the `ListTimeSeries` method when debugging this
       * field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
       */
      public com.google.monitoring.v3.AggregationOrBuilder getDenominatorAggregationsOrBuilder(
          int index) {
        return denominatorAggregations_.get(index);
      }

      public static final int COMPARISON_FIELD_NUMBER = 4;
      private int comparison_;
      /**
       *
       *
       * <pre>
       * The comparison to apply between the time series (indicated by `filter`
       * and `aggregation`) and the threshold (indicated by `threshold_value`).
       * The comparison is applied on each time series, with the time series
       * on the left-hand side and the threshold on the right-hand side.
       * Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
       * </pre>
       *
       * <code>.google.monitoring.v3.ComparisonType comparison = 4;</code>
       */
      public int getComparisonValue() {
        return comparison_;
      }
      /**
       *
       *
       * <pre>
       * The comparison to apply between the time series (indicated by `filter`
       * and `aggregation`) and the threshold (indicated by `threshold_value`).
       * The comparison is applied on each time series, with the time series
       * on the left-hand side and the threshold on the right-hand side.
       * Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
       * </pre>
       *
       * <code>.google.monitoring.v3.ComparisonType comparison = 4;</code>
       */
      public com.google.monitoring.v3.ComparisonType getComparison() {
        @SuppressWarnings("deprecation")
        com.google.monitoring.v3.ComparisonType result =
            com.google.monitoring.v3.ComparisonType.valueOf(comparison_);
        return result == null ? com.google.monitoring.v3.ComparisonType.UNRECOGNIZED : result;
      }

      public static final int THRESHOLD_VALUE_FIELD_NUMBER = 5;
      private double thresholdValue_;
      /**
       *
       *
       * <pre>
       * A value against which to compare the time series.
       * </pre>
       *
       * <code>double threshold_value = 5;</code>
       */
      public double getThresholdValue() {
        return thresholdValue_;
      }

      public static final int DURATION_FIELD_NUMBER = 6;
      private com.google.protobuf.Duration duration_;
      /**
       *
       *
       * <pre>
       * The amount of time that a time series must violate the
       * threshold to be considered failing. Currently, only values
       * that are a multiple of a minute--e.g., 0, 60, 120, or 300
       * seconds--are supported. If an invalid value is given, an
       * error will be returned. When choosing a duration, it is useful to
       * keep in mind the frequency of the underlying time series data
       * (which may also be affected by any alignments specified in the
       * `aggregations` field); a good duration is long enough so that a single
       * outlier does not generate spurious alerts, but short enough that
       * unhealthy states are detected and alerted on quickly.
       * </pre>
       *
       * <code>.google.protobuf.Duration duration = 6;</code>
       */
      public boolean hasDuration() {
        return duration_ != null;
      }
      /**
       *
       *
       * <pre>
       * The amount of time that a time series must violate the
       * threshold to be considered failing. Currently, only values
       * that are a multiple of a minute--e.g., 0, 60, 120, or 300
       * seconds--are supported. If an invalid value is given, an
       * error will be returned. When choosing a duration, it is useful to
       * keep in mind the frequency of the underlying time series data
       * (which may also be affected by any alignments specified in the
       * `aggregations` field); a good duration is long enough so that a single
       * outlier does not generate spurious alerts, but short enough that
       * unhealthy states are detected and alerted on quickly.
       * </pre>
       *
       * <code>.google.protobuf.Duration duration = 6;</code>
       */
      public com.google.protobuf.Duration getDuration() {
        return duration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : duration_;
      }
      /**
       *
       *
       * <pre>
       * The amount of time that a time series must violate the
       * threshold to be considered failing. Currently, only values
       * that are a multiple of a minute--e.g., 0, 60, 120, or 300
       * seconds--are supported. If an invalid value is given, an
       * error will be returned. When choosing a duration, it is useful to
       * keep in mind the frequency of the underlying time series data
       * (which may also be affected by any alignments specified in the
       * `aggregations` field); a good duration is long enough so that a single
       * outlier does not generate spurious alerts, but short enough that
       * unhealthy states are detected and alerted on quickly.
       * </pre>
       *
       * <code>.google.protobuf.Duration duration = 6;</code>
       */
      public com.google.protobuf.DurationOrBuilder getDurationOrBuilder() {
        return getDuration();
      }

      public static final int TRIGGER_FIELD_NUMBER = 7;
      private com.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger_;
      /**
       *
       *
       * <pre>
       * The number/percent of time series for which the comparison must hold
       * in order for the condition to trigger. If unspecified, then the
       * condition will trigger if the comparison is true for any of the
       * time series that have been identified by `filter` and `aggregations`,
       * or by the ratio, if `denominator_filter` and `denominator_aggregations`
       * are specified.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7;</code>
       */
      public boolean hasTrigger() {
        return trigger_ != null;
      }
      /**
       *
       *
       * <pre>
       * The number/percent of time series for which the comparison must hold
       * in order for the condition to trigger. If unspecified, then the
       * condition will trigger if the comparison is true for any of the
       * time series that have been identified by `filter` and `aggregations`,
       * or by the ratio, if `denominator_filter` and `denominator_aggregations`
       * are specified.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7;</code>
       */
      public com.google.monitoring.v3.AlertPolicy.Condition.Trigger getTrigger() {
        return trigger_ == null
            ? com.google.monitoring.v3.AlertPolicy.Condition.Trigger.getDefaultInstance()
            : trigger_;
      }
      /**
       *
       *
       * <pre>
       * The number/percent of time series for which the comparison must hold
       * in order for the condition to trigger. If unspecified, then the
       * condition will trigger if the comparison is true for any of the
       * time series that have been identified by `filter` and `aggregations`,
       * or by the ratio, if `denominator_filter` and `denominator_aggregations`
       * are specified.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7;</code>
       */
      public com.google.monitoring.v3.AlertPolicy.Condition.TriggerOrBuilder getTriggerOrBuilder() {
        return getTrigger();
      }

      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 (!getFilterBytes().isEmpty()) {
          com.google.protobuf.GeneratedMessageV3.writeString(output, 2, filter_);
        }
        if (comparison_
            != com.google.monitoring.v3.ComparisonType.COMPARISON_UNSPECIFIED.getNumber()) {
          output.writeEnum(4, comparison_);
        }
        if (thresholdValue_ != 0D) {
          output.writeDouble(5, thresholdValue_);
        }
        if (duration_ != null) {
          output.writeMessage(6, getDuration());
        }
        if (trigger_ != null) {
          output.writeMessage(7, getTrigger());
        }
        for (int i = 0; i < aggregations_.size(); i++) {
          output.writeMessage(8, aggregations_.get(i));
        }
        if (!getDenominatorFilterBytes().isEmpty()) {
          com.google.protobuf.GeneratedMessageV3.writeString(output, 9, denominatorFilter_);
        }
        for (int i = 0; i < denominatorAggregations_.size(); i++) {
          output.writeMessage(10, denominatorAggregations_.get(i));
        }
        unknownFields.writeTo(output);
      }

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

        size = 0;
        if (!getFilterBytes().isEmpty()) {
          size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, filter_);
        }
        if (comparison_
            != com.google.monitoring.v3.ComparisonType.COMPARISON_UNSPECIFIED.getNumber()) {
          size += com.google.protobuf.CodedOutputStream.computeEnumSize(4, comparison_);
        }
        if (thresholdValue_ != 0D) {
          size += com.google.protobuf.CodedOutputStream.computeDoubleSize(5, thresholdValue_);
        }
        if (duration_ != null) {
          size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getDuration());
        }
        if (trigger_ != null) {
          size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getTrigger());
        }
        for (int i = 0; i < aggregations_.size(); i++) {
          size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, aggregations_.get(i));
        }
        if (!getDenominatorFilterBytes().isEmpty()) {
          size += com.google.protobuf.GeneratedMessageV3.computeStringSize(9, denominatorFilter_);
        }
        for (int i = 0; i < denominatorAggregations_.size(); i++) {
          size +=
              com.google.protobuf.CodedOutputStream.computeMessageSize(
                  10, denominatorAggregations_.get(i));
        }
        size += unknownFields.getSerializedSize();
        memoizedSize = size;
        return size;
      }

      @java.lang.Override
      public boolean equals(final java.lang.Object obj) {
        if (obj == this) {
          return true;
        }
        if (!(obj instanceof com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold)) {
          return super.equals(obj);
        }
        com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold other =
            (com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold) obj;

        boolean result = true;
        result = result && getFilter().equals(other.getFilter());
        result = result && getAggregationsList().equals(other.getAggregationsList());
        result = result && getDenominatorFilter().equals(other.getDenominatorFilter());
        result =
            result
                && getDenominatorAggregationsList().equals(other.getDenominatorAggregationsList());
        result = result && comparison_ == other.comparison_;
        result =
            result
                && (java.lang.Double.doubleToLongBits(getThresholdValue())
                    == java.lang.Double.doubleToLongBits(other.getThresholdValue()));
        result = result && (hasDuration() == other.hasDuration());
        if (hasDuration()) {
          result = result && getDuration().equals(other.getDuration());
        }
        result = result && (hasTrigger() == other.hasTrigger());
        if (hasTrigger()) {
          result = result && getTrigger().equals(other.getTrigger());
        }
        result = result && unknownFields.equals(other.unknownFields);
        return result;
      }

      @java.lang.Override
      public int hashCode() {
        if (memoizedHashCode != 0) {
          return memoizedHashCode;
        }
        int hash = 41;
        hash = (19 * hash) + getDescriptor().hashCode();
        hash = (37 * hash) + FILTER_FIELD_NUMBER;
        hash = (53 * hash) + getFilter().hashCode();
        if (getAggregationsCount() > 0) {
          hash = (37 * hash) + AGGREGATIONS_FIELD_NUMBER;
          hash = (53 * hash) + getAggregationsList().hashCode();
        }
        hash = (37 * hash) + DENOMINATOR_FILTER_FIELD_NUMBER;
        hash = (53 * hash) + getDenominatorFilter().hashCode();
        if (getDenominatorAggregationsCount() > 0) {
          hash = (37 * hash) + DENOMINATOR_AGGREGATIONS_FIELD_NUMBER;
          hash = (53 * hash) + getDenominatorAggregationsList().hashCode();
        }
        hash = (37 * hash) + COMPARISON_FIELD_NUMBER;
        hash = (53 * hash) + comparison_;
        hash = (37 * hash) + THRESHOLD_VALUE_FIELD_NUMBER;
        hash =
            (53 * hash)
                + com.google.protobuf.Internal.hashLong(
                    java.lang.Double.doubleToLongBits(getThresholdValue()));
        if (hasDuration()) {
          hash = (37 * hash) + DURATION_FIELD_NUMBER;
          hash = (53 * hash) + getDuration().hashCode();
        }
        if (hasTrigger()) {
          hash = (37 * hash) + TRIGGER_FIELD_NUMBER;
          hash = (53 * hash) + getTrigger().hashCode();
        }
        hash = (29 * hash) + unknownFields.hashCode();
        memoizedHashCode = hash;
        return hash;
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold parseFrom(
          java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold parseFrom(
          java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold parseFrom(
          com.google.protobuf.ByteString data)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold 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.monitoring.v3.AlertPolicy.Condition.MetricThreshold parseFrom(
          byte[] data) throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold parseFrom(
          byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold parseFrom(
          java.io.InputStream input) throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold 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.monitoring.v3.AlertPolicy.Condition.MetricThreshold
          parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold
          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.monitoring.v3.AlertPolicy.Condition.MetricThreshold parseFrom(
          com.google.protobuf.CodedInputStream input) throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold 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.monitoring.v3.AlertPolicy.Condition.MetricThreshold 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 condition type that compares a collection of time series
       * against a threshold.
       * </pre>
       *
       * Protobuf type {@code google.monitoring.v3.AlertPolicy.Condition.MetricThreshold}
       */
      public static final class Builder
          extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
          implements
          // @@protoc_insertion_point(builder_implements:google.monitoring.v3.AlertPolicy.Condition.MetricThreshold)
          com.google.monitoring.v3.AlertPolicy.Condition.MetricThresholdOrBuilder {
        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
          return com.google.monitoring.v3.AlertProto
              .internal_static_google_monitoring_v3_AlertPolicy_Condition_MetricThreshold_descriptor;
        }

        @java.lang.Override
        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
            internalGetFieldAccessorTable() {
          return com.google.monitoring.v3.AlertProto
              .internal_static_google_monitoring_v3_AlertPolicy_Condition_MetricThreshold_fieldAccessorTable
              .ensureFieldAccessorsInitialized(
                  com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.class,
                  com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.Builder.class);
        }

        // Construct using
        // com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.newBuilder()
        private Builder() {
          maybeForceBuilderInitialization();
        }

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

        private void maybeForceBuilderInitialization() {
          if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {
            getAggregationsFieldBuilder();
            getDenominatorAggregationsFieldBuilder();
          }
        }

        @java.lang.Override
        public Builder clear() {
          super.clear();
          filter_ = "";

          if (aggregationsBuilder_ == null) {
            aggregations_ = java.util.Collections.emptyList();
            bitField0_ = (bitField0_ & ~0x00000002);
          } else {
            aggregationsBuilder_.clear();
          }
          denominatorFilter_ = "";

          if (denominatorAggregationsBuilder_ == null) {
            denominatorAggregations_ = java.util.Collections.emptyList();
            bitField0_ = (bitField0_ & ~0x00000008);
          } else {
            denominatorAggregationsBuilder_.clear();
          }
          comparison_ = 0;

          thresholdValue_ = 0D;

          if (durationBuilder_ == null) {
            duration_ = null;
          } else {
            duration_ = null;
            durationBuilder_ = null;
          }
          if (triggerBuilder_ == null) {
            trigger_ = null;
          } else {
            trigger_ = null;
            triggerBuilder_ = null;
          }
          return this;
        }

        @java.lang.Override
        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
          return com.google.monitoring.v3.AlertProto
              .internal_static_google_monitoring_v3_AlertPolicy_Condition_MetricThreshold_descriptor;
        }

        @java.lang.Override
        public com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold
            getDefaultInstanceForType() {
          return com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold
              .getDefaultInstance();
        }

        @java.lang.Override
        public com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold build() {
          com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold result = buildPartial();
          if (!result.isInitialized()) {
            throw newUninitializedMessageException(result);
          }
          return result;
        }

        @java.lang.Override
        public com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold buildPartial() {
          com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold result =
              new com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold(this);
          int from_bitField0_ = bitField0_;
          int to_bitField0_ = 0;
          result.filter_ = filter_;
          if (aggregationsBuilder_ == null) {
            if (((bitField0_ & 0x00000002) == 0x00000002)) {
              aggregations_ = java.util.Collections.unmodifiableList(aggregations_);
              bitField0_ = (bitField0_ & ~0x00000002);
            }
            result.aggregations_ = aggregations_;
          } else {
            result.aggregations_ = aggregationsBuilder_.build();
          }
          result.denominatorFilter_ = denominatorFilter_;
          if (denominatorAggregationsBuilder_ == null) {
            if (((bitField0_ & 0x00000008) == 0x00000008)) {
              denominatorAggregations_ =
                  java.util.Collections.unmodifiableList(denominatorAggregations_);
              bitField0_ = (bitField0_ & ~0x00000008);
            }
            result.denominatorAggregations_ = denominatorAggregations_;
          } else {
            result.denominatorAggregations_ = denominatorAggregationsBuilder_.build();
          }
          result.comparison_ = comparison_;
          result.thresholdValue_ = thresholdValue_;
          if (durationBuilder_ == null) {
            result.duration_ = duration_;
          } else {
            result.duration_ = durationBuilder_.build();
          }
          if (triggerBuilder_ == null) {
            result.trigger_ = trigger_;
          } else {
            result.trigger_ = triggerBuilder_.build();
          }
          result.bitField0_ = to_bitField0_;
          onBuilt();
          return result;
        }

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

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

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

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

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

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

        @java.lang.Override
        public Builder mergeFrom(com.google.protobuf.Message other) {
          if (other instanceof com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold) {
            return mergeFrom(
                (com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold) other);
          } else {
            super.mergeFrom(other);
            return this;
          }
        }

        public Builder mergeFrom(
            com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold other) {
          if (other
              == com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold
                  .getDefaultInstance()) return this;
          if (!other.getFilter().isEmpty()) {
            filter_ = other.filter_;
            onChanged();
          }
          if (aggregationsBuilder_ == null) {
            if (!other.aggregations_.isEmpty()) {
              if (aggregations_.isEmpty()) {
                aggregations_ = other.aggregations_;
                bitField0_ = (bitField0_ & ~0x00000002);
              } else {
                ensureAggregationsIsMutable();
                aggregations_.addAll(other.aggregations_);
              }
              onChanged();
            }
          } else {
            if (!other.aggregations_.isEmpty()) {
              if (aggregationsBuilder_.isEmpty()) {
                aggregationsBuilder_.dispose();
                aggregationsBuilder_ = null;
                aggregations_ = other.aggregations_;
                bitField0_ = (bitField0_ & ~0x00000002);
                aggregationsBuilder_ =
                    com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                        ? getAggregationsFieldBuilder()
                        : null;
              } else {
                aggregationsBuilder_.addAllMessages(other.aggregations_);
              }
            }
          }
          if (!other.getDenominatorFilter().isEmpty()) {
            denominatorFilter_ = other.denominatorFilter_;
            onChanged();
          }
          if (denominatorAggregationsBuilder_ == null) {
            if (!other.denominatorAggregations_.isEmpty()) {
              if (denominatorAggregations_.isEmpty()) {
                denominatorAggregations_ = other.denominatorAggregations_;
                bitField0_ = (bitField0_ & ~0x00000008);
              } else {
                ensureDenominatorAggregationsIsMutable();
                denominatorAggregations_.addAll(other.denominatorAggregations_);
              }
              onChanged();
            }
          } else {
            if (!other.denominatorAggregations_.isEmpty()) {
              if (denominatorAggregationsBuilder_.isEmpty()) {
                denominatorAggregationsBuilder_.dispose();
                denominatorAggregationsBuilder_ = null;
                denominatorAggregations_ = other.denominatorAggregations_;
                bitField0_ = (bitField0_ & ~0x00000008);
                denominatorAggregationsBuilder_ =
                    com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                        ? getDenominatorAggregationsFieldBuilder()
                        : null;
              } else {
                denominatorAggregationsBuilder_.addAllMessages(other.denominatorAggregations_);
              }
            }
          }
          if (other.comparison_ != 0) {
            setComparisonValue(other.getComparisonValue());
          }
          if (other.getThresholdValue() != 0D) {
            setThresholdValue(other.getThresholdValue());
          }
          if (other.hasDuration()) {
            mergeDuration(other.getDuration());
          }
          if (other.hasTrigger()) {
            mergeTrigger(other.getTrigger());
          }
          this.mergeUnknownFields(other.unknownFields);
          onChanged();
          return this;
        }

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

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

        private int bitField0_;

        private java.lang.Object filter_ = "";
        /**
         *
         *
         * <pre>
         * A [filter](/monitoring/api/v3/filters) that
         * identifies which time series should be compared with the threshold.
         * The filter is similar to the one that is specified in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
         * call is useful to verify the time series that will be retrieved /
         * processed) and must specify the metric type and optionally may contain
         * restrictions on resource type, resource labels, and metric labels.
         * This field may not exceed 2048 Unicode characters in length.
         * </pre>
         *
         * <code>string filter = 2;</code>
         */
        public java.lang.String getFilter() {
          java.lang.Object ref = filter_;
          if (!(ref instanceof java.lang.String)) {
            com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
            java.lang.String s = bs.toStringUtf8();
            filter_ = s;
            return s;
          } else {
            return (java.lang.String) ref;
          }
        }
        /**
         *
         *
         * <pre>
         * A [filter](/monitoring/api/v3/filters) that
         * identifies which time series should be compared with the threshold.
         * The filter is similar to the one that is specified in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
         * call is useful to verify the time series that will be retrieved /
         * processed) and must specify the metric type and optionally may contain
         * restrictions on resource type, resource labels, and metric labels.
         * This field may not exceed 2048 Unicode characters in length.
         * </pre>
         *
         * <code>string filter = 2;</code>
         */
        public com.google.protobuf.ByteString getFilterBytes() {
          java.lang.Object ref = filter_;
          if (ref instanceof String) {
            com.google.protobuf.ByteString b =
                com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
            filter_ = b;
            return b;
          } else {
            return (com.google.protobuf.ByteString) ref;
          }
        }
        /**
         *
         *
         * <pre>
         * A [filter](/monitoring/api/v3/filters) that
         * identifies which time series should be compared with the threshold.
         * The filter is similar to the one that is specified in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
         * call is useful to verify the time series that will be retrieved /
         * processed) and must specify the metric type and optionally may contain
         * restrictions on resource type, resource labels, and metric labels.
         * This field may not exceed 2048 Unicode characters in length.
         * </pre>
         *
         * <code>string filter = 2;</code>
         */
        public Builder setFilter(java.lang.String value) {
          if (value == null) {
            throw new NullPointerException();
          }

          filter_ = value;
          onChanged();
          return this;
        }
        /**
         *
         *
         * <pre>
         * A [filter](/monitoring/api/v3/filters) that
         * identifies which time series should be compared with the threshold.
         * The filter is similar to the one that is specified in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
         * call is useful to verify the time series that will be retrieved /
         * processed) and must specify the metric type and optionally may contain
         * restrictions on resource type, resource labels, and metric labels.
         * This field may not exceed 2048 Unicode characters in length.
         * </pre>
         *
         * <code>string filter = 2;</code>
         */
        public Builder clearFilter() {

          filter_ = getDefaultInstance().getFilter();
          onChanged();
          return this;
        }
        /**
         *
         *
         * <pre>
         * A [filter](/monitoring/api/v3/filters) that
         * identifies which time series should be compared with the threshold.
         * The filter is similar to the one that is specified in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
         * call is useful to verify the time series that will be retrieved /
         * processed) and must specify the metric type and optionally may contain
         * restrictions on resource type, resource labels, and metric labels.
         * This field may not exceed 2048 Unicode characters in length.
         * </pre>
         *
         * <code>string filter = 2;</code>
         */
        public Builder setFilterBytes(com.google.protobuf.ByteString value) {
          if (value == null) {
            throw new NullPointerException();
          }
          checkByteStringIsUtf8(value);

          filter_ = value;
          onChanged();
          return this;
        }

        private java.util.List<com.google.monitoring.v3.Aggregation> aggregations_ =
            java.util.Collections.emptyList();

        private void ensureAggregationsIsMutable() {
          if (!((bitField0_ & 0x00000002) == 0x00000002)) {
            aggregations_ =
                new java.util.ArrayList<com.google.monitoring.v3.Aggregation>(aggregations_);
            bitField0_ |= 0x00000002;
          }
        }

        private com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.monitoring.v3.Aggregation,
                com.google.monitoring.v3.Aggregation.Builder,
                com.google.monitoring.v3.AggregationOrBuilder>
            aggregationsBuilder_;

        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public java.util.List<com.google.monitoring.v3.Aggregation> getAggregationsList() {
          if (aggregationsBuilder_ == null) {
            return java.util.Collections.unmodifiableList(aggregations_);
          } else {
            return aggregationsBuilder_.getMessageList();
          }
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public int getAggregationsCount() {
          if (aggregationsBuilder_ == null) {
            return aggregations_.size();
          } else {
            return aggregationsBuilder_.getCount();
          }
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public com.google.monitoring.v3.Aggregation getAggregations(int index) {
          if (aggregationsBuilder_ == null) {
            return aggregations_.get(index);
          } else {
            return aggregationsBuilder_.getMessage(index);
          }
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public Builder setAggregations(int index, com.google.monitoring.v3.Aggregation value) {
          if (aggregationsBuilder_ == null) {
            if (value == null) {
              throw new NullPointerException();
            }
            ensureAggregationsIsMutable();
            aggregations_.set(index, value);
            onChanged();
          } else {
            aggregationsBuilder_.setMessage(index, value);
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public Builder setAggregations(
            int index, com.google.monitoring.v3.Aggregation.Builder builderForValue) {
          if (aggregationsBuilder_ == null) {
            ensureAggregationsIsMutable();
            aggregations_.set(index, builderForValue.build());
            onChanged();
          } else {
            aggregationsBuilder_.setMessage(index, builderForValue.build());
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public Builder addAggregations(com.google.monitoring.v3.Aggregation value) {
          if (aggregationsBuilder_ == null) {
            if (value == null) {
              throw new NullPointerException();
            }
            ensureAggregationsIsMutable();
            aggregations_.add(value);
            onChanged();
          } else {
            aggregationsBuilder_.addMessage(value);
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public Builder addAggregations(int index, com.google.monitoring.v3.Aggregation value) {
          if (aggregationsBuilder_ == null) {
            if (value == null) {
              throw new NullPointerException();
            }
            ensureAggregationsIsMutable();
            aggregations_.add(index, value);
            onChanged();
          } else {
            aggregationsBuilder_.addMessage(index, value);
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public Builder addAggregations(
            com.google.monitoring.v3.Aggregation.Builder builderForValue) {
          if (aggregationsBuilder_ == null) {
            ensureAggregationsIsMutable();
            aggregations_.add(builderForValue.build());
            onChanged();
          } else {
            aggregationsBuilder_.addMessage(builderForValue.build());
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public Builder addAggregations(
            int index, com.google.monitoring.v3.Aggregation.Builder builderForValue) {
          if (aggregationsBuilder_ == null) {
            ensureAggregationsIsMutable();
            aggregations_.add(index, builderForValue.build());
            onChanged();
          } else {
            aggregationsBuilder_.addMessage(index, builderForValue.build());
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public Builder addAllAggregations(
            java.lang.Iterable<? extends com.google.monitoring.v3.Aggregation> values) {
          if (aggregationsBuilder_ == null) {
            ensureAggregationsIsMutable();
            com.google.protobuf.AbstractMessageLite.Builder.addAll(values, aggregations_);
            onChanged();
          } else {
            aggregationsBuilder_.addAllMessages(values);
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public Builder clearAggregations() {
          if (aggregationsBuilder_ == null) {
            aggregations_ = java.util.Collections.emptyList();
            bitField0_ = (bitField0_ & ~0x00000002);
            onChanged();
          } else {
            aggregationsBuilder_.clear();
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public Builder removeAggregations(int index) {
          if (aggregationsBuilder_ == null) {
            ensureAggregationsIsMutable();
            aggregations_.remove(index);
            onChanged();
          } else {
            aggregationsBuilder_.remove(index);
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public com.google.monitoring.v3.Aggregation.Builder getAggregationsBuilder(int index) {
          return getAggregationsFieldBuilder().getBuilder(index);
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public com.google.monitoring.v3.AggregationOrBuilder getAggregationsOrBuilder(int index) {
          if (aggregationsBuilder_ == null) {
            return aggregations_.get(index);
          } else {
            return aggregationsBuilder_.getMessageOrBuilder(index);
          }
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public java.util.List<? extends com.google.monitoring.v3.AggregationOrBuilder>
            getAggregationsOrBuilderList() {
          if (aggregationsBuilder_ != null) {
            return aggregationsBuilder_.getMessageOrBuilderList();
          } else {
            return java.util.Collections.unmodifiableList(aggregations_);
          }
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public com.google.monitoring.v3.Aggregation.Builder addAggregationsBuilder() {
          return getAggregationsFieldBuilder()
              .addBuilder(com.google.monitoring.v3.Aggregation.getDefaultInstance());
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public com.google.monitoring.v3.Aggregation.Builder addAggregationsBuilder(int index) {
          return getAggregationsFieldBuilder()
              .addBuilder(index, com.google.monitoring.v3.Aggregation.getDefaultInstance());
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 8;</code>
         */
        public java.util.List<com.google.monitoring.v3.Aggregation.Builder>
            getAggregationsBuilderList() {
          return getAggregationsFieldBuilder().getBuilderList();
        }

        private com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.monitoring.v3.Aggregation,
                com.google.monitoring.v3.Aggregation.Builder,
                com.google.monitoring.v3.AggregationOrBuilder>
            getAggregationsFieldBuilder() {
          if (aggregationsBuilder_ == null) {
            aggregationsBuilder_ =
                new com.google.protobuf.RepeatedFieldBuilderV3<
                    com.google.monitoring.v3.Aggregation,
                    com.google.monitoring.v3.Aggregation.Builder,
                    com.google.monitoring.v3.AggregationOrBuilder>(
                    aggregations_,
                    ((bitField0_ & 0x00000002) == 0x00000002),
                    getParentForChildren(),
                    isClean());
            aggregations_ = null;
          }
          return aggregationsBuilder_;
        }

        private java.lang.Object denominatorFilter_ = "";
        /**
         *
         *
         * <pre>
         * A [filter](/monitoring/api/v3/filters) that identifies a time
         * series that should be used as the denominator of a ratio that will be
         * compared with the threshold. If a `denominator_filter` is specified,
         * the time series specified by the `filter` field will be used as the
         * numerator.
         * The filter is similar to the one that is specified in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
         * call is useful to verify the time series that will be retrieved /
         * processed) and must specify the metric type and optionally may contain
         * restrictions on resource type, resource labels, and metric labels.
         * This field may not exceed 2048 Unicode characters in length.
         * </pre>
         *
         * <code>string denominator_filter = 9;</code>
         */
        public java.lang.String getDenominatorFilter() {
          java.lang.Object ref = denominatorFilter_;
          if (!(ref instanceof java.lang.String)) {
            com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
            java.lang.String s = bs.toStringUtf8();
            denominatorFilter_ = s;
            return s;
          } else {
            return (java.lang.String) ref;
          }
        }
        /**
         *
         *
         * <pre>
         * A [filter](/monitoring/api/v3/filters) that identifies a time
         * series that should be used as the denominator of a ratio that will be
         * compared with the threshold. If a `denominator_filter` is specified,
         * the time series specified by the `filter` field will be used as the
         * numerator.
         * The filter is similar to the one that is specified in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
         * call is useful to verify the time series that will be retrieved /
         * processed) and must specify the metric type and optionally may contain
         * restrictions on resource type, resource labels, and metric labels.
         * This field may not exceed 2048 Unicode characters in length.
         * </pre>
         *
         * <code>string denominator_filter = 9;</code>
         */
        public com.google.protobuf.ByteString getDenominatorFilterBytes() {
          java.lang.Object ref = denominatorFilter_;
          if (ref instanceof String) {
            com.google.protobuf.ByteString b =
                com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
            denominatorFilter_ = b;
            return b;
          } else {
            return (com.google.protobuf.ByteString) ref;
          }
        }
        /**
         *
         *
         * <pre>
         * A [filter](/monitoring/api/v3/filters) that identifies a time
         * series that should be used as the denominator of a ratio that will be
         * compared with the threshold. If a `denominator_filter` is specified,
         * the time series specified by the `filter` field will be used as the
         * numerator.
         * The filter is similar to the one that is specified in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
         * call is useful to verify the time series that will be retrieved /
         * processed) and must specify the metric type and optionally may contain
         * restrictions on resource type, resource labels, and metric labels.
         * This field may not exceed 2048 Unicode characters in length.
         * </pre>
         *
         * <code>string denominator_filter = 9;</code>
         */
        public Builder setDenominatorFilter(java.lang.String value) {
          if (value == null) {
            throw new NullPointerException();
          }

          denominatorFilter_ = value;
          onChanged();
          return this;
        }
        /**
         *
         *
         * <pre>
         * A [filter](/monitoring/api/v3/filters) that identifies a time
         * series that should be used as the denominator of a ratio that will be
         * compared with the threshold. If a `denominator_filter` is specified,
         * the time series specified by the `filter` field will be used as the
         * numerator.
         * The filter is similar to the one that is specified in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
         * call is useful to verify the time series that will be retrieved /
         * processed) and must specify the metric type and optionally may contain
         * restrictions on resource type, resource labels, and metric labels.
         * This field may not exceed 2048 Unicode characters in length.
         * </pre>
         *
         * <code>string denominator_filter = 9;</code>
         */
        public Builder clearDenominatorFilter() {

          denominatorFilter_ = getDefaultInstance().getDenominatorFilter();
          onChanged();
          return this;
        }
        /**
         *
         *
         * <pre>
         * A [filter](/monitoring/api/v3/filters) that identifies a time
         * series that should be used as the denominator of a ratio that will be
         * compared with the threshold. If a `denominator_filter` is specified,
         * the time series specified by the `filter` field will be used as the
         * numerator.
         * The filter is similar to the one that is specified in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
         * call is useful to verify the time series that will be retrieved /
         * processed) and must specify the metric type and optionally may contain
         * restrictions on resource type, resource labels, and metric labels.
         * This field may not exceed 2048 Unicode characters in length.
         * </pre>
         *
         * <code>string denominator_filter = 9;</code>
         */
        public Builder setDenominatorFilterBytes(com.google.protobuf.ByteString value) {
          if (value == null) {
            throw new NullPointerException();
          }
          checkByteStringIsUtf8(value);

          denominatorFilter_ = value;
          onChanged();
          return this;
        }

        private java.util.List<com.google.monitoring.v3.Aggregation> denominatorAggregations_ =
            java.util.Collections.emptyList();

        private void ensureDenominatorAggregationsIsMutable() {
          if (!((bitField0_ & 0x00000008) == 0x00000008)) {
            denominatorAggregations_ =
                new java.util.ArrayList<com.google.monitoring.v3.Aggregation>(
                    denominatorAggregations_);
            bitField0_ |= 0x00000008;
          }
        }

        private com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.monitoring.v3.Aggregation,
                com.google.monitoring.v3.Aggregation.Builder,
                com.google.monitoring.v3.AggregationOrBuilder>
            denominatorAggregationsBuilder_;

        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public java.util.List<com.google.monitoring.v3.Aggregation>
            getDenominatorAggregationsList() {
          if (denominatorAggregationsBuilder_ == null) {
            return java.util.Collections.unmodifiableList(denominatorAggregations_);
          } else {
            return denominatorAggregationsBuilder_.getMessageList();
          }
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public int getDenominatorAggregationsCount() {
          if (denominatorAggregationsBuilder_ == null) {
            return denominatorAggregations_.size();
          } else {
            return denominatorAggregationsBuilder_.getCount();
          }
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public com.google.monitoring.v3.Aggregation getDenominatorAggregations(int index) {
          if (denominatorAggregationsBuilder_ == null) {
            return denominatorAggregations_.get(index);
          } else {
            return denominatorAggregationsBuilder_.getMessage(index);
          }
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public Builder setDenominatorAggregations(
            int index, com.google.monitoring.v3.Aggregation value) {
          if (denominatorAggregationsBuilder_ == null) {
            if (value == null) {
              throw new NullPointerException();
            }
            ensureDenominatorAggregationsIsMutable();
            denominatorAggregations_.set(index, value);
            onChanged();
          } else {
            denominatorAggregationsBuilder_.setMessage(index, value);
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public Builder setDenominatorAggregations(
            int index, com.google.monitoring.v3.Aggregation.Builder builderForValue) {
          if (denominatorAggregationsBuilder_ == null) {
            ensureDenominatorAggregationsIsMutable();
            denominatorAggregations_.set(index, builderForValue.build());
            onChanged();
          } else {
            denominatorAggregationsBuilder_.setMessage(index, builderForValue.build());
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public Builder addDenominatorAggregations(com.google.monitoring.v3.Aggregation value) {
          if (denominatorAggregationsBuilder_ == null) {
            if (value == null) {
              throw new NullPointerException();
            }
            ensureDenominatorAggregationsIsMutable();
            denominatorAggregations_.add(value);
            onChanged();
          } else {
            denominatorAggregationsBuilder_.addMessage(value);
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public Builder addDenominatorAggregations(
            int index, com.google.monitoring.v3.Aggregation value) {
          if (denominatorAggregationsBuilder_ == null) {
            if (value == null) {
              throw new NullPointerException();
            }
            ensureDenominatorAggregationsIsMutable();
            denominatorAggregations_.add(index, value);
            onChanged();
          } else {
            denominatorAggregationsBuilder_.addMessage(index, value);
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public Builder addDenominatorAggregations(
            com.google.monitoring.v3.Aggregation.Builder builderForValue) {
          if (denominatorAggregationsBuilder_ == null) {
            ensureDenominatorAggregationsIsMutable();
            denominatorAggregations_.add(builderForValue.build());
            onChanged();
          } else {
            denominatorAggregationsBuilder_.addMessage(builderForValue.build());
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public Builder addDenominatorAggregations(
            int index, com.google.monitoring.v3.Aggregation.Builder builderForValue) {
          if (denominatorAggregationsBuilder_ == null) {
            ensureDenominatorAggregationsIsMutable();
            denominatorAggregations_.add(index, builderForValue.build());
            onChanged();
          } else {
            denominatorAggregationsBuilder_.addMessage(index, builderForValue.build());
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public Builder addAllDenominatorAggregations(
            java.lang.Iterable<? extends com.google.monitoring.v3.Aggregation> values) {
          if (denominatorAggregationsBuilder_ == null) {
            ensureDenominatorAggregationsIsMutable();
            com.google.protobuf.AbstractMessageLite.Builder.addAll(
                values, denominatorAggregations_);
            onChanged();
          } else {
            denominatorAggregationsBuilder_.addAllMessages(values);
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public Builder clearDenominatorAggregations() {
          if (denominatorAggregationsBuilder_ == null) {
            denominatorAggregations_ = java.util.Collections.emptyList();
            bitField0_ = (bitField0_ & ~0x00000008);
            onChanged();
          } else {
            denominatorAggregationsBuilder_.clear();
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public Builder removeDenominatorAggregations(int index) {
          if (denominatorAggregationsBuilder_ == null) {
            ensureDenominatorAggregationsIsMutable();
            denominatorAggregations_.remove(index);
            onChanged();
          } else {
            denominatorAggregationsBuilder_.remove(index);
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public com.google.monitoring.v3.Aggregation.Builder getDenominatorAggregationsBuilder(
            int index) {
          return getDenominatorAggregationsFieldBuilder().getBuilder(index);
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public com.google.monitoring.v3.AggregationOrBuilder getDenominatorAggregationsOrBuilder(
            int index) {
          if (denominatorAggregationsBuilder_ == null) {
            return denominatorAggregations_.get(index);
          } else {
            return denominatorAggregationsBuilder_.getMessageOrBuilder(index);
          }
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public java.util.List<? extends com.google.monitoring.v3.AggregationOrBuilder>
            getDenominatorAggregationsOrBuilderList() {
          if (denominatorAggregationsBuilder_ != null) {
            return denominatorAggregationsBuilder_.getMessageOrBuilderList();
          } else {
            return java.util.Collections.unmodifiableList(denominatorAggregations_);
          }
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public com.google.monitoring.v3.Aggregation.Builder addDenominatorAggregationsBuilder() {
          return getDenominatorAggregationsFieldBuilder()
              .addBuilder(com.google.monitoring.v3.Aggregation.getDefaultInstance());
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public com.google.monitoring.v3.Aggregation.Builder addDenominatorAggregationsBuilder(
            int index) {
          return getDenominatorAggregationsFieldBuilder()
              .addBuilder(index, com.google.monitoring.v3.Aggregation.getDefaultInstance());
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series
         * selected by `denominatorFilter` as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resources).
         * When computing ratios, the `aggregations` and
         * `denominator_aggregations` fields must use the same alignment period
         * and produce time series that have the same periodicity and labels.
         * This field is similar to the one in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
         * is advisable to use the `ListTimeSeries` method when debugging this
         * field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation denominator_aggregations = 10;</code>
         */
        public java.util.List<com.google.monitoring.v3.Aggregation.Builder>
            getDenominatorAggregationsBuilderList() {
          return getDenominatorAggregationsFieldBuilder().getBuilderList();
        }

        private com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.monitoring.v3.Aggregation,
                com.google.monitoring.v3.Aggregation.Builder,
                com.google.monitoring.v3.AggregationOrBuilder>
            getDenominatorAggregationsFieldBuilder() {
          if (denominatorAggregationsBuilder_ == null) {
            denominatorAggregationsBuilder_ =
                new com.google.protobuf.RepeatedFieldBuilderV3<
                    com.google.monitoring.v3.Aggregation,
                    com.google.monitoring.v3.Aggregation.Builder,
                    com.google.monitoring.v3.AggregationOrBuilder>(
                    denominatorAggregations_,
                    ((bitField0_ & 0x00000008) == 0x00000008),
                    getParentForChildren(),
                    isClean());
            denominatorAggregations_ = null;
          }
          return denominatorAggregationsBuilder_;
        }

        private int comparison_ = 0;
        /**
         *
         *
         * <pre>
         * The comparison to apply between the time series (indicated by `filter`
         * and `aggregation`) and the threshold (indicated by `threshold_value`).
         * The comparison is applied on each time series, with the time series
         * on the left-hand side and the threshold on the right-hand side.
         * Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
         * </pre>
         *
         * <code>.google.monitoring.v3.ComparisonType comparison = 4;</code>
         */
        public int getComparisonValue() {
          return comparison_;
        }
        /**
         *
         *
         * <pre>
         * The comparison to apply between the time series (indicated by `filter`
         * and `aggregation`) and the threshold (indicated by `threshold_value`).
         * The comparison is applied on each time series, with the time series
         * on the left-hand side and the threshold on the right-hand side.
         * Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
         * </pre>
         *
         * <code>.google.monitoring.v3.ComparisonType comparison = 4;</code>
         */
        public Builder setComparisonValue(int value) {
          comparison_ = value;
          onChanged();
          return this;
        }
        /**
         *
         *
         * <pre>
         * The comparison to apply between the time series (indicated by `filter`
         * and `aggregation`) and the threshold (indicated by `threshold_value`).
         * The comparison is applied on each time series, with the time series
         * on the left-hand side and the threshold on the right-hand side.
         * Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
         * </pre>
         *
         * <code>.google.monitoring.v3.ComparisonType comparison = 4;</code>
         */
        public com.google.monitoring.v3.ComparisonType getComparison() {
          @SuppressWarnings("deprecation")
          com.google.monitoring.v3.ComparisonType result =
              com.google.monitoring.v3.ComparisonType.valueOf(comparison_);
          return result == null ? com.google.monitoring.v3.ComparisonType.UNRECOGNIZED : result;
        }
        /**
         *
         *
         * <pre>
         * The comparison to apply between the time series (indicated by `filter`
         * and `aggregation`) and the threshold (indicated by `threshold_value`).
         * The comparison is applied on each time series, with the time series
         * on the left-hand side and the threshold on the right-hand side.
         * Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
         * </pre>
         *
         * <code>.google.monitoring.v3.ComparisonType comparison = 4;</code>
         */
        public Builder setComparison(com.google.monitoring.v3.ComparisonType value) {
          if (value == null) {
            throw new NullPointerException();
          }

          comparison_ = value.getNumber();
          onChanged();
          return this;
        }
        /**
         *
         *
         * <pre>
         * The comparison to apply between the time series (indicated by `filter`
         * and `aggregation`) and the threshold (indicated by `threshold_value`).
         * The comparison is applied on each time series, with the time series
         * on the left-hand side and the threshold on the right-hand side.
         * Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently.
         * </pre>
         *
         * <code>.google.monitoring.v3.ComparisonType comparison = 4;</code>
         */
        public Builder clearComparison() {

          comparison_ = 0;
          onChanged();
          return this;
        }

        private double thresholdValue_;
        /**
         *
         *
         * <pre>
         * A value against which to compare the time series.
         * </pre>
         *
         * <code>double threshold_value = 5;</code>
         */
        public double getThresholdValue() {
          return thresholdValue_;
        }
        /**
         *
         *
         * <pre>
         * A value against which to compare the time series.
         * </pre>
         *
         * <code>double threshold_value = 5;</code>
         */
        public Builder setThresholdValue(double value) {

          thresholdValue_ = value;
          onChanged();
          return this;
        }
        /**
         *
         *
         * <pre>
         * A value against which to compare the time series.
         * </pre>
         *
         * <code>double threshold_value = 5;</code>
         */
        public Builder clearThresholdValue() {

          thresholdValue_ = 0D;
          onChanged();
          return this;
        }

        private com.google.protobuf.Duration duration_ = null;
        private com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Duration,
                com.google.protobuf.Duration.Builder,
                com.google.protobuf.DurationOrBuilder>
            durationBuilder_;
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must violate the
         * threshold to be considered failing. Currently, only values
         * that are a multiple of a minute--e.g., 0, 60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. When choosing a duration, it is useful to
         * keep in mind the frequency of the underlying time series data
         * (which may also be affected by any alignments specified in the
         * `aggregations` field); a good duration is long enough so that a single
         * outlier does not generate spurious alerts, but short enough that
         * unhealthy states are detected and alerted on quickly.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 6;</code>
         */
        public boolean hasDuration() {
          return durationBuilder_ != null || duration_ != null;
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must violate the
         * threshold to be considered failing. Currently, only values
         * that are a multiple of a minute--e.g., 0, 60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. When choosing a duration, it is useful to
         * keep in mind the frequency of the underlying time series data
         * (which may also be affected by any alignments specified in the
         * `aggregations` field); a good duration is long enough so that a single
         * outlier does not generate spurious alerts, but short enough that
         * unhealthy states are detected and alerted on quickly.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 6;</code>
         */
        public com.google.protobuf.Duration getDuration() {
          if (durationBuilder_ == null) {
            return duration_ == null
                ? com.google.protobuf.Duration.getDefaultInstance()
                : duration_;
          } else {
            return durationBuilder_.getMessage();
          }
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must violate the
         * threshold to be considered failing. Currently, only values
         * that are a multiple of a minute--e.g., 0, 60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. When choosing a duration, it is useful to
         * keep in mind the frequency of the underlying time series data
         * (which may also be affected by any alignments specified in the
         * `aggregations` field); a good duration is long enough so that a single
         * outlier does not generate spurious alerts, but short enough that
         * unhealthy states are detected and alerted on quickly.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 6;</code>
         */
        public Builder setDuration(com.google.protobuf.Duration value) {
          if (durationBuilder_ == null) {
            if (value == null) {
              throw new NullPointerException();
            }
            duration_ = value;
            onChanged();
          } else {
            durationBuilder_.setMessage(value);
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must violate the
         * threshold to be considered failing. Currently, only values
         * that are a multiple of a minute--e.g., 0, 60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. When choosing a duration, it is useful to
         * keep in mind the frequency of the underlying time series data
         * (which may also be affected by any alignments specified in the
         * `aggregations` field); a good duration is long enough so that a single
         * outlier does not generate spurious alerts, but short enough that
         * unhealthy states are detected and alerted on quickly.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 6;</code>
         */
        public Builder setDuration(com.google.protobuf.Duration.Builder builderForValue) {
          if (durationBuilder_ == null) {
            duration_ = builderForValue.build();
            onChanged();
          } else {
            durationBuilder_.setMessage(builderForValue.build());
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must violate the
         * threshold to be considered failing. Currently, only values
         * that are a multiple of a minute--e.g., 0, 60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. When choosing a duration, it is useful to
         * keep in mind the frequency of the underlying time series data
         * (which may also be affected by any alignments specified in the
         * `aggregations` field); a good duration is long enough so that a single
         * outlier does not generate spurious alerts, but short enough that
         * unhealthy states are detected and alerted on quickly.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 6;</code>
         */
        public Builder mergeDuration(com.google.protobuf.Duration value) {
          if (durationBuilder_ == null) {
            if (duration_ != null) {
              duration_ =
                  com.google.protobuf.Duration.newBuilder(duration_)
                      .mergeFrom(value)
                      .buildPartial();
            } else {
              duration_ = value;
            }
            onChanged();
          } else {
            durationBuilder_.mergeFrom(value);
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must violate the
         * threshold to be considered failing. Currently, only values
         * that are a multiple of a minute--e.g., 0, 60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. When choosing a duration, it is useful to
         * keep in mind the frequency of the underlying time series data
         * (which may also be affected by any alignments specified in the
         * `aggregations` field); a good duration is long enough so that a single
         * outlier does not generate spurious alerts, but short enough that
         * unhealthy states are detected and alerted on quickly.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 6;</code>
         */
        public Builder clearDuration() {
          if (durationBuilder_ == null) {
            duration_ = null;
            onChanged();
          } else {
            duration_ = null;
            durationBuilder_ = null;
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must violate the
         * threshold to be considered failing. Currently, only values
         * that are a multiple of a minute--e.g., 0, 60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. When choosing a duration, it is useful to
         * keep in mind the frequency of the underlying time series data
         * (which may also be affected by any alignments specified in the
         * `aggregations` field); a good duration is long enough so that a single
         * outlier does not generate spurious alerts, but short enough that
         * unhealthy states are detected and alerted on quickly.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 6;</code>
         */
        public com.google.protobuf.Duration.Builder getDurationBuilder() {

          onChanged();
          return getDurationFieldBuilder().getBuilder();
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must violate the
         * threshold to be considered failing. Currently, only values
         * that are a multiple of a minute--e.g., 0, 60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. When choosing a duration, it is useful to
         * keep in mind the frequency of the underlying time series data
         * (which may also be affected by any alignments specified in the
         * `aggregations` field); a good duration is long enough so that a single
         * outlier does not generate spurious alerts, but short enough that
         * unhealthy states are detected and alerted on quickly.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 6;</code>
         */
        public com.google.protobuf.DurationOrBuilder getDurationOrBuilder() {
          if (durationBuilder_ != null) {
            return durationBuilder_.getMessageOrBuilder();
          } else {
            return duration_ == null
                ? com.google.protobuf.Duration.getDefaultInstance()
                : duration_;
          }
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must violate the
         * threshold to be considered failing. Currently, only values
         * that are a multiple of a minute--e.g., 0, 60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. When choosing a duration, it is useful to
         * keep in mind the frequency of the underlying time series data
         * (which may also be affected by any alignments specified in the
         * `aggregations` field); a good duration is long enough so that a single
         * outlier does not generate spurious alerts, but short enough that
         * unhealthy states are detected and alerted on quickly.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 6;</code>
         */
        private com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Duration,
                com.google.protobuf.Duration.Builder,
                com.google.protobuf.DurationOrBuilder>
            getDurationFieldBuilder() {
          if (durationBuilder_ == null) {
            durationBuilder_ =
                new com.google.protobuf.SingleFieldBuilderV3<
                    com.google.protobuf.Duration,
                    com.google.protobuf.Duration.Builder,
                    com.google.protobuf.DurationOrBuilder>(
                    getDuration(), getParentForChildren(), isClean());
            duration_ = null;
          }
          return durationBuilder_;
        }

        private com.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger_ = null;
        private com.google.protobuf.SingleFieldBuilderV3<
                com.google.monitoring.v3.AlertPolicy.Condition.Trigger,
                com.google.monitoring.v3.AlertPolicy.Condition.Trigger.Builder,
                com.google.monitoring.v3.AlertPolicy.Condition.TriggerOrBuilder>
            triggerBuilder_;
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`,
         * or by the ratio, if `denominator_filter` and `denominator_aggregations`
         * are specified.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7;</code>
         */
        public boolean hasTrigger() {
          return triggerBuilder_ != null || trigger_ != null;
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`,
         * or by the ratio, if `denominator_filter` and `denominator_aggregations`
         * are specified.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7;</code>
         */
        public com.google.monitoring.v3.AlertPolicy.Condition.Trigger getTrigger() {
          if (triggerBuilder_ == null) {
            return trigger_ == null
                ? com.google.monitoring.v3.AlertPolicy.Condition.Trigger.getDefaultInstance()
                : trigger_;
          } else {
            return triggerBuilder_.getMessage();
          }
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`,
         * or by the ratio, if `denominator_filter` and `denominator_aggregations`
         * are specified.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7;</code>
         */
        public Builder setTrigger(com.google.monitoring.v3.AlertPolicy.Condition.Trigger value) {
          if (triggerBuilder_ == null) {
            if (value == null) {
              throw new NullPointerException();
            }
            trigger_ = value;
            onChanged();
          } else {
            triggerBuilder_.setMessage(value);
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`,
         * or by the ratio, if `denominator_filter` and `denominator_aggregations`
         * are specified.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7;</code>
         */
        public Builder setTrigger(
            com.google.monitoring.v3.AlertPolicy.Condition.Trigger.Builder builderForValue) {
          if (triggerBuilder_ == null) {
            trigger_ = builderForValue.build();
            onChanged();
          } else {
            triggerBuilder_.setMessage(builderForValue.build());
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`,
         * or by the ratio, if `denominator_filter` and `denominator_aggregations`
         * are specified.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7;</code>
         */
        public Builder mergeTrigger(com.google.monitoring.v3.AlertPolicy.Condition.Trigger value) {
          if (triggerBuilder_ == null) {
            if (trigger_ != null) {
              trigger_ =
                  com.google.monitoring.v3.AlertPolicy.Condition.Trigger.newBuilder(trigger_)
                      .mergeFrom(value)
                      .buildPartial();
            } else {
              trigger_ = value;
            }
            onChanged();
          } else {
            triggerBuilder_.mergeFrom(value);
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`,
         * or by the ratio, if `denominator_filter` and `denominator_aggregations`
         * are specified.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7;</code>
         */
        public Builder clearTrigger() {
          if (triggerBuilder_ == null) {
            trigger_ = null;
            onChanged();
          } else {
            trigger_ = null;
            triggerBuilder_ = null;
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`,
         * or by the ratio, if `denominator_filter` and `denominator_aggregations`
         * are specified.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7;</code>
         */
        public com.google.monitoring.v3.AlertPolicy.Condition.Trigger.Builder getTriggerBuilder() {

          onChanged();
          return getTriggerFieldBuilder().getBuilder();
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`,
         * or by the ratio, if `denominator_filter` and `denominator_aggregations`
         * are specified.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7;</code>
         */
        public com.google.monitoring.v3.AlertPolicy.Condition.TriggerOrBuilder
            getTriggerOrBuilder() {
          if (triggerBuilder_ != null) {
            return triggerBuilder_.getMessageOrBuilder();
          } else {
            return trigger_ == null
                ? com.google.monitoring.v3.AlertPolicy.Condition.Trigger.getDefaultInstance()
                : trigger_;
          }
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`,
         * or by the ratio, if `denominator_filter` and `denominator_aggregations`
         * are specified.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 7;</code>
         */
        private com.google.protobuf.SingleFieldBuilderV3<
                com.google.monitoring.v3.AlertPolicy.Condition.Trigger,
                com.google.monitoring.v3.AlertPolicy.Condition.Trigger.Builder,
                com.google.monitoring.v3.AlertPolicy.Condition.TriggerOrBuilder>
            getTriggerFieldBuilder() {
          if (triggerBuilder_ == null) {
            triggerBuilder_ =
                new com.google.protobuf.SingleFieldBuilderV3<
                    com.google.monitoring.v3.AlertPolicy.Condition.Trigger,
                    com.google.monitoring.v3.AlertPolicy.Condition.Trigger.Builder,
                    com.google.monitoring.v3.AlertPolicy.Condition.TriggerOrBuilder>(
                    getTrigger(), getParentForChildren(), isClean());
            trigger_ = null;
          }
          return triggerBuilder_;
        }

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

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

        // @@protoc_insertion_point(builder_scope:google.monitoring.v3.AlertPolicy.Condition.MetricThreshold)
      }

      // @@protoc_insertion_point(class_scope:google.monitoring.v3.AlertPolicy.Condition.MetricThreshold)
      private static final com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold
          DEFAULT_INSTANCE;

      static {
        DEFAULT_INSTANCE = new com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold();
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold
          getDefaultInstance() {
        return DEFAULT_INSTANCE;
      }

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

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

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

      @java.lang.Override
      public com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold
          getDefaultInstanceForType() {
        return DEFAULT_INSTANCE;
      }
    }

    public interface MetricAbsenceOrBuilder
        extends
        // @@protoc_insertion_point(interface_extends:google.monitoring.v3.AlertPolicy.Condition.MetricAbsence)
        com.google.protobuf.MessageOrBuilder {

      /**
       *
       *
       * <pre>
       * A [filter](/monitoring/api/v3/filters) that
       * identifies which time series should be compared with the threshold.
       * The filter is similar to the one that is specified in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
       * call is useful to verify the time series that will be retrieved /
       * processed) and must specify the metric type and optionally may contain
       * restrictions on resource type, resource labels, and metric labels.
       * This field may not exceed 2048 Unicode characters in length.
       * </pre>
       *
       * <code>string filter = 1;</code>
       */
      java.lang.String getFilter();
      /**
       *
       *
       * <pre>
       * A [filter](/monitoring/api/v3/filters) that
       * identifies which time series should be compared with the threshold.
       * The filter is similar to the one that is specified in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
       * call is useful to verify the time series that will be retrieved /
       * processed) and must specify the metric type and optionally may contain
       * restrictions on resource type, resource labels, and metric labels.
       * This field may not exceed 2048 Unicode characters in length.
       * </pre>
       *
       * <code>string filter = 1;</code>
       */
      com.google.protobuf.ByteString getFilterBytes();

      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the
       * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
       */
      java.util.List<com.google.monitoring.v3.Aggregation> getAggregationsList();
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the
       * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
       */
      com.google.monitoring.v3.Aggregation getAggregations(int index);
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the
       * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
       */
      int getAggregationsCount();
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the
       * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
       */
      java.util.List<? extends com.google.monitoring.v3.AggregationOrBuilder>
          getAggregationsOrBuilderList();
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the
       * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
       */
      com.google.monitoring.v3.AggregationOrBuilder getAggregationsOrBuilder(int index);

      /**
       *
       *
       * <pre>
       * The amount of time that a time series must fail to report new
       * data to be considered failing. Currently, only values that
       * are a multiple of a minute--e.g.  60, 120, or 300
       * seconds--are supported. If an invalid value is given, an
       * error will be returned. The `Duration.nanos` field is
       * ignored.
       * </pre>
       *
       * <code>.google.protobuf.Duration duration = 2;</code>
       */
      boolean hasDuration();
      /**
       *
       *
       * <pre>
       * The amount of time that a time series must fail to report new
       * data to be considered failing. Currently, only values that
       * are a multiple of a minute--e.g.  60, 120, or 300
       * seconds--are supported. If an invalid value is given, an
       * error will be returned. The `Duration.nanos` field is
       * ignored.
       * </pre>
       *
       * <code>.google.protobuf.Duration duration = 2;</code>
       */
      com.google.protobuf.Duration getDuration();
      /**
       *
       *
       * <pre>
       * The amount of time that a time series must fail to report new
       * data to be considered failing. Currently, only values that
       * are a multiple of a minute--e.g.  60, 120, or 300
       * seconds--are supported. If an invalid value is given, an
       * error will be returned. The `Duration.nanos` field is
       * ignored.
       * </pre>
       *
       * <code>.google.protobuf.Duration duration = 2;</code>
       */
      com.google.protobuf.DurationOrBuilder getDurationOrBuilder();

      /**
       *
       *
       * <pre>
       * The number/percent of time series for which the comparison must hold
       * in order for the condition to trigger. If unspecified, then the
       * condition will trigger if the comparison is true for any of the
       * time series that have been identified by `filter` and `aggregations`.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3;</code>
       */
      boolean hasTrigger();
      /**
       *
       *
       * <pre>
       * The number/percent of time series for which the comparison must hold
       * in order for the condition to trigger. If unspecified, then the
       * condition will trigger if the comparison is true for any of the
       * time series that have been identified by `filter` and `aggregations`.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3;</code>
       */
      com.google.monitoring.v3.AlertPolicy.Condition.Trigger getTrigger();
      /**
       *
       *
       * <pre>
       * The number/percent of time series for which the comparison must hold
       * in order for the condition to trigger. If unspecified, then the
       * condition will trigger if the comparison is true for any of the
       * time series that have been identified by `filter` and `aggregations`.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3;</code>
       */
      com.google.monitoring.v3.AlertPolicy.Condition.TriggerOrBuilder getTriggerOrBuilder();
    }
    /**
     *
     *
     * <pre>
     * A condition type that checks that monitored resources
     * are reporting data. The configuration defines a metric and
     * a set of monitored resources. The predicate is considered in violation
     * when a time series for the specified metric of a monitored
     * resource does not include any data in the specified `duration`.
     * </pre>
     *
     * Protobuf type {@code google.monitoring.v3.AlertPolicy.Condition.MetricAbsence}
     */
    public static final class MetricAbsence extends com.google.protobuf.GeneratedMessageV3
        implements
        // @@protoc_insertion_point(message_implements:google.monitoring.v3.AlertPolicy.Condition.MetricAbsence)
        MetricAbsenceOrBuilder {
      private static final long serialVersionUID = 0L;
      // Use MetricAbsence.newBuilder() to construct.
      private MetricAbsence(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
        super(builder);
      }

      private MetricAbsence() {
        filter_ = "";
        aggregations_ = java.util.Collections.emptyList();
      }

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

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

                  filter_ = s;
                  break;
                }
              case 18:
                {
                  com.google.protobuf.Duration.Builder subBuilder = null;
                  if (duration_ != null) {
                    subBuilder = duration_.toBuilder();
                  }
                  duration_ =
                      input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry);
                  if (subBuilder != null) {
                    subBuilder.mergeFrom(duration_);
                    duration_ = subBuilder.buildPartial();
                  }

                  break;
                }
              case 26:
                {
                  com.google.monitoring.v3.AlertPolicy.Condition.Trigger.Builder subBuilder = null;
                  if (trigger_ != null) {
                    subBuilder = trigger_.toBuilder();
                  }
                  trigger_ =
                      input.readMessage(
                          com.google.monitoring.v3.AlertPolicy.Condition.Trigger.parser(),
                          extensionRegistry);
                  if (subBuilder != null) {
                    subBuilder.mergeFrom(trigger_);
                    trigger_ = subBuilder.buildPartial();
                  }

                  break;
                }
              case 42:
                {
                  if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
                    aggregations_ = new java.util.ArrayList<com.google.monitoring.v3.Aggregation>();
                    mutable_bitField0_ |= 0x00000002;
                  }
                  aggregations_.add(
                      input.readMessage(
                          com.google.monitoring.v3.Aggregation.parser(), extensionRegistry));
                  break;
                }
              default:
                {
                  if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) {
                    done = true;
                  }
                  break;
                }
            }
          }
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.setUnfinishedMessage(this);
        } catch (java.io.IOException e) {
          throw new com.google.protobuf.InvalidProtocolBufferException(e)
              .setUnfinishedMessage(this);
        } finally {
          if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
            aggregations_ = java.util.Collections.unmodifiableList(aggregations_);
          }
          this.unknownFields = unknownFields.build();
          makeExtensionsImmutable();
        }
      }

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.monitoring.v3.AlertProto
            .internal_static_google_monitoring_v3_AlertPolicy_Condition_MetricAbsence_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.monitoring.v3.AlertProto
            .internal_static_google_monitoring_v3_AlertPolicy_Condition_MetricAbsence_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.class,
                com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.Builder.class);
      }

      private int bitField0_;
      public static final int FILTER_FIELD_NUMBER = 1;
      private volatile java.lang.Object filter_;
      /**
       *
       *
       * <pre>
       * A [filter](/monitoring/api/v3/filters) that
       * identifies which time series should be compared with the threshold.
       * The filter is similar to the one that is specified in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
       * call is useful to verify the time series that will be retrieved /
       * processed) and must specify the metric type and optionally may contain
       * restrictions on resource type, resource labels, and metric labels.
       * This field may not exceed 2048 Unicode characters in length.
       * </pre>
       *
       * <code>string filter = 1;</code>
       */
      public java.lang.String getFilter() {
        java.lang.Object ref = filter_;
        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();
          filter_ = s;
          return s;
        }
      }
      /**
       *
       *
       * <pre>
       * A [filter](/monitoring/api/v3/filters) that
       * identifies which time series should be compared with the threshold.
       * The filter is similar to the one that is specified in the
       * [`MetricService.ListTimeSeries`
       * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
       * call is useful to verify the time series that will be retrieved /
       * processed) and must specify the metric type and optionally may contain
       * restrictions on resource type, resource labels, and metric labels.
       * This field may not exceed 2048 Unicode characters in length.
       * </pre>
       *
       * <code>string filter = 1;</code>
       */
      public com.google.protobuf.ByteString getFilterBytes() {
        java.lang.Object ref = filter_;
        if (ref instanceof java.lang.String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          filter_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }

      public static final int AGGREGATIONS_FIELD_NUMBER = 5;
      private java.util.List<com.google.monitoring.v3.Aggregation> aggregations_;
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the
       * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
       */
      public java.util.List<com.google.monitoring.v3.Aggregation> getAggregationsList() {
        return aggregations_;
      }
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the
       * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
       */
      public java.util.List<? extends com.google.monitoring.v3.AggregationOrBuilder>
          getAggregationsOrBuilderList() {
        return aggregations_;
      }
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the
       * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
       */
      public int getAggregationsCount() {
        return aggregations_.size();
      }
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the
       * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
       */
      public com.google.monitoring.v3.Aggregation getAggregations(int index) {
        return aggregations_.get(index);
      }
      /**
       *
       *
       * <pre>
       * Specifies the alignment of data points in individual time series as
       * well as how to combine the retrieved time series together (such as
       * when aggregating multiple streams on each resource to a single
       * stream for each resource or when aggregating streams across all
       * members of a group of resrouces). Multiple aggregations
       * are applied in the order specified.
       * This field is similar to the
       * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
       * It is advisable to use the `ListTimeSeries` method when debugging this field.
       * </pre>
       *
       * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
       */
      public com.google.monitoring.v3.AggregationOrBuilder getAggregationsOrBuilder(int index) {
        return aggregations_.get(index);
      }

      public static final int DURATION_FIELD_NUMBER = 2;
      private com.google.protobuf.Duration duration_;
      /**
       *
       *
       * <pre>
       * The amount of time that a time series must fail to report new
       * data to be considered failing. Currently, only values that
       * are a multiple of a minute--e.g.  60, 120, or 300
       * seconds--are supported. If an invalid value is given, an
       * error will be returned. The `Duration.nanos` field is
       * ignored.
       * </pre>
       *
       * <code>.google.protobuf.Duration duration = 2;</code>
       */
      public boolean hasDuration() {
        return duration_ != null;
      }
      /**
       *
       *
       * <pre>
       * The amount of time that a time series must fail to report new
       * data to be considered failing. Currently, only values that
       * are a multiple of a minute--e.g.  60, 120, or 300
       * seconds--are supported. If an invalid value is given, an
       * error will be returned. The `Duration.nanos` field is
       * ignored.
       * </pre>
       *
       * <code>.google.protobuf.Duration duration = 2;</code>
       */
      public com.google.protobuf.Duration getDuration() {
        return duration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : duration_;
      }
      /**
       *
       *
       * <pre>
       * The amount of time that a time series must fail to report new
       * data to be considered failing. Currently, only values that
       * are a multiple of a minute--e.g.  60, 120, or 300
       * seconds--are supported. If an invalid value is given, an
       * error will be returned. The `Duration.nanos` field is
       * ignored.
       * </pre>
       *
       * <code>.google.protobuf.Duration duration = 2;</code>
       */
      public com.google.protobuf.DurationOrBuilder getDurationOrBuilder() {
        return getDuration();
      }

      public static final int TRIGGER_FIELD_NUMBER = 3;
      private com.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger_;
      /**
       *
       *
       * <pre>
       * The number/percent of time series for which the comparison must hold
       * in order for the condition to trigger. If unspecified, then the
       * condition will trigger if the comparison is true for any of the
       * time series that have been identified by `filter` and `aggregations`.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3;</code>
       */
      public boolean hasTrigger() {
        return trigger_ != null;
      }
      /**
       *
       *
       * <pre>
       * The number/percent of time series for which the comparison must hold
       * in order for the condition to trigger. If unspecified, then the
       * condition will trigger if the comparison is true for any of the
       * time series that have been identified by `filter` and `aggregations`.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3;</code>
       */
      public com.google.monitoring.v3.AlertPolicy.Condition.Trigger getTrigger() {
        return trigger_ == null
            ? com.google.monitoring.v3.AlertPolicy.Condition.Trigger.getDefaultInstance()
            : trigger_;
      }
      /**
       *
       *
       * <pre>
       * The number/percent of time series for which the comparison must hold
       * in order for the condition to trigger. If unspecified, then the
       * condition will trigger if the comparison is true for any of the
       * time series that have been identified by `filter` and `aggregations`.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3;</code>
       */
      public com.google.monitoring.v3.AlertPolicy.Condition.TriggerOrBuilder getTriggerOrBuilder() {
        return getTrigger();
      }

      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 (!getFilterBytes().isEmpty()) {
          com.google.protobuf.GeneratedMessageV3.writeString(output, 1, filter_);
        }
        if (duration_ != null) {
          output.writeMessage(2, getDuration());
        }
        if (trigger_ != null) {
          output.writeMessage(3, getTrigger());
        }
        for (int i = 0; i < aggregations_.size(); i++) {
          output.writeMessage(5, aggregations_.get(i));
        }
        unknownFields.writeTo(output);
      }

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

        size = 0;
        if (!getFilterBytes().isEmpty()) {
          size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, filter_);
        }
        if (duration_ != null) {
          size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getDuration());
        }
        if (trigger_ != null) {
          size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getTrigger());
        }
        for (int i = 0; i < aggregations_.size(); i++) {
          size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, aggregations_.get(i));
        }
        size += unknownFields.getSerializedSize();
        memoizedSize = size;
        return size;
      }

      @java.lang.Override
      public boolean equals(final java.lang.Object obj) {
        if (obj == this) {
          return true;
        }
        if (!(obj instanceof com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence)) {
          return super.equals(obj);
        }
        com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence other =
            (com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence) obj;

        boolean result = true;
        result = result && getFilter().equals(other.getFilter());
        result = result && getAggregationsList().equals(other.getAggregationsList());
        result = result && (hasDuration() == other.hasDuration());
        if (hasDuration()) {
          result = result && getDuration().equals(other.getDuration());
        }
        result = result && (hasTrigger() == other.hasTrigger());
        if (hasTrigger()) {
          result = result && getTrigger().equals(other.getTrigger());
        }
        result = result && unknownFields.equals(other.unknownFields);
        return result;
      }

      @java.lang.Override
      public int hashCode() {
        if (memoizedHashCode != 0) {
          return memoizedHashCode;
        }
        int hash = 41;
        hash = (19 * hash) + getDescriptor().hashCode();
        hash = (37 * hash) + FILTER_FIELD_NUMBER;
        hash = (53 * hash) + getFilter().hashCode();
        if (getAggregationsCount() > 0) {
          hash = (37 * hash) + AGGREGATIONS_FIELD_NUMBER;
          hash = (53 * hash) + getAggregationsList().hashCode();
        }
        if (hasDuration()) {
          hash = (37 * hash) + DURATION_FIELD_NUMBER;
          hash = (53 * hash) + getDuration().hashCode();
        }
        if (hasTrigger()) {
          hash = (37 * hash) + TRIGGER_FIELD_NUMBER;
          hash = (53 * hash) + getTrigger().hashCode();
        }
        hash = (29 * hash) + unknownFields.hashCode();
        memoizedHashCode = hash;
        return hash;
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence parseFrom(
          java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence parseFrom(
          java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence parseFrom(
          com.google.protobuf.ByteString data)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence 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.monitoring.v3.AlertPolicy.Condition.MetricAbsence parseFrom(
          byte[] data) throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence parseFrom(
          byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence parseFrom(
          java.io.InputStream input) throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence 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.monitoring.v3.AlertPolicy.Condition.MetricAbsence parseDelimitedFrom(
          java.io.InputStream input) throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence 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.monitoring.v3.AlertPolicy.Condition.MetricAbsence parseFrom(
          com.google.protobuf.CodedInputStream input) throws java.io.IOException {
        return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence 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.monitoring.v3.AlertPolicy.Condition.MetricAbsence 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 condition type that checks that monitored resources
       * are reporting data. The configuration defines a metric and
       * a set of monitored resources. The predicate is considered in violation
       * when a time series for the specified metric of a monitored
       * resource does not include any data in the specified `duration`.
       * </pre>
       *
       * Protobuf type {@code google.monitoring.v3.AlertPolicy.Condition.MetricAbsence}
       */
      public static final class Builder
          extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
          implements
          // @@protoc_insertion_point(builder_implements:google.monitoring.v3.AlertPolicy.Condition.MetricAbsence)
          com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsenceOrBuilder {
        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
          return com.google.monitoring.v3.AlertProto
              .internal_static_google_monitoring_v3_AlertPolicy_Condition_MetricAbsence_descriptor;
        }

        @java.lang.Override
        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
            internalGetFieldAccessorTable() {
          return com.google.monitoring.v3.AlertProto
              .internal_static_google_monitoring_v3_AlertPolicy_Condition_MetricAbsence_fieldAccessorTable
              .ensureFieldAccessorsInitialized(
                  com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.class,
                  com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.Builder.class);
        }

        // Construct using com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.newBuilder()
        private Builder() {
          maybeForceBuilderInitialization();
        }

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

        private void maybeForceBuilderInitialization() {
          if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {
            getAggregationsFieldBuilder();
          }
        }

        @java.lang.Override
        public Builder clear() {
          super.clear();
          filter_ = "";

          if (aggregationsBuilder_ == null) {
            aggregations_ = java.util.Collections.emptyList();
            bitField0_ = (bitField0_ & ~0x00000002);
          } else {
            aggregationsBuilder_.clear();
          }
          if (durationBuilder_ == null) {
            duration_ = null;
          } else {
            duration_ = null;
            durationBuilder_ = null;
          }
          if (triggerBuilder_ == null) {
            trigger_ = null;
          } else {
            trigger_ = null;
            triggerBuilder_ = null;
          }
          return this;
        }

        @java.lang.Override
        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
          return com.google.monitoring.v3.AlertProto
              .internal_static_google_monitoring_v3_AlertPolicy_Condition_MetricAbsence_descriptor;
        }

        @java.lang.Override
        public com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence
            getDefaultInstanceForType() {
          return com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.getDefaultInstance();
        }

        @java.lang.Override
        public com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence build() {
          com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence result = buildPartial();
          if (!result.isInitialized()) {
            throw newUninitializedMessageException(result);
          }
          return result;
        }

        @java.lang.Override
        public com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence buildPartial() {
          com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence result =
              new com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence(this);
          int from_bitField0_ = bitField0_;
          int to_bitField0_ = 0;
          result.filter_ = filter_;
          if (aggregationsBuilder_ == null) {
            if (((bitField0_ & 0x00000002) == 0x00000002)) {
              aggregations_ = java.util.Collections.unmodifiableList(aggregations_);
              bitField0_ = (bitField0_ & ~0x00000002);
            }
            result.aggregations_ = aggregations_;
          } else {
            result.aggregations_ = aggregationsBuilder_.build();
          }
          if (durationBuilder_ == null) {
            result.duration_ = duration_;
          } else {
            result.duration_ = durationBuilder_.build();
          }
          if (triggerBuilder_ == null) {
            result.trigger_ = trigger_;
          } else {
            result.trigger_ = triggerBuilder_.build();
          }
          result.bitField0_ = to_bitField0_;
          onBuilt();
          return result;
        }

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

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

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

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

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

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

        @java.lang.Override
        public Builder mergeFrom(com.google.protobuf.Message other) {
          if (other instanceof com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence) {
            return mergeFrom((com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence) other);
          } else {
            super.mergeFrom(other);
            return this;
          }
        }

        public Builder mergeFrom(
            com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence other) {
          if (other
              == com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.getDefaultInstance())
            return this;
          if (!other.getFilter().isEmpty()) {
            filter_ = other.filter_;
            onChanged();
          }
          if (aggregationsBuilder_ == null) {
            if (!other.aggregations_.isEmpty()) {
              if (aggregations_.isEmpty()) {
                aggregations_ = other.aggregations_;
                bitField0_ = (bitField0_ & ~0x00000002);
              } else {
                ensureAggregationsIsMutable();
                aggregations_.addAll(other.aggregations_);
              }
              onChanged();
            }
          } else {
            if (!other.aggregations_.isEmpty()) {
              if (aggregationsBuilder_.isEmpty()) {
                aggregationsBuilder_.dispose();
                aggregationsBuilder_ = null;
                aggregations_ = other.aggregations_;
                bitField0_ = (bitField0_ & ~0x00000002);
                aggregationsBuilder_ =
                    com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                        ? getAggregationsFieldBuilder()
                        : null;
              } else {
                aggregationsBuilder_.addAllMessages(other.aggregations_);
              }
            }
          }
          if (other.hasDuration()) {
            mergeDuration(other.getDuration());
          }
          if (other.hasTrigger()) {
            mergeTrigger(other.getTrigger());
          }
          this.mergeUnknownFields(other.unknownFields);
          onChanged();
          return this;
        }

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

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

        private int bitField0_;

        private java.lang.Object filter_ = "";
        /**
         *
         *
         * <pre>
         * A [filter](/monitoring/api/v3/filters) that
         * identifies which time series should be compared with the threshold.
         * The filter is similar to the one that is specified in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
         * call is useful to verify the time series that will be retrieved /
         * processed) and must specify the metric type and optionally may contain
         * restrictions on resource type, resource labels, and metric labels.
         * This field may not exceed 2048 Unicode characters in length.
         * </pre>
         *
         * <code>string filter = 1;</code>
         */
        public java.lang.String getFilter() {
          java.lang.Object ref = filter_;
          if (!(ref instanceof java.lang.String)) {
            com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
            java.lang.String s = bs.toStringUtf8();
            filter_ = s;
            return s;
          } else {
            return (java.lang.String) ref;
          }
        }
        /**
         *
         *
         * <pre>
         * A [filter](/monitoring/api/v3/filters) that
         * identifies which time series should be compared with the threshold.
         * The filter is similar to the one that is specified in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
         * call is useful to verify the time series that will be retrieved /
         * processed) and must specify the metric type and optionally may contain
         * restrictions on resource type, resource labels, and metric labels.
         * This field may not exceed 2048 Unicode characters in length.
         * </pre>
         *
         * <code>string filter = 1;</code>
         */
        public com.google.protobuf.ByteString getFilterBytes() {
          java.lang.Object ref = filter_;
          if (ref instanceof String) {
            com.google.protobuf.ByteString b =
                com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
            filter_ = b;
            return b;
          } else {
            return (com.google.protobuf.ByteString) ref;
          }
        }
        /**
         *
         *
         * <pre>
         * A [filter](/monitoring/api/v3/filters) that
         * identifies which time series should be compared with the threshold.
         * The filter is similar to the one that is specified in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
         * call is useful to verify the time series that will be retrieved /
         * processed) and must specify the metric type and optionally may contain
         * restrictions on resource type, resource labels, and metric labels.
         * This field may not exceed 2048 Unicode characters in length.
         * </pre>
         *
         * <code>string filter = 1;</code>
         */
        public Builder setFilter(java.lang.String value) {
          if (value == null) {
            throw new NullPointerException();
          }

          filter_ = value;
          onChanged();
          return this;
        }
        /**
         *
         *
         * <pre>
         * A [filter](/monitoring/api/v3/filters) that
         * identifies which time series should be compared with the threshold.
         * The filter is similar to the one that is specified in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
         * call is useful to verify the time series that will be retrieved /
         * processed) and must specify the metric type and optionally may contain
         * restrictions on resource type, resource labels, and metric labels.
         * This field may not exceed 2048 Unicode characters in length.
         * </pre>
         *
         * <code>string filter = 1;</code>
         */
        public Builder clearFilter() {

          filter_ = getDefaultInstance().getFilter();
          onChanged();
          return this;
        }
        /**
         *
         *
         * <pre>
         * A [filter](/monitoring/api/v3/filters) that
         * identifies which time series should be compared with the threshold.
         * The filter is similar to the one that is specified in the
         * [`MetricService.ListTimeSeries`
         * request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
         * call is useful to verify the time series that will be retrieved /
         * processed) and must specify the metric type and optionally may contain
         * restrictions on resource type, resource labels, and metric labels.
         * This field may not exceed 2048 Unicode characters in length.
         * </pre>
         *
         * <code>string filter = 1;</code>
         */
        public Builder setFilterBytes(com.google.protobuf.ByteString value) {
          if (value == null) {
            throw new NullPointerException();
          }
          checkByteStringIsUtf8(value);

          filter_ = value;
          onChanged();
          return this;
        }

        private java.util.List<com.google.monitoring.v3.Aggregation> aggregations_ =
            java.util.Collections.emptyList();

        private void ensureAggregationsIsMutable() {
          if (!((bitField0_ & 0x00000002) == 0x00000002)) {
            aggregations_ =
                new java.util.ArrayList<com.google.monitoring.v3.Aggregation>(aggregations_);
            bitField0_ |= 0x00000002;
          }
        }

        private com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.monitoring.v3.Aggregation,
                com.google.monitoring.v3.Aggregation.Builder,
                com.google.monitoring.v3.AggregationOrBuilder>
            aggregationsBuilder_;

        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public java.util.List<com.google.monitoring.v3.Aggregation> getAggregationsList() {
          if (aggregationsBuilder_ == null) {
            return java.util.Collections.unmodifiableList(aggregations_);
          } else {
            return aggregationsBuilder_.getMessageList();
          }
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public int getAggregationsCount() {
          if (aggregationsBuilder_ == null) {
            return aggregations_.size();
          } else {
            return aggregationsBuilder_.getCount();
          }
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public com.google.monitoring.v3.Aggregation getAggregations(int index) {
          if (aggregationsBuilder_ == null) {
            return aggregations_.get(index);
          } else {
            return aggregationsBuilder_.getMessage(index);
          }
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public Builder setAggregations(int index, com.google.monitoring.v3.Aggregation value) {
          if (aggregationsBuilder_ == null) {
            if (value == null) {
              throw new NullPointerException();
            }
            ensureAggregationsIsMutable();
            aggregations_.set(index, value);
            onChanged();
          } else {
            aggregationsBuilder_.setMessage(index, value);
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public Builder setAggregations(
            int index, com.google.monitoring.v3.Aggregation.Builder builderForValue) {
          if (aggregationsBuilder_ == null) {
            ensureAggregationsIsMutable();
            aggregations_.set(index, builderForValue.build());
            onChanged();
          } else {
            aggregationsBuilder_.setMessage(index, builderForValue.build());
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public Builder addAggregations(com.google.monitoring.v3.Aggregation value) {
          if (aggregationsBuilder_ == null) {
            if (value == null) {
              throw new NullPointerException();
            }
            ensureAggregationsIsMutable();
            aggregations_.add(value);
            onChanged();
          } else {
            aggregationsBuilder_.addMessage(value);
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public Builder addAggregations(int index, com.google.monitoring.v3.Aggregation value) {
          if (aggregationsBuilder_ == null) {
            if (value == null) {
              throw new NullPointerException();
            }
            ensureAggregationsIsMutable();
            aggregations_.add(index, value);
            onChanged();
          } else {
            aggregationsBuilder_.addMessage(index, value);
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public Builder addAggregations(
            com.google.monitoring.v3.Aggregation.Builder builderForValue) {
          if (aggregationsBuilder_ == null) {
            ensureAggregationsIsMutable();
            aggregations_.add(builderForValue.build());
            onChanged();
          } else {
            aggregationsBuilder_.addMessage(builderForValue.build());
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public Builder addAggregations(
            int index, com.google.monitoring.v3.Aggregation.Builder builderForValue) {
          if (aggregationsBuilder_ == null) {
            ensureAggregationsIsMutable();
            aggregations_.add(index, builderForValue.build());
            onChanged();
          } else {
            aggregationsBuilder_.addMessage(index, builderForValue.build());
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public Builder addAllAggregations(
            java.lang.Iterable<? extends com.google.monitoring.v3.Aggregation> values) {
          if (aggregationsBuilder_ == null) {
            ensureAggregationsIsMutable();
            com.google.protobuf.AbstractMessageLite.Builder.addAll(values, aggregations_);
            onChanged();
          } else {
            aggregationsBuilder_.addAllMessages(values);
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public Builder clearAggregations() {
          if (aggregationsBuilder_ == null) {
            aggregations_ = java.util.Collections.emptyList();
            bitField0_ = (bitField0_ & ~0x00000002);
            onChanged();
          } else {
            aggregationsBuilder_.clear();
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public Builder removeAggregations(int index) {
          if (aggregationsBuilder_ == null) {
            ensureAggregationsIsMutable();
            aggregations_.remove(index);
            onChanged();
          } else {
            aggregationsBuilder_.remove(index);
          }
          return this;
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public com.google.monitoring.v3.Aggregation.Builder getAggregationsBuilder(int index) {
          return getAggregationsFieldBuilder().getBuilder(index);
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public com.google.monitoring.v3.AggregationOrBuilder getAggregationsOrBuilder(int index) {
          if (aggregationsBuilder_ == null) {
            return aggregations_.get(index);
          } else {
            return aggregationsBuilder_.getMessageOrBuilder(index);
          }
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public java.util.List<? extends com.google.monitoring.v3.AggregationOrBuilder>
            getAggregationsOrBuilderList() {
          if (aggregationsBuilder_ != null) {
            return aggregationsBuilder_.getMessageOrBuilderList();
          } else {
            return java.util.Collections.unmodifiableList(aggregations_);
          }
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public com.google.monitoring.v3.Aggregation.Builder addAggregationsBuilder() {
          return getAggregationsFieldBuilder()
              .addBuilder(com.google.monitoring.v3.Aggregation.getDefaultInstance());
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public com.google.monitoring.v3.Aggregation.Builder addAggregationsBuilder(int index) {
          return getAggregationsFieldBuilder()
              .addBuilder(index, com.google.monitoring.v3.Aggregation.getDefaultInstance());
        }
        /**
         *
         *
         * <pre>
         * Specifies the alignment of data points in individual time series as
         * well as how to combine the retrieved time series together (such as
         * when aggregating multiple streams on each resource to a single
         * stream for each resource or when aggregating streams across all
         * members of a group of resrouces). Multiple aggregations
         * are applied in the order specified.
         * This field is similar to the
         * one in the [`MetricService.ListTimeSeries` request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
         * It is advisable to use the `ListTimeSeries` method when debugging this field.
         * </pre>
         *
         * <code>repeated .google.monitoring.v3.Aggregation aggregations = 5;</code>
         */
        public java.util.List<com.google.monitoring.v3.Aggregation.Builder>
            getAggregationsBuilderList() {
          return getAggregationsFieldBuilder().getBuilderList();
        }

        private com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.monitoring.v3.Aggregation,
                com.google.monitoring.v3.Aggregation.Builder,
                com.google.monitoring.v3.AggregationOrBuilder>
            getAggregationsFieldBuilder() {
          if (aggregationsBuilder_ == null) {
            aggregationsBuilder_ =
                new com.google.protobuf.RepeatedFieldBuilderV3<
                    com.google.monitoring.v3.Aggregation,
                    com.google.monitoring.v3.Aggregation.Builder,
                    com.google.monitoring.v3.AggregationOrBuilder>(
                    aggregations_,
                    ((bitField0_ & 0x00000002) == 0x00000002),
                    getParentForChildren(),
                    isClean());
            aggregations_ = null;
          }
          return aggregationsBuilder_;
        }

        private com.google.protobuf.Duration duration_ = null;
        private com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Duration,
                com.google.protobuf.Duration.Builder,
                com.google.protobuf.DurationOrBuilder>
            durationBuilder_;
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must fail to report new
         * data to be considered failing. Currently, only values that
         * are a multiple of a minute--e.g.  60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. The `Duration.nanos` field is
         * ignored.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 2;</code>
         */
        public boolean hasDuration() {
          return durationBuilder_ != null || duration_ != null;
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must fail to report new
         * data to be considered failing. Currently, only values that
         * are a multiple of a minute--e.g.  60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. The `Duration.nanos` field is
         * ignored.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 2;</code>
         */
        public com.google.protobuf.Duration getDuration() {
          if (durationBuilder_ == null) {
            return duration_ == null
                ? com.google.protobuf.Duration.getDefaultInstance()
                : duration_;
          } else {
            return durationBuilder_.getMessage();
          }
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must fail to report new
         * data to be considered failing. Currently, only values that
         * are a multiple of a minute--e.g.  60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. The `Duration.nanos` field is
         * ignored.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 2;</code>
         */
        public Builder setDuration(com.google.protobuf.Duration value) {
          if (durationBuilder_ == null) {
            if (value == null) {
              throw new NullPointerException();
            }
            duration_ = value;
            onChanged();
          } else {
            durationBuilder_.setMessage(value);
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must fail to report new
         * data to be considered failing. Currently, only values that
         * are a multiple of a minute--e.g.  60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. The `Duration.nanos` field is
         * ignored.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 2;</code>
         */
        public Builder setDuration(com.google.protobuf.Duration.Builder builderForValue) {
          if (durationBuilder_ == null) {
            duration_ = builderForValue.build();
            onChanged();
          } else {
            durationBuilder_.setMessage(builderForValue.build());
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must fail to report new
         * data to be considered failing. Currently, only values that
         * are a multiple of a minute--e.g.  60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. The `Duration.nanos` field is
         * ignored.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 2;</code>
         */
        public Builder mergeDuration(com.google.protobuf.Duration value) {
          if (durationBuilder_ == null) {
            if (duration_ != null) {
              duration_ =
                  com.google.protobuf.Duration.newBuilder(duration_)
                      .mergeFrom(value)
                      .buildPartial();
            } else {
              duration_ = value;
            }
            onChanged();
          } else {
            durationBuilder_.mergeFrom(value);
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must fail to report new
         * data to be considered failing. Currently, only values that
         * are a multiple of a minute--e.g.  60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. The `Duration.nanos` field is
         * ignored.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 2;</code>
         */
        public Builder clearDuration() {
          if (durationBuilder_ == null) {
            duration_ = null;
            onChanged();
          } else {
            duration_ = null;
            durationBuilder_ = null;
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must fail to report new
         * data to be considered failing. Currently, only values that
         * are a multiple of a minute--e.g.  60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. The `Duration.nanos` field is
         * ignored.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 2;</code>
         */
        public com.google.protobuf.Duration.Builder getDurationBuilder() {

          onChanged();
          return getDurationFieldBuilder().getBuilder();
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must fail to report new
         * data to be considered failing. Currently, only values that
         * are a multiple of a minute--e.g.  60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. The `Duration.nanos` field is
         * ignored.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 2;</code>
         */
        public com.google.protobuf.DurationOrBuilder getDurationOrBuilder() {
          if (durationBuilder_ != null) {
            return durationBuilder_.getMessageOrBuilder();
          } else {
            return duration_ == null
                ? com.google.protobuf.Duration.getDefaultInstance()
                : duration_;
          }
        }
        /**
         *
         *
         * <pre>
         * The amount of time that a time series must fail to report new
         * data to be considered failing. Currently, only values that
         * are a multiple of a minute--e.g.  60, 120, or 300
         * seconds--are supported. If an invalid value is given, an
         * error will be returned. The `Duration.nanos` field is
         * ignored.
         * </pre>
         *
         * <code>.google.protobuf.Duration duration = 2;</code>
         */
        private com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Duration,
                com.google.protobuf.Duration.Builder,
                com.google.protobuf.DurationOrBuilder>
            getDurationFieldBuilder() {
          if (durationBuilder_ == null) {
            durationBuilder_ =
                new com.google.protobuf.SingleFieldBuilderV3<
                    com.google.protobuf.Duration,
                    com.google.protobuf.Duration.Builder,
                    com.google.protobuf.DurationOrBuilder>(
                    getDuration(), getParentForChildren(), isClean());
            duration_ = null;
          }
          return durationBuilder_;
        }

        private com.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger_ = null;
        private com.google.protobuf.SingleFieldBuilderV3<
                com.google.monitoring.v3.AlertPolicy.Condition.Trigger,
                com.google.monitoring.v3.AlertPolicy.Condition.Trigger.Builder,
                com.google.monitoring.v3.AlertPolicy.Condition.TriggerOrBuilder>
            triggerBuilder_;
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3;</code>
         */
        public boolean hasTrigger() {
          return triggerBuilder_ != null || trigger_ != null;
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3;</code>
         */
        public com.google.monitoring.v3.AlertPolicy.Condition.Trigger getTrigger() {
          if (triggerBuilder_ == null) {
            return trigger_ == null
                ? com.google.monitoring.v3.AlertPolicy.Condition.Trigger.getDefaultInstance()
                : trigger_;
          } else {
            return triggerBuilder_.getMessage();
          }
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3;</code>
         */
        public Builder setTrigger(com.google.monitoring.v3.AlertPolicy.Condition.Trigger value) {
          if (triggerBuilder_ == null) {
            if (value == null) {
              throw new NullPointerException();
            }
            trigger_ = value;
            onChanged();
          } else {
            triggerBuilder_.setMessage(value);
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3;</code>
         */
        public Builder setTrigger(
            com.google.monitoring.v3.AlertPolicy.Condition.Trigger.Builder builderForValue) {
          if (triggerBuilder_ == null) {
            trigger_ = builderForValue.build();
            onChanged();
          } else {
            triggerBuilder_.setMessage(builderForValue.build());
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3;</code>
         */
        public Builder mergeTrigger(com.google.monitoring.v3.AlertPolicy.Condition.Trigger value) {
          if (triggerBuilder_ == null) {
            if (trigger_ != null) {
              trigger_ =
                  com.google.monitoring.v3.AlertPolicy.Condition.Trigger.newBuilder(trigger_)
                      .mergeFrom(value)
                      .buildPartial();
            } else {
              trigger_ = value;
            }
            onChanged();
          } else {
            triggerBuilder_.mergeFrom(value);
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3;</code>
         */
        public Builder clearTrigger() {
          if (triggerBuilder_ == null) {
            trigger_ = null;
            onChanged();
          } else {
            trigger_ = null;
            triggerBuilder_ = null;
          }

          return this;
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3;</code>
         */
        public com.google.monitoring.v3.AlertPolicy.Condition.Trigger.Builder getTriggerBuilder() {

          onChanged();
          return getTriggerFieldBuilder().getBuilder();
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3;</code>
         */
        public com.google.monitoring.v3.AlertPolicy.Condition.TriggerOrBuilder
            getTriggerOrBuilder() {
          if (triggerBuilder_ != null) {
            return triggerBuilder_.getMessageOrBuilder();
          } else {
            return trigger_ == null
                ? com.google.monitoring.v3.AlertPolicy.Condition.Trigger.getDefaultInstance()
                : trigger_;
          }
        }
        /**
         *
         *
         * <pre>
         * The number/percent of time series for which the comparison must hold
         * in order for the condition to trigger. If unspecified, then the
         * condition will trigger if the comparison is true for any of the
         * time series that have been identified by `filter` and `aggregations`.
         * </pre>
         *
         * <code>.google.monitoring.v3.AlertPolicy.Condition.Trigger trigger = 3;</code>
         */
        private com.google.protobuf.SingleFieldBuilderV3<
                com.google.monitoring.v3.AlertPolicy.Condition.Trigger,
                com.google.monitoring.v3.AlertPolicy.Condition.Trigger.Builder,
                com.google.monitoring.v3.AlertPolicy.Condition.TriggerOrBuilder>
            getTriggerFieldBuilder() {
          if (triggerBuilder_ == null) {
            triggerBuilder_ =
                new com.google.protobuf.SingleFieldBuilderV3<
                    com.google.monitoring.v3.AlertPolicy.Condition.Trigger,
                    com.google.monitoring.v3.AlertPolicy.Condition.Trigger.Builder,
                    com.google.monitoring.v3.AlertPolicy.Condition.TriggerOrBuilder>(
                    getTrigger(), getParentForChildren(), isClean());
            trigger_ = null;
          }
          return triggerBuilder_;
        }

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

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

        // @@protoc_insertion_point(builder_scope:google.monitoring.v3.AlertPolicy.Condition.MetricAbsence)
      }

      // @@protoc_insertion_point(class_scope:google.monitoring.v3.AlertPolicy.Condition.MetricAbsence)
      private static final com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence
          DEFAULT_INSTANCE;

      static {
        DEFAULT_INSTANCE = new com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence();
      }

      public static com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence
          getDefaultInstance() {
        return DEFAULT_INSTANCE;
      }

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

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

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

      @java.lang.Override
      public com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence
          getDefaultInstanceForType() {
        return DEFAULT_INSTANCE;
      }
    }

    private int conditionCase_ = 0;
    private java.lang.Object condition_;

    public enum ConditionCase implements com.google.protobuf.Internal.EnumLite {
      CONDITION_THRESHOLD(1),
      CONDITION_ABSENT(2),
      CONDITION_NOT_SET(0);
      private final int value;

      private ConditionCase(int value) {
        this.value = value;
      }
      /** @deprecated Use {@link #forNumber(int)} instead. */
      @java.lang.Deprecated
      public static ConditionCase valueOf(int value) {
        return forNumber(value);
      }

      public static ConditionCase forNumber(int value) {
        switch (value) {
          case 1:
            return CONDITION_THRESHOLD;
          case 2:
            return CONDITION_ABSENT;
          case 0:
            return CONDITION_NOT_SET;
          default:
            return null;
        }
      }

      public int getNumber() {
        return this.value;
      }
    };

    public ConditionCase getConditionCase() {
      return ConditionCase.forNumber(conditionCase_);
    }

    public static final int NAME_FIELD_NUMBER = 12;
    private volatile java.lang.Object name_;
    /**
     *
     *
     * <pre>
     * Required if the condition exists. The unique resource name for this
     * condition. Its syntax is:
     *     projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
     * `[CONDITION_ID]` is assigned by Stackdriver Monitoring when the
     * condition is created as part of a new or updated alerting policy.
     * When calling the
     * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
     * method, do not include the `name` field in the conditions of the
     * requested alerting policy. Stackdriver Monitoring creates the
     * condition identifiers and includes them in the new policy.
     * When calling the
     * [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]
     * method to update a policy, including a condition `name` causes the
     * existing condition to be updated. Conditions without names are added to
     * the updated policy. Existing conditions are deleted if they are not
     * updated.
     * Best practice is to preserve `[CONDITION_ID]` if you make only small
     * changes, such as those to condition thresholds, durations, or trigger
     * values.  Otherwise, treat the change as a new condition and let the
     * existing condition be deleted.
     * </pre>
     *
     * <code>string name = 12;</code>
     */
    public java.lang.String getName() {
      java.lang.Object ref = name_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        name_ = s;
        return s;
      }
    }
    /**
     *
     *
     * <pre>
     * Required if the condition exists. The unique resource name for this
     * condition. Its syntax is:
     *     projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
     * `[CONDITION_ID]` is assigned by Stackdriver Monitoring when the
     * condition is created as part of a new or updated alerting policy.
     * When calling the
     * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
     * method, do not include the `name` field in the conditions of the
     * requested alerting policy. Stackdriver Monitoring creates the
     * condition identifiers and includes them in the new policy.
     * When calling the
     * [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]
     * method to update a policy, including a condition `name` causes the
     * existing condition to be updated. Conditions without names are added to
     * the updated policy. Existing conditions are deleted if they are not
     * updated.
     * Best practice is to preserve `[CONDITION_ID]` if you make only small
     * changes, such as those to condition thresholds, durations, or trigger
     * values.  Otherwise, treat the change as a new condition and let the
     * existing condition be deleted.
     * </pre>
     *
     * <code>string name = 12;</code>
     */
    public com.google.protobuf.ByteString getNameBytes() {
      java.lang.Object ref = name_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        name_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int DISPLAY_NAME_FIELD_NUMBER = 6;
    private volatile java.lang.Object displayName_;
    /**
     *
     *
     * <pre>
     * A short name or phrase used to identify the condition in dashboards,
     * notifications, and incidents. To avoid confusion, don't use the same
     * display name for multiple conditions in the same policy.
     * </pre>
     *
     * <code>string display_name = 6;</code>
     */
    public java.lang.String getDisplayName() {
      java.lang.Object ref = displayName_;
      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();
        displayName_ = s;
        return s;
      }
    }
    /**
     *
     *
     * <pre>
     * A short name or phrase used to identify the condition in dashboards,
     * notifications, and incidents. To avoid confusion, don't use the same
     * display name for multiple conditions in the same policy.
     * </pre>
     *
     * <code>string display_name = 6;</code>
     */
    public com.google.protobuf.ByteString getDisplayNameBytes() {
      java.lang.Object ref = displayName_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        displayName_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int CONDITION_THRESHOLD_FIELD_NUMBER = 1;
    /**
     *
     *
     * <pre>
     * A condition that compares a time series against a threshold.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;
     * </code>
     */
    public boolean hasConditionThreshold() {
      return conditionCase_ == 1;
    }
    /**
     *
     *
     * <pre>
     * A condition that compares a time series against a threshold.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;
     * </code>
     */
    public com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold getConditionThreshold() {
      if (conditionCase_ == 1) {
        return (com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold) condition_;
      }
      return com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.getDefaultInstance();
    }
    /**
     *
     *
     * <pre>
     * A condition that compares a time series against a threshold.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;
     * </code>
     */
    public com.google.monitoring.v3.AlertPolicy.Condition.MetricThresholdOrBuilder
        getConditionThresholdOrBuilder() {
      if (conditionCase_ == 1) {
        return (com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold) condition_;
      }
      return com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.getDefaultInstance();
    }

    public static final int CONDITION_ABSENT_FIELD_NUMBER = 2;
    /**
     *
     *
     * <pre>
     * A condition that checks that a time series continues to
     * receive new data points.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;</code>
     */
    public boolean hasConditionAbsent() {
      return conditionCase_ == 2;
    }
    /**
     *
     *
     * <pre>
     * A condition that checks that a time series continues to
     * receive new data points.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;</code>
     */
    public com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence getConditionAbsent() {
      if (conditionCase_ == 2) {
        return (com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence) condition_;
      }
      return com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.getDefaultInstance();
    }
    /**
     *
     *
     * <pre>
     * A condition that checks that a time series continues to
     * receive new data points.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;</code>
     */
    public com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsenceOrBuilder
        getConditionAbsentOrBuilder() {
      if (conditionCase_ == 2) {
        return (com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence) condition_;
      }
      return com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.getDefaultInstance();
    }

    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 (conditionCase_ == 1) {
        output.writeMessage(
            1, (com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold) condition_);
      }
      if (conditionCase_ == 2) {
        output.writeMessage(
            2, (com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence) condition_);
      }
      if (!getDisplayNameBytes().isEmpty()) {
        com.google.protobuf.GeneratedMessageV3.writeString(output, 6, displayName_);
      }
      if (!getNameBytes().isEmpty()) {
        com.google.protobuf.GeneratedMessageV3.writeString(output, 12, name_);
      }
      unknownFields.writeTo(output);
    }

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

      size = 0;
      if (conditionCase_ == 1) {
        size +=
            com.google.protobuf.CodedOutputStream.computeMessageSize(
                1, (com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold) condition_);
      }
      if (conditionCase_ == 2) {
        size +=
            com.google.protobuf.CodedOutputStream.computeMessageSize(
                2, (com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence) condition_);
      }
      if (!getDisplayNameBytes().isEmpty()) {
        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, displayName_);
      }
      if (!getNameBytes().isEmpty()) {
        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(12, name_);
      }
      size += unknownFields.getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
      if (obj == this) {
        return true;
      }
      if (!(obj instanceof com.google.monitoring.v3.AlertPolicy.Condition)) {
        return super.equals(obj);
      }
      com.google.monitoring.v3.AlertPolicy.Condition other =
          (com.google.monitoring.v3.AlertPolicy.Condition) obj;

      boolean result = true;
      result = result && getName().equals(other.getName());
      result = result && getDisplayName().equals(other.getDisplayName());
      result = result && getConditionCase().equals(other.getConditionCase());
      if (!result) return false;
      switch (conditionCase_) {
        case 1:
          result = result && getConditionThreshold().equals(other.getConditionThreshold());
          break;
        case 2:
          result = result && getConditionAbsent().equals(other.getConditionAbsent());
          break;
        case 0:
        default:
      }
      result = result && unknownFields.equals(other.unknownFields);
      return result;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      hash = (37 * hash) + NAME_FIELD_NUMBER;
      hash = (53 * hash) + getName().hashCode();
      hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER;
      hash = (53 * hash) + getDisplayName().hashCode();
      switch (conditionCase_) {
        case 1:
          hash = (37 * hash) + CONDITION_THRESHOLD_FIELD_NUMBER;
          hash = (53 * hash) + getConditionThreshold().hashCode();
          break;
        case 2:
          hash = (37 * hash) + CONDITION_ABSENT_FIELD_NUMBER;
          hash = (53 * hash) + getConditionAbsent().hashCode();
          break;
        case 0:
        default:
      }
      hash = (29 * hash) + unknownFields.hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.google.monitoring.v3.AlertPolicy.Condition parseFrom(java.nio.ByteBuffer data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.monitoring.v3.AlertPolicy.Condition parseFrom(
        java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.monitoring.v3.AlertPolicy.Condition parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.monitoring.v3.AlertPolicy.Condition 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.monitoring.v3.AlertPolicy.Condition parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }

    public static com.google.monitoring.v3.AlertPolicy.Condition parseFrom(
        byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }

    public static com.google.monitoring.v3.AlertPolicy.Condition parseFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static com.google.monitoring.v3.AlertPolicy.Condition 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.monitoring.v3.AlertPolicy.Condition parseDelimitedFrom(
        java.io.InputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
    }

    public static com.google.monitoring.v3.AlertPolicy.Condition 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.monitoring.v3.AlertPolicy.Condition parseFrom(
        com.google.protobuf.CodedInputStream input) throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
    }

    public static com.google.monitoring.v3.AlertPolicy.Condition 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.monitoring.v3.AlertPolicy.Condition 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 condition is a true/false test that determines when an alerting policy
     * should open an incident. If a condition evaluates to true, it signifies
     * that something is wrong.
     * </pre>
     *
     * Protobuf type {@code google.monitoring.v3.AlertPolicy.Condition}
     */
    public static final class Builder
        extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.monitoring.v3.AlertPolicy.Condition)
        com.google.monitoring.v3.AlertPolicy.ConditionOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.monitoring.v3.AlertProto
            .internal_static_google_monitoring_v3_AlertPolicy_Condition_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.monitoring.v3.AlertProto
            .internal_static_google_monitoring_v3_AlertPolicy_Condition_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.monitoring.v3.AlertPolicy.Condition.class,
                com.google.monitoring.v3.AlertPolicy.Condition.Builder.class);
      }

      // Construct using com.google.monitoring.v3.AlertPolicy.Condition.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

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

      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
      }

      @java.lang.Override
      public Builder clear() {
        super.clear();
        name_ = "";

        displayName_ = "";

        conditionCase_ = 0;
        condition_ = null;
        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
        return com.google.monitoring.v3.AlertProto
            .internal_static_google_monitoring_v3_AlertPolicy_Condition_descriptor;
      }

      @java.lang.Override
      public com.google.monitoring.v3.AlertPolicy.Condition getDefaultInstanceForType() {
        return com.google.monitoring.v3.AlertPolicy.Condition.getDefaultInstance();
      }

      @java.lang.Override
      public com.google.monitoring.v3.AlertPolicy.Condition build() {
        com.google.monitoring.v3.AlertPolicy.Condition result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.google.monitoring.v3.AlertPolicy.Condition buildPartial() {
        com.google.monitoring.v3.AlertPolicy.Condition result =
            new com.google.monitoring.v3.AlertPolicy.Condition(this);
        result.name_ = name_;
        result.displayName_ = displayName_;
        if (conditionCase_ == 1) {
          if (conditionThresholdBuilder_ == null) {
            result.condition_ = condition_;
          } else {
            result.condition_ = conditionThresholdBuilder_.build();
          }
        }
        if (conditionCase_ == 2) {
          if (conditionAbsentBuilder_ == null) {
            result.condition_ = condition_;
          } else {
            result.condition_ = conditionAbsentBuilder_.build();
          }
        }
        result.conditionCase_ = conditionCase_;
        onBuilt();
        return result;
      }

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

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

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

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

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

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

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.google.monitoring.v3.AlertPolicy.Condition) {
          return mergeFrom((com.google.monitoring.v3.AlertPolicy.Condition) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.google.monitoring.v3.AlertPolicy.Condition other) {
        if (other == com.google.monitoring.v3.AlertPolicy.Condition.getDefaultInstance())
          return this;
        if (!other.getName().isEmpty()) {
          name_ = other.name_;
          onChanged();
        }
        if (!other.getDisplayName().isEmpty()) {
          displayName_ = other.displayName_;
          onChanged();
        }
        switch (other.getConditionCase()) {
          case CONDITION_THRESHOLD:
            {
              mergeConditionThreshold(other.getConditionThreshold());
              break;
            }
          case CONDITION_ABSENT:
            {
              mergeConditionAbsent(other.getConditionAbsent());
              break;
            }
          case CONDITION_NOT_SET:
            {
              break;
            }
        }
        this.mergeUnknownFields(other.unknownFields);
        onChanged();
        return this;
      }

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

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

      private int conditionCase_ = 0;
      private java.lang.Object condition_;

      public ConditionCase getConditionCase() {
        return ConditionCase.forNumber(conditionCase_);
      }

      public Builder clearCondition() {
        conditionCase_ = 0;
        condition_ = null;
        onChanged();
        return this;
      }

      private java.lang.Object name_ = "";
      /**
       *
       *
       * <pre>
       * Required if the condition exists. The unique resource name for this
       * condition. Its syntax is:
       *     projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
       * `[CONDITION_ID]` is assigned by Stackdriver Monitoring when the
       * condition is created as part of a new or updated alerting policy.
       * When calling the
       * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
       * method, do not include the `name` field in the conditions of the
       * requested alerting policy. Stackdriver Monitoring creates the
       * condition identifiers and includes them in the new policy.
       * When calling the
       * [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]
       * method to update a policy, including a condition `name` causes the
       * existing condition to be updated. Conditions without names are added to
       * the updated policy. Existing conditions are deleted if they are not
       * updated.
       * Best practice is to preserve `[CONDITION_ID]` if you make only small
       * changes, such as those to condition thresholds, durations, or trigger
       * values.  Otherwise, treat the change as a new condition and let the
       * existing condition be deleted.
       * </pre>
       *
       * <code>string name = 12;</code>
       */
      public java.lang.String getName() {
        java.lang.Object ref = name_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          name_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }
      /**
       *
       *
       * <pre>
       * Required if the condition exists. The unique resource name for this
       * condition. Its syntax is:
       *     projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
       * `[CONDITION_ID]` is assigned by Stackdriver Monitoring when the
       * condition is created as part of a new or updated alerting policy.
       * When calling the
       * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
       * method, do not include the `name` field in the conditions of the
       * requested alerting policy. Stackdriver Monitoring creates the
       * condition identifiers and includes them in the new policy.
       * When calling the
       * [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]
       * method to update a policy, including a condition `name` causes the
       * existing condition to be updated. Conditions without names are added to
       * the updated policy. Existing conditions are deleted if they are not
       * updated.
       * Best practice is to preserve `[CONDITION_ID]` if you make only small
       * changes, such as those to condition thresholds, durations, or trigger
       * values.  Otherwise, treat the change as a new condition and let the
       * existing condition be deleted.
       * </pre>
       *
       * <code>string name = 12;</code>
       */
      public com.google.protobuf.ByteString getNameBytes() {
        java.lang.Object ref = name_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          name_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       *
       *
       * <pre>
       * Required if the condition exists. The unique resource name for this
       * condition. Its syntax is:
       *     projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
       * `[CONDITION_ID]` is assigned by Stackdriver Monitoring when the
       * condition is created as part of a new or updated alerting policy.
       * When calling the
       * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
       * method, do not include the `name` field in the conditions of the
       * requested alerting policy. Stackdriver Monitoring creates the
       * condition identifiers and includes them in the new policy.
       * When calling the
       * [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]
       * method to update a policy, including a condition `name` causes the
       * existing condition to be updated. Conditions without names are added to
       * the updated policy. Existing conditions are deleted if they are not
       * updated.
       * Best practice is to preserve `[CONDITION_ID]` if you make only small
       * changes, such as those to condition thresholds, durations, or trigger
       * values.  Otherwise, treat the change as a new condition and let the
       * existing condition be deleted.
       * </pre>
       *
       * <code>string name = 12;</code>
       */
      public Builder setName(java.lang.String value) {
        if (value == null) {
          throw new NullPointerException();
        }

        name_ = value;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * Required if the condition exists. The unique resource name for this
       * condition. Its syntax is:
       *     projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
       * `[CONDITION_ID]` is assigned by Stackdriver Monitoring when the
       * condition is created as part of a new or updated alerting policy.
       * When calling the
       * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
       * method, do not include the `name` field in the conditions of the
       * requested alerting policy. Stackdriver Monitoring creates the
       * condition identifiers and includes them in the new policy.
       * When calling the
       * [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]
       * method to update a policy, including a condition `name` causes the
       * existing condition to be updated. Conditions without names are added to
       * the updated policy. Existing conditions are deleted if they are not
       * updated.
       * Best practice is to preserve `[CONDITION_ID]` if you make only small
       * changes, such as those to condition thresholds, durations, or trigger
       * values.  Otherwise, treat the change as a new condition and let the
       * existing condition be deleted.
       * </pre>
       *
       * <code>string name = 12;</code>
       */
      public Builder clearName() {

        name_ = getDefaultInstance().getName();
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * Required if the condition exists. The unique resource name for this
       * condition. Its syntax is:
       *     projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
       * `[CONDITION_ID]` is assigned by Stackdriver Monitoring when the
       * condition is created as part of a new or updated alerting policy.
       * When calling the
       * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
       * method, do not include the `name` field in the conditions of the
       * requested alerting policy. Stackdriver Monitoring creates the
       * condition identifiers and includes them in the new policy.
       * When calling the
       * [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy]
       * method to update a policy, including a condition `name` causes the
       * existing condition to be updated. Conditions without names are added to
       * the updated policy. Existing conditions are deleted if they are not
       * updated.
       * Best practice is to preserve `[CONDITION_ID]` if you make only small
       * changes, such as those to condition thresholds, durations, or trigger
       * values.  Otherwise, treat the change as a new condition and let the
       * existing condition be deleted.
       * </pre>
       *
       * <code>string name = 12;</code>
       */
      public Builder setNameBytes(com.google.protobuf.ByteString value) {
        if (value == null) {
          throw new NullPointerException();
        }
        checkByteStringIsUtf8(value);

        name_ = value;
        onChanged();
        return this;
      }

      private java.lang.Object displayName_ = "";
      /**
       *
       *
       * <pre>
       * A short name or phrase used to identify the condition in dashboards,
       * notifications, and incidents. To avoid confusion, don't use the same
       * display name for multiple conditions in the same policy.
       * </pre>
       *
       * <code>string display_name = 6;</code>
       */
      public java.lang.String getDisplayName() {
        java.lang.Object ref = displayName_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          displayName_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }
      /**
       *
       *
       * <pre>
       * A short name or phrase used to identify the condition in dashboards,
       * notifications, and incidents. To avoid confusion, don't use the same
       * display name for multiple conditions in the same policy.
       * </pre>
       *
       * <code>string display_name = 6;</code>
       */
      public com.google.protobuf.ByteString getDisplayNameBytes() {
        java.lang.Object ref = displayName_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
          displayName_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       *
       *
       * <pre>
       * A short name or phrase used to identify the condition in dashboards,
       * notifications, and incidents. To avoid confusion, don't use the same
       * display name for multiple conditions in the same policy.
       * </pre>
       *
       * <code>string display_name = 6;</code>
       */
      public Builder setDisplayName(java.lang.String value) {
        if (value == null) {
          throw new NullPointerException();
        }

        displayName_ = value;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * A short name or phrase used to identify the condition in dashboards,
       * notifications, and incidents. To avoid confusion, don't use the same
       * display name for multiple conditions in the same policy.
       * </pre>
       *
       * <code>string display_name = 6;</code>
       */
      public Builder clearDisplayName() {

        displayName_ = getDefaultInstance().getDisplayName();
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * A short name or phrase used to identify the condition in dashboards,
       * notifications, and incidents. To avoid confusion, don't use the same
       * display name for multiple conditions in the same policy.
       * </pre>
       *
       * <code>string display_name = 6;</code>
       */
      public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) {
        if (value == null) {
          throw new NullPointerException();
        }
        checkByteStringIsUtf8(value);

        displayName_ = value;
        onChanged();
        return this;
      }

      private com.google.protobuf.SingleFieldBuilderV3<
              com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold,
              com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.Builder,
              com.google.monitoring.v3.AlertPolicy.Condition.MetricThresholdOrBuilder>
          conditionThresholdBuilder_;
      /**
       *
       *
       * <pre>
       * A condition that compares a time series against a threshold.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;
       * </code>
       */
      public boolean hasConditionThreshold() {
        return conditionCase_ == 1;
      }
      /**
       *
       *
       * <pre>
       * A condition that compares a time series against a threshold.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;
       * </code>
       */
      public com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold
          getConditionThreshold() {
        if (conditionThresholdBuilder_ == null) {
          if (conditionCase_ == 1) {
            return (com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold) condition_;
          }
          return com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold
              .getDefaultInstance();
        } else {
          if (conditionCase_ == 1) {
            return conditionThresholdBuilder_.getMessage();
          }
          return com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold
              .getDefaultInstance();
        }
      }
      /**
       *
       *
       * <pre>
       * A condition that compares a time series against a threshold.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;
       * </code>
       */
      public Builder setConditionThreshold(
          com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold value) {
        if (conditionThresholdBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          condition_ = value;
          onChanged();
        } else {
          conditionThresholdBuilder_.setMessage(value);
        }
        conditionCase_ = 1;
        return this;
      }
      /**
       *
       *
       * <pre>
       * A condition that compares a time series against a threshold.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;
       * </code>
       */
      public Builder setConditionThreshold(
          com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.Builder builderForValue) {
        if (conditionThresholdBuilder_ == null) {
          condition_ = builderForValue.build();
          onChanged();
        } else {
          conditionThresholdBuilder_.setMessage(builderForValue.build());
        }
        conditionCase_ = 1;
        return this;
      }
      /**
       *
       *
       * <pre>
       * A condition that compares a time series against a threshold.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;
       * </code>
       */
      public Builder mergeConditionThreshold(
          com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold value) {
        if (conditionThresholdBuilder_ == null) {
          if (conditionCase_ == 1
              && condition_
                  != com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold
                      .getDefaultInstance()) {
            condition_ =
                com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.newBuilder(
                        (com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold) condition_)
                    .mergeFrom(value)
                    .buildPartial();
          } else {
            condition_ = value;
          }
          onChanged();
        } else {
          if (conditionCase_ == 1) {
            conditionThresholdBuilder_.mergeFrom(value);
          }
          conditionThresholdBuilder_.setMessage(value);
        }
        conditionCase_ = 1;
        return this;
      }
      /**
       *
       *
       * <pre>
       * A condition that compares a time series against a threshold.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;
       * </code>
       */
      public Builder clearConditionThreshold() {
        if (conditionThresholdBuilder_ == null) {
          if (conditionCase_ == 1) {
            conditionCase_ = 0;
            condition_ = null;
            onChanged();
          }
        } else {
          if (conditionCase_ == 1) {
            conditionCase_ = 0;
            condition_ = null;
          }
          conditionThresholdBuilder_.clear();
        }
        return this;
      }
      /**
       *
       *
       * <pre>
       * A condition that compares a time series against a threshold.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;
       * </code>
       */
      public com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.Builder
          getConditionThresholdBuilder() {
        return getConditionThresholdFieldBuilder().getBuilder();
      }
      /**
       *
       *
       * <pre>
       * A condition that compares a time series against a threshold.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;
       * </code>
       */
      public com.google.monitoring.v3.AlertPolicy.Condition.MetricThresholdOrBuilder
          getConditionThresholdOrBuilder() {
        if ((conditionCase_ == 1) && (conditionThresholdBuilder_ != null)) {
          return conditionThresholdBuilder_.getMessageOrBuilder();
        } else {
          if (conditionCase_ == 1) {
            return (com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold) condition_;
          }
          return com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold
              .getDefaultInstance();
        }
      }
      /**
       *
       *
       * <pre>
       * A condition that compares a time series against a threshold.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold condition_threshold = 1;
       * </code>
       */
      private com.google.protobuf.SingleFieldBuilderV3<
              com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold,
              com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.Builder,
              com.google.monitoring.v3.AlertPolicy.Condition.MetricThresholdOrBuilder>
          getConditionThresholdFieldBuilder() {
        if (conditionThresholdBuilder_ == null) {
          if (!(conditionCase_ == 1)) {
            condition_ =
                com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.getDefaultInstance();
          }
          conditionThresholdBuilder_ =
              new com.google.protobuf.SingleFieldBuilderV3<
                  com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold,
                  com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.Builder,
                  com.google.monitoring.v3.AlertPolicy.Condition.MetricThresholdOrBuilder>(
                  (com.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold) condition_,
                  getParentForChildren(),
                  isClean());
          condition_ = null;
        }
        conditionCase_ = 1;
        onChanged();
        ;
        return conditionThresholdBuilder_;
      }

      private com.google.protobuf.SingleFieldBuilderV3<
              com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence,
              com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.Builder,
              com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsenceOrBuilder>
          conditionAbsentBuilder_;
      /**
       *
       *
       * <pre>
       * A condition that checks that a time series continues to
       * receive new data points.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;
       * </code>
       */
      public boolean hasConditionAbsent() {
        return conditionCase_ == 2;
      }
      /**
       *
       *
       * <pre>
       * A condition that checks that a time series continues to
       * receive new data points.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;
       * </code>
       */
      public com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence getConditionAbsent() {
        if (conditionAbsentBuilder_ == null) {
          if (conditionCase_ == 2) {
            return (com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence) condition_;
          }
          return com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.getDefaultInstance();
        } else {
          if (conditionCase_ == 2) {
            return conditionAbsentBuilder_.getMessage();
          }
          return com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.getDefaultInstance();
        }
      }
      /**
       *
       *
       * <pre>
       * A condition that checks that a time series continues to
       * receive new data points.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;
       * </code>
       */
      public Builder setConditionAbsent(
          com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence value) {
        if (conditionAbsentBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          condition_ = value;
          onChanged();
        } else {
          conditionAbsentBuilder_.setMessage(value);
        }
        conditionCase_ = 2;
        return this;
      }
      /**
       *
       *
       * <pre>
       * A condition that checks that a time series continues to
       * receive new data points.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;
       * </code>
       */
      public Builder setConditionAbsent(
          com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.Builder builderForValue) {
        if (conditionAbsentBuilder_ == null) {
          condition_ = builderForValue.build();
          onChanged();
        } else {
          conditionAbsentBuilder_.setMessage(builderForValue.build());
        }
        conditionCase_ = 2;
        return this;
      }
      /**
       *
       *
       * <pre>
       * A condition that checks that a time series continues to
       * receive new data points.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;
       * </code>
       */
      public Builder mergeConditionAbsent(
          com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence value) {
        if (conditionAbsentBuilder_ == null) {
          if (conditionCase_ == 2
              && condition_
                  != com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence
                      .getDefaultInstance()) {
            condition_ =
                com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.newBuilder(
                        (com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence) condition_)
                    .mergeFrom(value)
                    .buildPartial();
          } else {
            condition_ = value;
          }
          onChanged();
        } else {
          if (conditionCase_ == 2) {
            conditionAbsentBuilder_.mergeFrom(value);
          }
          conditionAbsentBuilder_.setMessage(value);
        }
        conditionCase_ = 2;
        return this;
      }
      /**
       *
       *
       * <pre>
       * A condition that checks that a time series continues to
       * receive new data points.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;
       * </code>
       */
      public Builder clearConditionAbsent() {
        if (conditionAbsentBuilder_ == null) {
          if (conditionCase_ == 2) {
            conditionCase_ = 0;
            condition_ = null;
            onChanged();
          }
        } else {
          if (conditionCase_ == 2) {
            conditionCase_ = 0;
            condition_ = null;
          }
          conditionAbsentBuilder_.clear();
        }
        return this;
      }
      /**
       *
       *
       * <pre>
       * A condition that checks that a time series continues to
       * receive new data points.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;
       * </code>
       */
      public com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.Builder
          getConditionAbsentBuilder() {
        return getConditionAbsentFieldBuilder().getBuilder();
      }
      /**
       *
       *
       * <pre>
       * A condition that checks that a time series continues to
       * receive new data points.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;
       * </code>
       */
      public com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsenceOrBuilder
          getConditionAbsentOrBuilder() {
        if ((conditionCase_ == 2) && (conditionAbsentBuilder_ != null)) {
          return conditionAbsentBuilder_.getMessageOrBuilder();
        } else {
          if (conditionCase_ == 2) {
            return (com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence) condition_;
          }
          return com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.getDefaultInstance();
        }
      }
      /**
       *
       *
       * <pre>
       * A condition that checks that a time series continues to
       * receive new data points.
       * </pre>
       *
       * <code>.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence condition_absent = 2;
       * </code>
       */
      private com.google.protobuf.SingleFieldBuilderV3<
              com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence,
              com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.Builder,
              com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsenceOrBuilder>
          getConditionAbsentFieldBuilder() {
        if (conditionAbsentBuilder_ == null) {
          if (!(conditionCase_ == 2)) {
            condition_ =
                com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.getDefaultInstance();
          }
          conditionAbsentBuilder_ =
              new com.google.protobuf.SingleFieldBuilderV3<
                  com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence,
                  com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.Builder,
                  com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsenceOrBuilder>(
                  (com.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence) condition_,
                  getParentForChildren(),
                  isClean());
          condition_ = null;
        }
        conditionCase_ = 2;
        onChanged();
        ;
        return conditionAbsentBuilder_;
      }

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

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

      // @@protoc_insertion_point(builder_scope:google.monitoring.v3.AlertPolicy.Condition)
    }

    // @@protoc_insertion_point(class_scope:google.monitoring.v3.AlertPolicy.Condition)
    private static final com.google.monitoring.v3.AlertPolicy.Condition DEFAULT_INSTANCE;

    static {
      DEFAULT_INSTANCE = new com.google.monitoring.v3.AlertPolicy.Condition();
    }

    public static com.google.monitoring.v3.AlertPolicy.Condition getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

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

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

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

    @java.lang.Override
    public com.google.monitoring.v3.AlertPolicy.Condition getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }
  }

  private int bitField0_;
  public static final int NAME_FIELD_NUMBER = 1;
  private volatile java.lang.Object name_;
  /**
   *
   *
   * <pre>
   * Required if the policy exists. The resource name for this policy. The
   * syntax is:
   *     projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
   * `[ALERT_POLICY_ID]` is assigned by Stackdriver Monitoring when the policy
   * is created.  When calling the
   * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
   * method, do not include the `name` field in the alerting policy passed as
   * part of the request.
   * </pre>
   *
   * <code>string name = 1;</code>
   */
  public java.lang.String getName() {
    java.lang.Object ref = name_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      name_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Required if the policy exists. The resource name for this policy. The
   * syntax is:
   *     projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
   * `[ALERT_POLICY_ID]` is assigned by Stackdriver Monitoring when the policy
   * is created.  When calling the
   * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
   * method, do not include the `name` field in the alerting policy passed as
   * part of the request.
   * </pre>
   *
   * <code>string name = 1;</code>
   */
  public com.google.protobuf.ByteString getNameBytes() {
    java.lang.Object ref = name_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      name_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int DISPLAY_NAME_FIELD_NUMBER = 2;
  private volatile java.lang.Object displayName_;
  /**
   *
   *
   * <pre>
   * A short name or phrase used to identify the policy in dashboards,
   * notifications, and incidents. To avoid confusion, don't use the same
   * display name for multiple policies in the same project. The name is
   * limited to 512 Unicode characters.
   * </pre>
   *
   * <code>string display_name = 2;</code>
   */
  public java.lang.String getDisplayName() {
    java.lang.Object ref = displayName_;
    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();
      displayName_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * A short name or phrase used to identify the policy in dashboards,
   * notifications, and incidents. To avoid confusion, don't use the same
   * display name for multiple policies in the same project. The name is
   * limited to 512 Unicode characters.
   * </pre>
   *
   * <code>string display_name = 2;</code>
   */
  public com.google.protobuf.ByteString getDisplayNameBytes() {
    java.lang.Object ref = displayName_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      displayName_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int DOCUMENTATION_FIELD_NUMBER = 13;
  private com.google.monitoring.v3.AlertPolicy.Documentation documentation_;
  /**
   *
   *
   * <pre>
   * Documentation that is included with notifications and incidents related to
   * this policy. Best practice is for the documentation to include information
   * to help responders understand, mitigate, escalate, and correct the
   * underlying problems detected by the alerting policy. Notification channels
   * that have limited capacity might not show this documentation.
   * </pre>
   *
   * <code>.google.monitoring.v3.AlertPolicy.Documentation documentation = 13;</code>
   */
  public boolean hasDocumentation() {
    return documentation_ != null;
  }
  /**
   *
   *
   * <pre>
   * Documentation that is included with notifications and incidents related to
   * this policy. Best practice is for the documentation to include information
   * to help responders understand, mitigate, escalate, and correct the
   * underlying problems detected by the alerting policy. Notification channels
   * that have limited capacity might not show this documentation.
   * </pre>
   *
   * <code>.google.monitoring.v3.AlertPolicy.Documentation documentation = 13;</code>
   */
  public com.google.monitoring.v3.AlertPolicy.Documentation getDocumentation() {
    return documentation_ == null
        ? com.google.monitoring.v3.AlertPolicy.Documentation.getDefaultInstance()
        : documentation_;
  }
  /**
   *
   *
   * <pre>
   * Documentation that is included with notifications and incidents related to
   * this policy. Best practice is for the documentation to include information
   * to help responders understand, mitigate, escalate, and correct the
   * underlying problems detected by the alerting policy. Notification channels
   * that have limited capacity might not show this documentation.
   * </pre>
   *
   * <code>.google.monitoring.v3.AlertPolicy.Documentation documentation = 13;</code>
   */
  public com.google.monitoring.v3.AlertPolicy.DocumentationOrBuilder getDocumentationOrBuilder() {
    return getDocumentation();
  }

  public static final int USER_LABELS_FIELD_NUMBER = 16;

  private static final class UserLabelsDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<java.lang.String, java.lang.String> defaultEntry =
        com.google.protobuf.MapEntry.<java.lang.String, java.lang.String>newDefaultInstance(
            com.google.monitoring.v3.AlertProto
                .internal_static_google_monitoring_v3_AlertPolicy_UserLabelsEntry_descriptor,
            com.google.protobuf.WireFormat.FieldType.STRING,
            "",
            com.google.protobuf.WireFormat.FieldType.STRING,
            "");
  }

  private com.google.protobuf.MapField<java.lang.String, java.lang.String> userLabels_;

  private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetUserLabels() {
    if (userLabels_ == null) {
      return com.google.protobuf.MapField.emptyMapField(UserLabelsDefaultEntryHolder.defaultEntry);
    }
    return userLabels_;
  }

  public int getUserLabelsCount() {
    return internalGetUserLabels().getMap().size();
  }
  /**
   *
   *
   * <pre>
   * User-supplied key/value data to be used for organizing and
   * identifying the `AlertPolicy` objects.
   * The field can contain up to 64 entries. Each key and value is limited to
   * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
   * values can contain only lowercase letters, numerals, underscores, and
   * dashes. Keys must begin with a letter.
   * </pre>
   *
   * <code>map&lt;string, string&gt; user_labels = 16;</code>
   */
  public boolean containsUserLabels(java.lang.String key) {
    if (key == null) {
      throw new java.lang.NullPointerException();
    }
    return internalGetUserLabels().getMap().containsKey(key);
  }
  /** Use {@link #getUserLabelsMap()} instead. */
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, java.lang.String> getUserLabels() {
    return getUserLabelsMap();
  }
  /**
   *
   *
   * <pre>
   * User-supplied key/value data to be used for organizing and
   * identifying the `AlertPolicy` objects.
   * The field can contain up to 64 entries. Each key and value is limited to
   * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
   * values can contain only lowercase letters, numerals, underscores, and
   * dashes. Keys must begin with a letter.
   * </pre>
   *
   * <code>map&lt;string, string&gt; user_labels = 16;</code>
   */
  public java.util.Map<java.lang.String, java.lang.String> getUserLabelsMap() {
    return internalGetUserLabels().getMap();
  }
  /**
   *
   *
   * <pre>
   * User-supplied key/value data to be used for organizing and
   * identifying the `AlertPolicy` objects.
   * The field can contain up to 64 entries. Each key and value is limited to
   * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
   * values can contain only lowercase letters, numerals, underscores, and
   * dashes. Keys must begin with a letter.
   * </pre>
   *
   * <code>map&lt;string, string&gt; user_labels = 16;</code>
   */
  public java.lang.String getUserLabelsOrDefault(
      java.lang.String key, java.lang.String defaultValue) {
    if (key == null) {
      throw new java.lang.NullPointerException();
    }
    java.util.Map<java.lang.String, java.lang.String> map = internalGetUserLabels().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   *
   *
   * <pre>
   * User-supplied key/value data to be used for organizing and
   * identifying the `AlertPolicy` objects.
   * The field can contain up to 64 entries. Each key and value is limited to
   * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
   * values can contain only lowercase letters, numerals, underscores, and
   * dashes. Keys must begin with a letter.
   * </pre>
   *
   * <code>map&lt;string, string&gt; user_labels = 16;</code>
   */
  public java.lang.String getUserLabelsOrThrow(java.lang.String key) {
    if (key == null) {
      throw new java.lang.NullPointerException();
    }
    java.util.Map<java.lang.String, java.lang.String> map = internalGetUserLabels().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  public static final int CONDITIONS_FIELD_NUMBER = 12;
  private java.util.List<com.google.monitoring.v3.AlertPolicy.Condition> conditions_;
  /**
   *
   *
   * <pre>
   * A list of conditions for the policy. The conditions are combined by AND or
   * OR according to the `combiner` field. If the combined conditions evaluate
   * to true, then an incident is created. A policy can have from one to six
   * conditions.
   * </pre>
   *
   * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
   */
  public java.util.List<com.google.monitoring.v3.AlertPolicy.Condition> getConditionsList() {
    return conditions_;
  }
  /**
   *
   *
   * <pre>
   * A list of conditions for the policy. The conditions are combined by AND or
   * OR according to the `combiner` field. If the combined conditions evaluate
   * to true, then an incident is created. A policy can have from one to six
   * conditions.
   * </pre>
   *
   * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
   */
  public java.util.List<? extends com.google.monitoring.v3.AlertPolicy.ConditionOrBuilder>
      getConditionsOrBuilderList() {
    return conditions_;
  }
  /**
   *
   *
   * <pre>
   * A list of conditions for the policy. The conditions are combined by AND or
   * OR according to the `combiner` field. If the combined conditions evaluate
   * to true, then an incident is created. A policy can have from one to six
   * conditions.
   * </pre>
   *
   * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
   */
  public int getConditionsCount() {
    return conditions_.size();
  }
  /**
   *
   *
   * <pre>
   * A list of conditions for the policy. The conditions are combined by AND or
   * OR according to the `combiner` field. If the combined conditions evaluate
   * to true, then an incident is created. A policy can have from one to six
   * conditions.
   * </pre>
   *
   * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
   */
  public com.google.monitoring.v3.AlertPolicy.Condition getConditions(int index) {
    return conditions_.get(index);
  }
  /**
   *
   *
   * <pre>
   * A list of conditions for the policy. The conditions are combined by AND or
   * OR according to the `combiner` field. If the combined conditions evaluate
   * to true, then an incident is created. A policy can have from one to six
   * conditions.
   * </pre>
   *
   * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
   */
  public com.google.monitoring.v3.AlertPolicy.ConditionOrBuilder getConditionsOrBuilder(int index) {
    return conditions_.get(index);
  }

  public static final int COMBINER_FIELD_NUMBER = 6;
  private int combiner_;
  /**
   *
   *
   * <pre>
   * How to combine the results of multiple conditions
   * to determine if an incident should be opened.
   * </pre>
   *
   * <code>.google.monitoring.v3.AlertPolicy.ConditionCombinerType combiner = 6;</code>
   */
  public int getCombinerValue() {
    return combiner_;
  }
  /**
   *
   *
   * <pre>
   * How to combine the results of multiple conditions
   * to determine if an incident should be opened.
   * </pre>
   *
   * <code>.google.monitoring.v3.AlertPolicy.ConditionCombinerType combiner = 6;</code>
   */
  public com.google.monitoring.v3.AlertPolicy.ConditionCombinerType getCombiner() {
    @SuppressWarnings("deprecation")
    com.google.monitoring.v3.AlertPolicy.ConditionCombinerType result =
        com.google.monitoring.v3.AlertPolicy.ConditionCombinerType.valueOf(combiner_);
    return result == null
        ? com.google.monitoring.v3.AlertPolicy.ConditionCombinerType.UNRECOGNIZED
        : result;
  }

  public static final int ENABLED_FIELD_NUMBER = 17;
  private com.google.protobuf.BoolValue enabled_;
  /**
   *
   *
   * <pre>
   * Whether or not the policy is enabled. On write, the default interpretation
   * if unset is that the policy is enabled. On read, clients should not make
   * any assumption about the state if it has not been populated. The
   * field should always be populated on List and Get operations, unless
   * a field projection has been specified that strips it out.
   * </pre>
   *
   * <code>.google.protobuf.BoolValue enabled = 17;</code>
   */
  public boolean hasEnabled() {
    return enabled_ != null;
  }
  /**
   *
   *
   * <pre>
   * Whether or not the policy is enabled. On write, the default interpretation
   * if unset is that the policy is enabled. On read, clients should not make
   * any assumption about the state if it has not been populated. The
   * field should always be populated on List and Get operations, unless
   * a field projection has been specified that strips it out.
   * </pre>
   *
   * <code>.google.protobuf.BoolValue enabled = 17;</code>
   */
  public com.google.protobuf.BoolValue getEnabled() {
    return enabled_ == null ? com.google.protobuf.BoolValue.getDefaultInstance() : enabled_;
  }
  /**
   *
   *
   * <pre>
   * Whether or not the policy is enabled. On write, the default interpretation
   * if unset is that the policy is enabled. On read, clients should not make
   * any assumption about the state if it has not been populated. The
   * field should always be populated on List and Get operations, unless
   * a field projection has been specified that strips it out.
   * </pre>
   *
   * <code>.google.protobuf.BoolValue enabled = 17;</code>
   */
  public com.google.protobuf.BoolValueOrBuilder getEnabledOrBuilder() {
    return getEnabled();
  }

  public static final int NOTIFICATION_CHANNELS_FIELD_NUMBER = 14;
  private com.google.protobuf.LazyStringList notificationChannels_;
  /**
   *
   *
   * <pre>
   * Identifies the notification channels to which notifications should be sent
   * when incidents are opened or closed or when new violations occur on
   * an already opened incident. Each element of this array corresponds to
   * the `name` field in each of the
   * [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
   * objects that are returned from the [`ListNotificationChannels`]
   * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
   * method. The syntax of the entries in this field is:
   *     projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
   * </pre>
   *
   * <code>repeated string notification_channels = 14;</code>
   */
  public com.google.protobuf.ProtocolStringList getNotificationChannelsList() {
    return notificationChannels_;
  }
  /**
   *
   *
   * <pre>
   * Identifies the notification channels to which notifications should be sent
   * when incidents are opened or closed or when new violations occur on
   * an already opened incident. Each element of this array corresponds to
   * the `name` field in each of the
   * [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
   * objects that are returned from the [`ListNotificationChannels`]
   * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
   * method. The syntax of the entries in this field is:
   *     projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
   * </pre>
   *
   * <code>repeated string notification_channels = 14;</code>
   */
  public int getNotificationChannelsCount() {
    return notificationChannels_.size();
  }
  /**
   *
   *
   * <pre>
   * Identifies the notification channels to which notifications should be sent
   * when incidents are opened or closed or when new violations occur on
   * an already opened incident. Each element of this array corresponds to
   * the `name` field in each of the
   * [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
   * objects that are returned from the [`ListNotificationChannels`]
   * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
   * method. The syntax of the entries in this field is:
   *     projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
   * </pre>
   *
   * <code>repeated string notification_channels = 14;</code>
   */
  public java.lang.String getNotificationChannels(int index) {
    return notificationChannels_.get(index);
  }
  /**
   *
   *
   * <pre>
   * Identifies the notification channels to which notifications should be sent
   * when incidents are opened or closed or when new violations occur on
   * an already opened incident. Each element of this array corresponds to
   * the `name` field in each of the
   * [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
   * objects that are returned from the [`ListNotificationChannels`]
   * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
   * method. The syntax of the entries in this field is:
   *     projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
   * </pre>
   *
   * <code>repeated string notification_channels = 14;</code>
   */
  public com.google.protobuf.ByteString getNotificationChannelsBytes(int index) {
    return notificationChannels_.getByteString(index);
  }

  public static final int CREATION_RECORD_FIELD_NUMBER = 10;
  private com.google.monitoring.v3.MutationRecord creationRecord_;
  /**
   *
   *
   * <pre>
   * A read-only record of the creation of the alerting policy. If provided
   * in a call to create or update, this field will be ignored.
   * </pre>
   *
   * <code>.google.monitoring.v3.MutationRecord creation_record = 10;</code>
   */
  public boolean hasCreationRecord() {
    return creationRecord_ != null;
  }
  /**
   *
   *
   * <pre>
   * A read-only record of the creation of the alerting policy. If provided
   * in a call to create or update, this field will be ignored.
   * </pre>
   *
   * <code>.google.monitoring.v3.MutationRecord creation_record = 10;</code>
   */
  public com.google.monitoring.v3.MutationRecord getCreationRecord() {
    return creationRecord_ == null
        ? com.google.monitoring.v3.MutationRecord.getDefaultInstance()
        : creationRecord_;
  }
  /**
   *
   *
   * <pre>
   * A read-only record of the creation of the alerting policy. If provided
   * in a call to create or update, this field will be ignored.
   * </pre>
   *
   * <code>.google.monitoring.v3.MutationRecord creation_record = 10;</code>
   */
  public com.google.monitoring.v3.MutationRecordOrBuilder getCreationRecordOrBuilder() {
    return getCreationRecord();
  }

  public static final int MUTATION_RECORD_FIELD_NUMBER = 11;
  private com.google.monitoring.v3.MutationRecord mutationRecord_;
  /**
   *
   *
   * <pre>
   * A read-only record of the most recent change to the alerting policy. If
   * provided in a call to create or update, this field will be ignored.
   * </pre>
   *
   * <code>.google.monitoring.v3.MutationRecord mutation_record = 11;</code>
   */
  public boolean hasMutationRecord() {
    return mutationRecord_ != null;
  }
  /**
   *
   *
   * <pre>
   * A read-only record of the most recent change to the alerting policy. If
   * provided in a call to create or update, this field will be ignored.
   * </pre>
   *
   * <code>.google.monitoring.v3.MutationRecord mutation_record = 11;</code>
   */
  public com.google.monitoring.v3.MutationRecord getMutationRecord() {
    return mutationRecord_ == null
        ? com.google.monitoring.v3.MutationRecord.getDefaultInstance()
        : mutationRecord_;
  }
  /**
   *
   *
   * <pre>
   * A read-only record of the most recent change to the alerting policy. If
   * provided in a call to create or update, this field will be ignored.
   * </pre>
   *
   * <code>.google.monitoring.v3.MutationRecord mutation_record = 11;</code>
   */
  public com.google.monitoring.v3.MutationRecordOrBuilder getMutationRecordOrBuilder() {
    return getMutationRecord();
  }

  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 (!getNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
    }
    if (!getDisplayNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, displayName_);
    }
    if (combiner_
        != com.google.monitoring.v3.AlertPolicy.ConditionCombinerType.COMBINE_UNSPECIFIED
            .getNumber()) {
      output.writeEnum(6, combiner_);
    }
    if (creationRecord_ != null) {
      output.writeMessage(10, getCreationRecord());
    }
    if (mutationRecord_ != null) {
      output.writeMessage(11, getMutationRecord());
    }
    for (int i = 0; i < conditions_.size(); i++) {
      output.writeMessage(12, conditions_.get(i));
    }
    if (documentation_ != null) {
      output.writeMessage(13, getDocumentation());
    }
    for (int i = 0; i < notificationChannels_.size(); i++) {
      com.google.protobuf.GeneratedMessageV3.writeString(
          output, 14, notificationChannels_.getRaw(i));
    }
    com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(
        output, internalGetUserLabels(), UserLabelsDefaultEntryHolder.defaultEntry, 16);
    if (enabled_ != null) {
      output.writeMessage(17, getEnabled());
    }
    unknownFields.writeTo(output);
  }

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

    size = 0;
    if (!getNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
    }
    if (!getDisplayNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, displayName_);
    }
    if (combiner_
        != com.google.monitoring.v3.AlertPolicy.ConditionCombinerType.COMBINE_UNSPECIFIED
            .getNumber()) {
      size += com.google.protobuf.CodedOutputStream.computeEnumSize(6, combiner_);
    }
    if (creationRecord_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(10, getCreationRecord());
    }
    if (mutationRecord_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(11, getMutationRecord());
    }
    for (int i = 0; i < conditions_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(12, conditions_.get(i));
    }
    if (documentation_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(13, getDocumentation());
    }
    {
      int dataSize = 0;
      for (int i = 0; i < notificationChannels_.size(); i++) {
        dataSize += computeStringSizeNoTag(notificationChannels_.getRaw(i));
      }
      size += dataSize;
      size += 1 * getNotificationChannelsList().size();
    }
    for (java.util.Map.Entry<java.lang.String, java.lang.String> entry :
        internalGetUserLabels().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.String, java.lang.String> userLabels__ =
          UserLabelsDefaultEntryHolder.defaultEntry
              .newBuilderForType()
              .setKey(entry.getKey())
              .setValue(entry.getValue())
              .build();
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(16, userLabels__);
    }
    if (enabled_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(17, getEnabled());
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.monitoring.v3.AlertPolicy)) {
      return super.equals(obj);
    }
    com.google.monitoring.v3.AlertPolicy other = (com.google.monitoring.v3.AlertPolicy) obj;

    boolean result = true;
    result = result && getName().equals(other.getName());
    result = result && getDisplayName().equals(other.getDisplayName());
    result = result && (hasDocumentation() == other.hasDocumentation());
    if (hasDocumentation()) {
      result = result && getDocumentation().equals(other.getDocumentation());
    }
    result = result && internalGetUserLabels().equals(other.internalGetUserLabels());
    result = result && getConditionsList().equals(other.getConditionsList());
    result = result && combiner_ == other.combiner_;
    result = result && (hasEnabled() == other.hasEnabled());
    if (hasEnabled()) {
      result = result && getEnabled().equals(other.getEnabled());
    }
    result = result && getNotificationChannelsList().equals(other.getNotificationChannelsList());
    result = result && (hasCreationRecord() == other.hasCreationRecord());
    if (hasCreationRecord()) {
      result = result && getCreationRecord().equals(other.getCreationRecord());
    }
    result = result && (hasMutationRecord() == other.hasMutationRecord());
    if (hasMutationRecord()) {
      result = result && getMutationRecord().equals(other.getMutationRecord());
    }
    result = result && unknownFields.equals(other.unknownFields);
    return result;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + NAME_FIELD_NUMBER;
    hash = (53 * hash) + getName().hashCode();
    hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER;
    hash = (53 * hash) + getDisplayName().hashCode();
    if (hasDocumentation()) {
      hash = (37 * hash) + DOCUMENTATION_FIELD_NUMBER;
      hash = (53 * hash) + getDocumentation().hashCode();
    }
    if (!internalGetUserLabels().getMap().isEmpty()) {
      hash = (37 * hash) + USER_LABELS_FIELD_NUMBER;
      hash = (53 * hash) + internalGetUserLabels().hashCode();
    }
    if (getConditionsCount() > 0) {
      hash = (37 * hash) + CONDITIONS_FIELD_NUMBER;
      hash = (53 * hash) + getConditionsList().hashCode();
    }
    hash = (37 * hash) + COMBINER_FIELD_NUMBER;
    hash = (53 * hash) + combiner_;
    if (hasEnabled()) {
      hash = (37 * hash) + ENABLED_FIELD_NUMBER;
      hash = (53 * hash) + getEnabled().hashCode();
    }
    if (getNotificationChannelsCount() > 0) {
      hash = (37 * hash) + NOTIFICATION_CHANNELS_FIELD_NUMBER;
      hash = (53 * hash) + getNotificationChannelsList().hashCode();
    }
    if (hasCreationRecord()) {
      hash = (37 * hash) + CREATION_RECORD_FIELD_NUMBER;
      hash = (53 * hash) + getCreationRecord().hashCode();
    }
    if (hasMutationRecord()) {
      hash = (37 * hash) + MUTATION_RECORD_FIELD_NUMBER;
      hash = (53 * hash) + getMutationRecord().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.monitoring.v3.AlertPolicy parseFrom(java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.monitoring.v3.AlertPolicy parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.monitoring.v3.AlertPolicy parseFrom(com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

  public static com.google.monitoring.v3.AlertPolicy parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.monitoring.v3.AlertPolicy parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

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

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

  public static com.google.monitoring.v3.AlertPolicy 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.monitoring.v3.AlertPolicy 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 description of the conditions under which some aspect of your system is
   * considered to be "unhealthy" and the ways to notify people or services about
   * this state. For an overview of alert policies, see
   * [Introduction to Alerting](/monitoring/alerts/).
   * </pre>
   *
   * Protobuf type {@code google.monitoring.v3.AlertPolicy}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.monitoring.v3.AlertPolicy)
      com.google.monitoring.v3.AlertPolicyOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.monitoring.v3.AlertProto
          .internal_static_google_monitoring_v3_AlertPolicy_descriptor;
    }

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

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

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.monitoring.v3.AlertProto
          .internal_static_google_monitoring_v3_AlertPolicy_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.monitoring.v3.AlertPolicy.class,
              com.google.monitoring.v3.AlertPolicy.Builder.class);
    }

    // Construct using com.google.monitoring.v3.AlertPolicy.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

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

    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {
        getConditionsFieldBuilder();
      }
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      name_ = "";

      displayName_ = "";

      if (documentationBuilder_ == null) {
        documentation_ = null;
      } else {
        documentation_ = null;
        documentationBuilder_ = null;
      }
      internalGetMutableUserLabels().clear();
      if (conditionsBuilder_ == null) {
        conditions_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000010);
      } else {
        conditionsBuilder_.clear();
      }
      combiner_ = 0;

      if (enabledBuilder_ == null) {
        enabled_ = null;
      } else {
        enabled_ = null;
        enabledBuilder_ = null;
      }
      notificationChannels_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000080);
      if (creationRecordBuilder_ == null) {
        creationRecord_ = null;
      } else {
        creationRecord_ = null;
        creationRecordBuilder_ = null;
      }
      if (mutationRecordBuilder_ == null) {
        mutationRecord_ = null;
      } else {
        mutationRecord_ = null;
        mutationRecordBuilder_ = null;
      }
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.monitoring.v3.AlertProto
          .internal_static_google_monitoring_v3_AlertPolicy_descriptor;
    }

    @java.lang.Override
    public com.google.monitoring.v3.AlertPolicy getDefaultInstanceForType() {
      return com.google.monitoring.v3.AlertPolicy.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.monitoring.v3.AlertPolicy build() {
      com.google.monitoring.v3.AlertPolicy result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.monitoring.v3.AlertPolicy buildPartial() {
      com.google.monitoring.v3.AlertPolicy result = new com.google.monitoring.v3.AlertPolicy(this);
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      result.name_ = name_;
      result.displayName_ = displayName_;
      if (documentationBuilder_ == null) {
        result.documentation_ = documentation_;
      } else {
        result.documentation_ = documentationBuilder_.build();
      }
      result.userLabels_ = internalGetUserLabels();
      result.userLabels_.makeImmutable();
      if (conditionsBuilder_ == null) {
        if (((bitField0_ & 0x00000010) == 0x00000010)) {
          conditions_ = java.util.Collections.unmodifiableList(conditions_);
          bitField0_ = (bitField0_ & ~0x00000010);
        }
        result.conditions_ = conditions_;
      } else {
        result.conditions_ = conditionsBuilder_.build();
      }
      result.combiner_ = combiner_;
      if (enabledBuilder_ == null) {
        result.enabled_ = enabled_;
      } else {
        result.enabled_ = enabledBuilder_.build();
      }
      if (((bitField0_ & 0x00000080) == 0x00000080)) {
        notificationChannels_ = notificationChannels_.getUnmodifiableView();
        bitField0_ = (bitField0_ & ~0x00000080);
      }
      result.notificationChannels_ = notificationChannels_;
      if (creationRecordBuilder_ == null) {
        result.creationRecord_ = creationRecord_;
      } else {
        result.creationRecord_ = creationRecordBuilder_.build();
      }
      if (mutationRecordBuilder_ == null) {
        result.mutationRecord_ = mutationRecord_;
      } else {
        result.mutationRecord_ = mutationRecordBuilder_.build();
      }
      result.bitField0_ = to_bitField0_;
      onBuilt();
      return result;
    }

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

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

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

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

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

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

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.monitoring.v3.AlertPolicy) {
        return mergeFrom((com.google.monitoring.v3.AlertPolicy) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.monitoring.v3.AlertPolicy other) {
      if (other == com.google.monitoring.v3.AlertPolicy.getDefaultInstance()) return this;
      if (!other.getName().isEmpty()) {
        name_ = other.name_;
        onChanged();
      }
      if (!other.getDisplayName().isEmpty()) {
        displayName_ = other.displayName_;
        onChanged();
      }
      if (other.hasDocumentation()) {
        mergeDocumentation(other.getDocumentation());
      }
      internalGetMutableUserLabels().mergeFrom(other.internalGetUserLabels());
      if (conditionsBuilder_ == null) {
        if (!other.conditions_.isEmpty()) {
          if (conditions_.isEmpty()) {
            conditions_ = other.conditions_;
            bitField0_ = (bitField0_ & ~0x00000010);
          } else {
            ensureConditionsIsMutable();
            conditions_.addAll(other.conditions_);
          }
          onChanged();
        }
      } else {
        if (!other.conditions_.isEmpty()) {
          if (conditionsBuilder_.isEmpty()) {
            conditionsBuilder_.dispose();
            conditionsBuilder_ = null;
            conditions_ = other.conditions_;
            bitField0_ = (bitField0_ & ~0x00000010);
            conditionsBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getConditionsFieldBuilder()
                    : null;
          } else {
            conditionsBuilder_.addAllMessages(other.conditions_);
          }
        }
      }
      if (other.combiner_ != 0) {
        setCombinerValue(other.getCombinerValue());
      }
      if (other.hasEnabled()) {
        mergeEnabled(other.getEnabled());
      }
      if (!other.notificationChannels_.isEmpty()) {
        if (notificationChannels_.isEmpty()) {
          notificationChannels_ = other.notificationChannels_;
          bitField0_ = (bitField0_ & ~0x00000080);
        } else {
          ensureNotificationChannelsIsMutable();
          notificationChannels_.addAll(other.notificationChannels_);
        }
        onChanged();
      }
      if (other.hasCreationRecord()) {
        mergeCreationRecord(other.getCreationRecord());
      }
      if (other.hasMutationRecord()) {
        mergeMutationRecord(other.getMutationRecord());
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

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

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

    private int bitField0_;

    private java.lang.Object name_ = "";
    /**
     *
     *
     * <pre>
     * Required if the policy exists. The resource name for this policy. The
     * syntax is:
     *     projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
     * `[ALERT_POLICY_ID]` is assigned by Stackdriver Monitoring when the policy
     * is created.  When calling the
     * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
     * method, do not include the `name` field in the alerting policy passed as
     * part of the request.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public java.lang.String getName() {
      java.lang.Object ref = name_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        name_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Required if the policy exists. The resource name for this policy. The
     * syntax is:
     *     projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
     * `[ALERT_POLICY_ID]` is assigned by Stackdriver Monitoring when the policy
     * is created.  When calling the
     * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
     * method, do not include the `name` field in the alerting policy passed as
     * part of the request.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public com.google.protobuf.ByteString getNameBytes() {
      java.lang.Object ref = name_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        name_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Required if the policy exists. The resource name for this policy. The
     * syntax is:
     *     projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
     * `[ALERT_POLICY_ID]` is assigned by Stackdriver Monitoring when the policy
     * is created.  When calling the
     * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
     * method, do not include the `name` field in the alerting policy passed as
     * part of the request.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public Builder setName(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      name_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required if the policy exists. The resource name for this policy. The
     * syntax is:
     *     projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
     * `[ALERT_POLICY_ID]` is assigned by Stackdriver Monitoring when the policy
     * is created.  When calling the
     * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
     * method, do not include the `name` field in the alerting policy passed as
     * part of the request.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public Builder clearName() {

      name_ = getDefaultInstance().getName();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Required if the policy exists. The resource name for this policy. The
     * syntax is:
     *     projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
     * `[ALERT_POLICY_ID]` is assigned by Stackdriver Monitoring when the policy
     * is created.  When calling the
     * [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
     * method, do not include the `name` field in the alerting policy passed as
     * part of the request.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public Builder setNameBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

      name_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object displayName_ = "";
    /**
     *
     *
     * <pre>
     * A short name or phrase used to identify the policy in dashboards,
     * notifications, and incidents. To avoid confusion, don't use the same
     * display name for multiple policies in the same project. The name is
     * limited to 512 Unicode characters.
     * </pre>
     *
     * <code>string display_name = 2;</code>
     */
    public java.lang.String getDisplayName() {
      java.lang.Object ref = displayName_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        displayName_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * A short name or phrase used to identify the policy in dashboards,
     * notifications, and incidents. To avoid confusion, don't use the same
     * display name for multiple policies in the same project. The name is
     * limited to 512 Unicode characters.
     * </pre>
     *
     * <code>string display_name = 2;</code>
     */
    public com.google.protobuf.ByteString getDisplayNameBytes() {
      java.lang.Object ref = displayName_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        displayName_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * A short name or phrase used to identify the policy in dashboards,
     * notifications, and incidents. To avoid confusion, don't use the same
     * display name for multiple policies in the same project. The name is
     * limited to 512 Unicode characters.
     * </pre>
     *
     * <code>string display_name = 2;</code>
     */
    public Builder setDisplayName(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      displayName_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * A short name or phrase used to identify the policy in dashboards,
     * notifications, and incidents. To avoid confusion, don't use the same
     * display name for multiple policies in the same project. The name is
     * limited to 512 Unicode characters.
     * </pre>
     *
     * <code>string display_name = 2;</code>
     */
    public Builder clearDisplayName() {

      displayName_ = getDefaultInstance().getDisplayName();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * A short name or phrase used to identify the policy in dashboards,
     * notifications, and incidents. To avoid confusion, don't use the same
     * display name for multiple policies in the same project. The name is
     * limited to 512 Unicode characters.
     * </pre>
     *
     * <code>string display_name = 2;</code>
     */
    public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

      displayName_ = value;
      onChanged();
      return this;
    }

    private com.google.monitoring.v3.AlertPolicy.Documentation documentation_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.monitoring.v3.AlertPolicy.Documentation,
            com.google.monitoring.v3.AlertPolicy.Documentation.Builder,
            com.google.monitoring.v3.AlertPolicy.DocumentationOrBuilder>
        documentationBuilder_;
    /**
     *
     *
     * <pre>
     * Documentation that is included with notifications and incidents related to
     * this policy. Best practice is for the documentation to include information
     * to help responders understand, mitigate, escalate, and correct the
     * underlying problems detected by the alerting policy. Notification channels
     * that have limited capacity might not show this documentation.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Documentation documentation = 13;</code>
     */
    public boolean hasDocumentation() {
      return documentationBuilder_ != null || documentation_ != null;
    }
    /**
     *
     *
     * <pre>
     * Documentation that is included with notifications and incidents related to
     * this policy. Best practice is for the documentation to include information
     * to help responders understand, mitigate, escalate, and correct the
     * underlying problems detected by the alerting policy. Notification channels
     * that have limited capacity might not show this documentation.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Documentation documentation = 13;</code>
     */
    public com.google.monitoring.v3.AlertPolicy.Documentation getDocumentation() {
      if (documentationBuilder_ == null) {
        return documentation_ == null
            ? com.google.monitoring.v3.AlertPolicy.Documentation.getDefaultInstance()
            : documentation_;
      } else {
        return documentationBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Documentation that is included with notifications and incidents related to
     * this policy. Best practice is for the documentation to include information
     * to help responders understand, mitigate, escalate, and correct the
     * underlying problems detected by the alerting policy. Notification channels
     * that have limited capacity might not show this documentation.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Documentation documentation = 13;</code>
     */
    public Builder setDocumentation(com.google.monitoring.v3.AlertPolicy.Documentation value) {
      if (documentationBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        documentation_ = value;
        onChanged();
      } else {
        documentationBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Documentation that is included with notifications and incidents related to
     * this policy. Best practice is for the documentation to include information
     * to help responders understand, mitigate, escalate, and correct the
     * underlying problems detected by the alerting policy. Notification channels
     * that have limited capacity might not show this documentation.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Documentation documentation = 13;</code>
     */
    public Builder setDocumentation(
        com.google.monitoring.v3.AlertPolicy.Documentation.Builder builderForValue) {
      if (documentationBuilder_ == null) {
        documentation_ = builderForValue.build();
        onChanged();
      } else {
        documentationBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Documentation that is included with notifications and incidents related to
     * this policy. Best practice is for the documentation to include information
     * to help responders understand, mitigate, escalate, and correct the
     * underlying problems detected by the alerting policy. Notification channels
     * that have limited capacity might not show this documentation.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Documentation documentation = 13;</code>
     */
    public Builder mergeDocumentation(com.google.monitoring.v3.AlertPolicy.Documentation value) {
      if (documentationBuilder_ == null) {
        if (documentation_ != null) {
          documentation_ =
              com.google.monitoring.v3.AlertPolicy.Documentation.newBuilder(documentation_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          documentation_ = value;
        }
        onChanged();
      } else {
        documentationBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Documentation that is included with notifications and incidents related to
     * this policy. Best practice is for the documentation to include information
     * to help responders understand, mitigate, escalate, and correct the
     * underlying problems detected by the alerting policy. Notification channels
     * that have limited capacity might not show this documentation.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Documentation documentation = 13;</code>
     */
    public Builder clearDocumentation() {
      if (documentationBuilder_ == null) {
        documentation_ = null;
        onChanged();
      } else {
        documentation_ = null;
        documentationBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Documentation that is included with notifications and incidents related to
     * this policy. Best practice is for the documentation to include information
     * to help responders understand, mitigate, escalate, and correct the
     * underlying problems detected by the alerting policy. Notification channels
     * that have limited capacity might not show this documentation.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Documentation documentation = 13;</code>
     */
    public com.google.monitoring.v3.AlertPolicy.Documentation.Builder getDocumentationBuilder() {

      onChanged();
      return getDocumentationFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Documentation that is included with notifications and incidents related to
     * this policy. Best practice is for the documentation to include information
     * to help responders understand, mitigate, escalate, and correct the
     * underlying problems detected by the alerting policy. Notification channels
     * that have limited capacity might not show this documentation.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Documentation documentation = 13;</code>
     */
    public com.google.monitoring.v3.AlertPolicy.DocumentationOrBuilder getDocumentationOrBuilder() {
      if (documentationBuilder_ != null) {
        return documentationBuilder_.getMessageOrBuilder();
      } else {
        return documentation_ == null
            ? com.google.monitoring.v3.AlertPolicy.Documentation.getDefaultInstance()
            : documentation_;
      }
    }
    /**
     *
     *
     * <pre>
     * Documentation that is included with notifications and incidents related to
     * this policy. Best practice is for the documentation to include information
     * to help responders understand, mitigate, escalate, and correct the
     * underlying problems detected by the alerting policy. Notification channels
     * that have limited capacity might not show this documentation.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.Documentation documentation = 13;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.monitoring.v3.AlertPolicy.Documentation,
            com.google.monitoring.v3.AlertPolicy.Documentation.Builder,
            com.google.monitoring.v3.AlertPolicy.DocumentationOrBuilder>
        getDocumentationFieldBuilder() {
      if (documentationBuilder_ == null) {
        documentationBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.monitoring.v3.AlertPolicy.Documentation,
                com.google.monitoring.v3.AlertPolicy.Documentation.Builder,
                com.google.monitoring.v3.AlertPolicy.DocumentationOrBuilder>(
                getDocumentation(), getParentForChildren(), isClean());
        documentation_ = null;
      }
      return documentationBuilder_;
    }

    private com.google.protobuf.MapField<java.lang.String, java.lang.String> userLabels_;

    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
        internalGetUserLabels() {
      if (userLabels_ == null) {
        return com.google.protobuf.MapField.emptyMapField(
            UserLabelsDefaultEntryHolder.defaultEntry);
      }
      return userLabels_;
    }

    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
        internalGetMutableUserLabels() {
      onChanged();
      ;
      if (userLabels_ == null) {
        userLabels_ =
            com.google.protobuf.MapField.newMapField(UserLabelsDefaultEntryHolder.defaultEntry);
      }
      if (!userLabels_.isMutable()) {
        userLabels_ = userLabels_.copy();
      }
      return userLabels_;
    }

    public int getUserLabelsCount() {
      return internalGetUserLabels().getMap().size();
    }
    /**
     *
     *
     * <pre>
     * User-supplied key/value data to be used for organizing and
     * identifying the `AlertPolicy` objects.
     * The field can contain up to 64 entries. Each key and value is limited to
     * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
     * values can contain only lowercase letters, numerals, underscores, and
     * dashes. Keys must begin with a letter.
     * </pre>
     *
     * <code>map&lt;string, string&gt; user_labels = 16;</code>
     */
    public boolean containsUserLabels(java.lang.String key) {
      if (key == null) {
        throw new java.lang.NullPointerException();
      }
      return internalGetUserLabels().getMap().containsKey(key);
    }
    /** Use {@link #getUserLabelsMap()} instead. */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getUserLabels() {
      return getUserLabelsMap();
    }
    /**
     *
     *
     * <pre>
     * User-supplied key/value data to be used for organizing and
     * identifying the `AlertPolicy` objects.
     * The field can contain up to 64 entries. Each key and value is limited to
     * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
     * values can contain only lowercase letters, numerals, underscores, and
     * dashes. Keys must begin with a letter.
     * </pre>
     *
     * <code>map&lt;string, string&gt; user_labels = 16;</code>
     */
    public java.util.Map<java.lang.String, java.lang.String> getUserLabelsMap() {
      return internalGetUserLabels().getMap();
    }
    /**
     *
     *
     * <pre>
     * User-supplied key/value data to be used for organizing and
     * identifying the `AlertPolicy` objects.
     * The field can contain up to 64 entries. Each key and value is limited to
     * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
     * values can contain only lowercase letters, numerals, underscores, and
     * dashes. Keys must begin with a letter.
     * </pre>
     *
     * <code>map&lt;string, string&gt; user_labels = 16;</code>
     */
    public java.lang.String getUserLabelsOrDefault(
        java.lang.String key, java.lang.String defaultValue) {
      if (key == null) {
        throw new java.lang.NullPointerException();
      }
      java.util.Map<java.lang.String, java.lang.String> map = internalGetUserLabels().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     *
     *
     * <pre>
     * User-supplied key/value data to be used for organizing and
     * identifying the `AlertPolicy` objects.
     * The field can contain up to 64 entries. Each key and value is limited to
     * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
     * values can contain only lowercase letters, numerals, underscores, and
     * dashes. Keys must begin with a letter.
     * </pre>
     *
     * <code>map&lt;string, string&gt; user_labels = 16;</code>
     */
    public java.lang.String getUserLabelsOrThrow(java.lang.String key) {
      if (key == null) {
        throw new java.lang.NullPointerException();
      }
      java.util.Map<java.lang.String, java.lang.String> map = internalGetUserLabels().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearUserLabels() {
      internalGetMutableUserLabels().getMutableMap().clear();
      return this;
    }
    /**
     *
     *
     * <pre>
     * User-supplied key/value data to be used for organizing and
     * identifying the `AlertPolicy` objects.
     * The field can contain up to 64 entries. Each key and value is limited to
     * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
     * values can contain only lowercase letters, numerals, underscores, and
     * dashes. Keys must begin with a letter.
     * </pre>
     *
     * <code>map&lt;string, string&gt; user_labels = 16;</code>
     */
    public Builder removeUserLabels(java.lang.String key) {
      if (key == null) {
        throw new java.lang.NullPointerException();
      }
      internalGetMutableUserLabels().getMutableMap().remove(key);
      return this;
    }
    /** Use alternate mutation accessors instead. */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getMutableUserLabels() {
      return internalGetMutableUserLabels().getMutableMap();
    }
    /**
     *
     *
     * <pre>
     * User-supplied key/value data to be used for organizing and
     * identifying the `AlertPolicy` objects.
     * The field can contain up to 64 entries. Each key and value is limited to
     * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
     * values can contain only lowercase letters, numerals, underscores, and
     * dashes. Keys must begin with a letter.
     * </pre>
     *
     * <code>map&lt;string, string&gt; user_labels = 16;</code>
     */
    public Builder putUserLabels(java.lang.String key, java.lang.String value) {
      if (key == null) {
        throw new java.lang.NullPointerException();
      }
      if (value == null) {
        throw new java.lang.NullPointerException();
      }
      internalGetMutableUserLabels().getMutableMap().put(key, value);
      return this;
    }
    /**
     *
     *
     * <pre>
     * User-supplied key/value data to be used for organizing and
     * identifying the `AlertPolicy` objects.
     * The field can contain up to 64 entries. Each key and value is limited to
     * 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
     * values can contain only lowercase letters, numerals, underscores, and
     * dashes. Keys must begin with a letter.
     * </pre>
     *
     * <code>map&lt;string, string&gt; user_labels = 16;</code>
     */
    public Builder putAllUserLabels(java.util.Map<java.lang.String, java.lang.String> values) {
      internalGetMutableUserLabels().getMutableMap().putAll(values);
      return this;
    }

    private java.util.List<com.google.monitoring.v3.AlertPolicy.Condition> conditions_ =
        java.util.Collections.emptyList();

    private void ensureConditionsIsMutable() {
      if (!((bitField0_ & 0x00000010) == 0x00000010)) {
        conditions_ =
            new java.util.ArrayList<com.google.monitoring.v3.AlertPolicy.Condition>(conditions_);
        bitField0_ |= 0x00000010;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.monitoring.v3.AlertPolicy.Condition,
            com.google.monitoring.v3.AlertPolicy.Condition.Builder,
            com.google.monitoring.v3.AlertPolicy.ConditionOrBuilder>
        conditionsBuilder_;

    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public java.util.List<com.google.monitoring.v3.AlertPolicy.Condition> getConditionsList() {
      if (conditionsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(conditions_);
      } else {
        return conditionsBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public int getConditionsCount() {
      if (conditionsBuilder_ == null) {
        return conditions_.size();
      } else {
        return conditionsBuilder_.getCount();
      }
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public com.google.monitoring.v3.AlertPolicy.Condition getConditions(int index) {
      if (conditionsBuilder_ == null) {
        return conditions_.get(index);
      } else {
        return conditionsBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public Builder setConditions(int index, com.google.monitoring.v3.AlertPolicy.Condition value) {
      if (conditionsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureConditionsIsMutable();
        conditions_.set(index, value);
        onChanged();
      } else {
        conditionsBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public Builder setConditions(
        int index, com.google.monitoring.v3.AlertPolicy.Condition.Builder builderForValue) {
      if (conditionsBuilder_ == null) {
        ensureConditionsIsMutable();
        conditions_.set(index, builderForValue.build());
        onChanged();
      } else {
        conditionsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public Builder addConditions(com.google.monitoring.v3.AlertPolicy.Condition value) {
      if (conditionsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureConditionsIsMutable();
        conditions_.add(value);
        onChanged();
      } else {
        conditionsBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public Builder addConditions(int index, com.google.monitoring.v3.AlertPolicy.Condition value) {
      if (conditionsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureConditionsIsMutable();
        conditions_.add(index, value);
        onChanged();
      } else {
        conditionsBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public Builder addConditions(
        com.google.monitoring.v3.AlertPolicy.Condition.Builder builderForValue) {
      if (conditionsBuilder_ == null) {
        ensureConditionsIsMutable();
        conditions_.add(builderForValue.build());
        onChanged();
      } else {
        conditionsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public Builder addConditions(
        int index, com.google.monitoring.v3.AlertPolicy.Condition.Builder builderForValue) {
      if (conditionsBuilder_ == null) {
        ensureConditionsIsMutable();
        conditions_.add(index, builderForValue.build());
        onChanged();
      } else {
        conditionsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public Builder addAllConditions(
        java.lang.Iterable<? extends com.google.monitoring.v3.AlertPolicy.Condition> values) {
      if (conditionsBuilder_ == null) {
        ensureConditionsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, conditions_);
        onChanged();
      } else {
        conditionsBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public Builder clearConditions() {
      if (conditionsBuilder_ == null) {
        conditions_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000010);
        onChanged();
      } else {
        conditionsBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public Builder removeConditions(int index) {
      if (conditionsBuilder_ == null) {
        ensureConditionsIsMutable();
        conditions_.remove(index);
        onChanged();
      } else {
        conditionsBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public com.google.monitoring.v3.AlertPolicy.Condition.Builder getConditionsBuilder(int index) {
      return getConditionsFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public com.google.monitoring.v3.AlertPolicy.ConditionOrBuilder getConditionsOrBuilder(
        int index) {
      if (conditionsBuilder_ == null) {
        return conditions_.get(index);
      } else {
        return conditionsBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public java.util.List<? extends com.google.monitoring.v3.AlertPolicy.ConditionOrBuilder>
        getConditionsOrBuilderList() {
      if (conditionsBuilder_ != null) {
        return conditionsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(conditions_);
      }
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public com.google.monitoring.v3.AlertPolicy.Condition.Builder addConditionsBuilder() {
      return getConditionsFieldBuilder()
          .addBuilder(com.google.monitoring.v3.AlertPolicy.Condition.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public com.google.monitoring.v3.AlertPolicy.Condition.Builder addConditionsBuilder(int index) {
      return getConditionsFieldBuilder()
          .addBuilder(index, com.google.monitoring.v3.AlertPolicy.Condition.getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * A list of conditions for the policy. The conditions are combined by AND or
     * OR according to the `combiner` field. If the combined conditions evaluate
     * to true, then an incident is created. A policy can have from one to six
     * conditions.
     * </pre>
     *
     * <code>repeated .google.monitoring.v3.AlertPolicy.Condition conditions = 12;</code>
     */
    public java.util.List<com.google.monitoring.v3.AlertPolicy.Condition.Builder>
        getConditionsBuilderList() {
      return getConditionsFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            com.google.monitoring.v3.AlertPolicy.Condition,
            com.google.monitoring.v3.AlertPolicy.Condition.Builder,
            com.google.monitoring.v3.AlertPolicy.ConditionOrBuilder>
        getConditionsFieldBuilder() {
      if (conditionsBuilder_ == null) {
        conditionsBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                com.google.monitoring.v3.AlertPolicy.Condition,
                com.google.monitoring.v3.AlertPolicy.Condition.Builder,
                com.google.monitoring.v3.AlertPolicy.ConditionOrBuilder>(
                conditions_,
                ((bitField0_ & 0x00000010) == 0x00000010),
                getParentForChildren(),
                isClean());
        conditions_ = null;
      }
      return conditionsBuilder_;
    }

    private int combiner_ = 0;
    /**
     *
     *
     * <pre>
     * How to combine the results of multiple conditions
     * to determine if an incident should be opened.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.ConditionCombinerType combiner = 6;</code>
     */
    public int getCombinerValue() {
      return combiner_;
    }
    /**
     *
     *
     * <pre>
     * How to combine the results of multiple conditions
     * to determine if an incident should be opened.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.ConditionCombinerType combiner = 6;</code>
     */
    public Builder setCombinerValue(int value) {
      combiner_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * How to combine the results of multiple conditions
     * to determine if an incident should be opened.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.ConditionCombinerType combiner = 6;</code>
     */
    public com.google.monitoring.v3.AlertPolicy.ConditionCombinerType getCombiner() {
      @SuppressWarnings("deprecation")
      com.google.monitoring.v3.AlertPolicy.ConditionCombinerType result =
          com.google.monitoring.v3.AlertPolicy.ConditionCombinerType.valueOf(combiner_);
      return result == null
          ? com.google.monitoring.v3.AlertPolicy.ConditionCombinerType.UNRECOGNIZED
          : result;
    }
    /**
     *
     *
     * <pre>
     * How to combine the results of multiple conditions
     * to determine if an incident should be opened.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.ConditionCombinerType combiner = 6;</code>
     */
    public Builder setCombiner(com.google.monitoring.v3.AlertPolicy.ConditionCombinerType value) {
      if (value == null) {
        throw new NullPointerException();
      }

      combiner_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * How to combine the results of multiple conditions
     * to determine if an incident should be opened.
     * </pre>
     *
     * <code>.google.monitoring.v3.AlertPolicy.ConditionCombinerType combiner = 6;</code>
     */
    public Builder clearCombiner() {

      combiner_ = 0;
      onChanged();
      return this;
    }

    private com.google.protobuf.BoolValue enabled_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.BoolValue,
            com.google.protobuf.BoolValue.Builder,
            com.google.protobuf.BoolValueOrBuilder>
        enabledBuilder_;
    /**
     *
     *
     * <pre>
     * Whether or not the policy is enabled. On write, the default interpretation
     * if unset is that the policy is enabled. On read, clients should not make
     * any assumption about the state if it has not been populated. The
     * field should always be populated on List and Get operations, unless
     * a field projection has been specified that strips it out.
     * </pre>
     *
     * <code>.google.protobuf.BoolValue enabled = 17;</code>
     */
    public boolean hasEnabled() {
      return enabledBuilder_ != null || enabled_ != null;
    }
    /**
     *
     *
     * <pre>
     * Whether or not the policy is enabled. On write, the default interpretation
     * if unset is that the policy is enabled. On read, clients should not make
     * any assumption about the state if it has not been populated. The
     * field should always be populated on List and Get operations, unless
     * a field projection has been specified that strips it out.
     * </pre>
     *
     * <code>.google.protobuf.BoolValue enabled = 17;</code>
     */
    public com.google.protobuf.BoolValue getEnabled() {
      if (enabledBuilder_ == null) {
        return enabled_ == null ? com.google.protobuf.BoolValue.getDefaultInstance() : enabled_;
      } else {
        return enabledBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Whether or not the policy is enabled. On write, the default interpretation
     * if unset is that the policy is enabled. On read, clients should not make
     * any assumption about the state if it has not been populated. The
     * field should always be populated on List and Get operations, unless
     * a field projection has been specified that strips it out.
     * </pre>
     *
     * <code>.google.protobuf.BoolValue enabled = 17;</code>
     */
    public Builder setEnabled(com.google.protobuf.BoolValue value) {
      if (enabledBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        enabled_ = value;
        onChanged();
      } else {
        enabledBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Whether or not the policy is enabled. On write, the default interpretation
     * if unset is that the policy is enabled. On read, clients should not make
     * any assumption about the state if it has not been populated. The
     * field should always be populated on List and Get operations, unless
     * a field projection has been specified that strips it out.
     * </pre>
     *
     * <code>.google.protobuf.BoolValue enabled = 17;</code>
     */
    public Builder setEnabled(com.google.protobuf.BoolValue.Builder builderForValue) {
      if (enabledBuilder_ == null) {
        enabled_ = builderForValue.build();
        onChanged();
      } else {
        enabledBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Whether or not the policy is enabled. On write, the default interpretation
     * if unset is that the policy is enabled. On read, clients should not make
     * any assumption about the state if it has not been populated. The
     * field should always be populated on List and Get operations, unless
     * a field projection has been specified that strips it out.
     * </pre>
     *
     * <code>.google.protobuf.BoolValue enabled = 17;</code>
     */
    public Builder mergeEnabled(com.google.protobuf.BoolValue value) {
      if (enabledBuilder_ == null) {
        if (enabled_ != null) {
          enabled_ =
              com.google.protobuf.BoolValue.newBuilder(enabled_).mergeFrom(value).buildPartial();
        } else {
          enabled_ = value;
        }
        onChanged();
      } else {
        enabledBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Whether or not the policy is enabled. On write, the default interpretation
     * if unset is that the policy is enabled. On read, clients should not make
     * any assumption about the state if it has not been populated. The
     * field should always be populated on List and Get operations, unless
     * a field projection has been specified that strips it out.
     * </pre>
     *
     * <code>.google.protobuf.BoolValue enabled = 17;</code>
     */
    public Builder clearEnabled() {
      if (enabledBuilder_ == null) {
        enabled_ = null;
        onChanged();
      } else {
        enabled_ = null;
        enabledBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Whether or not the policy is enabled. On write, the default interpretation
     * if unset is that the policy is enabled. On read, clients should not make
     * any assumption about the state if it has not been populated. The
     * field should always be populated on List and Get operations, unless
     * a field projection has been specified that strips it out.
     * </pre>
     *
     * <code>.google.protobuf.BoolValue enabled = 17;</code>
     */
    public com.google.protobuf.BoolValue.Builder getEnabledBuilder() {

      onChanged();
      return getEnabledFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Whether or not the policy is enabled. On write, the default interpretation
     * if unset is that the policy is enabled. On read, clients should not make
     * any assumption about the state if it has not been populated. The
     * field should always be populated on List and Get operations, unless
     * a field projection has been specified that strips it out.
     * </pre>
     *
     * <code>.google.protobuf.BoolValue enabled = 17;</code>
     */
    public com.google.protobuf.BoolValueOrBuilder getEnabledOrBuilder() {
      if (enabledBuilder_ != null) {
        return enabledBuilder_.getMessageOrBuilder();
      } else {
        return enabled_ == null ? com.google.protobuf.BoolValue.getDefaultInstance() : enabled_;
      }
    }
    /**
     *
     *
     * <pre>
     * Whether or not the policy is enabled. On write, the default interpretation
     * if unset is that the policy is enabled. On read, clients should not make
     * any assumption about the state if it has not been populated. The
     * field should always be populated on List and Get operations, unless
     * a field projection has been specified that strips it out.
     * </pre>
     *
     * <code>.google.protobuf.BoolValue enabled = 17;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.BoolValue,
            com.google.protobuf.BoolValue.Builder,
            com.google.protobuf.BoolValueOrBuilder>
        getEnabledFieldBuilder() {
      if (enabledBuilder_ == null) {
        enabledBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.BoolValue,
                com.google.protobuf.BoolValue.Builder,
                com.google.protobuf.BoolValueOrBuilder>(
                getEnabled(), getParentForChildren(), isClean());
        enabled_ = null;
      }
      return enabledBuilder_;
    }

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

    private void ensureNotificationChannelsIsMutable() {
      if (!((bitField0_ & 0x00000080) == 0x00000080)) {
        notificationChannels_ = new com.google.protobuf.LazyStringArrayList(notificationChannels_);
        bitField0_ |= 0x00000080;
      }
    }
    /**
     *
     *
     * <pre>
     * Identifies the notification channels to which notifications should be sent
     * when incidents are opened or closed or when new violations occur on
     * an already opened incident. Each element of this array corresponds to
     * the `name` field in each of the
     * [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
     * objects that are returned from the [`ListNotificationChannels`]
     * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
     * method. The syntax of the entries in this field is:
     *     projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
     * </pre>
     *
     * <code>repeated string notification_channels = 14;</code>
     */
    public com.google.protobuf.ProtocolStringList getNotificationChannelsList() {
      return notificationChannels_.getUnmodifiableView();
    }
    /**
     *
     *
     * <pre>
     * Identifies the notification channels to which notifications should be sent
     * when incidents are opened or closed or when new violations occur on
     * an already opened incident. Each element of this array corresponds to
     * the `name` field in each of the
     * [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
     * objects that are returned from the [`ListNotificationChannels`]
     * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
     * method. The syntax of the entries in this field is:
     *     projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
     * </pre>
     *
     * <code>repeated string notification_channels = 14;</code>
     */
    public int getNotificationChannelsCount() {
      return notificationChannels_.size();
    }
    /**
     *
     *
     * <pre>
     * Identifies the notification channels to which notifications should be sent
     * when incidents are opened or closed or when new violations occur on
     * an already opened incident. Each element of this array corresponds to
     * the `name` field in each of the
     * [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
     * objects that are returned from the [`ListNotificationChannels`]
     * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
     * method. The syntax of the entries in this field is:
     *     projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
     * </pre>
     *
     * <code>repeated string notification_channels = 14;</code>
     */
    public java.lang.String getNotificationChannels(int index) {
      return notificationChannels_.get(index);
    }
    /**
     *
     *
     * <pre>
     * Identifies the notification channels to which notifications should be sent
     * when incidents are opened or closed or when new violations occur on
     * an already opened incident. Each element of this array corresponds to
     * the `name` field in each of the
     * [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
     * objects that are returned from the [`ListNotificationChannels`]
     * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
     * method. The syntax of the entries in this field is:
     *     projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
     * </pre>
     *
     * <code>repeated string notification_channels = 14;</code>
     */
    public com.google.protobuf.ByteString getNotificationChannelsBytes(int index) {
      return notificationChannels_.getByteString(index);
    }
    /**
     *
     *
     * <pre>
     * Identifies the notification channels to which notifications should be sent
     * when incidents are opened or closed or when new violations occur on
     * an already opened incident. Each element of this array corresponds to
     * the `name` field in each of the
     * [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
     * objects that are returned from the [`ListNotificationChannels`]
     * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
     * method. The syntax of the entries in this field is:
     *     projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
     * </pre>
     *
     * <code>repeated string notification_channels = 14;</code>
     */
    public Builder setNotificationChannels(int index, java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureNotificationChannelsIsMutable();
      notificationChannels_.set(index, value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Identifies the notification channels to which notifications should be sent
     * when incidents are opened or closed or when new violations occur on
     * an already opened incident. Each element of this array corresponds to
     * the `name` field in each of the
     * [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
     * objects that are returned from the [`ListNotificationChannels`]
     * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
     * method. The syntax of the entries in this field is:
     *     projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
     * </pre>
     *
     * <code>repeated string notification_channels = 14;</code>
     */
    public Builder addNotificationChannels(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureNotificationChannelsIsMutable();
      notificationChannels_.add(value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Identifies the notification channels to which notifications should be sent
     * when incidents are opened or closed or when new violations occur on
     * an already opened incident. Each element of this array corresponds to
     * the `name` field in each of the
     * [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
     * objects that are returned from the [`ListNotificationChannels`]
     * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
     * method. The syntax of the entries in this field is:
     *     projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
     * </pre>
     *
     * <code>repeated string notification_channels = 14;</code>
     */
    public Builder addAllNotificationChannels(java.lang.Iterable<java.lang.String> values) {
      ensureNotificationChannelsIsMutable();
      com.google.protobuf.AbstractMessageLite.Builder.addAll(values, notificationChannels_);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Identifies the notification channels to which notifications should be sent
     * when incidents are opened or closed or when new violations occur on
     * an already opened incident. Each element of this array corresponds to
     * the `name` field in each of the
     * [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
     * objects that are returned from the [`ListNotificationChannels`]
     * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
     * method. The syntax of the entries in this field is:
     *     projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
     * </pre>
     *
     * <code>repeated string notification_channels = 14;</code>
     */
    public Builder clearNotificationChannels() {
      notificationChannels_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000080);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Identifies the notification channels to which notifications should be sent
     * when incidents are opened or closed or when new violations occur on
     * an already opened incident. Each element of this array corresponds to
     * the `name` field in each of the
     * [`NotificationChannel`][google.monitoring.v3.NotificationChannel]
     * objects that are returned from the [`ListNotificationChannels`]
     * [google.monitoring.v3.NotificationChannelService.ListNotificationChannels]
     * method. The syntax of the entries in this field is:
     *     projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
     * </pre>
     *
     * <code>repeated string notification_channels = 14;</code>
     */
    public Builder addNotificationChannelsBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      ensureNotificationChannelsIsMutable();
      notificationChannels_.add(value);
      onChanged();
      return this;
    }

    private com.google.monitoring.v3.MutationRecord creationRecord_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.monitoring.v3.MutationRecord,
            com.google.monitoring.v3.MutationRecord.Builder,
            com.google.monitoring.v3.MutationRecordOrBuilder>
        creationRecordBuilder_;
    /**
     *
     *
     * <pre>
     * A read-only record of the creation of the alerting policy. If provided
     * in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord creation_record = 10;</code>
     */
    public boolean hasCreationRecord() {
      return creationRecordBuilder_ != null || creationRecord_ != null;
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the creation of the alerting policy. If provided
     * in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord creation_record = 10;</code>
     */
    public com.google.monitoring.v3.MutationRecord getCreationRecord() {
      if (creationRecordBuilder_ == null) {
        return creationRecord_ == null
            ? com.google.monitoring.v3.MutationRecord.getDefaultInstance()
            : creationRecord_;
      } else {
        return creationRecordBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the creation of the alerting policy. If provided
     * in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord creation_record = 10;</code>
     */
    public Builder setCreationRecord(com.google.monitoring.v3.MutationRecord value) {
      if (creationRecordBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        creationRecord_ = value;
        onChanged();
      } else {
        creationRecordBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the creation of the alerting policy. If provided
     * in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord creation_record = 10;</code>
     */
    public Builder setCreationRecord(
        com.google.monitoring.v3.MutationRecord.Builder builderForValue) {
      if (creationRecordBuilder_ == null) {
        creationRecord_ = builderForValue.build();
        onChanged();
      } else {
        creationRecordBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the creation of the alerting policy. If provided
     * in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord creation_record = 10;</code>
     */
    public Builder mergeCreationRecord(com.google.monitoring.v3.MutationRecord value) {
      if (creationRecordBuilder_ == null) {
        if (creationRecord_ != null) {
          creationRecord_ =
              com.google.monitoring.v3.MutationRecord.newBuilder(creationRecord_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          creationRecord_ = value;
        }
        onChanged();
      } else {
        creationRecordBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the creation of the alerting policy. If provided
     * in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord creation_record = 10;</code>
     */
    public Builder clearCreationRecord() {
      if (creationRecordBuilder_ == null) {
        creationRecord_ = null;
        onChanged();
      } else {
        creationRecord_ = null;
        creationRecordBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the creation of the alerting policy. If provided
     * in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord creation_record = 10;</code>
     */
    public com.google.monitoring.v3.MutationRecord.Builder getCreationRecordBuilder() {

      onChanged();
      return getCreationRecordFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the creation of the alerting policy. If provided
     * in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord creation_record = 10;</code>
     */
    public com.google.monitoring.v3.MutationRecordOrBuilder getCreationRecordOrBuilder() {
      if (creationRecordBuilder_ != null) {
        return creationRecordBuilder_.getMessageOrBuilder();
      } else {
        return creationRecord_ == null
            ? com.google.monitoring.v3.MutationRecord.getDefaultInstance()
            : creationRecord_;
      }
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the creation of the alerting policy. If provided
     * in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord creation_record = 10;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.monitoring.v3.MutationRecord,
            com.google.monitoring.v3.MutationRecord.Builder,
            com.google.monitoring.v3.MutationRecordOrBuilder>
        getCreationRecordFieldBuilder() {
      if (creationRecordBuilder_ == null) {
        creationRecordBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.monitoring.v3.MutationRecord,
                com.google.monitoring.v3.MutationRecord.Builder,
                com.google.monitoring.v3.MutationRecordOrBuilder>(
                getCreationRecord(), getParentForChildren(), isClean());
        creationRecord_ = null;
      }
      return creationRecordBuilder_;
    }

    private com.google.monitoring.v3.MutationRecord mutationRecord_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.monitoring.v3.MutationRecord,
            com.google.monitoring.v3.MutationRecord.Builder,
            com.google.monitoring.v3.MutationRecordOrBuilder>
        mutationRecordBuilder_;
    /**
     *
     *
     * <pre>
     * A read-only record of the most recent change to the alerting policy. If
     * provided in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord mutation_record = 11;</code>
     */
    public boolean hasMutationRecord() {
      return mutationRecordBuilder_ != null || mutationRecord_ != null;
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the most recent change to the alerting policy. If
     * provided in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord mutation_record = 11;</code>
     */
    public com.google.monitoring.v3.MutationRecord getMutationRecord() {
      if (mutationRecordBuilder_ == null) {
        return mutationRecord_ == null
            ? com.google.monitoring.v3.MutationRecord.getDefaultInstance()
            : mutationRecord_;
      } else {
        return mutationRecordBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the most recent change to the alerting policy. If
     * provided in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord mutation_record = 11;</code>
     */
    public Builder setMutationRecord(com.google.monitoring.v3.MutationRecord value) {
      if (mutationRecordBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        mutationRecord_ = value;
        onChanged();
      } else {
        mutationRecordBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the most recent change to the alerting policy. If
     * provided in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord mutation_record = 11;</code>
     */
    public Builder setMutationRecord(
        com.google.monitoring.v3.MutationRecord.Builder builderForValue) {
      if (mutationRecordBuilder_ == null) {
        mutationRecord_ = builderForValue.build();
        onChanged();
      } else {
        mutationRecordBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the most recent change to the alerting policy. If
     * provided in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord mutation_record = 11;</code>
     */
    public Builder mergeMutationRecord(com.google.monitoring.v3.MutationRecord value) {
      if (mutationRecordBuilder_ == null) {
        if (mutationRecord_ != null) {
          mutationRecord_ =
              com.google.monitoring.v3.MutationRecord.newBuilder(mutationRecord_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          mutationRecord_ = value;
        }
        onChanged();
      } else {
        mutationRecordBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the most recent change to the alerting policy. If
     * provided in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord mutation_record = 11;</code>
     */
    public Builder clearMutationRecord() {
      if (mutationRecordBuilder_ == null) {
        mutationRecord_ = null;
        onChanged();
      } else {
        mutationRecord_ = null;
        mutationRecordBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the most recent change to the alerting policy. If
     * provided in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord mutation_record = 11;</code>
     */
    public com.google.monitoring.v3.MutationRecord.Builder getMutationRecordBuilder() {

      onChanged();
      return getMutationRecordFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the most recent change to the alerting policy. If
     * provided in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord mutation_record = 11;</code>
     */
    public com.google.monitoring.v3.MutationRecordOrBuilder getMutationRecordOrBuilder() {
      if (mutationRecordBuilder_ != null) {
        return mutationRecordBuilder_.getMessageOrBuilder();
      } else {
        return mutationRecord_ == null
            ? com.google.monitoring.v3.MutationRecord.getDefaultInstance()
            : mutationRecord_;
      }
    }
    /**
     *
     *
     * <pre>
     * A read-only record of the most recent change to the alerting policy. If
     * provided in a call to create or update, this field will be ignored.
     * </pre>
     *
     * <code>.google.monitoring.v3.MutationRecord mutation_record = 11;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.monitoring.v3.MutationRecord,
            com.google.monitoring.v3.MutationRecord.Builder,
            com.google.monitoring.v3.MutationRecordOrBuilder>
        getMutationRecordFieldBuilder() {
      if (mutationRecordBuilder_ == null) {
        mutationRecordBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.monitoring.v3.MutationRecord,
                com.google.monitoring.v3.MutationRecord.Builder,
                com.google.monitoring.v3.MutationRecordOrBuilder>(
                getMutationRecord(), getParentForChildren(), isClean());
        mutationRecord_ = null;
      }
      return mutationRecordBuilder_;
    }

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

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

    // @@protoc_insertion_point(builder_scope:google.monitoring.v3.AlertPolicy)
  }

  // @@protoc_insertion_point(class_scope:google.monitoring.v3.AlertPolicy)
  private static final com.google.monitoring.v3.AlertPolicy DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.monitoring.v3.AlertPolicy();
  }

  public static com.google.monitoring.v3.AlertPolicy getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

  @java.lang.Override
  public com.google.monitoring.v3.AlertPolicy getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
