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

io.envoyproxy.envoy.api.v2.endpoint.Endpoint.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.api.v2.endpoint

/** Upstream host identifier.
  *
  * @param address
  *   The upstream host address.
  *  
  *   .. attention::
  *  
  *     The form of host address depends on the given cluster type. For STATIC or EDS,
  *     it is expected to be a direct IP address (or something resolvable by the
  *     specified :ref:`resolver <envoy_api_field_core.SocketAddress.resolver_name>`
  *     in the Address). For LOGICAL or STRICT DNS, it is expected to be hostname,
  *     and will be resolved via DNS.
  * @param healthCheckConfig
  *   The optional health check configuration is used as configuration for the
  *   health checker to contact the health checked host.
  *  
  *   .. attention::
  *  
  *     This takes into effect only for upstream clusters with
  *     :ref:`active health checking <arch_overview_health_checking>` enabled.
  * @param hostname
  *   The hostname associated with this endpoint. This hostname is not used for routing or address
  *   resolution. If provided, it will be associated with the endpoint, and can be used for features
  *   that require a hostname, like
  *   :ref:`auto_host_rewrite <envoy_api_field_route.RouteAction.auto_host_rewrite>`.
  */
@SerialVersionUID(0L)
final case class Endpoint(
    address: _root_.scala.Option[io.envoyproxy.envoy.api.v2.core.Address] = _root_.scala.None,
    healthCheckConfig: _root_.scala.Option[io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig] = _root_.scala.None,
    hostname: _root_.scala.Predef.String = "",
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Endpoint] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      if (address.isDefined) {
        val __value = address.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      if (healthCheckConfig.isDefined) {
        val __value = healthCheckConfig.get
        __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
      };
      
      {
        val __value = hostname
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __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 = {
      address.foreach { __v =>
        val __m = __v
        _output__.writeTag(1, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      healthCheckConfig.foreach { __v =>
        val __m = __v
        _output__.writeTag(2, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      {
        val __v = hostname
        if (!__v.isEmpty) {
          _output__.writeString(3, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def getAddress: io.envoyproxy.envoy.api.v2.core.Address = address.getOrElse(io.envoyproxy.envoy.api.v2.core.Address.defaultInstance)
    def clearAddress: Endpoint = copy(address = _root_.scala.None)
    def withAddress(__v: io.envoyproxy.envoy.api.v2.core.Address): Endpoint = copy(address = Option(__v))
    def getHealthCheckConfig: io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig = healthCheckConfig.getOrElse(io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig.defaultInstance)
    def clearHealthCheckConfig: Endpoint = copy(healthCheckConfig = _root_.scala.None)
    def withHealthCheckConfig(__v: io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig): Endpoint = copy(healthCheckConfig = Option(__v))
    def withHostname(__v: _root_.scala.Predef.String): Endpoint = copy(hostname = __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 => address.orNull
        case 2 => healthCheckConfig.orNull
        case 3 => {
          val __t = hostname
          if (__t != "") __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 => address.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 2 => healthCheckConfig.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
        case 3 => _root_.scalapb.descriptors.PString(hostname)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: io.envoyproxy.envoy.api.v2.endpoint.Endpoint.type = io.envoyproxy.envoy.api.v2.endpoint.Endpoint
    // @@protoc_insertion_point(GeneratedMessage[envoy.api.v2.endpoint.Endpoint])
}

object Endpoint extends scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.api.v2.endpoint.Endpoint] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.api.v2.endpoint.Endpoint] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): io.envoyproxy.envoy.api.v2.endpoint.Endpoint = {
    var __address: _root_.scala.Option[io.envoyproxy.envoy.api.v2.core.Address] = _root_.scala.None
    var __healthCheckConfig: _root_.scala.Option[io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig] = _root_.scala.None
    var __hostname: _root_.scala.Predef.String = ""
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __address = Option(__address.fold(_root_.scalapb.LiteParser.readMessage[io.envoyproxy.envoy.api.v2.core.Address](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 18 =>
          __healthCheckConfig = Option(__healthCheckConfig.fold(_root_.scalapb.LiteParser.readMessage[io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
        case 26 =>
          __hostname = _input__.readStringRequireUtf8()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    io.envoyproxy.envoy.api.v2.endpoint.Endpoint(
        address = __address,
        healthCheckConfig = __healthCheckConfig,
        hostname = __hostname,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[io.envoyproxy.envoy.api.v2.endpoint.Endpoint] = _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.api.v2.endpoint.Endpoint(
        address = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[io.envoyproxy.envoy.api.v2.core.Address]]),
        healthCheckConfig = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[_root_.scala.Option[io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig]]),
        hostname = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse("")
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = EndpointComponentsProto.javaDescriptor.getMessageTypes().get(0)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = EndpointComponentsProto.scalaDescriptor.messages(0)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 1 => __out = io.envoyproxy.envoy.api.v2.core.Address
      case 2 => __out = io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] =
    Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]](
      _root_.io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig
    )
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
  lazy val defaultInstance = io.envoyproxy.envoy.api.v2.endpoint.Endpoint(
    address = _root_.scala.None,
    healthCheckConfig = _root_.scala.None,
    hostname = ""
  )
  /** The optional health check configuration.
    *
    * @param portValue
    *   Optional alternative health check port value.
    *  
    *   By default the health check address port of an upstream host is the same
    *   as the host's serving address port. This provides an alternative health
    *   check port. Setting this with a non-zero value allows an upstream host
    *   to have different health check address port.
    * @param hostname
    *   By default, the host header for L7 health checks is controlled by cluster level configuration
    *   (see: :ref:`host <envoy_api_field_core.HealthCheck.HttpHealthCheck.host>` and
    *   :ref:`authority <envoy_api_field_core.HealthCheck.GrpcHealthCheck.authority>`). Setting this
    *   to a non-empty value allows overriding the cluster level configuration for a specific
    *   endpoint.
    */
  @SerialVersionUID(0L)
  final case class HealthCheckConfig(
      portValue: _root_.scala.Int = 0,
      hostname: _root_.scala.Predef.String = "",
      unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
      ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[HealthCheckConfig] {
      @transient
      private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
      private[this] def __computeSerializedSize(): _root_.scala.Int = {
        var __size = 0
        
        {
          val __value = portValue
          if (__value != 0) {
            __size += _root_.com.google.protobuf.CodedOutputStream.computeUInt32Size(1, __value)
          }
        };
        
        {
          val __value = hostname
          if (!__value.isEmpty) {
            __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __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 = portValue
          if (__v != 0) {
            _output__.writeUInt32(1, __v)
          }
        };
        {
          val __v = hostname
          if (!__v.isEmpty) {
            _output__.writeString(2, __v)
          }
        };
        unknownFields.writeTo(_output__)
      }
      def withPortValue(__v: _root_.scala.Int): HealthCheckConfig = copy(portValue = __v)
      def withHostname(__v: _root_.scala.Predef.String): HealthCheckConfig = copy(hostname = __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 = portValue
            if (__t != 0) __t else null
          }
          case 2 => {
            val __t = hostname
            if (__t != "") __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.PInt(portValue)
          case 2 => _root_.scalapb.descriptors.PString(hostname)
        }
      }
      def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
      def companion: io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig.type = io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig
      // @@protoc_insertion_point(GeneratedMessage[envoy.api.v2.endpoint.Endpoint.HealthCheckConfig])
  }
  
  object HealthCheckConfig extends scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig] {
    implicit def messageCompanion: scalapb.GeneratedMessageCompanion[io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig] = this
    def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig = {
      var __portValue: _root_.scala.Int = 0
      var __hostname: _root_.scala.Predef.String = ""
      var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
      var _done__ = false
      while (!_done__) {
        val _tag__ = _input__.readTag()
        _tag__ match {
          case 0 => _done__ = true
          case 8 =>
            __portValue = _input__.readUInt32()
          case 18 =>
            __hostname = _input__.readStringRequireUtf8()
          case tag =>
            if (_unknownFields__ == null) {
              _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
            }
            _unknownFields__.parseField(tag, _input__)
        }
      }
      io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig(
          portValue = __portValue,
          hostname = __hostname,
          unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
      )
    }
    implicit def messageReads: _root_.scalapb.descriptors.Reads[io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig] = _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.api.v2.endpoint.Endpoint.HealthCheckConfig(
          portValue = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Int]).getOrElse(0),
          hostname = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse("")
        )
      case _ => throw new RuntimeException("Expected PMessage")
    }
    def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = io.envoyproxy.envoy.api.v2.endpoint.Endpoint.javaDescriptor.getNestedTypes().get(0)
    def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = io.envoyproxy.envoy.api.v2.endpoint.Endpoint.scalaDescriptor.nestedMessages(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[_] = throw new MatchError(__fieldNumber)
    lazy val defaultInstance = io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig(
      portValue = 0,
      hostname = ""
    )
    implicit class HealthCheckConfigLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig](_l) {
      def portValue: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Int] = field(_.portValue)((c_, f_) => c_.copy(portValue = f_))
      def hostname: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.hostname)((c_, f_) => c_.copy(hostname = f_))
    }
    final val PORT_VALUE_FIELD_NUMBER = 1
    final val HOSTNAME_FIELD_NUMBER = 2
    def of(
      portValue: _root_.scala.Int,
      hostname: _root_.scala.Predef.String
    ): _root_.io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig = _root_.io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig(
      portValue,
      hostname
    )
    // @@protoc_insertion_point(GeneratedMessageCompanion[envoy.api.v2.endpoint.Endpoint.HealthCheckConfig])
  }
  
  implicit class EndpointLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.api.v2.endpoint.Endpoint]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, io.envoyproxy.envoy.api.v2.endpoint.Endpoint](_l) {
    def address: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.api.v2.core.Address] = field(_.getAddress)((c_, f_) => c_.copy(address = Option(f_)))
    def optionalAddress: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[io.envoyproxy.envoy.api.v2.core.Address]] = field(_.address)((c_, f_) => c_.copy(address = f_))
    def healthCheckConfig: _root_.scalapb.lenses.Lens[UpperPB, io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig] = field(_.getHealthCheckConfig)((c_, f_) => c_.copy(healthCheckConfig = Option(f_)))
    def optionalHealthCheckConfig: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig]] = field(_.healthCheckConfig)((c_, f_) => c_.copy(healthCheckConfig = f_))
    def hostname: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.hostname)((c_, f_) => c_.copy(hostname = f_))
  }
  final val ADDRESS_FIELD_NUMBER = 1
  final val HEALTH_CHECK_CONFIG_FIELD_NUMBER = 2
  final val HOSTNAME_FIELD_NUMBER = 3
  def of(
    address: _root_.scala.Option[io.envoyproxy.envoy.api.v2.core.Address],
    healthCheckConfig: _root_.scala.Option[io.envoyproxy.envoy.api.v2.endpoint.Endpoint.HealthCheckConfig],
    hostname: _root_.scala.Predef.String
  ): _root_.io.envoyproxy.envoy.api.v2.endpoint.Endpoint = _root_.io.envoyproxy.envoy.api.v2.endpoint.Endpoint(
    address,
    healthCheckConfig,
    hostname
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[envoy.api.v2.endpoint.Endpoint])
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy