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

commonMain.protokt.v1.google.api.service.kt Maven / Gradle / Ivy

// Generated by protokt version 1.0.0-beta.2. Do not modify.
// Source: google/api/service.proto
@file:Suppress("DEPRECATION")

package protokt.v1.google.api

import protokt.v1.AbstractDeserializer
import protokt.v1.AbstractMessage
import protokt.v1.BuilderDsl
import protokt.v1.Collections.copyList
import protokt.v1.Collections.unmodifiableList
import protokt.v1.GeneratedMessage
import protokt.v1.GeneratedProperty
import protokt.v1.Reader
import protokt.v1.SizeCodecs.sizeOf
import protokt.v1.UnknownFieldSet
import protokt.v1.Writer
import protokt.v1.google.protobuf.Api
import protokt.v1.google.protobuf.Enum
import protokt.v1.google.protobuf.Type
import protokt.v1.google.protobuf.UInt32Value
import protokt.v1.google.protobuf.UInt32ValueConverter
import kotlin.Any
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.UInt
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.MutableList
import kotlin.jvm.JvmStatic

/**
 * `Service` is the root object of Google API service configuration (service config). It describes
 * the basic information about a logical service, such as the service name and the user-facing title,
 * and delegates other aspects to sub-sections. Each sub-section is either a proto message or a
 * repeated proto message that configures a specific aspect, such as auth. For more information, see
 * each proto message definition.
 *
 *  Example:
 *
 *      type: google.api.Service     name: calendar.googleapis.com     title: Google Calendar API
 *  apis:     - name: google.calendar.v3.Calendar
 *
 *      visibility:       rules:       - selector: "google.calendar.v3.*"         restriction:
 * PREVIEW     backend:       rules:       - selector: "google.calendar.v3.*"         address:
 * calendar.example.com
 *
 *      authentication:       providers:       - id: google_calendar_auth         jwks_uri:
 * https://www.googleapis.com/oauth2/v1/certs         issuer: https://securetoken.google.com
 * rules:       - selector: "*"         requirements:           provider_id: google_calendar_auth
 */
@GeneratedMessage("google.api.Service")
public class Service private constructor(
  /**
   * The service name, which is a DNS-like logical identifier for the service, such as
   * `calendar.googleapis.com`. The service name typically goes through DNS verification to make sure
   * the owner of the service also owns the DNS name.
   */
  @GeneratedProperty(1)
  public val name: String,
  /**
   * The product title for this service, it is the name displayed in Google Cloud Console.
   */
  @GeneratedProperty(2)
  public val title: String,
  /**
   * A list of API interfaces exported by this service. Only the `name` field of the
   * [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration author, as
   * the remaining fields will be derived from the IDL during the normalization process. It is an error
   * to specify an API interface here which cannot be resolved against the associated IDL files.
   */
  @GeneratedProperty(3)
  public val apis: List,
  /**
   * A list of all proto message types included in this API service. Types referenced directly or
   * indirectly by the `apis` are automatically included.  Messages which are not referenced but shall
   * be included, such as types used by the `google.protobuf.Any` type, should be listed here by name
   * by the configuration author. Example:
   *
   *      types:     - name: google.protobuf.Int32
   */
  @GeneratedProperty(4)
  public val types: List,
  /**
   * A list of all enum types included in this API service.  Enums referenced directly or indirectly
   * by the `apis` are automatically included.  Enums which are not referenced but shall be included
   * should be listed here by name by the configuration author. Example:
   *
   *      enums:     - name: google.someapi.v1.SomeEnum
   */
  @GeneratedProperty(5)
  public val enums: List,
  /**
   * Additional API documentation.
   */
  @GeneratedProperty(6)
  public val documentation: Documentation?,
  /**
   * API backend configuration.
   */
  @GeneratedProperty(8)
  public val backend: Backend?,
  /**
   * HTTP configuration.
   */
  @GeneratedProperty(9)
  public val http: Http?,
  /**
   * Quota configuration.
   */
  @GeneratedProperty(10)
  public val quota: Quota?,
  /**
   * Auth configuration.
   */
  @GeneratedProperty(11)
  public val authentication: Authentication?,
  /**
   * Context configuration.
   */
  @GeneratedProperty(12)
  public val context: Context?,
  /**
   * Configuration controlling usage of this service.
   */
  @GeneratedProperty(15)
  public val usage: Usage?,
  /**
   * Configuration for network endpoints.  If this is empty, then an endpoint with the same name as
   * the service is automatically generated to service all defined APIs.
   */
  @GeneratedProperty(18)
  public val endpoints: List,
  /**
   * Obsolete. Do not use.
   *
   *  This field has no semantic meaning. The service config compiler always sets this field to `3`.
   */
  @GeneratedProperty(20)
  public val configVersion: UInt?,
  /**
   * Configuration for the service control plane.
   */
  @GeneratedProperty(21)
  public val control: Control?,
  /**
   * The Google project that owns this service.
   */
  @GeneratedProperty(22)
  public val producerProjectId: String,
  /**
   * Defines the logs used by this service.
   */
  @GeneratedProperty(23)
  public val logs: List,
  /**
   * Defines the metrics used by this service.
   */
  @GeneratedProperty(24)
  public val metrics: List,
  /**
   * Defines the monitored resources used by this service. This is required by the
   * [Service.monitoring][google.api.Service.monitoring] and
   * [Service.logging][google.api.Service.logging] configurations.
   */
  @GeneratedProperty(25)
  public val monitoredResources: List,
  /**
   * Billing configuration.
   */
  @GeneratedProperty(26)
  public val billing: Billing?,
  /**
   * Logging configuration.
   */
  @GeneratedProperty(27)
  public val logging: Logging?,
  /**
   * Monitoring configuration.
   */
  @GeneratedProperty(28)
  public val monitoring: Monitoring?,
  /**
   * System parameter configuration.
   */
  @GeneratedProperty(29)
  public val systemParameters: SystemParameters?,
  /**
   * A unique ID for a specific instance of this message, typically assigned by the client for
   * tracking purpose. Must be no longer than 63 characters and only lower case letters, digits, '.',
   * '_' and '-' are allowed. If empty, the server may choose to generate one instead.
   */
  @GeneratedProperty(33)
  public val id: String,
  /**
   * Output only. The source information for this configuration if available.
   */
  @GeneratedProperty(37)
  public val sourceInfo: SourceInfo?,
  /**
   * Settings for [Google Cloud Client
   * libraries](https://cloud.google.com/apis/docs/cloud-client-libraries) generated from APIs defined
   * as protocol buffers.
   */
  @GeneratedProperty(45)
  public val publishing: Publishing?,
  public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractMessage() {
  private val `$messageSize`: Int by lazy {
    var result = 0
    if (name.isNotEmpty()) {
      result += sizeOf(10u) + sizeOf(name)
    }
    if (title.isNotEmpty()) {
      result += sizeOf(18u) + sizeOf(title)
    }
    if (apis.isNotEmpty()) {
      result += (sizeOf(26u) * apis.size) + apis.sumOf { sizeOf(it) }
    }
    if (types.isNotEmpty()) {
      result += (sizeOf(34u) * types.size) + types.sumOf { sizeOf(it) }
    }
    if (enums.isNotEmpty()) {
      result += (sizeOf(42u) * enums.size) + enums.sumOf { sizeOf(it) }
    }
    if (documentation != null) {
      result += sizeOf(50u) + sizeOf(documentation)
    }
    if (backend != null) {
      result += sizeOf(66u) + sizeOf(backend)
    }
    if (http != null) {
      result += sizeOf(74u) + sizeOf(http)
    }
    if (quota != null) {
      result += sizeOf(82u) + sizeOf(quota)
    }
    if (authentication != null) {
      result += sizeOf(90u) + sizeOf(authentication)
    }
    if (context != null) {
      result += sizeOf(98u) + sizeOf(context)
    }
    if (usage != null) {
      result += sizeOf(122u) + sizeOf(usage)
    }
    if (endpoints.isNotEmpty()) {
      result += (sizeOf(146u) * endpoints.size) + endpoints.sumOf { sizeOf(it) }
    }
    if (configVersion != null) {
      result += sizeOf(162u) + sizeOf(UInt32ValueConverter.unwrap(configVersion))
    }
    if (control != null) {
      result += sizeOf(170u) + sizeOf(control)
    }
    if (producerProjectId.isNotEmpty()) {
      result += sizeOf(178u) + sizeOf(producerProjectId)
    }
    if (logs.isNotEmpty()) {
      result += (sizeOf(186u) * logs.size) + logs.sumOf { sizeOf(it) }
    }
    if (metrics.isNotEmpty()) {
      result += (sizeOf(194u) * metrics.size) + metrics.sumOf { sizeOf(it) }
    }
    if (monitoredResources.isNotEmpty()) {
      result += (sizeOf(202u) * monitoredResources.size) + monitoredResources.sumOf { sizeOf(it) }
    }
    if (billing != null) {
      result += sizeOf(210u) + sizeOf(billing)
    }
    if (logging != null) {
      result += sizeOf(218u) + sizeOf(logging)
    }
    if (monitoring != null) {
      result += sizeOf(226u) + sizeOf(monitoring)
    }
    if (systemParameters != null) {
      result += sizeOf(234u) + sizeOf(systemParameters)
    }
    if (id.isNotEmpty()) {
      result += sizeOf(266u) + sizeOf(id)
    }
    if (sourceInfo != null) {
      result += sizeOf(298u) + sizeOf(sourceInfo)
    }
    if (publishing != null) {
      result += sizeOf(362u) + sizeOf(publishing)
    }
    result += unknownFields.size()
    result
  }

  override fun messageSize(): Int = `$messageSize`

  override fun serialize(writer: Writer) {
    if (name.isNotEmpty()) {
      writer.writeTag(10u).write(name)
    }
    if (title.isNotEmpty()) {
      writer.writeTag(18u).write(title)
    }
    apis.forEach { writer.writeTag(26u).write(it) }
    types.forEach { writer.writeTag(34u).write(it) }
    enums.forEach { writer.writeTag(42u).write(it) }
    if (documentation != null) {
      writer.writeTag(50u).write(documentation)
    }
    if (backend != null) {
      writer.writeTag(66u).write(backend)
    }
    if (http != null) {
      writer.writeTag(74u).write(http)
    }
    if (quota != null) {
      writer.writeTag(82u).write(quota)
    }
    if (authentication != null) {
      writer.writeTag(90u).write(authentication)
    }
    if (context != null) {
      writer.writeTag(98u).write(context)
    }
    if (usage != null) {
      writer.writeTag(122u).write(usage)
    }
    endpoints.forEach { writer.writeTag(146u).write(it) }
    if (configVersion != null) {
      writer.writeTag(162u).write(UInt32ValueConverter.unwrap(configVersion))
    }
    if (control != null) {
      writer.writeTag(170u).write(control)
    }
    if (producerProjectId.isNotEmpty()) {
      writer.writeTag(178u).write(producerProjectId)
    }
    logs.forEach { writer.writeTag(186u).write(it) }
    metrics.forEach { writer.writeTag(194u).write(it) }
    monitoredResources.forEach { writer.writeTag(202u).write(it) }
    if (billing != null) {
      writer.writeTag(210u).write(billing)
    }
    if (logging != null) {
      writer.writeTag(218u).write(logging)
    }
    if (monitoring != null) {
      writer.writeTag(226u).write(monitoring)
    }
    if (systemParameters != null) {
      writer.writeTag(234u).write(systemParameters)
    }
    if (id.isNotEmpty()) {
      writer.writeTag(266u).write(id)
    }
    if (sourceInfo != null) {
      writer.writeTag(298u).write(sourceInfo)
    }
    if (publishing != null) {
      writer.writeTag(362u).write(publishing)
    }
    writer.writeUnknown(unknownFields)
  }

  override fun equals(other: Any?): Boolean =
    other is Service &&
      other.name == name &&
      other.title == title &&
      other.apis == apis &&
      other.types == types &&
      other.enums == enums &&
      other.documentation == documentation &&
      other.backend == backend &&
      other.http == http &&
      other.quota == quota &&
      other.authentication == authentication &&
      other.context == context &&
      other.usage == usage &&
      other.endpoints == endpoints &&
      other.configVersion == configVersion &&
      other.control == control &&
      other.producerProjectId == producerProjectId &&
      other.logs == logs &&
      other.metrics == metrics &&
      other.monitoredResources == monitoredResources &&
      other.billing == billing &&
      other.logging == logging &&
      other.monitoring == monitoring &&
      other.systemParameters == systemParameters &&
      other.id == id &&
      other.sourceInfo == sourceInfo &&
      other.publishing == publishing &&
      other.unknownFields == unknownFields

  override fun hashCode(): Int {
    var result = unknownFields.hashCode()
    result = 31 * result + name.hashCode()
    result = 31 * result + title.hashCode()
    result = 31 * result + apis.hashCode()
    result = 31 * result + types.hashCode()
    result = 31 * result + enums.hashCode()
    result = 31 * result + documentation.hashCode()
    result = 31 * result + backend.hashCode()
    result = 31 * result + http.hashCode()
    result = 31 * result + quota.hashCode()
    result = 31 * result + authentication.hashCode()
    result = 31 * result + context.hashCode()
    result = 31 * result + usage.hashCode()
    result = 31 * result + endpoints.hashCode()
    result = 31 * result + configVersion.hashCode()
    result = 31 * result + control.hashCode()
    result = 31 * result + producerProjectId.hashCode()
    result = 31 * result + logs.hashCode()
    result = 31 * result + metrics.hashCode()
    result = 31 * result + monitoredResources.hashCode()
    result = 31 * result + billing.hashCode()
    result = 31 * result + logging.hashCode()
    result = 31 * result + monitoring.hashCode()
    result = 31 * result + systemParameters.hashCode()
    result = 31 * result + id.hashCode()
    result = 31 * result + sourceInfo.hashCode()
    result = 31 * result + publishing.hashCode()
    return result
  }

  override fun toString(): String =
    "Service(" +
      "name=$name, " +
      "title=$title, " +
      "apis=$apis, " +
      "types=$types, " +
      "enums=$enums, " +
      "documentation=$documentation, " +
      "backend=$backend, " +
      "http=$http, " +
      "quota=$quota, " +
      "authentication=$authentication, " +
      "context=$context, " +
      "usage=$usage, " +
      "endpoints=$endpoints, " +
      "configVersion=$configVersion, " +
      "control=$control, " +
      "producerProjectId=$producerProjectId, " +
      "logs=$logs, " +
      "metrics=$metrics, " +
      "monitoredResources=$monitoredResources, " +
      "billing=$billing, " +
      "logging=$logging, " +
      "monitoring=$monitoring, " +
      "systemParameters=$systemParameters, " +
      "id=$id, " +
      "sourceInfo=$sourceInfo, " +
      "publishing=$publishing" +
      if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"

  public fun copy(builder: Builder.() -> Unit): Service =
    Builder().apply {
      name = [email protected]
      title = [email protected]
      apis = [email protected]
      types = [email protected]
      enums = [email protected]
      documentation = [email protected]
      backend = [email protected]
      http = [email protected]
      quota = [email protected]
      authentication = [email protected]
      context = [email protected]
      usage = [email protected]
      endpoints = [email protected]
      configVersion = [email protected]
      control = [email protected]
      producerProjectId = [email protected]
      logs = [email protected]
      metrics = [email protected]
      monitoredResources = [email protected]
      billing = [email protected]
      logging = [email protected]
      monitoring = [email protected]
      systemParameters = [email protected]
      id = [email protected]
      sourceInfo = [email protected]
      publishing = [email protected]
      unknownFields = [email protected]
      builder()
    }.build()

  @BuilderDsl
  public class Builder {
    public var name: String = ""

    public var title: String = ""

    public var apis: List = emptyList()
      set(newValue) {
        field = copyList(newValue)
      }

    public var types: List = emptyList()
      set(newValue) {
        field = copyList(newValue)
      }

    public var enums: List = emptyList()
      set(newValue) {
        field = copyList(newValue)
      }

    public var documentation: Documentation? = null

    public var backend: Backend? = null

    public var http: Http? = null

    public var quota: Quota? = null

    public var authentication: Authentication? = null

    public var context: Context? = null

    public var usage: Usage? = null

    public var endpoints: List = emptyList()
      set(newValue) {
        field = copyList(newValue)
      }

    public var configVersion: UInt? = null

    public var control: Control? = null

    public var producerProjectId: String = ""

    public var logs: List = emptyList()
      set(newValue) {
        field = copyList(newValue)
      }

    public var metrics: List = emptyList()
      set(newValue) {
        field = copyList(newValue)
      }

    public var monitoredResources: List = emptyList()
      set(newValue) {
        field = copyList(newValue)
      }

    public var billing: Billing? = null

    public var logging: Logging? = null

    public var monitoring: Monitoring? = null

    public var systemParameters: SystemParameters? = null

    public var id: String = ""

    public var sourceInfo: SourceInfo? = null

    public var publishing: Publishing? = null

    public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

    public fun build(): Service =
      Service(
        name,
        title,
        unmodifiableList(apis),
        unmodifiableList(types),
        unmodifiableList(enums),
        documentation,
        backend,
        http,
        quota,
        authentication,
        context,
        usage,
        unmodifiableList(endpoints),
        configVersion,
        control,
        producerProjectId,
        unmodifiableList(logs),
        unmodifiableList(metrics),
        unmodifiableList(monitoredResources),
        billing,
        logging,
        monitoring,
        systemParameters,
        id,
        sourceInfo,
        publishing,
        unknownFields
      )
  }

  public companion object Deserializer : AbstractDeserializer() {
    @JvmStatic
    override fun deserialize(reader: Reader): Service {
      var name = ""
      var title = ""
      var apis: MutableList? = null
      var types: MutableList? = null
      var enums: MutableList? = null
      var documentation: Documentation? = null
      var backend: Backend? = null
      var http: Http? = null
      var quota: Quota? = null
      var authentication: Authentication? = null
      var context: Context? = null
      var usage: Usage? = null
      var endpoints: MutableList? = null
      var configVersion: UInt? = null
      var control: Control? = null
      var producerProjectId = ""
      var logs: MutableList? = null
      var metrics: MutableList? = null
      var monitoredResources: MutableList? = null
      var billing: Billing? = null
      var logging: Logging? = null
      var monitoring: Monitoring? = null
      var systemParameters: SystemParameters? = null
      var id = ""
      var sourceInfo: SourceInfo? = null
      var publishing: Publishing? = null
      var unknownFields: UnknownFieldSet.Builder? = null

      while (true) {
        when (reader.readTag()) {
          0u -> return Service(
            name,
            title,
            unmodifiableList(apis),
            unmodifiableList(types),
            unmodifiableList(enums),
            documentation,
            backend,
            http,
            quota,
            authentication,
            context,
            usage,
            unmodifiableList(endpoints),
            configVersion,
            control,
            producerProjectId,
            unmodifiableList(logs),
            unmodifiableList(metrics),
            unmodifiableList(monitoredResources),
            billing,
            logging,
            monitoring,
            systemParameters,
            id,
            sourceInfo,
            publishing,
            UnknownFieldSet.from(unknownFields)
          )
          10u -> name = reader.readString()
          18u -> title = reader.readString()
          26u ->
            apis =
              (apis ?: mutableListOf()).apply {
                reader.readRepeated(false) {
                  add(reader.readMessage(Api))
                }
              }
          34u ->
            types =
              (types ?: mutableListOf()).apply {
                reader.readRepeated(false) {
                  add(reader.readMessage(Type))
                }
              }
          42u ->
            enums =
              (enums ?: mutableListOf()).apply {
                reader.readRepeated(false) {
                  add(reader.readMessage(Enum))
                }
              }
          50u -> documentation = reader.readMessage(Documentation)
          66u -> backend = reader.readMessage(Backend)
          74u -> http = reader.readMessage(Http)
          82u -> quota = reader.readMessage(Quota)
          90u -> authentication = reader.readMessage(Authentication)
          98u -> context = reader.readMessage(Context)
          122u -> usage = reader.readMessage(Usage)
          146u ->
            endpoints =
              (endpoints ?: mutableListOf()).apply {
                reader.readRepeated(false) {
                  add(reader.readMessage(Endpoint))
                }
              }
          162u -> configVersion = UInt32ValueConverter.wrap(reader.readMessage(UInt32Value))
          170u -> control = reader.readMessage(Control)
          178u -> producerProjectId = reader.readString()
          186u ->
            logs =
              (logs ?: mutableListOf()).apply {
                reader.readRepeated(false) {
                  add(reader.readMessage(LogDescriptor))
                }
              }
          194u ->
            metrics =
              (metrics ?: mutableListOf()).apply {
                reader.readRepeated(false) {
                  add(reader.readMessage(MetricDescriptor))
                }
              }
          202u ->
            monitoredResources =
              (monitoredResources ?: mutableListOf()).apply {
                reader.readRepeated(false) {
                  add(reader.readMessage(MonitoredResourceDescriptor))
                }
              }
          210u -> billing = reader.readMessage(Billing)
          218u -> logging = reader.readMessage(Logging)
          226u -> monitoring = reader.readMessage(Monitoring)
          234u -> systemParameters = reader.readMessage(SystemParameters)
          266u -> id = reader.readString()
          298u -> sourceInfo = reader.readMessage(SourceInfo)
          362u -> publishing = reader.readMessage(Publishing)
          else ->
            unknownFields =
              (unknownFields ?: UnknownFieldSet.Builder()).also {
                it.add(reader.readUnknown())
              }
        }
      }
    }

    @JvmStatic
    public operator fun invoke(dsl: Builder.() -> Unit): Service = Builder().apply(dsl).build()
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy