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

protokt.com.google.api.service.kt Maven / Gradle / Ivy

// Generated by protokt version 0.9.0. Do not modify.
// Source: google/api/service.proto
package com.google.api

import com.toasttab.protokt.Api
import com.toasttab.protokt.Enum_
import com.toasttab.protokt.Type
import com.toasttab.protokt.rt.KtDeserializer
import com.toasttab.protokt.rt.KtGeneratedMessage
import com.toasttab.protokt.rt.KtMessage
import com.toasttab.protokt.rt.KtMessageDeserializer
import com.toasttab.protokt.rt.KtMessageSerializer
import com.toasttab.protokt.rt.Tag
import com.toasttab.protokt.rt.UnknownFieldSet
import com.toasttab.protokt.rt.copyList
import com.toasttab.protokt.rt.finishList
import com.toasttab.protokt.rt.sizeof
import kotlin.Any
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.MutableList

/**
 * `Service` is the root object of Google service configuration schema. It describes basic
 * information about a service, such as the name and the 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. See each proto message definition for details. 
 *
 *  Example: 
 *
 *      type: google.api.Service     name: calendar.googleapis.com     title: Google Calendar API   
 *  apis:     - name: google.calendar.v3.Calendar     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
 */
@KtGeneratedMessage("google.api.Service")
@Suppress("DEPRECATION")
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.
     */
    val name: String,
    /**
     * The product title for this service.
     */
    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.
     */
    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. Example: 
     *
     *      types:     - name: google.protobuf.Int32
     */
    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. Example: 
     *
     *      enums:     - name: google.someapi.v1.SomeEnum
     */
    val enums: List,
    /**
     * Additional API documentation.
     */
    val documentation: Documentation?,
    /**
     * API backend configuration.
     */
    val backend: Backend?,
    /**
     * HTTP configuration.
     */
    val http: Http?,
    /**
     * Quota configuration.
     */
    val quota: Quota?,
    /**
     * Auth configuration.
     */
    val authentication: Authentication?,
    /**
     * Context configuration.
     */
    val context: Context?,
    /**
     * Configuration controlling usage of this service.
     */
    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.
     */
    val endpoints: List,
    /**
     * Obsolete. Do not use. 
     *
     *  This field has no semantic meaning. The service config compiler always sets this field to
     * `3`.
     */
    @Deprecated("deprecated in proto")
    val configVersion: Int?,
    /**
     * Configuration for the service control plane.
     */
    val control: Control?,
    /**
     * The Google project that owns this service.
     */
    val producerProjectId: String,
    /**
     * Defines the logs used by this service.
     */
    val logs: List,
    /**
     * Defines the metrics used by this service.
     */
    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.
     */
    val monitoredResources: List,
    /**
     * Billing configuration.
     */
    val billing: Billing?,
    /**
     * Logging configuration.
     */
    val logging: Logging?,
    /**
     * Monitoring configuration.
     */
    val monitoring: Monitoring?,
    /**
     * System parameter configuration.
     */
    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.
     */
    val id: String,
    /**
     * Output only. The source information for this configuration if available.
     */
    val sourceInfo: SourceInfo?,
    val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : KtMessage {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
        var result = 0
        if (name.isNotEmpty()) {
            result += sizeof(Tag(1)) + sizeof(name) 
        }
        if (title.isNotEmpty()) {
            result += sizeof(Tag(2)) + sizeof(title) 
        }
        if (apis.isNotEmpty()) {
            result += (sizeof(Tag(3)) * apis.size) + apis.sumOf { sizeof(it) } 
        }
        if (types.isNotEmpty()) {
            result += (sizeof(Tag(4)) * types.size) + types.sumOf { sizeof(it) } 
        }
        if (enums.isNotEmpty()) {
            result += (sizeof(Tag(5)) * enums.size) + enums.sumOf { sizeof(it) } 
        }
        if (documentation  != null) {
            result += sizeof(Tag(6)) + sizeof(documentation) 
        }
        if (backend  != null) {
            result += sizeof(Tag(8)) + sizeof(backend) 
        }
        if (http  != null) {
            result += sizeof(Tag(9)) + sizeof(http) 
        }
        if (quota  != null) {
            result += sizeof(Tag(10)) + sizeof(quota) 
        }
        if (authentication  != null) {
            result += sizeof(Tag(11)) + sizeof(authentication) 
        }
        if (context  != null) {
            result += sizeof(Tag(12)) + sizeof(context) 
        }
        if (usage  != null) {
            result += sizeof(Tag(15)) + sizeof(usage) 
        }
        if (endpoints.isNotEmpty()) {
            result += (sizeof(Tag(18)) * endpoints.size) + endpoints.sumOf { sizeof(it) } 
        }
        if (configVersion  != null) {
            result += sizeof(Tag(20)) +
                    sizeof(com.toasttab.protokt.UInt32ValueConverter.unwrap(configVersion)) 
        }
        if (control  != null) {
            result += sizeof(Tag(21)) + sizeof(control) 
        }
        if (producerProjectId.isNotEmpty()) {
            result += sizeof(Tag(22)) + sizeof(producerProjectId) 
        }
        if (logs.isNotEmpty()) {
            result += (sizeof(Tag(23)) * logs.size) + logs.sumOf { sizeof(it) } 
        }
        if (metrics.isNotEmpty()) {
            result += (sizeof(Tag(24)) * metrics.size) + metrics.sumOf { sizeof(it) } 
        }
        if (monitoredResources.isNotEmpty()) {
            result += (sizeof(Tag(25)) * monitoredResources.size) + monitoredResources.sumOf {
                    sizeof(it) } 
        }
        if (billing  != null) {
            result += sizeof(Tag(26)) + sizeof(billing) 
        }
        if (logging  != null) {
            result += sizeof(Tag(27)) + sizeof(logging) 
        }
        if (monitoring  != null) {
            result += sizeof(Tag(28)) + sizeof(monitoring) 
        }
        if (systemParameters  != null) {
            result += sizeof(Tag(29)) + sizeof(systemParameters) 
        }
        if (id.isNotEmpty()) {
            result += sizeof(Tag(33)) + sizeof(id) 
        }
        if (sourceInfo  != null) {
            result += sizeof(Tag(37)) + sizeof(sourceInfo) 
        }
        result += unknownFields.size()
        return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
        if (name.isNotEmpty()) {
            serializer.write(Tag(10)).write(name)
        }
        if (title.isNotEmpty()) {
            serializer.write(Tag(18)).write(title)
        }
        if (apis.isNotEmpty()) {
            apis.forEach { serializer.write(Tag(26)).write(it) }
        }
        if (types.isNotEmpty()) {
            types.forEach { serializer.write(Tag(34)).write(it) }
        }
        if (enums.isNotEmpty()) {
            enums.forEach { serializer.write(Tag(42)).write(it) }
        }
        if (documentation  != null) {
            serializer.write(Tag(50)).write(documentation)
        }
        if (backend  != null) {
            serializer.write(Tag(66)).write(backend)
        }
        if (http  != null) {
            serializer.write(Tag(74)).write(http)
        }
        if (quota  != null) {
            serializer.write(Tag(82)).write(quota)
        }
        if (authentication  != null) {
            serializer.write(Tag(90)).write(authentication)
        }
        if (context  != null) {
            serializer.write(Tag(98)).write(context)
        }
        if (usage  != null) {
            serializer.write(Tag(122)).write(usage)
        }
        if (endpoints.isNotEmpty()) {
            endpoints.forEach { serializer.write(Tag(146)).write(it) }
        }
        if (configVersion  != null) {
            serializer.write(Tag(162)).write(com.toasttab.protokt.UInt32ValueConverter.unwrap(configVersion))
        }
        if (control  != null) {
            serializer.write(Tag(170)).write(control)
        }
        if (producerProjectId.isNotEmpty()) {
            serializer.write(Tag(178)).write(producerProjectId)
        }
        if (logs.isNotEmpty()) {
            logs.forEach { serializer.write(Tag(186)).write(it) }
        }
        if (metrics.isNotEmpty()) {
            metrics.forEach { serializer.write(Tag(194)).write(it) }
        }
        if (monitoredResources.isNotEmpty()) {
            monitoredResources.forEach { serializer.write(Tag(202)).write(it) }
        }
        if (billing  != null) {
            serializer.write(Tag(210)).write(billing)
        }
        if (logging  != null) {
            serializer.write(Tag(218)).write(logging)
        }
        if (monitoring  != null) {
            serializer.write(Tag(226)).write(monitoring)
        }
        if (systemParameters  != null) {
            serializer.write(Tag(234)).write(systemParameters)
        }
        if (id.isNotEmpty()) {
            serializer.write(Tag(266)).write(id)
        }
        if (sourceInfo  != null) {
            serializer.write(Tag(298)).write(sourceInfo)
        }
        serializer.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.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()
        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, " +
        "unknownFields=$unknownFields)"

    fun copy(dsl: ServiceDsl.() -> Unit): Service = Service.Deserializer {
        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]
        unknownFields = [email protected]
        dsl()
    }

    class ServiceDsl {
        var name: String = ""

        var title: String = ""

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

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

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

        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: List = emptyList()
            set(newValue) {
                field = copyList(newValue)
            }

        @Deprecated("deprecated in proto")
        var configVersion: Int? = null

        var control: Control? = null

        var producerProjectId: String = ""

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

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

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

        var billing: Billing? = null

        var logging: Logging? = null

        var monitoring: Monitoring? = null

        var systemParameters: SystemParameters? = null

        var id: String = ""

        var sourceInfo: SourceInfo? = null

        var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

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

    companion object Deserializer : KtDeserializer, (ServiceDsl.() -> Unit) ->
            Service {
        override fun deserialize(deserializer: KtMessageDeserializer): 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 : Int? = 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 unknownFields: UnknownFieldSet.Builder? = null
            while (true) {
                when(deserializer.readTag()) {
                    0 -> return Service(name,
                            title,
                            finishList(apis),
                            finishList(types),
                            finishList(enums),
                            documentation,
                            backend,
                            http,
                            quota,
                            authentication,
                            context,
                            usage,
                            finishList(endpoints),
                            configVersion,
                            control,
                            producerProjectId,
                            finishList(logs),
                            finishList(metrics),
                            finishList(monitoredResources),
                            billing,
                            logging,
                            monitoring,
                            systemParameters,
                            id,
                            sourceInfo,
                            UnknownFieldSet.from(unknownFields))
                    10 -> name = deserializer.readString()
                    18 -> title = deserializer.readString()
                    26 -> apis = (apis ?: mutableListOf()).apply {
                                   deserializer.readRepeated(false) {
                                       add(deserializer.readMessage(com.toasttab.protokt.Api))
                                   }
                               }
                    34 -> types = (types ?: mutableListOf()).apply {
                                   deserializer.readRepeated(false) {
                                       add(deserializer.readMessage(com.toasttab.protokt.Type))
                                   }
                               }
                    42 -> enums = (enums ?: mutableListOf()).apply {
                                   deserializer.readRepeated(false) {
                                       add(deserializer.readMessage(com.toasttab.protokt.Enum_))
                                   }
                               }
                    50 -> documentation = deserializer.readMessage(com.google.api.Documentation)
                    66 -> backend = deserializer.readMessage(com.google.api.Backend)
                    74 -> http = deserializer.readMessage(com.google.api.Http)
                    82 -> quota = deserializer.readMessage(com.google.api.Quota)
                    90 -> authentication = deserializer.readMessage(com.google.api.Authentication)
                    98 -> context = deserializer.readMessage(com.google.api.Context)
                    122 -> usage = deserializer.readMessage(com.google.api.Usage)
                    146 -> endpoints = (endpoints ?: mutableListOf()).apply {
                                   deserializer.readRepeated(false) {
                                       add(deserializer.readMessage(com.google.api.Endpoint))
                                   }
                               }
                    162 -> configVersion =
                            com.toasttab.protokt.UInt32ValueConverter.wrap(deserializer.readMessage(com.toasttab.protokt.UInt32Value))
                    170 -> control = deserializer.readMessage(com.google.api.Control)
                    178 -> producerProjectId = deserializer.readString()
                    186 -> logs = (logs ?: mutableListOf()).apply {
                                   deserializer.readRepeated(false) {
                                       add(deserializer.readMessage(com.google.api.LogDescriptor))
                                   }
                               }
                    194 -> metrics = (metrics ?: mutableListOf()).apply {
                                   deserializer.readRepeated(false) {
                                      
                                    add(deserializer.readMessage(com.google.api.MetricDescriptor))
                                   }
                               }
                    202 -> monitoredResources = (monitoredResources ?: mutableListOf()).apply {
                                   deserializer.readRepeated(false) {
                                      
                                    add(deserializer.readMessage(com.google.api.MonitoredResourceDescriptor))
                                   }
                               }
                    210 -> billing = deserializer.readMessage(com.google.api.Billing)
                    218 -> logging = deserializer.readMessage(com.google.api.Logging)
                    226 -> monitoring = deserializer.readMessage(com.google.api.Monitoring)
                    234 -> systemParameters =
                            deserializer.readMessage(com.google.api.SystemParameters)
                    266 -> id = deserializer.readString()
                    298 -> sourceInfo = deserializer.readMessage(com.google.api.SourceInfo)
                    else -> unknownFields = (unknownFields ?:
                            UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
                }
            }
        }

        override fun invoke(dsl: ServiceDsl.() -> Unit): Service =
                ServiceDsl().apply(dsl).build()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy