
commonMain.protokt.v1.google.api.endpoint.kt Maven / Gradle / Ivy
// Generated by protokt version 1.0.0-beta.2. Do not modify.
// Source: google/api/endpoint.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 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
import kotlin.jvm.JvmStatic
/**
* `Endpoint` describes a network address of a service that serves a set of APIs. It is commonly
* known as a service endpoint. A service may expose any number of service endpoints, and all service
* endpoints share the same service definition, such as quota limits and monitoring metrics.
*
* Example:
*
* type: google.api.Service name: library-example.googleapis.com endpoints: #
* Declares network address `https://library-example.googleapis.com` # for service
* `library-example.googleapis.com`. The `https` scheme # is implicit for all service endpoints.
* Other schemes may be # supported in the future. - name: library-example.googleapis.com
* allow_cors: false - name: content-staging-library-example.googleapis.com # Allows HTTP
* OPTIONS calls to be passed to the API frontend, for it # to decide whether the subsequent
* cross-origin request is allowed # to proceed. allow_cors: true
*/
@GeneratedMessage("google.api.Endpoint")
public class Endpoint private constructor(
/**
* The canonical name of this endpoint.
*/
@GeneratedProperty(1)
public val name: String,
/**
* Unimplemented. Dot not use.
*
* DEPRECATED: This field is no longer supported. Instead of using aliases, please specify
* multiple [google.api.Endpoint][google.api.Endpoint] for each of the intended aliases.
*
* Additional names that this endpoint will be hosted on.
*/
@GeneratedProperty(2)
@Deprecated("deprecated in proto")
public val aliases: List,
/**
* Allowing [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka cross-domain
* traffic, would allow the backends served from this endpoint to receive and respond to HTTP OPTIONS
* requests. The response will be used by the browser to determine whether the subsequent
* cross-origin request is allowed to proceed.
*/
@GeneratedProperty(5)
public val allowCors: Boolean,
/**
* The specification of an Internet routable address of API frontend that will handle requests to
* this [API Endpoint](https://cloud.google.com/apis/design/glossary). It should be either a valid
* IPv4 address or a fully-qualified domain name. For example, "8.8.8.8" or "myservice.appspot.com".
*/
@GeneratedProperty(101)
public val target: String,
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 (aliases.isNotEmpty()) {
result += (sizeOf(18u) * aliases.size) + aliases.sumOf { sizeOf(it) }
}
if (allowCors) {
result += sizeOf(40u) + 1
}
if (target.isNotEmpty()) {
result += sizeOf(810u) + sizeOf(target)
}
result += unknownFields.size()
result
}
override fun messageSize(): Int = `$messageSize`
override fun serialize(writer: Writer) {
if (name.isNotEmpty()) {
writer.writeTag(10u).write(name)
}
aliases.forEach { writer.writeTag(18u).write(it) }
if (allowCors) {
writer.writeTag(40u).write(allowCors)
}
if (target.isNotEmpty()) {
writer.writeTag(810u).write(target)
}
writer.writeUnknown(unknownFields)
}
override fun equals(other: Any?): Boolean =
other is Endpoint &&
other.name == name &&
other.aliases == aliases &&
other.allowCors == allowCors &&
other.target == target &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + name.hashCode()
result = 31 * result + aliases.hashCode()
result = 31 * result + allowCors.hashCode()
result = 31 * result + target.hashCode()
return result
}
override fun toString(): String =
"Endpoint(" +
"name=$name, " +
"aliases=$aliases, " +
"allowCors=$allowCors, " +
"target=$target" +
if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"
public fun copy(builder: Builder.() -> Unit): Endpoint =
Builder().apply {
name = [email protected]
aliases = [email protected]
allowCors = [email protected]
target = [email protected]
unknownFields = [email protected]
builder()
}.build()
@BuilderDsl
public class Builder {
public var name: String = ""
@Deprecated("deprecated in proto")
public var aliases: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
public var allowCors: Boolean = false
public var target: String = ""
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): Endpoint =
Endpoint(
name,
unmodifiableList(aliases),
allowCors,
target,
unknownFields
)
}
public companion object Deserializer : AbstractDeserializer() {
@JvmStatic
override fun deserialize(reader: Reader): Endpoint {
var name = ""
var aliases: MutableList? = null
var allowCors = false
var target = ""
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (reader.readTag()) {
0u -> return Endpoint(
name,
unmodifiableList(aliases),
allowCors,
target,
UnknownFieldSet.from(unknownFields)
)
10u -> name = reader.readString()
18u ->
aliases =
(aliases ?: mutableListOf()).apply {
reader.readRepeated(false) {
add(reader.readString())
}
}
40u -> allowCors = reader.readBool()
810u -> target = reader.readString()
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(reader.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): Endpoint = Builder().apply(dsl).build()
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy