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

io.envoyproxy.envoy.service.health.v3.Capability.scala Maven / Gradle / Ivy

// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package io.envoyproxy.envoy.service.health.v3

/** Defines supported protocols etc, so the management server can assign proper
  * endpoints to healthcheck.
  */
@SerialVersionUID(0L)
final case class Capability(
    healthCheckProtocols: _root_.scala.Seq[io.envoyproxy.envoy.service.health.v3.Capability.Protocol] = _root_.scala.Seq.empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Capability] {
    private[this] def healthCheckProtocolsSerializedSize = {
      if (__healthCheckProtocolsSerializedSizeField == 0) __healthCheckProtocolsSerializedSizeField = {
        var __s: _root_.scala.Int = 0
        healthCheckProtocols.foreach(__i => __s += _root_.com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag(__i.value))
        __s
      }
      __healthCheckProtocolsSerializedSizeField
    }
    @transient private[this] var __healthCheckProtocolsSerializedSizeField: _root_.scala.Int = 0
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      if (healthCheckProtocols.nonEmpty) {
        val __localsize = healthCheckProtocolsSerializedSize
        __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 = {
      if (healthCheckProtocols.nonEmpty) {
        _output__.writeTag(1, 2)
        _output__.writeUInt32NoTag(healthCheckProtocolsSerializedSize)
        healthCheckProtocols.foreach((_output__.writeEnumNoTag _).compose((_: io.envoyproxy.envoy.service.health.v3.Capability.Protocol).value))
      };
      unknownFields.writeTo(_output__)
    }
    def clearHealthCheckProtocols = copy(healthCheckProtocols = _root_.scala.Seq.empty)
    def addHealthCheckProtocols(__vs: io.envoyproxy.envoy.service.health.v3.Capability.Protocol *): Capability = addAllHealthCheckProtocols(__vs)
    def addAllHealthCheckProtocols(__vs: Iterable[io.envoyproxy.envoy.service.health.v3.Capability.Protocol]): Capability = copy(healthCheckProtocols = healthCheckProtocols ++ __vs)
    def withHealthCheckProtocols(__v: _root_.scala.Seq[io.envoyproxy.envoy.service.health.v3.Capability.Protocol]): Capability = copy(healthCheckProtocols = __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 => healthCheckProtocols.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.PRepeated(healthCheckProtocols.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.service.health.v3.Capability.type = io.envoyproxy.envoy.service.health.v3.Capability
    // @@protoc_insertion_point(GeneratedMessage[envoy.service.health.v3.Capability])
}

object Capability extends scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.service.health.v3.Capability] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.service.health.v3.Capability] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): io.envoyproxy.envoy.service.health.v3.Capability = {
    val __healthCheckProtocols: _root_.scala.collection.immutable.VectorBuilder[io.envoyproxy.envoy.service.health.v3.Capability.Protocol] = new _root_.scala.collection.immutable.VectorBuilder[io.envoyproxy.envoy.service.health.v3.Capability.Protocol]
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 8 =>
          __healthCheckProtocols += io.envoyproxy.envoy.service.health.v3.Capability.Protocol.fromValue(_input__.readEnum())
        case 10 => {
          val length = _input__.readRawVarint32()
          val oldLimit = _input__.pushLimit(length)
          while (_input__.getBytesUntilLimit > 0) {
            __healthCheckProtocols += io.envoyproxy.envoy.service.health.v3.Capability.Protocol.fromValue(_input__.readEnum())
          }
          _input__.popLimit(oldLimit)
        }
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    io.envoyproxy.envoy.service.health.v3.Capability(
        healthCheckProtocols = __healthCheckProtocols.result(),
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[io.envoyproxy.envoy.service.health.v3.Capability] = _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.service.health.v3.Capability(
        healthCheckProtocols = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Seq[_root_.scalapb.descriptors.EnumValueDescriptor]]).getOrElse(_root_.scala.Seq.empty).iterator.map(__e => io.envoyproxy.envoy.service.health.v3.Capability.Protocol.fromValue(__e.number)).toSeq
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = HdsProto.javaDescriptor.getMessageTypes().get(0)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = HdsProto.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 1 => io.envoyproxy.envoy.service.health.v3.Capability.Protocol
    }
  }
  lazy val defaultInstance = io.envoyproxy.envoy.service.health.v3.Capability(
    healthCheckProtocols = _root_.scala.Seq.empty
  )
  /** Different Envoy instances may have different capabilities (e.g. Redis)
    * and/or have ports enabled for different protocols.
    */
  sealed abstract class Protocol(val value: _root_.scala.Int) extends _root_.scalapb.GeneratedEnum {
    type EnumType = Protocol
    def isHttp: _root_.scala.Boolean = false
    def isTcp: _root_.scala.Boolean = false
    def isRedis: _root_.scala.Boolean = false
    def companion: _root_.scalapb.GeneratedEnumCompanion[Protocol] = io.envoyproxy.envoy.service.health.v3.Capability.Protocol
    final def asRecognized: _root_.scala.Option[io.envoyproxy.envoy.service.health.v3.Capability.Protocol.Recognized] = if (isUnrecognized) _root_.scala.None else _root_.scala.Some(this.asInstanceOf[io.envoyproxy.envoy.service.health.v3.Capability.Protocol.Recognized])
  }
  
  object Protocol extends _root_.scalapb.GeneratedEnumCompanion[Protocol] {
    sealed trait Recognized extends Protocol
    implicit def enumCompanion: _root_.scalapb.GeneratedEnumCompanion[Protocol] = this
    
    @SerialVersionUID(0L)
    case object HTTP extends Protocol(0) with Protocol.Recognized {
      val index = 0
      val name = "HTTP"
      override def isHttp: _root_.scala.Boolean = true
    }
    
    @SerialVersionUID(0L)
    case object TCP extends Protocol(1) with Protocol.Recognized {
      val index = 1
      val name = "TCP"
      override def isTcp: _root_.scala.Boolean = true
    }
    
    @SerialVersionUID(0L)
    case object REDIS extends Protocol(2) with Protocol.Recognized {
      val index = 2
      val name = "REDIS"
      override def isRedis: _root_.scala.Boolean = true
    }
    
    @SerialVersionUID(0L)
    final case class Unrecognized(unrecognizedValue: _root_.scala.Int) extends Protocol(unrecognizedValue) with _root_.scalapb.UnrecognizedEnum
    lazy val values = scala.collection.immutable.Seq(HTTP, TCP, REDIS)
    def fromValue(__value: _root_.scala.Int): Protocol = __value match {
      case 0 => HTTP
      case 1 => TCP
      case 2 => REDIS
      case __other => Unrecognized(__other)
    }
    def javaDescriptor: _root_.com.google.protobuf.Descriptors.EnumDescriptor = io.envoyproxy.envoy.service.health.v3.Capability.javaDescriptor.getEnumTypes().get(0)
    def scalaDescriptor: _root_.scalapb.descriptors.EnumDescriptor = io.envoyproxy.envoy.service.health.v3.Capability.scalaDescriptor.enums(0)
  }
  implicit class CapabilityLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.service.health.v3.Capability]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, io.envoyproxy.envoy.service.health.v3.Capability](_l) {
    def healthCheckProtocols: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[io.envoyproxy.envoy.service.health.v3.Capability.Protocol]] = field(_.healthCheckProtocols)((c_, f_) => c_.copy(healthCheckProtocols = f_))
  }
  final val HEALTH_CHECK_PROTOCOLS_FIELD_NUMBER = 1
  def of(
    healthCheckProtocols: _root_.scala.Seq[io.envoyproxy.envoy.service.health.v3.Capability.Protocol]
  ): _root_.io.envoyproxy.envoy.service.health.v3.Capability = _root_.io.envoyproxy.envoy.service.health.v3.Capability(
    healthCheckProtocols
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[envoy.service.health.v3.Capability])
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy