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

io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.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.ext_proc.v3

/** This message contains common fields between header and body responses.
  * [#next-free-field: 6]
  *
  * @param status
  *   If set, provide additional direction on how the Envoy proxy should
  *   handle the rest of the HTTP filter chain.
  * @param headerMutation
  *   Instructions on how to manipulate the headers. When responding to an
  *   HttpBody request, header mutations will only take effect if
  *   the current processing mode for the body is BUFFERED.
  * @param bodyMutation
  *   Replace the body of the last message sent to the remote server on this
  *   stream. If responding to an HttpBody request, simply replace or clear
  *   the body chunk that was sent with that request. Body mutations only take
  *   effect in response to "body" messages and are ignored otherwise.
  * @param trailers
  *   [#not-implemented-hide:]
  *   Add new trailers to the message. This may be used when responding to either a
  *   HttpHeaders or HttpBody message, but only if this message is returned
  *   along with the CONTINUE_AND_REPLACE status.
  * @param clearRouteCache
  *   Clear the route cache for the current request.
  *   This is necessary if the remote server
  *   modified headers that are used to calculate the route.
  */
@SerialVersionUID(0L)
final case class CommonResponse(
    status: io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.ResponseStatus = io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.ResponseStatus.CONTINUE,
    headerMutation: _root_.scala.Option[io.envoyproxy.envoy.service.ext_proc.v3.HeaderMutation] = _root_.scala.None,
    bodyMutation: _root_.scala.Option[io.envoyproxy.envoy.service.ext_proc.v3.BodyMutation] = _root_.scala.None,
    trailers: _root_.scala.Option[io.envoyproxy.envoy.config.core.v3.HeaderMap] = _root_.scala.None,
    clearRouteCache: _root_.scala.Boolean = false,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[CommonResponse] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = status.value
        if (__value != 0) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(1, __value)
        }
      };
      if (headerMutation.isDefined) {
        val __value = headerMutation.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (bodyMutation.isDefined) {
        val __value = bodyMutation.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (trailers.isDefined) {
        val __value = trailers.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      
      {
        val __value = clearRouteCache
        if (__value != false) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(5, __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 = {
      {
        val __v = status.value
        if (__v != 0) {
          _output__.writeEnum(1, __v)
        }
      };
      headerMutation.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      bodyMutation.foreach { __v =>
        val __m = __v
        _output__.writeTag(3, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      trailers.foreach { __v =>
        val __m = __v
        _output__.writeTag(4, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      {
        val __v = clearRouteCache
        if (__v != false) {
          _output__.writeBool(5, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def withStatus(__v: io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.ResponseStatus): CommonResponse = copy(status = __v)
    def getHeaderMutation: io.envoyproxy.envoy.service.ext_proc.v3.HeaderMutation = headerMutation.getOrElse(io.envoyproxy.envoy.service.ext_proc.v3.HeaderMutation.defaultInstance)
    def clearHeaderMutation: CommonResponse = copy(headerMutation = _root_.scala.None)
    def withHeaderMutation(__v: io.envoyproxy.envoy.service.ext_proc.v3.HeaderMutation): CommonResponse = copy(headerMutation = Option(__v))
    def getBodyMutation: io.envoyproxy.envoy.service.ext_proc.v3.BodyMutation = bodyMutation.getOrElse(io.envoyproxy.envoy.service.ext_proc.v3.BodyMutation.defaultInstance)
    def clearBodyMutation: CommonResponse = copy(bodyMutation = _root_.scala.None)
    def withBodyMutation(__v: io.envoyproxy.envoy.service.ext_proc.v3.BodyMutation): CommonResponse = copy(bodyMutation = Option(__v))
    def getTrailers: io.envoyproxy.envoy.config.core.v3.HeaderMap = trailers.getOrElse(io.envoyproxy.envoy.config.core.v3.HeaderMap.defaultInstance)
    def clearTrailers: CommonResponse = copy(trailers = _root_.scala.None)
    def withTrailers(__v: io.envoyproxy.envoy.config.core.v3.HeaderMap): CommonResponse = copy(trailers = Option(__v))
    def withClearRouteCache(__v: _root_.scala.Boolean): CommonResponse = copy(clearRouteCache = __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 = status.javaValueDescriptor
          if (__t.getNumber() != 0) __t else null
        }
        case 2 => headerMutation.orNull
        case 3 => bodyMutation.orNull
        case 4 => trailers.orNull
        case 5 => {
          val __t = clearRouteCache
          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 => _root_.scalapb.descriptors.PEnum(status.scalaValueDescriptor)
        case 2 => headerMutation.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => bodyMutation.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 4 => trailers.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 5 => _root_.scalapb.descriptors.PBoolean(clearRouteCache)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.type = io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse
    // @@protoc_insertion_point(GeneratedMessage[envoy.service.ext_proc.v3.CommonResponse])
}

object CommonResponse extends scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse = {
    var __status: io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.ResponseStatus = io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.ResponseStatus.CONTINUE
    var __headerMutation: _root_.scala.Option[io.envoyproxy.envoy.service.ext_proc.v3.HeaderMutation] = _root_.scala.None
    var __bodyMutation: _root_.scala.Option[io.envoyproxy.envoy.service.ext_proc.v3.BodyMutation] = _root_.scala.None
    var __trailers: _root_.scala.Option[io.envoyproxy.envoy.config.core.v3.HeaderMap] = _root_.scala.None
    var __clearRouteCache: _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 8 =>
          __status = io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.ResponseStatus.fromValue(_input__.readEnum())
        case 18 =>
          __headerMutation = Option(__headerMutation.fold(_root_.scalapb.LiteParser.readMessage[io.envoyproxy.envoy.service.ext_proc.v3.HeaderMutation](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 26 =>
          __bodyMutation = Option(__bodyMutation.fold(_root_.scalapb.LiteParser.readMessage[io.envoyproxy.envoy.service.ext_proc.v3.BodyMutation](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 34 =>
          __trailers = Option(__trailers.fold(_root_.scalapb.LiteParser.readMessage[io.envoyproxy.envoy.config.core.v3.HeaderMap](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 40 =>
          __clearRouteCache = _input__.readBool()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse(
        status = __status,
        headerMutation = __headerMutation,
        bodyMutation = __bodyMutation,
        trailers = __trailers,
        clearRouteCache = __clearRouteCache,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse] = _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.ext_proc.v3.CommonResponse(
        status = io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.ResponseStatus.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.ResponseStatus.CONTINUE.scalaValueDescriptor).number),
        headerMutation = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[io.envoyproxy.envoy.service.ext_proc.v3.HeaderMutation]]),
        bodyMutation = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[_root_.scala.Option[io.envoyproxy.envoy.service.ext_proc.v3.BodyMutation]]),
        trailers = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[io.envoyproxy.envoy.config.core.v3.HeaderMap]]),
        clearRouteCache = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).map(_.as[_root_.scala.Boolean]).getOrElse(false)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = ExternalProcessorProto.javaDescriptor.getMessageTypes().get(8)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = ExternalProcessorProto.scalaDescriptor.messages(8)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 2 => __out = io.envoyproxy.envoy.service.ext_proc.v3.HeaderMutation
      case 3 => __out = io.envoyproxy.envoy.service.ext_proc.v3.BodyMutation
      case 4 => __out = io.envoyproxy.envoy.config.core.v3.HeaderMap
    }
    __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 1 => io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.ResponseStatus
    }
  }
  lazy val defaultInstance = io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse(
    status = io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.ResponseStatus.CONTINUE,
    headerMutation = _root_.scala.None,
    bodyMutation = _root_.scala.None,
    trailers = _root_.scala.None,
    clearRouteCache = false
  )
  sealed abstract class ResponseStatus(val value: _root_.scala.Int) extends _root_.scalapb.GeneratedEnum {
    type EnumType = ResponseStatus
    def isContinue: _root_.scala.Boolean = false
    def isContinueAndReplace: _root_.scala.Boolean = false
    def companion: _root_.scalapb.GeneratedEnumCompanion[ResponseStatus] = io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.ResponseStatus
    final def asRecognized: _root_.scala.Option[io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.ResponseStatus.Recognized] = if (isUnrecognized) _root_.scala.None else _root_.scala.Some(this.asInstanceOf[io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.ResponseStatus.Recognized])
  }
  
  object ResponseStatus extends _root_.scalapb.GeneratedEnumCompanion[ResponseStatus] {
    sealed trait Recognized extends ResponseStatus
    implicit def enumCompanion: _root_.scalapb.GeneratedEnumCompanion[ResponseStatus] = this
    
    /** Apply the mutation instructions in this message to the
      * request or response, and then continue processing the filter
      * stream as normal. This is the default.
      */
    @SerialVersionUID(0L)
    case object CONTINUE extends ResponseStatus(0) with ResponseStatus.Recognized {
      val index = 0
      val name = "CONTINUE"
      override def isContinue: _root_.scala.Boolean = true
    }
    
    /** Apply the specified header mutation, replace the body with the body
      * specified in the body mutation (if present), and do not send any
      * further messages for this request or response even if the processing
      * mode is configured to do so.
      *
      * When used in response to a request_headers or response_headers message,
      * this status makes it possible to either completely replace the body
      * while discarding the original body, or to add a body to a message that
      * formerly did not have one.
      *
      * In other words, this response makes it possible to turn an HTTP GET
      * into a POST, PUT, or PATCH.
      */
    @SerialVersionUID(0L)
    case object CONTINUE_AND_REPLACE extends ResponseStatus(1) with ResponseStatus.Recognized {
      val index = 1
      val name = "CONTINUE_AND_REPLACE"
      override def isContinueAndReplace: _root_.scala.Boolean = true
    }
    
    @SerialVersionUID(0L)
    final case class Unrecognized(unrecognizedValue: _root_.scala.Int) extends ResponseStatus(unrecognizedValue) with _root_.scalapb.UnrecognizedEnum
    lazy val values = scala.collection.immutable.Seq(CONTINUE, CONTINUE_AND_REPLACE)
    def fromValue(__value: _root_.scala.Int): ResponseStatus = __value match {
      case 0 => CONTINUE
      case 1 => CONTINUE_AND_REPLACE
      case __other => Unrecognized(__other)
    }
    def javaDescriptor: _root_.com.google.protobuf.Descriptors.EnumDescriptor = io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.javaDescriptor.getEnumTypes().get(0)
    def scalaDescriptor: _root_.scalapb.descriptors.EnumDescriptor = io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.scalaDescriptor.enums(0)
  }
  implicit class CommonResponseLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse](_l) {
    def status: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.ResponseStatus] = field(_.status)((c_, f_) => c_.copy(status = f_))
    def headerMutation: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.service.ext_proc.v3.HeaderMutation] = field(_.getHeaderMutation)((c_, f_) => c_.copy(headerMutation = Option(f_)))
    def optionalHeaderMutation: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[io.envoyproxy.envoy.service.ext_proc.v3.HeaderMutation]] = field(_.headerMutation)((c_, f_) => c_.copy(headerMutation = f_))
    def bodyMutation: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.service.ext_proc.v3.BodyMutation] = field(_.getBodyMutation)((c_, f_) => c_.copy(bodyMutation = Option(f_)))
    def optionalBodyMutation: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[io.envoyproxy.envoy.service.ext_proc.v3.BodyMutation]] = field(_.bodyMutation)((c_, f_) => c_.copy(bodyMutation = f_))
    def trailers: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.config.core.v3.HeaderMap] = field(_.getTrailers)((c_, f_) => c_.copy(trailers = Option(f_)))
    def optionalTrailers: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[io.envoyproxy.envoy.config.core.v3.HeaderMap]] = field(_.trailers)((c_, f_) => c_.copy(trailers = f_))
    def clearRouteCache: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.clearRouteCache)((c_, f_) => c_.copy(clearRouteCache = f_))
  }
  final val STATUS_FIELD_NUMBER = 1
  final val HEADER_MUTATION_FIELD_NUMBER = 2
  final val BODY_MUTATION_FIELD_NUMBER = 3
  final val TRAILERS_FIELD_NUMBER = 4
  final val CLEAR_ROUTE_CACHE_FIELD_NUMBER = 5
  def of(
    status: io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse.ResponseStatus,
    headerMutation: _root_.scala.Option[io.envoyproxy.envoy.service.ext_proc.v3.HeaderMutation],
    bodyMutation: _root_.scala.Option[io.envoyproxy.envoy.service.ext_proc.v3.BodyMutation],
    trailers: _root_.scala.Option[io.envoyproxy.envoy.config.core.v3.HeaderMap],
    clearRouteCache: _root_.scala.Boolean
  ): _root_.io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse = _root_.io.envoyproxy.envoy.service.ext_proc.v3.CommonResponse(
    status,
    headerMutation,
    bodyMutation,
    trailers,
    clearRouteCache
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[envoy.service.ext_proc.v3.CommonResponse])
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy