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

io.envoyproxy.envoy.admin.v2alpha.ServerInfo.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.admin.v2alpha

/** Proto representation of the value returned by /server_info, containing
  * server version/server status information.
  * [#next-free-field: 7]
  *
  * @param version
  *   Server version.
  * @param state
  *   State of the server.
  * @param uptimeCurrentEpoch
  *   Uptime since current epoch was started.
  * @param uptimeAllEpochs
  *   Uptime since the start of the first epoch.
  * @param hotRestartVersion
  *   Hot restart version.
  * @param commandLineOptions
  *   Command line options the server is currently running with.
  */
@SerialVersionUID(0L)
final case class ServerInfo(
    version: _root_.scala.Predef.String = "",
    state: io.envoyproxy.envoy.admin.v2alpha.ServerInfo.State = io.envoyproxy.envoy.admin.v2alpha.ServerInfo.State.LIVE,
    uptimeCurrentEpoch: _root_.scala.Option[com.google.protobuf.duration.Duration] = _root_.scala.None,
    uptimeAllEpochs: _root_.scala.Option[com.google.protobuf.duration.Duration] = _root_.scala.None,
    hotRestartVersion: _root_.scala.Predef.String = "",
    commandLineOptions: _root_.scala.Option[io.envoyproxy.envoy.admin.v2alpha.CommandLineOptions] = _root_.scala.None,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[ServerInfo] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = version
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
        }
      };
      
      {
        val __value = state.value
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(2, __value)
        }
      };
      if (uptimeCurrentEpoch.isDefined) {
        val __value = uptimeCurrentEpoch.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (uptimeAllEpochs.isDefined) {
        val __value = uptimeAllEpochs.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      
      {
        val __value = hotRestartVersion
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(5, __value)
        }
      };
      if (commandLineOptions.isDefined) {
        val __value = commandLineOptions.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      __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 = version
        if (!__v.isEmpty) {
          _output__.writeString(1, __v)
        }
      };
      {
        val __v = state.value
        if (__v != 0) {
          _output__.writeEnum(2, __v)
        }
      };
      uptimeCurrentEpoch.foreach { __v =>
        val __m = __v
        _output__.writeTag(3, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      uptimeAllEpochs.foreach { __v =>
        val __m = __v
        _output__.writeTag(4, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      {
        val __v = hotRestartVersion
        if (!__v.isEmpty) {
          _output__.writeString(5, __v)
        }
      };
      commandLineOptions.foreach { __v =>
        val __m = __v
        _output__.writeTag(6, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      unknownFields.writeTo(_output__)
    }
    def withVersion(__v: _root_.scala.Predef.String): ServerInfo = copy(version = __v)
    def withState(__v: io.envoyproxy.envoy.admin.v2alpha.ServerInfo.State): ServerInfo = copy(state = __v)
    def getUptimeCurrentEpoch: com.google.protobuf.duration.Duration = uptimeCurrentEpoch.getOrElse(com.google.protobuf.duration.Duration.defaultInstance)
    def clearUptimeCurrentEpoch: ServerInfo = copy(uptimeCurrentEpoch = _root_.scala.None)
    def withUptimeCurrentEpoch(__v: com.google.protobuf.duration.Duration): ServerInfo = copy(uptimeCurrentEpoch = Option(__v))
    def getUptimeAllEpochs: com.google.protobuf.duration.Duration = uptimeAllEpochs.getOrElse(com.google.protobuf.duration.Duration.defaultInstance)
    def clearUptimeAllEpochs: ServerInfo = copy(uptimeAllEpochs = _root_.scala.None)
    def withUptimeAllEpochs(__v: com.google.protobuf.duration.Duration): ServerInfo = copy(uptimeAllEpochs = Option(__v))
    def withHotRestartVersion(__v: _root_.scala.Predef.String): ServerInfo = copy(hotRestartVersion = __v)
    def getCommandLineOptions: io.envoyproxy.envoy.admin.v2alpha.CommandLineOptions = commandLineOptions.getOrElse(io.envoyproxy.envoy.admin.v2alpha.CommandLineOptions.defaultInstance)
    def clearCommandLineOptions: ServerInfo = copy(commandLineOptions = _root_.scala.None)
    def withCommandLineOptions(__v: io.envoyproxy.envoy.admin.v2alpha.CommandLineOptions): ServerInfo = copy(commandLineOptions = Option(__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 = version
          if (__t != "") __t else null
        }
        case 2 => {
          val __t = state.javaValueDescriptor
          if (__t.getNumber() != 0) __t else null
        }
        case 3 => uptimeCurrentEpoch.orNull
        case 4 => uptimeAllEpochs.orNull
        case 5 => {
          val __t = hotRestartVersion
          if (__t != "") __t else null
        }
        case 6 => commandLineOptions.orNull
      }
    }
    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(version)
        case 2 => _root_.scalapb.descriptors.PEnum(state.scalaValueDescriptor)
        case 3 => uptimeCurrentEpoch.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 4 => uptimeAllEpochs.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 5 => _root_.scalapb.descriptors.PString(hotRestartVersion)
        case 6 => commandLineOptions.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: io.envoyproxy.envoy.admin.v2alpha.ServerInfo.type = io.envoyproxy.envoy.admin.v2alpha.ServerInfo
    // @@protoc_insertion_point(GeneratedMessage[envoy.admin.v2alpha.ServerInfo])
}

object ServerInfo extends scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.admin.v2alpha.ServerInfo] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.admin.v2alpha.ServerInfo] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): io.envoyproxy.envoy.admin.v2alpha.ServerInfo = {
    var __version: _root_.scala.Predef.String = ""
    var __state: io.envoyproxy.envoy.admin.v2alpha.ServerInfo.State = io.envoyproxy.envoy.admin.v2alpha.ServerInfo.State.LIVE
    var __uptimeCurrentEpoch: _root_.scala.Option[com.google.protobuf.duration.Duration] = _root_.scala.None
    var __uptimeAllEpochs: _root_.scala.Option[com.google.protobuf.duration.Duration] = _root_.scala.None
    var __hotRestartVersion: _root_.scala.Predef.String = ""
    var __commandLineOptions: _root_.scala.Option[io.envoyproxy.envoy.admin.v2alpha.CommandLineOptions] = _root_.scala.None
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __version = _input__.readStringRequireUtf8()
        case 16 =>
          __state = io.envoyproxy.envoy.admin.v2alpha.ServerInfo.State.fromValue(_input__.readEnum())
        case 26 =>
          __uptimeCurrentEpoch = Option(__uptimeCurrentEpoch.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.duration.Duration](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 34 =>
          __uptimeAllEpochs = Option(__uptimeAllEpochs.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.duration.Duration](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 42 =>
          __hotRestartVersion = _input__.readStringRequireUtf8()
        case 50 =>
          __commandLineOptions = Option(__commandLineOptions.fold(_root_.scalapb.LiteParser.readMessage[io.envoyproxy.envoy.admin.v2alpha.CommandLineOptions](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    io.envoyproxy.envoy.admin.v2alpha.ServerInfo(
        version = __version,
        state = __state,
        uptimeCurrentEpoch = __uptimeCurrentEpoch,
        uptimeAllEpochs = __uptimeAllEpochs,
        hotRestartVersion = __hotRestartVersion,
        commandLineOptions = __commandLineOptions,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[io.envoyproxy.envoy.admin.v2alpha.ServerInfo] = _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.admin.v2alpha.ServerInfo(
        version = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        state = io.envoyproxy.envoy.admin.v2alpha.ServerInfo.State.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(io.envoyproxy.envoy.admin.v2alpha.ServerInfo.State.LIVE.scalaValueDescriptor).number),
        uptimeCurrentEpoch = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.duration.Duration]]),
        uptimeAllEpochs = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.duration.Duration]]),
        hotRestartVersion = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        commandLineOptions = __fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).flatMap(_.as[_root_.scala.Option[io.envoyproxy.envoy.admin.v2alpha.CommandLineOptions]])
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ServerInfoProto.javaDescriptor.getMessageTypes().get(0)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ServerInfoProto.scalaDescriptor.messages(0)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 3 => __out = com.google.protobuf.duration.Duration
      case 4 => __out = com.google.protobuf.duration.Duration
      case 6 => __out = io.envoyproxy.envoy.admin.v2alpha.CommandLineOptions
    }
    __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 2 => io.envoyproxy.envoy.admin.v2alpha.ServerInfo.State
    }
  }
  lazy val defaultInstance = io.envoyproxy.envoy.admin.v2alpha.ServerInfo(
    version = "",
    state = io.envoyproxy.envoy.admin.v2alpha.ServerInfo.State.LIVE,
    uptimeCurrentEpoch = _root_.scala.None,
    uptimeAllEpochs = _root_.scala.None,
    hotRestartVersion = "",
    commandLineOptions = _root_.scala.None
  )
  sealed abstract class State(val value: _root_.scala.Int) extends _root_.scalapb.GeneratedEnum {
    type EnumType = State
    def isLive: _root_.scala.Boolean = false
    def isDraining: _root_.scala.Boolean = false
    def isPreInitializing: _root_.scala.Boolean = false
    def isInitializing: _root_.scala.Boolean = false
    def companion: _root_.scalapb.GeneratedEnumCompanion[State] = io.envoyproxy.envoy.admin.v2alpha.ServerInfo.State
    final def asRecognized: _root_.scala.Option[io.envoyproxy.envoy.admin.v2alpha.ServerInfo.State.Recognized] = if (isUnrecognized) _root_.scala.None else _root_.scala.Some(this.asInstanceOf[io.envoyproxy.envoy.admin.v2alpha.ServerInfo.State.Recognized])
  }
  
  object State extends _root_.scalapb.GeneratedEnumCompanion[State] {
    sealed trait Recognized extends State
    implicit def enumCompanion: _root_.scalapb.GeneratedEnumCompanion[State] = this
    
    /** Server is live and serving traffic.
      */
    @SerialVersionUID(0L)
    case object LIVE extends State(0) with State.Recognized {
      val index = 0
      val name = "LIVE"
      override def isLive: _root_.scala.Boolean = true
    }
    
    /** Server is draining listeners in response to external health checks failing.
      */
    @SerialVersionUID(0L)
    case object DRAINING extends State(1) with State.Recognized {
      val index = 1
      val name = "DRAINING"
      override def isDraining: _root_.scala.Boolean = true
    }
    
    /** Server has not yet completed cluster manager initialization.
      */
    @SerialVersionUID(0L)
    case object PRE_INITIALIZING extends State(2) with State.Recognized {
      val index = 2
      val name = "PRE_INITIALIZING"
      override def isPreInitializing: _root_.scala.Boolean = true
    }
    
    /** Server is running the cluster manager initialization callbacks (e.g., RDS).
      */
    @SerialVersionUID(0L)
    case object INITIALIZING extends State(3) with State.Recognized {
      val index = 3
      val name = "INITIALIZING"
      override def isInitializing: _root_.scala.Boolean = true
    }
    
    @SerialVersionUID(0L)
    final case class Unrecognized(unrecognizedValue: _root_.scala.Int) extends State(unrecognizedValue) with _root_.scalapb.UnrecognizedEnum
    lazy val values = scala.collection.immutable.Seq(LIVE, DRAINING, PRE_INITIALIZING, INITIALIZING)
    def fromValue(__value: _root_.scala.Int): State = __value match {
      case 0 => LIVE
      case 1 => DRAINING
      case 2 => PRE_INITIALIZING
      case 3 => INITIALIZING
      case __other => Unrecognized(__other)
    }
    def javaDescriptor: _root_.com.google.protobuf.Descriptors.EnumDescriptor = io.envoyproxy.envoy.admin.v2alpha.ServerInfo.javaDescriptor.getEnumTypes().get(0)
    def scalaDescriptor: _root_.scalapb.descriptors.EnumDescriptor = io.envoyproxy.envoy.admin.v2alpha.ServerInfo.scalaDescriptor.enums(0)
  }
  implicit class ServerInfoLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.admin.v2alpha.ServerInfo]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, io.envoyproxy.envoy.admin.v2alpha.ServerInfo](_l) {
    def version: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.version)((c_, f_) => c_.copy(version = f_))
    def state: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.admin.v2alpha.ServerInfo.State] = field(_.state)((c_, f_) => c_.copy(state = f_))
    def uptimeCurrentEpoch: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.duration.Duration] = field(_.getUptimeCurrentEpoch)((c_, f_) => c_.copy(uptimeCurrentEpoch = Option(f_)))
    def optionalUptimeCurrentEpoch: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.duration.Duration]] = field(_.uptimeCurrentEpoch)((c_, f_) => c_.copy(uptimeCurrentEpoch = f_))
    def uptimeAllEpochs: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.duration.Duration] = field(_.getUptimeAllEpochs)((c_, f_) => c_.copy(uptimeAllEpochs = Option(f_)))
    def optionalUptimeAllEpochs: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.duration.Duration]] = field(_.uptimeAllEpochs)((c_, f_) => c_.copy(uptimeAllEpochs = f_))
    def hotRestartVersion: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.hotRestartVersion)((c_, f_) => c_.copy(hotRestartVersion = f_))
    def commandLineOptions: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.admin.v2alpha.CommandLineOptions] = field(_.getCommandLineOptions)((c_, f_) => c_.copy(commandLineOptions = Option(f_)))
    def optionalCommandLineOptions: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[io.envoyproxy.envoy.admin.v2alpha.CommandLineOptions]] = field(_.commandLineOptions)((c_, f_) => c_.copy(commandLineOptions = f_))
  }
  final val VERSION_FIELD_NUMBER = 1
  final val STATE_FIELD_NUMBER = 2
  final val UPTIME_CURRENT_EPOCH_FIELD_NUMBER = 3
  final val UPTIME_ALL_EPOCHS_FIELD_NUMBER = 4
  final val HOT_RESTART_VERSION_FIELD_NUMBER = 5
  final val COMMAND_LINE_OPTIONS_FIELD_NUMBER = 6
  def of(
    version: _root_.scala.Predef.String,
    state: io.envoyproxy.envoy.admin.v2alpha.ServerInfo.State,
    uptimeCurrentEpoch: _root_.scala.Option[com.google.protobuf.duration.Duration],
    uptimeAllEpochs: _root_.scala.Option[com.google.protobuf.duration.Duration],
    hotRestartVersion: _root_.scala.Predef.String,
    commandLineOptions: _root_.scala.Option[io.envoyproxy.envoy.admin.v2alpha.CommandLineOptions]
  ): _root_.io.envoyproxy.envoy.admin.v2alpha.ServerInfo = _root_.io.envoyproxy.envoy.admin.v2alpha.ServerInfo(
    version,
    state,
    uptimeCurrentEpoch,
    uptimeAllEpochs,
    hotRestartVersion,
    commandLineOptions
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[envoy.admin.v2alpha.ServerInfo])
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy