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

com.google.api.billing.Billing.scala Maven / Gradle / Ivy

Go to download

Apache Pekko Connectors is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Pekko.

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

package com.google.api.billing

/** Billing related configuration of the service.
  *
  * The following example shows how to configure monitored resources and metrics
  * for billing, `consumer_destinations` is the only supported destination and
  * the monitored resources need at least one label key
  * `cloud.googleapis.com/location` to indicate the location of the billing
  * usage, using different monitored resources between monitoring and billing is
  * recommended so they can be evolved independently:
  *
  *
  *     monitored_resources:
  *     - type: library.googleapis.com/billing_branch
  *       labels:
  *       - key: cloud.googleapis.com/location
  *         description: |
  *           Predefined label to support billing location restriction.
  *       - key: city
  *         description: |
  *           Custom label to define the city where the library branch is located
  *           in.
  *       - key: name
  *         description: Custom label to define the name of the library branch.
  *     metrics:
  *     - name: library.googleapis.com/book/borrowed_count
  *       metric_kind: DELTA
  *       value_type: INT64
  *       unit: "1"
  *     billing:
  *       consumer_destinations:
  *       - monitored_resource: library.googleapis.com/billing_branch
  *         metrics:
  *         - library.googleapis.com/book/borrowed_count
  *
  * @param consumerDestinations
  *   Billing configurations for sending metrics to the consumer project.
  *   There can be multiple consumer destinations per service, each one must have
  *   a different monitored resource type. A metric can be used in at most
  *   one consumer destination.
  */
@SerialVersionUID(0L)
final case class Billing(
    consumerDestinations: _root_.scala.Seq[com.google.api.billing.Billing.BillingDestination] = _root_.scala.Seq.empty,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Billing] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      consumerDestinations.foreach { __item =>
        val __value = __item
        __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 = {
      consumerDestinations.foreach { __v =>
        val __m = __v
        _output__.writeTag(8, 2)
        _output__.writeUInt32NoTag(__m.serializedSize)
        __m.writeTo(_output__)
      };
      unknownFields.writeTo(_output__)
    }
    def clearConsumerDestinations = copy(consumerDestinations = _root_.scala.Seq.empty)
    def addConsumerDestinations(__vs: com.google.api.billing.Billing.BillingDestination *): Billing = addAllConsumerDestinations(__vs)
    def addAllConsumerDestinations(__vs: Iterable[com.google.api.billing.Billing.BillingDestination]): Billing = copy(consumerDestinations = consumerDestinations ++ __vs)
    def withConsumerDestinations(__v: _root_.scala.Seq[com.google.api.billing.Billing.BillingDestination]): Billing = copy(consumerDestinations = __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 8 => consumerDestinations
      }
    }
    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 8 => _root_.scalapb.descriptors.PRepeated(consumerDestinations.iterator.map(_.toPMessage).toVector)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: com.google.api.billing.Billing.type = com.google.api.billing.Billing
    // @@protoc_insertion_point(GeneratedMessage[google.api.Billing])
}

object Billing extends scalapb.GeneratedMessageCompanion[com.google.api.billing.Billing] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[com.google.api.billing.Billing] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): com.google.api.billing.Billing = {
    val __consumerDestinations: _root_.scala.collection.immutable.VectorBuilder[com.google.api.billing.Billing.BillingDestination] = new _root_.scala.collection.immutable.VectorBuilder[com.google.api.billing.Billing.BillingDestination]
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 66 =>
          __consumerDestinations += _root_.scalapb.LiteParser.readMessage[com.google.api.billing.Billing.BillingDestination](_input__)
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    com.google.api.billing.Billing(
        consumerDestinations = __consumerDestinations.result(),
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[com.google.api.billing.Billing] = _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.")
      com.google.api.billing.Billing(
        consumerDestinations = __fieldsMap.get(scalaDescriptor.findFieldByNumber(8).get).map(_.as[_root_.scala.Seq[com.google.api.billing.Billing.BillingDestination]]).getOrElse(_root_.scala.Seq.empty)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = BillingProto.javaDescriptor.getMessageTypes().get(0)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = BillingProto.scalaDescriptor.messages(0)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
    var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
    (__number: @_root_.scala.unchecked) match {
      case 8 => __out = com.google.api.billing.Billing.BillingDestination
    }
    __out
  }
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] =
    Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]](
      _root_.com.google.api.billing.Billing.BillingDestination
    )
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
  lazy val defaultInstance = com.google.api.billing.Billing(
    consumerDestinations = _root_.scala.Seq.empty
  )
  /** Configuration of a specific billing destination (Currently only support
    * bill against consumer project).
    *
    * @param monitoredResource
    *   The monitored resource type. The type must be defined in
    *   [Service.monitored_resources][google.api.Service.monitored_resources]
    *   section.
    * @param metrics
    *   Names of the metrics to report to this billing destination.
    *   Each name must be defined in
    *   [Service.metrics][google.api.Service.metrics] section.
    */
  @SerialVersionUID(0L)
  final case class BillingDestination(
      monitoredResource: _root_.scala.Predef.String = "",
      metrics: _root_.scala.Seq[_root_.scala.Predef.String] = _root_.scala.Seq.empty,
      unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
      ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[BillingDestination] {
      @transient
      private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
      private[this] def __computeSerializedSize(): _root_.scala.Int = {
        var __size = 0
        
        {
          val __value = monitoredResource
          if (!__value.isEmpty) {
            __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
          }
        };
        metrics.foreach { __item =>
          val __value = __item
          __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 = monitoredResource
          if (!__v.isEmpty) {
            _output__.writeString(1, __v)
          }
        };
        metrics.foreach { __v =>
          val __m = __v
          _output__.writeString(2, __m)
        };
        unknownFields.writeTo(_output__)
      }
      def withMonitoredResource(__v: _root_.scala.Predef.String): BillingDestination = copy(monitoredResource = __v)
      def clearMetrics = copy(metrics = _root_.scala.Seq.empty)
      def addMetrics(__vs: _root_.scala.Predef.String *): BillingDestination = addAllMetrics(__vs)
      def addAllMetrics(__vs: Iterable[_root_.scala.Predef.String]): BillingDestination = copy(metrics = metrics ++ __vs)
      def withMetrics(__v: _root_.scala.Seq[_root_.scala.Predef.String]): BillingDestination = copy(metrics = __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 = monitoredResource
            if (__t != "") __t else null
          }
          case 2 => metrics
        }
      }
      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(monitoredResource)
          case 2 => _root_.scalapb.descriptors.PRepeated(metrics.iterator.map(_root_.scalapb.descriptors.PString(_)).toVector)
        }
      }
      def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
      def companion: com.google.api.billing.Billing.BillingDestination.type = com.google.api.billing.Billing.BillingDestination
      // @@protoc_insertion_point(GeneratedMessage[google.api.Billing.BillingDestination])
  }
  
  object BillingDestination extends scalapb.GeneratedMessageCompanion[com.google.api.billing.Billing.BillingDestination] {
    implicit def messageCompanion: scalapb.GeneratedMessageCompanion[com.google.api.billing.Billing.BillingDestination] = this
    def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): com.google.api.billing.Billing.BillingDestination = {
      var __monitoredResource: _root_.scala.Predef.String = ""
      val __metrics: _root_.scala.collection.immutable.VectorBuilder[_root_.scala.Predef.String] = new _root_.scala.collection.immutable.VectorBuilder[_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 =>
            __monitoredResource = _input__.readStringRequireUtf8()
          case 18 =>
            __metrics += _input__.readStringRequireUtf8()
          case tag =>
            if (_unknownFields__ == null) {
              _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
            }
            _unknownFields__.parseField(tag, _input__)
        }
      }
      com.google.api.billing.Billing.BillingDestination(
          monitoredResource = __monitoredResource,
          metrics = __metrics.result(),
          unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
      )
    }
    implicit def messageReads: _root_.scalapb.descriptors.Reads[com.google.api.billing.Billing.BillingDestination] = _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.")
        com.google.api.billing.Billing.BillingDestination(
          monitoredResource = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
          metrics = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Seq[_root_.scala.Predef.String]]).getOrElse(_root_.scala.Seq.empty)
        )
      case _ => throw new RuntimeException("Expected PMessage")
    }
    def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = com.google.api.billing.Billing.javaDescriptor.getNestedTypes().get(0)
    def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = com.google.api.billing.Billing.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 = com.google.api.billing.Billing.BillingDestination(
      monitoredResource = "",
      metrics = _root_.scala.Seq.empty
    )
    implicit class BillingDestinationLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, com.google.api.billing.Billing.BillingDestination]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, com.google.api.billing.Billing.BillingDestination](_l) {
      def monitoredResource: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.monitoredResource)((c_, f_) => c_.copy(monitoredResource = f_))
      def metrics: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[_root_.scala.Predef.String]] = field(_.metrics)((c_, f_) => c_.copy(metrics = f_))
    }
    final val MONITORED_RESOURCE_FIELD_NUMBER = 1
    final val METRICS_FIELD_NUMBER = 2
    def of(
      monitoredResource: _root_.scala.Predef.String,
      metrics: _root_.scala.Seq[_root_.scala.Predef.String]
    ): _root_.com.google.api.billing.Billing.BillingDestination = _root_.com.google.api.billing.Billing.BillingDestination(
      monitoredResource,
      metrics
    )
    // @@protoc_insertion_point(GeneratedMessageCompanion[google.api.Billing.BillingDestination])
  }
  
  implicit class BillingLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, com.google.api.billing.Billing]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, com.google.api.billing.Billing](_l) {
    def consumerDestinations: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Seq[com.google.api.billing.Billing.BillingDestination]] = field(_.consumerDestinations)((c_, f_) => c_.copy(consumerDestinations = f_))
  }
  final val CONSUMER_DESTINATIONS_FIELD_NUMBER = 8
  def of(
    consumerDestinations: _root_.scala.Seq[com.google.api.billing.Billing.BillingDestination]
  ): _root_.com.google.api.billing.Billing = _root_.com.google.api.billing.Billing(
    consumerDestinations
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[google.api.Billing])
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy