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

io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig.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.metrics.v3

/** Metrics Service is configured as a built-in *envoy.stat_sinks.metrics_service* :ref:`StatsSink
  * <envoy_v3_api_msg_config.metrics.v3.StatsSink>`. This opaque configuration will be used to create
  * Metrics Service.
  *
  * Example:
  *
  * .. code-block:: yaml
  *
  *     stats_sinks:
  *       - name: envoy.stat_sinks.metrics_service
  *         typed_config:
  *           "@type": type.googleapis.com/envoy.config.metrics.v3.MetricsServiceConfig
  *           transport_api_version: V3
  *
  * [#extension: envoy.stat_sinks.metrics_service]
  *
  * @param grpcService
  *   The upstream gRPC cluster that hosts the metrics service.
  * @param transportApiVersion
  *   API version for metric service transport protocol. This describes the metric service gRPC
  *   endpoint and version of messages used on the wire.
  * @param reportCountersAsDeltas
  *   If true, counters are reported as the delta between flushing intervals. Otherwise, the current
  *   counter value is reported. Defaults to false.
  *   Eventually (https://github.com/envoyproxy/envoy/issues/10968) if this value is not set, the
  *   sink will take updates from the :ref:`MetricsResponse <envoy_v3_api_msg_service.metrics.v3.StreamMetricsResponse>`.
  * @param emitTagsAsLabels
  *   If true, metrics will have their tags emitted as labels on the metrics objects sent to the MetricsService,
  *   and the tag extracted name will be used instead of the full name, which may contain values used by the tag
  *   extractor or additional tags added during stats creation.
  */
@SerialVersionUID(0L)
final case class MetricsServiceConfig(
    grpcService: _root_.scala.Option[io.envoyproxy.envoy.config.core.v3.GrpcService] = _root_.scala.None,
    transportApiVersion: io.envoyproxy.envoy.config.core.v3.ApiVersion = io.envoyproxy.envoy.config.core.v3.ApiVersion.AUTO,
    reportCountersAsDeltas: _root_.scala.Option[_root_.scala.Boolean] = _root_.scala.None,
    emitTagsAsLabels: _root_.scala.Boolean = false,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[MetricsServiceConfig] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      if (grpcService.isDefined) {
        val __value = grpcService.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      
      {
        val __value = transportApiVersion.value
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(3, __value)
        }
      };
      if (reportCountersAsDeltas.isDefined) {
        val __value = io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig._typemapper_reportCountersAsDeltas.toBase(reportCountersAsDeltas.get)
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      
      {
        val __value = emitTagsAsLabels
        if (__value != false) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(4, __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 = {
      grpcService.foreach { __v =>
        val __m = __v
        _output__.writeTag(1, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      reportCountersAsDeltas.foreach { __v =>
        val __m = io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig._typemapper_reportCountersAsDeltas.toBase(__v)
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      {
        val __v = transportApiVersion.value
        if (__v != 0) {
          _output__.writeEnum(3, __v)
        }
      };
      {
        val __v = emitTagsAsLabels
        if (__v != false) {
          _output__.writeBool(4, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def getGrpcService: io.envoyproxy.envoy.config.core.v3.GrpcService = grpcService.getOrElse(io.envoyproxy.envoy.config.core.v3.GrpcService.defaultInstance)
    def clearGrpcService: MetricsServiceConfig = copy(grpcService = _root_.scala.None)
    def withGrpcService(__v: io.envoyproxy.envoy.config.core.v3.GrpcService): MetricsServiceConfig = copy(grpcService = Option(__v))
    def withTransportApiVersion(__v: io.envoyproxy.envoy.config.core.v3.ApiVersion): MetricsServiceConfig = copy(transportApiVersion = __v)
    def getReportCountersAsDeltas: _root_.scala.Boolean = reportCountersAsDeltas.getOrElse(io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig._typemapper_reportCountersAsDeltas.toCustom(com.google.protobuf.wrappers.BoolValue.defaultInstance))
    def clearReportCountersAsDeltas: MetricsServiceConfig = copy(reportCountersAsDeltas = _root_.scala.None)
    def withReportCountersAsDeltas(__v: _root_.scala.Boolean): MetricsServiceConfig = copy(reportCountersAsDeltas = Option(__v))
    def withEmitTagsAsLabels(__v: _root_.scala.Boolean): MetricsServiceConfig = copy(emitTagsAsLabels = __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 => grpcService.orNull
        case 3 => {
          val __t = transportApiVersion.javaValueDescriptor
          if (__t.getNumber() != 0) __t else null
        }
        case 2 => reportCountersAsDeltas.map(io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig._typemapper_reportCountersAsDeltas.toBase(_)).orNull
        case 4 => {
          val __t = emitTagsAsLabels
          if (__t != false) __t else null
        }
      }
    }
    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 => grpcService.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => _root_.scalapb.descriptors.PEnum(transportApiVersion.scalaValueDescriptor)
        case 2 => reportCountersAsDeltas.map(io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig._typemapper_reportCountersAsDeltas.toBase(_).toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 4 => _root_.scalapb.descriptors.PBoolean(emitTagsAsLabels)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig.type = io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig
    // @@protoc_insertion_point(GeneratedMessage[envoy.config.metrics.v3.MetricsServiceConfig])
}

object MetricsServiceConfig extends scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig = {
    var __grpcService: _root_.scala.Option[io.envoyproxy.envoy.config.core.v3.GrpcService] = _root_.scala.None
    var __transportApiVersion: io.envoyproxy.envoy.config.core.v3.ApiVersion = io.envoyproxy.envoy.config.core.v3.ApiVersion.AUTO
    var __reportCountersAsDeltas: _root_.scala.Option[_root_.scala.Boolean] = _root_.scala.None
    var __emitTagsAsLabels: _root_.scala.Boolean = false
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __grpcService = Option(__grpcService.fold(_root_.scalapb.LiteParser.readMessage[io.envoyproxy.envoy.config.core.v3.GrpcService](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 24 =>
          __transportApiVersion = io.envoyproxy.envoy.config.core.v3.ApiVersion.fromValue(_input__.readEnum())
        case 18 =>
          __reportCountersAsDeltas = Option(io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig._typemapper_reportCountersAsDeltas.toCustom(__reportCountersAsDeltas.map(io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig._typemapper_reportCountersAsDeltas.toBase(_)).fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.wrappers.BoolValue](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _))))
        case 32 =>
          __emitTagsAsLabels = _input__.readBool()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig(
        grpcService = __grpcService,
        transportApiVersion = __transportApiVersion,
        reportCountersAsDeltas = __reportCountersAsDeltas,
        emitTagsAsLabels = __emitTagsAsLabels,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig] = _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.metrics.v3.MetricsServiceConfig(
        grpcService = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[io.envoyproxy.envoy.config.core.v3.GrpcService]]),
        transportApiVersion = io.envoyproxy.envoy.config.core.v3.ApiVersion.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(io.envoyproxy.envoy.config.core.v3.ApiVersion.AUTO.scalaValueDescriptor).number),
        reportCountersAsDeltas = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.wrappers.BoolValue]]).map(io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig._typemapper_reportCountersAsDeltas.toCustom(_)),
        emitTagsAsLabels = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Boolean]).getOrElse(false)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = MetricsServiceProto.javaDescriptor.getMessageTypes().get(0)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = MetricsServiceProto.scalaDescriptor.messages(0)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 1 => __out = io.envoyproxy.envoy.config.core.v3.GrpcService
      case 2 => __out = com.google.protobuf.wrappers.BoolValue
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = {
    (__fieldNumber: @_root_.scala.unchecked) match {
      case 3 => io.envoyproxy.envoy.config.core.v3.ApiVersion
    }
  }
  lazy val defaultInstance = io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig(
    grpcService = _root_.scala.None,
    transportApiVersion = io.envoyproxy.envoy.config.core.v3.ApiVersion.AUTO,
    reportCountersAsDeltas = _root_.scala.None,
    emitTagsAsLabels = false
  )
  implicit class MetricsServiceConfigLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig](_l) {
    def grpcService: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.config.core.v3.GrpcService] = field(_.getGrpcService)((c_, f_) => c_.copy(grpcService = Option(f_)))
    def optionalGrpcService: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[io.envoyproxy.envoy.config.core.v3.GrpcService]] = field(_.grpcService)((c_, f_) => c_.copy(grpcService = f_))
    def transportApiVersion: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.config.core.v3.ApiVersion] = field(_.transportApiVersion)((c_, f_) => c_.copy(transportApiVersion = f_))
    def reportCountersAsDeltas: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.getReportCountersAsDeltas)((c_, f_) => c_.copy(reportCountersAsDeltas = Option(f_)))
    def optionalReportCountersAsDeltas: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[_root_.scala.Boolean]] = field(_.reportCountersAsDeltas)((c_, f_) => c_.copy(reportCountersAsDeltas = f_))
    def emitTagsAsLabels: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.emitTagsAsLabels)((c_, f_) => c_.copy(emitTagsAsLabels = f_))
  }
  final val GRPC_SERVICE_FIELD_NUMBER = 1
  final val TRANSPORT_API_VERSION_FIELD_NUMBER = 3
  final val REPORT_COUNTERS_AS_DELTAS_FIELD_NUMBER = 2
  final val EMIT_TAGS_AS_LABELS_FIELD_NUMBER = 4
  @transient
  private[v3] val _typemapper_reportCountersAsDeltas: _root_.scalapb.TypeMapper[com.google.protobuf.wrappers.BoolValue, _root_.scala.Boolean] = implicitly[_root_.scalapb.TypeMapper[com.google.protobuf.wrappers.BoolValue, _root_.scala.Boolean]]
  def of(
    grpcService: _root_.scala.Option[io.envoyproxy.envoy.config.core.v3.GrpcService],
    transportApiVersion: io.envoyproxy.envoy.config.core.v3.ApiVersion,
    reportCountersAsDeltas: _root_.scala.Option[_root_.scala.Boolean],
    emitTagsAsLabels: _root_.scala.Boolean
  ): _root_.io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig = _root_.io.envoyproxy.envoy.config.metrics.v3.MetricsServiceConfig(
    grpcService,
    transportApiVersion,
    reportCountersAsDeltas,
    emitTagsAsLabels
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[envoy.config.metrics.v3.MetricsServiceConfig])
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy