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

io.envoyproxy.envoy.config.trace.v2.LightstepConfig.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.trace.v2

/** Configuration for the LightStep tracer.
  * [#extension: envoy.tracers.lightstep]
  *
  * @param collectorCluster
  *   The cluster manager cluster that hosts the LightStep collectors.
  * @param accessTokenFile
  *   File containing the access token to the `LightStep
  *   <https://lightstep.com/>`_ API.
  * @param propagationModes
  *   Propagation modes to use by LightStep's tracer.
  */
@SerialVersionUID(0L)
final case class LightstepConfig(
    collectorCluster: _root_.scala.Predef.String = "",
    accessTokenFile: _root_.scala.Predef.String = "",
    propagationModes: _root_.scala.Seq[io.envoyproxy.envoy.config.trace.v2.LightstepConfig.PropagationMode] = _root_.scala.Seq.empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[LightstepConfig] {
    private[this] def propagationModesSerializedSize = {
      if (__propagationModesSerializedSizeField == 0) __propagationModesSerializedSizeField = {
        var __s: _root_.scala.Int = 0
        propagationModes.foreach(__i => __s += _root_.com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag(__i.value))
        __s
      }
      __propagationModesSerializedSizeField
    }
    @transient private[this] var __propagationModesSerializedSizeField: _root_.scala.Int = 0
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = collectorCluster
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
        }
      };
      
      {
        val __value = accessTokenFile
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value)
        }
      };
      if (propagationModes.nonEmpty) {
        val __localsize = propagationModesSerializedSize
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__localsize) + __localsize
      }
      __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 = collectorCluster
        if (!__v.isEmpty) {
          _output__.writeString(1, __v)
        }
      };
      {
        val __v = accessTokenFile
        if (!__v.isEmpty) {
          _output__.writeString(2, __v)
        }
      };
      if (propagationModes.nonEmpty) {
        _output__.writeTag(3, 2)
        _output__.writeUInt32NoTag(propagationModesSerializedSize)
        propagationModes.foreach((_output__.writeEnumNoTag _).compose((_: io.envoyproxy.envoy.config.trace.v2.LightstepConfig.PropagationMode).value))
      };
      unknownFields.writeTo(_output__)
    }
    def withCollectorCluster(__v: _root_.scala.Predef.String): LightstepConfig = copy(collectorCluster = __v)
    def withAccessTokenFile(__v: _root_.scala.Predef.String): LightstepConfig = copy(accessTokenFile = __v)
    def clearPropagationModes = copy(propagationModes = _root_.scala.Seq.empty)
    def addPropagationModes(__vs: io.envoyproxy.envoy.config.trace.v2.LightstepConfig.PropagationMode *): LightstepConfig = addAllPropagationModes(__vs)
    def addAllPropagationModes(__vs: Iterable[io.envoyproxy.envoy.config.trace.v2.LightstepConfig.PropagationMode]): LightstepConfig = copy(propagationModes = propagationModes ++ __vs)
    def withPropagationModes(__v: _root_.scala.Seq[io.envoyproxy.envoy.config.trace.v2.LightstepConfig.PropagationMode]): LightstepConfig = copy(propagationModes = __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 = collectorCluster
          if (__t != "") __t else null
        }
        case 2 => {
          val __t = accessTokenFile
          if (__t != "") __t else null
        }
        case 3 => propagationModes.iterator.map(_.javaValueDescriptor).toSeq
      }
    }
    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(collectorCluster)
        case 2 => _root_.scalapb.descriptors.PString(accessTokenFile)
        case 3 => _root_.scalapb.descriptors.PRepeated(propagationModes.iterator.map(__e => _root_.scalapb.descriptors.PEnum(__e.scalaValueDescriptor)).toVector)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: io.envoyproxy.envoy.config.trace.v2.LightstepConfig.type = io.envoyproxy.envoy.config.trace.v2.LightstepConfig
    // @@protoc_insertion_point(GeneratedMessage[envoy.config.trace.v2.LightstepConfig])
}

object LightstepConfig extends scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.config.trace.v2.LightstepConfig] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.config.trace.v2.LightstepConfig] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): io.envoyproxy.envoy.config.trace.v2.LightstepConfig = {
    var __collectorCluster: _root_.scala.Predef.String = ""
    var __accessTokenFile: _root_.scala.Predef.String = ""
    val __propagationModes: _root_.scala.collection.immutable.VectorBuilder[io.envoyproxy.envoy.config.trace.v2.LightstepConfig.PropagationMode] = new _root_.scala.collection.immutable.VectorBuilder[io.envoyproxy.envoy.config.trace.v2.LightstepConfig.PropagationMode]
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __collectorCluster = _input__.readStringRequireUtf8()
        case 18 =>
          __accessTokenFile = _input__.readStringRequireUtf8()
        case 24 =>
          __propagationModes += io.envoyproxy.envoy.config.trace.v2.LightstepConfig.PropagationMode.fromValue(_input__.readEnum())
        case 26 => {
          val length = _input__.readRawVarint32()
          val oldLimit = _input__.pushLimit(length)
          while (_input__.getBytesUntilLimit > 0) {
            __propagationModes += io.envoyproxy.envoy.config.trace.v2.LightstepConfig.PropagationMode.fromValue(_input__.readEnum())
          }
          _input__.popLimit(oldLimit)
        }
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    io.envoyproxy.envoy.config.trace.v2.LightstepConfig(
        collectorCluster = __collectorCluster,
        accessTokenFile = __accessTokenFile,
        propagationModes = __propagationModes.result(),
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[io.envoyproxy.envoy.config.trace.v2.LightstepConfig] = _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.trace.v2.LightstepConfig(
        collectorCluster = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        accessTokenFile = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        propagationModes = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Seq[_root_.scalapb.descriptors.EnumValueDescriptor]]).getOrElse(_root_.scala.Seq.empty).iterator.map(__e => io.envoyproxy.envoy.config.trace.v2.LightstepConfig.PropagationMode.fromValue(__e.number)).toSeq
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LightstepProto.javaDescriptor.getMessageTypes().get(0)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LightstepProto.scalaDescriptor.messages(0)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number)
  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.trace.v2.LightstepConfig.PropagationMode
    }
  }
  lazy val defaultInstance = io.envoyproxy.envoy.config.trace.v2.LightstepConfig(
    collectorCluster = "",
    accessTokenFile = "",
    propagationModes = _root_.scala.Seq.empty
  )
  /** Available propagation modes
    */
  sealed abstract class PropagationMode(val value: _root_.scala.Int) extends _root_.scalapb.GeneratedEnum {
    type EnumType = PropagationMode
    def isEnvoy: _root_.scala.Boolean = false
    def isLightstep: _root_.scala.Boolean = false
    def isB3: _root_.scala.Boolean = false
    def isTraceContext: _root_.scala.Boolean = false
    def companion: _root_.scalapb.GeneratedEnumCompanion[PropagationMode] = io.envoyproxy.envoy.config.trace.v2.LightstepConfig.PropagationMode
    final def asRecognized: _root_.scala.Option[io.envoyproxy.envoy.config.trace.v2.LightstepConfig.PropagationMode.Recognized] = if (isUnrecognized) _root_.scala.None else _root_.scala.Some(this.asInstanceOf[io.envoyproxy.envoy.config.trace.v2.LightstepConfig.PropagationMode.Recognized])
  }
  
  object PropagationMode extends _root_.scalapb.GeneratedEnumCompanion[PropagationMode] {
    sealed trait Recognized extends PropagationMode
    implicit def enumCompanion: _root_.scalapb.GeneratedEnumCompanion[PropagationMode] = this
    
    /** Propagate trace context in the single header x-ot-span-context.
      */
    @SerialVersionUID(0L)
    case object ENVOY extends PropagationMode(0) with PropagationMode.Recognized {
      val index = 0
      val name = "ENVOY"
      override def isEnvoy: _root_.scala.Boolean = true
    }
    
    /** Propagate trace context using LightStep's native format.
      */
    @SerialVersionUID(0L)
    case object LIGHTSTEP extends PropagationMode(1) with PropagationMode.Recognized {
      val index = 1
      val name = "LIGHTSTEP"
      override def isLightstep: _root_.scala.Boolean = true
    }
    
    /** Propagate trace context using the b3 format.
      */
    @SerialVersionUID(0L)
    case object B3 extends PropagationMode(2) with PropagationMode.Recognized {
      val index = 2
      val name = "B3"
      override def isB3: _root_.scala.Boolean = true
    }
    
    /** Propagation trace context using the w3 trace-context standard.
      */
    @SerialVersionUID(0L)
    case object TRACE_CONTEXT extends PropagationMode(3) with PropagationMode.Recognized {
      val index = 3
      val name = "TRACE_CONTEXT"
      override def isTraceContext: _root_.scala.Boolean = true
    }
    
    @SerialVersionUID(0L)
    final case class Unrecognized(unrecognizedValue: _root_.scala.Int) extends PropagationMode(unrecognizedValue) with _root_.scalapb.UnrecognizedEnum
    lazy val values = scala.collection.immutable.Seq(ENVOY, LIGHTSTEP, B3, TRACE_CONTEXT)
    def fromValue(__value: _root_.scala.Int): PropagationMode = __value match {
      case 0 => ENVOY
      case 1 => LIGHTSTEP
      case 2 => B3
      case 3 => TRACE_CONTEXT
      case __other => Unrecognized(__other)
    }
    def javaDescriptor: _root_.com.google.protobuf.Descriptors.EnumDescriptor = io.envoyproxy.envoy.config.trace.v2.LightstepConfig.javaDescriptor.getEnumTypes().get(0)
    def scalaDescriptor: _root_.scalapb.descriptors.EnumDescriptor = io.envoyproxy.envoy.config.trace.v2.LightstepConfig.scalaDescriptor.enums(0)
  }
  implicit class LightstepConfigLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.config.trace.v2.LightstepConfig]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, io.envoyproxy.envoy.config.trace.v2.LightstepConfig](_l) {
    def collectorCluster: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.collectorCluster)((c_, f_) => c_.copy(collectorCluster = f_))
    def accessTokenFile: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.accessTokenFile)((c_, f_) => c_.copy(accessTokenFile = f_))
    def propagationModes: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[io.envoyproxy.envoy.config.trace.v2.LightstepConfig.PropagationMode]] = field(_.propagationModes)((c_, f_) => c_.copy(propagationModes = f_))
  }
  final val COLLECTOR_CLUSTER_FIELD_NUMBER = 1
  final val ACCESS_TOKEN_FILE_FIELD_NUMBER = 2
  final val PROPAGATION_MODES_FIELD_NUMBER = 3
  def of(
    collectorCluster: _root_.scala.Predef.String,
    accessTokenFile: _root_.scala.Predef.String,
    propagationModes: _root_.scala.Seq[io.envoyproxy.envoy.config.trace.v2.LightstepConfig.PropagationMode]
  ): _root_.io.envoyproxy.envoy.config.trace.v2.LightstepConfig = _root_.io.envoyproxy.envoy.config.trace.v2.LightstepConfig(
    collectorCluster,
    accessTokenFile,
    propagationModes
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[envoy.config.trace.v2.LightstepConfig])
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy