// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/logging/v2/logging_config.proto

package com.google.logging.v2;

/**
 * <pre>
 * Describes a sink used to export log entries to one of the following
 * destinations in any project: a Cloud Storage bucket, a BigQuery dataset, or a
 * Cloud Pub/Sub topic.  A logs filter controls which log entries are
 * exported. The sink must be created within a project, organization, billing
 * account, or folder.
 * </pre>
 *
 * Protobuf type {@code google.logging.v2.LogSink}
 */
public  final class LogSink extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:google.logging.v2.LogSink)
    LogSinkOrBuilder {
private static final long serialVersionUID = 0L;
  // Use LogSink.newBuilder() to construct.
  private LogSink(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private LogSink() {
    name_ = "";
    destination_ = "";
    filter_ = "";
    outputVersionFormat_ = 0;
    writerIdentity_ = "";
    includeChildren_ = false;
  }

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

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

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

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

            outputVersionFormat_ = rawValue;
            break;
          }
          case 66: {
            java.lang.String s = input.readStringRequireUtf8();

            writerIdentity_ = s;
            break;
          }
          case 72: {

            includeChildren_ = input.readBool();
            break;
          }
          case 82: {
            com.google.protobuf.Timestamp.Builder subBuilder = null;
            if (startTime_ != null) {
              subBuilder = startTime_.toBuilder();
            }
            startTime_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(startTime_);
              startTime_ = subBuilder.buildPartial();
            }

            break;
          }
          case 90: {
            com.google.protobuf.Timestamp.Builder subBuilder = null;
            if (endTime_ != null) {
              subBuilder = endTime_.toBuilder();
            }
            endTime_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(endTime_);
              endTime_ = subBuilder.buildPartial();
            }

            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.logging.v2.LoggingConfigProto.internal_static_google_logging_v2_LogSink_descriptor;
  }

  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.logging.v2.LoggingConfigProto.internal_static_google_logging_v2_LogSink_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.logging.v2.LogSink.class, com.google.logging.v2.LogSink.Builder.class);
  }

  /**
   * <pre>
   * Available log entry formats. Log entries can be written to Stackdriver
   * Logging in either format and can be exported in either format.
   * Version 2 is the preferred format.
   * </pre>
   *
   * Protobuf enum {@code google.logging.v2.LogSink.VersionFormat}
   */
  public enum VersionFormat
      implements com.google.protobuf.ProtocolMessageEnum {
    /**
     * <pre>
     * An unspecified format version that will default to V2.
     * </pre>
     *
     * <code>VERSION_FORMAT_UNSPECIFIED = 0;</code>
     */
    VERSION_FORMAT_UNSPECIFIED(0),
    /**
     * <pre>
     * `LogEntry` version 2 format.
     * </pre>
     *
     * <code>V2 = 1;</code>
     */
    V2(1),
    /**
     * <pre>
     * `LogEntry` version 1 format.
     * </pre>
     *
     * <code>V1 = 2;</code>
     */
    V1(2),
    UNRECOGNIZED(-1),
    ;

    /**
     * <pre>
     * An unspecified format version that will default to V2.
     * </pre>
     *
     * <code>VERSION_FORMAT_UNSPECIFIED = 0;</code>
     */
    public static final int VERSION_FORMAT_UNSPECIFIED_VALUE = 0;
    /**
     * <pre>
     * `LogEntry` version 2 format.
     * </pre>
     *
     * <code>V2 = 1;</code>
     */
    public static final int V2_VALUE = 1;
    /**
     * <pre>
     * `LogEntry` version 1 format.
     * </pre>
     *
     * <code>V1 = 2;</code>
     */
    public static final int V1_VALUE = 2;


    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 VersionFormat valueOf(int value) {
      return forNumber(value);
    }

    public static VersionFormat forNumber(int value) {
      switch (value) {
        case 0: return VERSION_FORMAT_UNSPECIFIED;
        case 1: return V2;
        case 2: return V1;
        default: return null;
      }
    }

    public static com.google.protobuf.Internal.EnumLiteMap<VersionFormat>
        internalGetValueMap() {
      return internalValueMap;
    }
    private static final com.google.protobuf.Internal.EnumLiteMap<
        VersionFormat> internalValueMap =
          new com.google.protobuf.Internal.EnumLiteMap<VersionFormat>() {
            public VersionFormat findValueByNumber(int number) {
              return VersionFormat.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.logging.v2.LogSink.getDescriptor().getEnumTypes().get(0);
    }

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

    public static VersionFormat 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 VersionFormat(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:google.logging.v2.LogSink.VersionFormat)
  }

  public static final int NAME_FIELD_NUMBER = 1;
  private volatile java.lang.Object name_;
  /**
   * <pre>
   * Required. The client-assigned sink identifier, unique within the
   * project. Example: `"my-syslog-errors-to-pubsub"`.  Sink identifiers are
   * limited to 100 characters and can include only the following characters:
   * upper and lower-case alphanumeric characters, underscores, hyphens, and
   * periods.
   * </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. The client-assigned sink identifier, unique within the
   * project. Example: `"my-syslog-errors-to-pubsub"`.  Sink identifiers are
   * limited to 100 characters and can include only the following characters:
   * upper and lower-case alphanumeric characters, underscores, hyphens, and
   * periods.
   * </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 DESTINATION_FIELD_NUMBER = 3;
  private volatile java.lang.Object destination_;
  /**
   * <pre>
   * Required. The export destination:
   *     "storage.googleapis.com/[GCS_BUCKET]"
   *     "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]"
   *     "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]"
   * The sink's `writer_identity`, set when the sink is created, must
   * have permission to write to the destination or else the log
   * entries are not exported.  For more information, see
   * [Exporting Logs With Sinks](/logging/docs/api/tasks/exporting-logs).
   * </pre>
   *
   * <code>string destination = 3;</code>
   */
  public java.lang.String getDestination() {
    java.lang.Object ref = destination_;
    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();
      destination_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * Required. The export destination:
   *     "storage.googleapis.com/[GCS_BUCKET]"
   *     "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]"
   *     "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]"
   * The sink's `writer_identity`, set when the sink is created, must
   * have permission to write to the destination or else the log
   * entries are not exported.  For more information, see
   * [Exporting Logs With Sinks](/logging/docs/api/tasks/exporting-logs).
   * </pre>
   *
   * <code>string destination = 3;</code>
   */
  public com.google.protobuf.ByteString
      getDestinationBytes() {
    java.lang.Object ref = destination_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      destination_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int FILTER_FIELD_NUMBER = 5;
  private volatile java.lang.Object filter_;
  /**
   * <pre>
   * Optional.
   * An [advanced logs filter](/logging/docs/view/advanced_filters).  The only
   * exported log entries are those that are in the resource owning the sink and
   * that match the filter.  For example:
   *     logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity&gt;=ERROR
   * </pre>
   *
   * <code>string filter = 5;</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>
   * Optional.
   * An [advanced logs filter](/logging/docs/view/advanced_filters).  The only
   * exported log entries are those that are in the resource owning the sink and
   * that match the filter.  For example:
   *     logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity&gt;=ERROR
   * </pre>
   *
   * <code>string filter = 5;</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 OUTPUT_VERSION_FORMAT_FIELD_NUMBER = 6;
  private int outputVersionFormat_;
  /**
   * <pre>
   * Deprecated. The log entry format to use for this sink's exported log
   * entries.  The v2 format is used by default and cannot be changed.
   * </pre>
   *
   * <code>.google.logging.v2.LogSink.VersionFormat output_version_format = 6;</code>
   */
  public int getOutputVersionFormatValue() {
    return outputVersionFormat_;
  }
  /**
   * <pre>
   * Deprecated. The log entry format to use for this sink's exported log
   * entries.  The v2 format is used by default and cannot be changed.
   * </pre>
   *
   * <code>.google.logging.v2.LogSink.VersionFormat output_version_format = 6;</code>
   */
  public com.google.logging.v2.LogSink.VersionFormat getOutputVersionFormat() {
    com.google.logging.v2.LogSink.VersionFormat result = com.google.logging.v2.LogSink.VersionFormat.valueOf(outputVersionFormat_);
    return result == null ? com.google.logging.v2.LogSink.VersionFormat.UNRECOGNIZED : result;
  }

  public static final int WRITER_IDENTITY_FIELD_NUMBER = 8;
  private volatile java.lang.Object writerIdentity_;
  /**
   * <pre>
   * Output only. An IAM identity&amp;mdash;a service account or group&amp;mdash;under
   * which Stackdriver Logging writes the exported log entries to the sink's
   * destination.  This field is set by
   * [sinks.create](/logging/docs/api/reference/rest/v2/projects.sinks/create)
   * and
   * [sinks.update](/logging/docs/api/reference/rest/v2/projects.sinks/update),
   * based on the setting of `unique_writer_identity` in those methods.
   * Until you grant this identity write-access to the destination, log entry
   * exports from this sink will fail. For more information,
   * see [Granting access for a
   * resource](/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource).
   * Consult the destination service's documentation to determine the
   * appropriate IAM roles to assign to the identity.
   * </pre>
   *
   * <code>string writer_identity = 8;</code>
   */
  public java.lang.String getWriterIdentity() {
    java.lang.Object ref = writerIdentity_;
    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();
      writerIdentity_ = s;
      return s;
    }
  }
  /**
   * <pre>
   * Output only. An IAM identity&amp;mdash;a service account or group&amp;mdash;under
   * which Stackdriver Logging writes the exported log entries to the sink's
   * destination.  This field is set by
   * [sinks.create](/logging/docs/api/reference/rest/v2/projects.sinks/create)
   * and
   * [sinks.update](/logging/docs/api/reference/rest/v2/projects.sinks/update),
   * based on the setting of `unique_writer_identity` in those methods.
   * Until you grant this identity write-access to the destination, log entry
   * exports from this sink will fail. For more information,
   * see [Granting access for a
   * resource](/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource).
   * Consult the destination service's documentation to determine the
   * appropriate IAM roles to assign to the identity.
   * </pre>
   *
   * <code>string writer_identity = 8;</code>
   */
  public com.google.protobuf.ByteString
      getWriterIdentityBytes() {
    java.lang.Object ref = writerIdentity_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      writerIdentity_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int INCLUDE_CHILDREN_FIELD_NUMBER = 9;
  private boolean includeChildren_;
  /**
   * <pre>
   * Optional. This field applies only to sinks owned by organizations and
   * folders. If the field is false, the default, only the logs owned by the
   * sink's parent resource are available for export. If the field is true, then
   * logs from all the projects, folders, and billing accounts contained in the
   * sink's parent resource are also available for export. Whether a particular
   * log entry from the children is exported depends on the sink's filter
   * expression. For example, if this field is true, then the filter
   * `resource.type=gce_instance` would export all Compute Engine VM instance
   * log entries from all projects in the sink's parent. To only export entries
   * from certain child projects, filter on the project part of the log name:
   *     logName:("projects/test-project1/" OR "projects/test-project2/") AND
   *     resource.type=gce_instance
   * </pre>
   *
   * <code>bool include_children = 9;</code>
   */
  public boolean getIncludeChildren() {
    return includeChildren_;
  }

  public static final int START_TIME_FIELD_NUMBER = 10;
  private com.google.protobuf.Timestamp startTime_;
  /**
   * <pre>
   * Deprecated. This field is ignored when creating or updating sinks.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp start_time = 10;</code>
   */
  public boolean hasStartTime() {
    return startTime_ != null;
  }
  /**
   * <pre>
   * Deprecated. This field is ignored when creating or updating sinks.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp start_time = 10;</code>
   */
  public com.google.protobuf.Timestamp getStartTime() {
    return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_;
  }
  /**
   * <pre>
   * Deprecated. This field is ignored when creating or updating sinks.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp start_time = 10;</code>
   */
  public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() {
    return getStartTime();
  }

  public static final int END_TIME_FIELD_NUMBER = 11;
  private com.google.protobuf.Timestamp endTime_;
  /**
   * <pre>
   * Deprecated. This field is ignored when creating or updating sinks.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp end_time = 11;</code>
   */
  public boolean hasEndTime() {
    return endTime_ != null;
  }
  /**
   * <pre>
   * Deprecated. This field is ignored when creating or updating sinks.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp end_time = 11;</code>
   */
  public com.google.protobuf.Timestamp getEndTime() {
    return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_;
  }
  /**
   * <pre>
   * Deprecated. This field is ignored when creating or updating sinks.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp end_time = 11;</code>
   */
  public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() {
    return getEndTime();
  }

  private byte memoizedIsInitialized = -1;
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (!getNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
    }
    if (!getDestinationBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 3, destination_);
    }
    if (!getFilterBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 5, filter_);
    }
    if (outputVersionFormat_ != com.google.logging.v2.LogSink.VersionFormat.VERSION_FORMAT_UNSPECIFIED.getNumber()) {
      output.writeEnum(6, outputVersionFormat_);
    }
    if (!getWriterIdentityBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 8, writerIdentity_);
    }
    if (includeChildren_ != false) {
      output.writeBool(9, includeChildren_);
    }
    if (startTime_ != null) {
      output.writeMessage(10, getStartTime());
    }
    if (endTime_ != null) {
      output.writeMessage(11, getEndTime());
    }
    unknownFields.writeTo(output);
  }

  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 (!getDestinationBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, destination_);
    }
    if (!getFilterBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, filter_);
    }
    if (outputVersionFormat_ != com.google.logging.v2.LogSink.VersionFormat.VERSION_FORMAT_UNSPECIFIED.getNumber()) {
      size += com.google.protobuf.CodedOutputStream
        .computeEnumSize(6, outputVersionFormat_);
    }
    if (!getWriterIdentityBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(8, writerIdentity_);
    }
    if (includeChildren_ != false) {
      size += com.google.protobuf.CodedOutputStream
        .computeBoolSize(9, includeChildren_);
    }
    if (startTime_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(10, getStartTime());
    }
    if (endTime_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(11, getEndTime());
    }
    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.logging.v2.LogSink)) {
      return super.equals(obj);
    }
    com.google.logging.v2.LogSink other = (com.google.logging.v2.LogSink) obj;

    boolean result = true;
    result = result && getName()
        .equals(other.getName());
    result = result && getDestination()
        .equals(other.getDestination());
    result = result && getFilter()
        .equals(other.getFilter());
    result = result && outputVersionFormat_ == other.outputVersionFormat_;
    result = result && getWriterIdentity()
        .equals(other.getWriterIdentity());
    result = result && (getIncludeChildren()
        == other.getIncludeChildren());
    result = result && (hasStartTime() == other.hasStartTime());
    if (hasStartTime()) {
      result = result && getStartTime()
          .equals(other.getStartTime());
    }
    result = result && (hasEndTime() == other.hasEndTime());
    if (hasEndTime()) {
      result = result && getEndTime()
          .equals(other.getEndTime());
    }
    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) + DESTINATION_FIELD_NUMBER;
    hash = (53 * hash) + getDestination().hashCode();
    hash = (37 * hash) + FILTER_FIELD_NUMBER;
    hash = (53 * hash) + getFilter().hashCode();
    hash = (37 * hash) + OUTPUT_VERSION_FORMAT_FIELD_NUMBER;
    hash = (53 * hash) + outputVersionFormat_;
    hash = (37 * hash) + WRITER_IDENTITY_FIELD_NUMBER;
    hash = (53 * hash) + getWriterIdentity().hashCode();
    hash = (37 * hash) + INCLUDE_CHILDREN_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
        getIncludeChildren());
    if (hasStartTime()) {
      hash = (37 * hash) + START_TIME_FIELD_NUMBER;
      hash = (53 * hash) + getStartTime().hashCode();
    }
    if (hasEndTime()) {
      hash = (37 * hash) + END_TIME_FIELD_NUMBER;
      hash = (53 * hash) + getEndTime().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.logging.v2.LogSink parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.logging.v2.LogSink parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.logging.v2.LogSink parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.logging.v2.LogSink 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.logging.v2.LogSink parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.logging.v2.LogSink parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.logging.v2.LogSink parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.logging.v2.LogSink 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.logging.v2.LogSink parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static com.google.logging.v2.LogSink 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.logging.v2.LogSink parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.logging.v2.LogSink parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(com.google.logging.v2.LogSink prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(
      com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   * <pre>
   * Describes a sink used to export log entries to one of the following
   * destinations in any project: a Cloud Storage bucket, a BigQuery dataset, or a
   * Cloud Pub/Sub topic.  A logs filter controls which log entries are
   * exported. The sink must be created within a project, organization, billing
   * account, or folder.
   * </pre>
   *
   * Protobuf type {@code google.logging.v2.LogSink}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:google.logging.v2.LogSink)
      com.google.logging.v2.LogSinkOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.google.logging.v2.LoggingConfigProto.internal_static_google_logging_v2_LogSink_descriptor;
    }

    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.logging.v2.LoggingConfigProto.internal_static_google_logging_v2_LogSink_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.logging.v2.LogSink.class, com.google.logging.v2.LogSink.Builder.class);
    }

    // Construct using com.google.logging.v2.LogSink.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

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

      destination_ = "";

      filter_ = "";

      outputVersionFormat_ = 0;

      writerIdentity_ = "";

      includeChildren_ = false;

      if (startTimeBuilder_ == null) {
        startTime_ = null;
      } else {
        startTime_ = null;
        startTimeBuilder_ = null;
      }
      if (endTimeBuilder_ == null) {
        endTime_ = null;
      } else {
        endTime_ = null;
        endTimeBuilder_ = null;
      }
      return this;
    }

    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.google.logging.v2.LoggingConfigProto.internal_static_google_logging_v2_LogSink_descriptor;
    }

    public com.google.logging.v2.LogSink getDefaultInstanceForType() {
      return com.google.logging.v2.LogSink.getDefaultInstance();
    }

    public com.google.logging.v2.LogSink build() {
      com.google.logging.v2.LogSink result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    public com.google.logging.v2.LogSink buildPartial() {
      com.google.logging.v2.LogSink result = new com.google.logging.v2.LogSink(this);
      result.name_ = name_;
      result.destination_ = destination_;
      result.filter_ = filter_;
      result.outputVersionFormat_ = outputVersionFormat_;
      result.writerIdentity_ = writerIdentity_;
      result.includeChildren_ = includeChildren_;
      if (startTimeBuilder_ == null) {
        result.startTime_ = startTime_;
      } else {
        result.startTime_ = startTimeBuilder_.build();
      }
      if (endTimeBuilder_ == null) {
        result.endTime_ = endTime_;
      } else {
        result.endTime_ = endTimeBuilder_.build();
      }
      onBuilt();
      return result;
    }

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

    public Builder mergeFrom(com.google.logging.v2.LogSink other) {
      if (other == com.google.logging.v2.LogSink.getDefaultInstance()) return this;
      if (!other.getName().isEmpty()) {
        name_ = other.name_;
        onChanged();
      }
      if (!other.getDestination().isEmpty()) {
        destination_ = other.destination_;
        onChanged();
      }
      if (!other.getFilter().isEmpty()) {
        filter_ = other.filter_;
        onChanged();
      }
      if (other.outputVersionFormat_ != 0) {
        setOutputVersionFormatValue(other.getOutputVersionFormatValue());
      }
      if (!other.getWriterIdentity().isEmpty()) {
        writerIdentity_ = other.writerIdentity_;
        onChanged();
      }
      if (other.getIncludeChildren() != false) {
        setIncludeChildren(other.getIncludeChildren());
      }
      if (other.hasStartTime()) {
        mergeStartTime(other.getStartTime());
      }
      if (other.hasEndTime()) {
        mergeEndTime(other.getEndTime());
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    public final boolean isInitialized() {
      return true;
    }

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

    private java.lang.Object name_ = "";
    /**
     * <pre>
     * Required. The client-assigned sink identifier, unique within the
     * project. Example: `"my-syslog-errors-to-pubsub"`.  Sink identifiers are
     * limited to 100 characters and can include only the following characters:
     * upper and lower-case alphanumeric characters, underscores, hyphens, and
     * periods.
     * </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. The client-assigned sink identifier, unique within the
     * project. Example: `"my-syslog-errors-to-pubsub"`.  Sink identifiers are
     * limited to 100 characters and can include only the following characters:
     * upper and lower-case alphanumeric characters, underscores, hyphens, and
     * periods.
     * </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. The client-assigned sink identifier, unique within the
     * project. Example: `"my-syslog-errors-to-pubsub"`.  Sink identifiers are
     * limited to 100 characters and can include only the following characters:
     * upper and lower-case alphanumeric characters, underscores, hyphens, and
     * periods.
     * </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. The client-assigned sink identifier, unique within the
     * project. Example: `"my-syslog-errors-to-pubsub"`.  Sink identifiers are
     * limited to 100 characters and can include only the following characters:
     * upper and lower-case alphanumeric characters, underscores, hyphens, and
     * periods.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public Builder clearName() {
      
      name_ = getDefaultInstance().getName();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The client-assigned sink identifier, unique within the
     * project. Example: `"my-syslog-errors-to-pubsub"`.  Sink identifiers are
     * limited to 100 characters and can include only the following characters:
     * upper and lower-case alphanumeric characters, underscores, hyphens, and
     * periods.
     * </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 destination_ = "";
    /**
     * <pre>
     * Required. The export destination:
     *     "storage.googleapis.com/[GCS_BUCKET]"
     *     "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]"
     *     "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]"
     * The sink's `writer_identity`, set when the sink is created, must
     * have permission to write to the destination or else the log
     * entries are not exported.  For more information, see
     * [Exporting Logs With Sinks](/logging/docs/api/tasks/exporting-logs).
     * </pre>
     *
     * <code>string destination = 3;</code>
     */
    public java.lang.String getDestination() {
      java.lang.Object ref = destination_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        destination_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * Required. The export destination:
     *     "storage.googleapis.com/[GCS_BUCKET]"
     *     "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]"
     *     "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]"
     * The sink's `writer_identity`, set when the sink is created, must
     * have permission to write to the destination or else the log
     * entries are not exported.  For more information, see
     * [Exporting Logs With Sinks](/logging/docs/api/tasks/exporting-logs).
     * </pre>
     *
     * <code>string destination = 3;</code>
     */
    public com.google.protobuf.ByteString
        getDestinationBytes() {
      java.lang.Object ref = destination_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        destination_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * Required. The export destination:
     *     "storage.googleapis.com/[GCS_BUCKET]"
     *     "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]"
     *     "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]"
     * The sink's `writer_identity`, set when the sink is created, must
     * have permission to write to the destination or else the log
     * entries are not exported.  For more information, see
     * [Exporting Logs With Sinks](/logging/docs/api/tasks/exporting-logs).
     * </pre>
     *
     * <code>string destination = 3;</code>
     */
    public Builder setDestination(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      destination_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The export destination:
     *     "storage.googleapis.com/[GCS_BUCKET]"
     *     "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]"
     *     "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]"
     * The sink's `writer_identity`, set when the sink is created, must
     * have permission to write to the destination or else the log
     * entries are not exported.  For more information, see
     * [Exporting Logs With Sinks](/logging/docs/api/tasks/exporting-logs).
     * </pre>
     *
     * <code>string destination = 3;</code>
     */
    public Builder clearDestination() {
      
      destination_ = getDefaultInstance().getDestination();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Required. The export destination:
     *     "storage.googleapis.com/[GCS_BUCKET]"
     *     "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]"
     *     "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]"
     * The sink's `writer_identity`, set when the sink is created, must
     * have permission to write to the destination or else the log
     * entries are not exported.  For more information, see
     * [Exporting Logs With Sinks](/logging/docs/api/tasks/exporting-logs).
     * </pre>
     *
     * <code>string destination = 3;</code>
     */
    public Builder setDestinationBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      destination_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object filter_ = "";
    /**
     * <pre>
     * Optional.
     * An [advanced logs filter](/logging/docs/view/advanced_filters).  The only
     * exported log entries are those that are in the resource owning the sink and
     * that match the filter.  For example:
     *     logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity&gt;=ERROR
     * </pre>
     *
     * <code>string filter = 5;</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>
     * Optional.
     * An [advanced logs filter](/logging/docs/view/advanced_filters).  The only
     * exported log entries are those that are in the resource owning the sink and
     * that match the filter.  For example:
     *     logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity&gt;=ERROR
     * </pre>
     *
     * <code>string filter = 5;</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>
     * Optional.
     * An [advanced logs filter](/logging/docs/view/advanced_filters).  The only
     * exported log entries are those that are in the resource owning the sink and
     * that match the filter.  For example:
     *     logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity&gt;=ERROR
     * </pre>
     *
     * <code>string filter = 5;</code>
     */
    public Builder setFilter(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      filter_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Optional.
     * An [advanced logs filter](/logging/docs/view/advanced_filters).  The only
     * exported log entries are those that are in the resource owning the sink and
     * that match the filter.  For example:
     *     logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity&gt;=ERROR
     * </pre>
     *
     * <code>string filter = 5;</code>
     */
    public Builder clearFilter() {
      
      filter_ = getDefaultInstance().getFilter();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Optional.
     * An [advanced logs filter](/logging/docs/view/advanced_filters).  The only
     * exported log entries are those that are in the resource owning the sink and
     * that match the filter.  For example:
     *     logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity&gt;=ERROR
     * </pre>
     *
     * <code>string filter = 5;</code>
     */
    public Builder setFilterBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      filter_ = value;
      onChanged();
      return this;
    }

    private int outputVersionFormat_ = 0;
    /**
     * <pre>
     * Deprecated. The log entry format to use for this sink's exported log
     * entries.  The v2 format is used by default and cannot be changed.
     * </pre>
     *
     * <code>.google.logging.v2.LogSink.VersionFormat output_version_format = 6;</code>
     */
    public int getOutputVersionFormatValue() {
      return outputVersionFormat_;
    }
    /**
     * <pre>
     * Deprecated. The log entry format to use for this sink's exported log
     * entries.  The v2 format is used by default and cannot be changed.
     * </pre>
     *
     * <code>.google.logging.v2.LogSink.VersionFormat output_version_format = 6;</code>
     */
    public Builder setOutputVersionFormatValue(int value) {
      outputVersionFormat_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Deprecated. The log entry format to use for this sink's exported log
     * entries.  The v2 format is used by default and cannot be changed.
     * </pre>
     *
     * <code>.google.logging.v2.LogSink.VersionFormat output_version_format = 6;</code>
     */
    public com.google.logging.v2.LogSink.VersionFormat getOutputVersionFormat() {
      com.google.logging.v2.LogSink.VersionFormat result = com.google.logging.v2.LogSink.VersionFormat.valueOf(outputVersionFormat_);
      return result == null ? com.google.logging.v2.LogSink.VersionFormat.UNRECOGNIZED : result;
    }
    /**
     * <pre>
     * Deprecated. The log entry format to use for this sink's exported log
     * entries.  The v2 format is used by default and cannot be changed.
     * </pre>
     *
     * <code>.google.logging.v2.LogSink.VersionFormat output_version_format = 6;</code>
     */
    public Builder setOutputVersionFormat(com.google.logging.v2.LogSink.VersionFormat value) {
      if (value == null) {
        throw new NullPointerException();
      }
      
      outputVersionFormat_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Deprecated. The log entry format to use for this sink's exported log
     * entries.  The v2 format is used by default and cannot be changed.
     * </pre>
     *
     * <code>.google.logging.v2.LogSink.VersionFormat output_version_format = 6;</code>
     */
    public Builder clearOutputVersionFormat() {
      
      outputVersionFormat_ = 0;
      onChanged();
      return this;
    }

    private java.lang.Object writerIdentity_ = "";
    /**
     * <pre>
     * Output only. An IAM identity&amp;mdash;a service account or group&amp;mdash;under
     * which Stackdriver Logging writes the exported log entries to the sink's
     * destination.  This field is set by
     * [sinks.create](/logging/docs/api/reference/rest/v2/projects.sinks/create)
     * and
     * [sinks.update](/logging/docs/api/reference/rest/v2/projects.sinks/update),
     * based on the setting of `unique_writer_identity` in those methods.
     * Until you grant this identity write-access to the destination, log entry
     * exports from this sink will fail. For more information,
     * see [Granting access for a
     * resource](/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource).
     * Consult the destination service's documentation to determine the
     * appropriate IAM roles to assign to the identity.
     * </pre>
     *
     * <code>string writer_identity = 8;</code>
     */
    public java.lang.String getWriterIdentity() {
      java.lang.Object ref = writerIdentity_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        writerIdentity_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * Output only. An IAM identity&amp;mdash;a service account or group&amp;mdash;under
     * which Stackdriver Logging writes the exported log entries to the sink's
     * destination.  This field is set by
     * [sinks.create](/logging/docs/api/reference/rest/v2/projects.sinks/create)
     * and
     * [sinks.update](/logging/docs/api/reference/rest/v2/projects.sinks/update),
     * based on the setting of `unique_writer_identity` in those methods.
     * Until you grant this identity write-access to the destination, log entry
     * exports from this sink will fail. For more information,
     * see [Granting access for a
     * resource](/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource).
     * Consult the destination service's documentation to determine the
     * appropriate IAM roles to assign to the identity.
     * </pre>
     *
     * <code>string writer_identity = 8;</code>
     */
    public com.google.protobuf.ByteString
        getWriterIdentityBytes() {
      java.lang.Object ref = writerIdentity_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        writerIdentity_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * Output only. An IAM identity&amp;mdash;a service account or group&amp;mdash;under
     * which Stackdriver Logging writes the exported log entries to the sink's
     * destination.  This field is set by
     * [sinks.create](/logging/docs/api/reference/rest/v2/projects.sinks/create)
     * and
     * [sinks.update](/logging/docs/api/reference/rest/v2/projects.sinks/update),
     * based on the setting of `unique_writer_identity` in those methods.
     * Until you grant this identity write-access to the destination, log entry
     * exports from this sink will fail. For more information,
     * see [Granting access for a
     * resource](/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource).
     * Consult the destination service's documentation to determine the
     * appropriate IAM roles to assign to the identity.
     * </pre>
     *
     * <code>string writer_identity = 8;</code>
     */
    public Builder setWriterIdentity(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      writerIdentity_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Output only. An IAM identity&amp;mdash;a service account or group&amp;mdash;under
     * which Stackdriver Logging writes the exported log entries to the sink's
     * destination.  This field is set by
     * [sinks.create](/logging/docs/api/reference/rest/v2/projects.sinks/create)
     * and
     * [sinks.update](/logging/docs/api/reference/rest/v2/projects.sinks/update),
     * based on the setting of `unique_writer_identity` in those methods.
     * Until you grant this identity write-access to the destination, log entry
     * exports from this sink will fail. For more information,
     * see [Granting access for a
     * resource](/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource).
     * Consult the destination service's documentation to determine the
     * appropriate IAM roles to assign to the identity.
     * </pre>
     *
     * <code>string writer_identity = 8;</code>
     */
    public Builder clearWriterIdentity() {
      
      writerIdentity_ = getDefaultInstance().getWriterIdentity();
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Output only. An IAM identity&amp;mdash;a service account or group&amp;mdash;under
     * which Stackdriver Logging writes the exported log entries to the sink's
     * destination.  This field is set by
     * [sinks.create](/logging/docs/api/reference/rest/v2/projects.sinks/create)
     * and
     * [sinks.update](/logging/docs/api/reference/rest/v2/projects.sinks/update),
     * based on the setting of `unique_writer_identity` in those methods.
     * Until you grant this identity write-access to the destination, log entry
     * exports from this sink will fail. For more information,
     * see [Granting access for a
     * resource](/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource).
     * Consult the destination service's documentation to determine the
     * appropriate IAM roles to assign to the identity.
     * </pre>
     *
     * <code>string writer_identity = 8;</code>
     */
    public Builder setWriterIdentityBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      writerIdentity_ = value;
      onChanged();
      return this;
    }

    private boolean includeChildren_ ;
    /**
     * <pre>
     * Optional. This field applies only to sinks owned by organizations and
     * folders. If the field is false, the default, only the logs owned by the
     * sink's parent resource are available for export. If the field is true, then
     * logs from all the projects, folders, and billing accounts contained in the
     * sink's parent resource are also available for export. Whether a particular
     * log entry from the children is exported depends on the sink's filter
     * expression. For example, if this field is true, then the filter
     * `resource.type=gce_instance` would export all Compute Engine VM instance
     * log entries from all projects in the sink's parent. To only export entries
     * from certain child projects, filter on the project part of the log name:
     *     logName:("projects/test-project1/" OR "projects/test-project2/") AND
     *     resource.type=gce_instance
     * </pre>
     *
     * <code>bool include_children = 9;</code>
     */
    public boolean getIncludeChildren() {
      return includeChildren_;
    }
    /**
     * <pre>
     * Optional. This field applies only to sinks owned by organizations and
     * folders. If the field is false, the default, only the logs owned by the
     * sink's parent resource are available for export. If the field is true, then
     * logs from all the projects, folders, and billing accounts contained in the
     * sink's parent resource are also available for export. Whether a particular
     * log entry from the children is exported depends on the sink's filter
     * expression. For example, if this field is true, then the filter
     * `resource.type=gce_instance` would export all Compute Engine VM instance
     * log entries from all projects in the sink's parent. To only export entries
     * from certain child projects, filter on the project part of the log name:
     *     logName:("projects/test-project1/" OR "projects/test-project2/") AND
     *     resource.type=gce_instance
     * </pre>
     *
     * <code>bool include_children = 9;</code>
     */
    public Builder setIncludeChildren(boolean value) {
      
      includeChildren_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * Optional. This field applies only to sinks owned by organizations and
     * folders. If the field is false, the default, only the logs owned by the
     * sink's parent resource are available for export. If the field is true, then
     * logs from all the projects, folders, and billing accounts contained in the
     * sink's parent resource are also available for export. Whether a particular
     * log entry from the children is exported depends on the sink's filter
     * expression. For example, if this field is true, then the filter
     * `resource.type=gce_instance` would export all Compute Engine VM instance
     * log entries from all projects in the sink's parent. To only export entries
     * from certain child projects, filter on the project part of the log name:
     *     logName:("projects/test-project1/" OR "projects/test-project2/") AND
     *     resource.type=gce_instance
     * </pre>
     *
     * <code>bool include_children = 9;</code>
     */
    public Builder clearIncludeChildren() {
      
      includeChildren_ = false;
      onChanged();
      return this;
    }

    private com.google.protobuf.Timestamp startTime_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> startTimeBuilder_;
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp start_time = 10;</code>
     */
    public boolean hasStartTime() {
      return startTimeBuilder_ != null || startTime_ != null;
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp start_time = 10;</code>
     */
    public com.google.protobuf.Timestamp getStartTime() {
      if (startTimeBuilder_ == null) {
        return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_;
      } else {
        return startTimeBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp start_time = 10;</code>
     */
    public Builder setStartTime(com.google.protobuf.Timestamp value) {
      if (startTimeBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        startTime_ = value;
        onChanged();
      } else {
        startTimeBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp start_time = 10;</code>
     */
    public Builder setStartTime(
        com.google.protobuf.Timestamp.Builder builderForValue) {
      if (startTimeBuilder_ == null) {
        startTime_ = builderForValue.build();
        onChanged();
      } else {
        startTimeBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp start_time = 10;</code>
     */
    public Builder mergeStartTime(com.google.protobuf.Timestamp value) {
      if (startTimeBuilder_ == null) {
        if (startTime_ != null) {
          startTime_ =
            com.google.protobuf.Timestamp.newBuilder(startTime_).mergeFrom(value).buildPartial();
        } else {
          startTime_ = value;
        }
        onChanged();
      } else {
        startTimeBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp start_time = 10;</code>
     */
    public Builder clearStartTime() {
      if (startTimeBuilder_ == null) {
        startTime_ = null;
        onChanged();
      } else {
        startTime_ = null;
        startTimeBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp start_time = 10;</code>
     */
    public com.google.protobuf.Timestamp.Builder getStartTimeBuilder() {
      
      onChanged();
      return getStartTimeFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp start_time = 10;</code>
     */
    public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() {
      if (startTimeBuilder_ != null) {
        return startTimeBuilder_.getMessageOrBuilder();
      } else {
        return startTime_ == null ?
            com.google.protobuf.Timestamp.getDefaultInstance() : startTime_;
      }
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp start_time = 10;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> 
        getStartTimeFieldBuilder() {
      if (startTimeBuilder_ == null) {
        startTimeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>(
                getStartTime(),
                getParentForChildren(),
                isClean());
        startTime_ = null;
      }
      return startTimeBuilder_;
    }

    private com.google.protobuf.Timestamp endTime_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> endTimeBuilder_;
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp end_time = 11;</code>
     */
    public boolean hasEndTime() {
      return endTimeBuilder_ != null || endTime_ != null;
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp end_time = 11;</code>
     */
    public com.google.protobuf.Timestamp getEndTime() {
      if (endTimeBuilder_ == null) {
        return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_;
      } else {
        return endTimeBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp end_time = 11;</code>
     */
    public Builder setEndTime(com.google.protobuf.Timestamp value) {
      if (endTimeBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        endTime_ = value;
        onChanged();
      } else {
        endTimeBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp end_time = 11;</code>
     */
    public Builder setEndTime(
        com.google.protobuf.Timestamp.Builder builderForValue) {
      if (endTimeBuilder_ == null) {
        endTime_ = builderForValue.build();
        onChanged();
      } else {
        endTimeBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp end_time = 11;</code>
     */
    public Builder mergeEndTime(com.google.protobuf.Timestamp value) {
      if (endTimeBuilder_ == null) {
        if (endTime_ != null) {
          endTime_ =
            com.google.protobuf.Timestamp.newBuilder(endTime_).mergeFrom(value).buildPartial();
        } else {
          endTime_ = value;
        }
        onChanged();
      } else {
        endTimeBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp end_time = 11;</code>
     */
    public Builder clearEndTime() {
      if (endTimeBuilder_ == null) {
        endTime_ = null;
        onChanged();
      } else {
        endTime_ = null;
        endTimeBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp end_time = 11;</code>
     */
    public com.google.protobuf.Timestamp.Builder getEndTimeBuilder() {
      
      onChanged();
      return getEndTimeFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp end_time = 11;</code>
     */
    public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() {
      if (endTimeBuilder_ != null) {
        return endTimeBuilder_.getMessageOrBuilder();
      } else {
        return endTime_ == null ?
            com.google.protobuf.Timestamp.getDefaultInstance() : endTime_;
      }
    }
    /**
     * <pre>
     * Deprecated. This field is ignored when creating or updating sinks.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp end_time = 11;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> 
        getEndTimeFieldBuilder() {
      if (endTimeBuilder_ == null) {
        endTimeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>(
                getEndTime(),
                getParentForChildren(),
                isClean());
        endTime_ = null;
      }
      return endTimeBuilder_;
    }
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFieldsProto3(unknownFields);
    }

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


    // @@protoc_insertion_point(builder_scope:google.logging.v2.LogSink)
  }

  // @@protoc_insertion_point(class_scope:google.logging.v2.LogSink)
  private static final com.google.logging.v2.LogSink DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new com.google.logging.v2.LogSink();
  }

  public static com.google.logging.v2.LogSink getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

  public com.google.logging.v2.LogSink getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

