All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig.scala Maven / Gradle / Ivy

There is a newer version: 1.23.0-dev-f04150-1
Show newest version
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package io.envoyproxy.envoy.config.accesslog.v2

/** Common configuration for gRPC access logs.
  * [#next-free-field: 6]
  *
  * @param logName
  *   The friendly name of the access log to be returned in :ref:`StreamAccessLogsMessage.Identifier
  *   <envoy_api_msg_service.accesslog.v2.StreamAccessLogsMessage.Identifier>`. This allows the
  *   access log server to differentiate between different access logs coming from the same Envoy.
  * @param grpcService
  *   The gRPC service for the access log service.
  * @param bufferFlushInterval
  *   Interval for flushing access logs to the gRPC stream. Logger will flush requests every time
  *   this interval is elapsed, or when batch size limit is hit, whichever comes first. Defaults to
  *   1 second.
  * @param bufferSizeBytes
  *   Soft size limit in bytes for access log entries buffer. Logger will buffer requests until
  *   this limit it hit, or every time flush interval is elapsed, whichever comes first. Setting it
  *   to zero effectively disables the batching. Defaults to 16384.
  * @param filterStateObjectsToLog
  *   Additional filter state objects to log in :ref:`filter_state_objects
  *   <envoy_api_field_data.accesslog.v2.AccessLogCommon.filter_state_objects>`.
  *   Logger will call `FilterState::Object::serializeAsProto` to serialize the filter state object.
  */
@SerialVersionUID(0L)
final case class CommonGrpcAccessLogConfig(
    logName: _root_.scala.Predef.String = "",
    grpcService: _root_.scala.Option[io.envoyproxy.envoy.api.v2.core.GrpcService] = _root_.scala.None,
    bufferFlushInterval: _root_.scala.Option[com.google.protobuf.duration.Duration] = _root_.scala.None,
    bufferSizeBytes: _root_.scala.Option[_root_.scala.Int] = _root_.scala.None,
    filterStateObjectsToLog: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[CommonGrpcAccessLogConfig] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = logName
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
        }
      };
      if (grpcService.isDefined) {
        val __value = grpcService.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (bufferFlushInterval.isDefined) {
        val __value = bufferFlushInterval.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (bufferSizeBytes.isDefined) {
        val __value = io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig._typemapper_bufferSizeBytes.toBase(bufferSizeBytes.get)
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      filterStateObjectsToLog.foreach { __item =>
        val __value = __item
        __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(5, __value)
      }
      __size += unknownFields.serializedSize
      __size
    }
    override def serializedSize: _root_.scala.Int = {
      var __size = __serializedSizeMemoized
      if (__size == 0) {
        __size = __computeSerializedSize() + 1
        __serializedSizeMemoized = __size
      }
      __size - 1
      
    }
    def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
      {
        val __v = logName
        if (!__v.isEmpty) {
          _output__.writeString(1, __v)
        }
      };
      grpcService.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      bufferFlushInterval.foreach { __v =>
        val __m = __v
        _output__.writeTag(3, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      bufferSizeBytes.foreach { __v =>
        val __m = io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig._typemapper_bufferSizeBytes.toBase(__v)
        _output__.writeTag(4, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      filterStateObjectsToLog.foreach { __v =>
        val __m = __v
        _output__.writeString(5, __m)
      };
      unknownFields.writeTo(_output__)
    }
    def withLogName(__v: _root_.scala.Predef.String): CommonGrpcAccessLogConfig = copy(logName = __v)
    def getGrpcService: io.envoyproxy.envoy.api.v2.core.GrpcService = grpcService.getOrElse(io.envoyproxy.envoy.api.v2.core.GrpcService.defaultInstance)
    def clearGrpcService: CommonGrpcAccessLogConfig = copy(grpcService = _root_.scala.None)
    def withGrpcService(__v: io.envoyproxy.envoy.api.v2.core.GrpcService): CommonGrpcAccessLogConfig = copy(grpcService = Option(__v))
    def getBufferFlushInterval: com.google.protobuf.duration.Duration = bufferFlushInterval.getOrElse(com.google.protobuf.duration.Duration.defaultInstance)
    def clearBufferFlushInterval: CommonGrpcAccessLogConfig = copy(bufferFlushInterval = _root_.scala.None)
    def withBufferFlushInterval(__v: com.google.protobuf.duration.Duration): CommonGrpcAccessLogConfig = copy(bufferFlushInterval = Option(__v))
    def getBufferSizeBytes: _root_.scala.Int = bufferSizeBytes.getOrElse(io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig._typemapper_bufferSizeBytes.toCustom(com.google.protobuf.wrappers.UInt32Value.defaultInstance))
    def clearBufferSizeBytes: CommonGrpcAccessLogConfig = copy(bufferSizeBytes = _root_.scala.None)
    def withBufferSizeBytes(__v: _root_.scala.Int): CommonGrpcAccessLogConfig = copy(bufferSizeBytes = Option(__v))
    def clearFilterStateObjectsToLog = copy(filterStateObjectsToLog = _root_.scala.Seq.empty)
    def addFilterStateObjectsToLog(__vs: _root_.scala.Predef.String *): CommonGrpcAccessLogConfig = addAllFilterStateObjectsToLog(__vs)
    def addAllFilterStateObjectsToLog(__vs: Iterable[_root_.scala.Predef.String]): CommonGrpcAccessLogConfig = copy(filterStateObjectsToLog = filterStateObjectsToLog ++ __vs)
    def withFilterStateObjectsToLog(__v: _root_.scala.Seq[_root_.scala.Predef.String]): CommonGrpcAccessLogConfig = copy(filterStateObjectsToLog = __v)
    def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
    def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
    def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
      (__fieldNumber: @_root_.scala.unchecked) match {
        case 1 => {
          val __t = logName
          if (__t != "") __t else null
        }
        case 2 => grpcService.orNull
        case 3 => bufferFlushInterval.orNull
        case 4 => bufferSizeBytes.map(io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig._typemapper_bufferSizeBytes.toBase(_)).orNull
        case 5 => filterStateObjectsToLog
      }
    }
    def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
      _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
      (__field.number: @_root_.scala.unchecked) match {
        case 1 => _root_.scalapb.descriptors.PString(logName)
        case 2 => grpcService.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => bufferFlushInterval.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 4 => bufferSizeBytes.map(io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig._typemapper_bufferSizeBytes.toBase(_).toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 5 => _root_.scalapb.descriptors.PRepeated(filterStateObjectsToLog.iterator.map(_root_.scalapb.descriptors.PString(_)).toVector)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig.type = io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig
    // @@protoc_insertion_point(GeneratedMessage[envoy.config.accesslog.v2.CommonGrpcAccessLogConfig])
}

object CommonGrpcAccessLogConfig extends scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig = {
    var __logName: _root_.scala.Predef.String = ""
    var __grpcService: _root_.scala.Option[io.envoyproxy.envoy.api.v2.core.GrpcService] = _root_.scala.None
    var __bufferFlushInterval: _root_.scala.Option[com.google.protobuf.duration.Duration] = _root_.scala.None
    var __bufferSizeBytes: _root_.scala.Option[_root_.scala.Int] = _root_.scala.None
    val __filterStateObjectsToLog: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] = new _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String]
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __logName = _input__.readStringRequireUtf8()
        case 18 =>
          __grpcService = Option(__grpcService.fold(_root_.scalapb.LiteParser.readMessage[io.envoyproxy.envoy.api.v2.core.GrpcService](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 26 =>
          __bufferFlushInterval = Option(__bufferFlushInterval.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.duration.Duration](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 34 =>
          __bufferSizeBytes = Option(io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig._typemapper_bufferSizeBytes.toCustom(__bufferSizeBytes.map(io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig._typemapper_bufferSizeBytes.toBase(_)).fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.wrappers.UInt32Value](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))))
        case 42 =>
          __filterStateObjectsToLog += _input__.readStringRequireUtf8()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig(
        logName = __logName,
        grpcService = __grpcService,
        bufferFlushInterval = __bufferFlushInterval,
        bufferSizeBytes = __bufferSizeBytes,
        filterStateObjectsToLog = __filterStateObjectsToLog.result(),
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig] = _root_.scalapb.descriptors.Reads{
    case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
      _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.")
      io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig(
        logName = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        grpcService = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[io.envoyproxy.envoy.api.v2.core.GrpcService]]),
        bufferFlushInterval = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.duration.Duration]]),
        bufferSizeBytes = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.wrappers.UInt32Value]]).map(io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig._typemapper_bufferSizeBytes.toCustom(_)),
        filterStateObjectsToLog = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Seq[_root_.scala.Predef.String]]).getOrElse(_root_.scala.Seq.empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = AlsProto.javaDescriptor.getMessageTypes().get(2)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = AlsProto.scalaDescriptor.messages(2)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 2 => __out = io.envoyproxy.envoy.api.v2.core.GrpcService
      case 3 => __out = com.google.protobuf.duration.Duration
      case 4 => __out = com.google.protobuf.wrappers.UInt32Value
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
  lazy val defaultInstance = io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig(
    logName = "",
    grpcService = _root_.scala.None,
    bufferFlushInterval = _root_.scala.None,
    bufferSizeBytes = _root_.scala.None,
    filterStateObjectsToLog = _root_.scala.Seq.empty
  )
  implicit class CommonGrpcAccessLogConfigLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig](_l) {
    def logName: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.logName)((c_, f_) => c_.copy(logName = f_))
    def grpcService: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.api.v2.core.GrpcService] = field(_.getGrpcService)((c_, f_) => c_.copy(grpcService = Option(f_)))
    def optionalGrpcService: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[io.envoyproxy.envoy.api.v2.core.GrpcService]] = field(_.grpcService)((c_, f_) => c_.copy(grpcService = f_))
    def bufferFlushInterval: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.duration.Duration] = field(_.getBufferFlushInterval)((c_, f_) => c_.copy(bufferFlushInterval = Option(f_)))
    def optionalBufferFlushInterval: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.duration.Duration]] = field(_.bufferFlushInterval)((c_, f_) => c_.copy(bufferFlushInterval = f_))
    def bufferSizeBytes: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.getBufferSizeBytes)((c_, f_) => c_.copy(bufferSizeBytes = Option(f_)))
    def optionalBufferSizeBytes: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[_root_.scala.Int]] = field(_.bufferSizeBytes)((c_, f_) => c_.copy(bufferSizeBytes = f_))
    def filterStateObjectsToLog: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.filterStateObjectsToLog)((c_, f_) => c_.copy(filterStateObjectsToLog = f_))
  }
  final val LOG_NAME_FIELD_NUMBER = 1
  final val GRPC_SERVICE_FIELD_NUMBER = 2
  final val BUFFER_FLUSH_INTERVAL_FIELD_NUMBER = 3
  final val BUFFER_SIZE_BYTES_FIELD_NUMBER = 4
  final val FILTER_STATE_OBJECTS_TO_LOG_FIELD_NUMBER = 5
  @transient
  private[v2] val _typemapper_bufferSizeBytes: _root_.scalapb.TypeMapper[com.google.protobuf.wrappers.UInt32Value, _root_.scala.Int] = implicitly[_root_.scalapb.TypeMapper[com.google.protobuf.wrappers.UInt32Value, _root_.scala.Int]]
  def of(
    logName: _root_.scala.Predef.String,
    grpcService: _root_.scala.Option[io.envoyproxy.envoy.api.v2.core.GrpcService],
    bufferFlushInterval: _root_.scala.Option[com.google.protobuf.duration.Duration],
    bufferSizeBytes: _root_.scala.Option[_root_.scala.Int],
    filterStateObjectsToLog: _root_.scala.Seq[_root_.scala.Predef.String]
  ): _root_.io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig = _root_.io.envoyproxy.envoy.config.accesslog.v2.CommonGrpcAccessLogConfig(
    logName,
    grpcService,
    bufferFlushInterval,
    bufferSizeBytes,
    filterStateObjectsToLog
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[envoy.config.accesslog.v2.CommonGrpcAccessLogConfig])
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy