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

io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.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.service.discovery.v3

/** [#next-free-field: 7]
  *
  * @param versionInfo
  *   The version of the response data.
  * @param resources
  *   The response resources. These resources are typed and depend on the API being called.
  * @param canary
  *   [#not-implemented-hide:]
  *   Canary is used to support two Envoy command line flags:
  *  
  *   * --terminate-on-canary-transition-failure. When set, Envoy is able to
  *     terminate if it detects that configuration is stuck at canary. Consider
  *     this example sequence of updates:
  *     - Management server applies a canary config successfully.
  *     - Management server rolls back to a production config.
  *     - Envoy rejects the new production config.
  *     Since there is no sensible way to continue receiving configuration
  *     updates, Envoy will then terminate and apply production config from a
  *     clean slate.
  *   * --dry-run-canary. When set, a canary response will never be applied, only
  *     validated via a dry run.
  * @param typeUrl
  *   Type URL for resources. Identifies the xDS API when muxing over ADS.
  *   Must be consistent with the type_url in the 'resources' repeated Any (if non-empty).
  * @param nonce
  *   For gRPC based subscriptions, the nonce provides a way to explicitly ack a
  *   specific DiscoveryResponse in a following DiscoveryRequest. Additional
  *   messages may have been sent by Envoy to the management server for the
  *   previous version on the stream prior to this DiscoveryResponse, that were
  *   unprocessed at response send time. The nonce allows the management server
  *   to ignore any further DiscoveryRequests for the previous version until a
  *   DiscoveryRequest bearing the nonce. The nonce is optional and is not
  *   required for non-stream based xDS implementations.
  * @param controlPlane
  *   The control plane instance that sent the response.
  */
@SerialVersionUID(0L)
final case class DiscoveryResponse(
    versionInfo: _root_.scala.Predef.String = "",
    resources: _root_.scala.Seq[com.google.protobuf.any.Any] = _root_.scala.Seq.empty,
    canary: _root_.scala.Boolean = false,
    typeUrl: _root_.scala.Predef.String = "",
    nonce: _root_.scala.Predef.String = "",
    controlPlane: _root_.scala.Option[io.envoyproxy.envoy.config.core.v3.ControlPlane] = _root_.scala.None,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[DiscoveryResponse] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = versionInfo
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
        }
      };
      resources.foreach { __item =>
        val __value = __item
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      }
      
      {
        val __value = canary
        if (__value != false) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(3, __value)
        }
      };
      
      {
        val __value = typeUrl
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(4, __value)
        }
      };
      
      {
        val __value = nonce
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(5, __value)
        }
      };
      if (controlPlane.isDefined) {
        val __value = controlPlane.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 = versionInfo
        if (!__v.isEmpty) {
          _output__.writeString(1, __v)
        }
      };
      resources.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      {
        val __v = canary
        if (__v != false) {
          _output__.writeBool(3, __v)
        }
      };
      {
        val __v = typeUrl
        if (!__v.isEmpty) {
          _output__.writeString(4, __v)
        }
      };
      {
        val __v = nonce
        if (!__v.isEmpty) {
          _output__.writeString(5, __v)
        }
      };
      controlPlane.foreach { __v =>
        val __m = __v
        _output__.writeTag(6, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      unknownFields.writeTo(_output__)
    }
    def withVersionInfo(__v: _root_.scala.Predef.String): DiscoveryResponse = copy(versionInfo = __v)
    def clearResources = copy(resources = _root_.scala.Seq.empty)
    def addResources(__vs: com.google.protobuf.any.Any *): DiscoveryResponse = addAllResources(__vs)
    def addAllResources(__vs: Iterable[com.google.protobuf.any.Any]): DiscoveryResponse = copy(resources = resources ++ __vs)
    def withResources(__v: _root_.scala.Seq[com.google.protobuf.any.Any]): DiscoveryResponse = copy(resources = __v)
    def withCanary(__v: _root_.scala.Boolean): DiscoveryResponse = copy(canary = __v)
    def withTypeUrl(__v: _root_.scala.Predef.String): DiscoveryResponse = copy(typeUrl = __v)
    def withNonce(__v: _root_.scala.Predef.String): DiscoveryResponse = copy(nonce = __v)
    def getControlPlane: io.envoyproxy.envoy.config.core.v3.ControlPlane = controlPlane.getOrElse(io.envoyproxy.envoy.config.core.v3.ControlPlane.defaultInstance)
    def clearControlPlane: DiscoveryResponse = copy(controlPlane = _root_.scala.None)
    def withControlPlane(__v: io.envoyproxy.envoy.config.core.v3.ControlPlane): DiscoveryResponse = copy(controlPlane = 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 = versionInfo
          if (__t != "") __t else null
        }
        case 2 => resources
        case 3 => {
          val __t = canary
          if (__t != false) __t else null
        }
        case 4 => {
          val __t = typeUrl
          if (__t != "") __t else null
        }
        case 5 => {
          val __t = nonce
          if (__t != "") __t else null
        }
        case 6 => controlPlane.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(versionInfo)
        case 2 => _root_.scalapb.descriptors.PRepeated(resources.iterator.map(_.toPMessage).toVector)
        case 3 => _root_.scalapb.descriptors.PBoolean(canary)
        case 4 => _root_.scalapb.descriptors.PString(typeUrl)
        case 5 => _root_.scalapb.descriptors.PString(nonce)
        case 6 => controlPlane.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse.type = io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse
    // @@protoc_insertion_point(GeneratedMessage[envoy.service.discovery.v3.DiscoveryResponse])
}

object DiscoveryResponse extends scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse = {
    var __versionInfo: _root_.scala.Predef.String = ""
    val __resources: _root_.scala.collection.immutable.VectorBuilder[com.google.protobuf.any.Any] = new _root_.scala.collection.immutable.VectorBuilder[com.google.protobuf.any.Any]
    var __canary: _root_.scala.Boolean = false
    var __typeUrl: _root_.scala.Predef.String = ""
    var __nonce: _root_.scala.Predef.String = ""
    var __controlPlane: _root_.scala.Option[io.envoyproxy.envoy.config.core.v3.ControlPlane] = _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 =>
          __versionInfo = _input__.readStringRequireUtf8()
        case 18 =>
          __resources += _root_.scalapb.LiteParser.readMessage[com.google.protobuf.any.Any](_input__)
        case 24 =>
          __canary = _input__.readBool()
        case 34 =>
          __typeUrl = _input__.readStringRequireUtf8()
        case 42 =>
          __nonce = _input__.readStringRequireUtf8()
        case 50 =>
          __controlPlane = Option(__controlPlane.fold(_root_.scalapb.LiteParser.readMessage[io.envoyproxy.envoy.config.core.v3.ControlPlane](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse(
        versionInfo = __versionInfo,
        resources = __resources.result(),
        canary = __canary,
        typeUrl = __typeUrl,
        nonce = __nonce,
        controlPlane = __controlPlane,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse] = _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.discovery.v3.DiscoveryResponse(
        versionInfo = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        resources = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Seq[com.google.protobuf.any.Any]]).getOrElse(_root_.scala.Seq.empty),
        canary = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Boolean]).getOrElse(false),
        typeUrl = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        nonce = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        controlPlane = __fieldsMap.get(scalaDescriptor.findFieldByNumber(6).get).flatMap(_.as[_root_.scala.Option[io.envoyproxy.envoy.config.core.v3.ControlPlane]])
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = DiscoveryProto.javaDescriptor.getMessageTypes().get(3)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = DiscoveryProto.scalaDescriptor.messages(3)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 2 => __out = com.google.protobuf.any.Any
      case 6 => __out = io.envoyproxy.envoy.config.core.v3.ControlPlane
    }
    __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.service.discovery.v3.DiscoveryResponse(
    versionInfo = "",
    resources = _root_.scala.Seq.empty,
    canary = false,
    typeUrl = "",
    nonce = "",
    controlPlane = _root_.scala.None
  )
  implicit class DiscoveryResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse](_l) {
    def versionInfo: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.versionInfo)((c_, f_) => c_.copy(versionInfo = f_))
    def resources: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[com.google.protobuf.any.Any]] = field(_.resources)((c_, f_) => c_.copy(resources = f_))
    def canary: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.canary)((c_, f_) => c_.copy(canary = f_))
    def typeUrl: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.typeUrl)((c_, f_) => c_.copy(typeUrl = f_))
    def nonce: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.nonce)((c_, f_) => c_.copy(nonce = f_))
    def controlPlane: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.config.core.v3.ControlPlane] = field(_.getControlPlane)((c_, f_) => c_.copy(controlPlane = Option(f_)))
    def optionalControlPlane: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[io.envoyproxy.envoy.config.core.v3.ControlPlane]] = field(_.controlPlane)((c_, f_) => c_.copy(controlPlane = f_))
  }
  final val VERSION_INFO_FIELD_NUMBER = 1
  final val RESOURCES_FIELD_NUMBER = 2
  final val CANARY_FIELD_NUMBER = 3
  final val TYPE_URL_FIELD_NUMBER = 4
  final val NONCE_FIELD_NUMBER = 5
  final val CONTROL_PLANE_FIELD_NUMBER = 6
  def of(
    versionInfo: _root_.scala.Predef.String,
    resources: _root_.scala.Seq[com.google.protobuf.any.Any],
    canary: _root_.scala.Boolean,
    typeUrl: _root_.scala.Predef.String,
    nonce: _root_.scala.Predef.String,
    controlPlane: _root_.scala.Option[io.envoyproxy.envoy.config.core.v3.ControlPlane]
  ): _root_.io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse = _root_.io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse(
    versionInfo,
    resources,
    canary,
    typeUrl,
    nonce,
    controlPlane
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[envoy.service.discovery.v3.DiscoveryResponse])
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy