commonMain.protokt.v1.google.api.log.kt Maven / Gradle / Ivy
// Generated by protokt version 1.0.0-alpha.8. Do not modify.
// Source: google/api/log.proto
@file:Suppress("DEPRECATION")
package protokt.v1.google.api
import protokt.v1.AbstractKtDeserializer
import protokt.v1.AbstractKtMessage
import protokt.v1.Collections.copyList
import protokt.v1.Collections.unmodifiableList
import protokt.v1.KtBuilderDsl
import protokt.v1.KtMessageDeserializer
import protokt.v1.KtMessageSerializer
import protokt.v1.SizeCodecs.sizeOf
import protokt.v1.UnknownFieldSet
import kotlin.Any
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.MutableList
import kotlin.jvm.JvmStatic
import com.toasttab.protokt.rt.KtGeneratedMessage as RtKtGeneratedMessage
import protokt.v1.KtGeneratedMessage as V1KtGeneratedMessage
/**
* A description of a log type. Example in YAML format:
*
* - name: library.googleapis.com/activity_history description: The history of borrowing
* and returning library items. display_name: Activity labels: - key: /customer_id
* description: Identifier of a library customer
*/
@V1KtGeneratedMessage("google.api.LogDescriptor")
@RtKtGeneratedMessage("google.api.LogDescriptor")
public class LogDescriptor private constructor(
/**
* The name of the log. It must be less than 512 characters long and can include the following
* characters: upper- and lower-case alphanumeric characters [A-Za-z0-9], and punctuation characters
* including slash, underscore, hyphen, period [/_-.].
*/
public val name: String,
/**
* The set of labels that are available to describe a specific log entry. Runtime requests that
* contain labels not specified here are considered invalid.
*/
public val labels: List,
/**
* A human-readable description of this log. This information appears in the documentation and can
* contain details.
*/
public val description: String,
/**
* The human-readable name for this log. This information appears on the user interface and should
* be concise.
*/
public val displayName: String,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (name.isNotEmpty()) {
result += sizeOf(10u) + sizeOf(name)
}
if (labels.isNotEmpty()) {
result += (sizeOf(18u) * labels.size) + labels.sumOf { sizeOf(it) }
}
if (description.isNotEmpty()) {
result += sizeOf(26u) + sizeOf(description)
}
if (displayName.isNotEmpty()) {
result += sizeOf(34u) + sizeOf(displayName)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (name.isNotEmpty()) {
serializer.writeTag(10u).write(name)
}
labels.forEach { serializer.writeTag(18u).write(it) }
if (description.isNotEmpty()) {
serializer.writeTag(26u).write(description)
}
if (displayName.isNotEmpty()) {
serializer.writeTag(34u).write(displayName)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: Any?): Boolean =
other is LogDescriptor &&
other.name == name &&
other.labels == labels &&
other.description == description &&
other.displayName == displayName &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + name.hashCode()
result = 31 * result + labels.hashCode()
result = 31 * result + description.hashCode()
result = 31 * result + displayName.hashCode()
return result
}
override fun toString(): String =
"LogDescriptor(" +
"name=$name, " +
"labels=$labels, " +
"description=$description, " +
"displayName=$displayName" +
if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"
public fun copy(builder: Builder.() -> Unit): LogDescriptor =
Builder().apply {
name = [email protected]
labels = [email protected]
description = [email protected]
displayName = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var name: String = ""
public var labels: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
public var description: String = ""
public var displayName: String = ""
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): LogDescriptor =
LogDescriptor(
name,
unmodifiableList(labels),
description,
displayName,
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
override fun deserialize(deserializer: KtMessageDeserializer): LogDescriptor {
var name = ""
var labels: MutableList? = null
var description = ""
var displayName = ""
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (deserializer.readTag()) {
0 -> return LogDescriptor(
name,
unmodifiableList(labels),
description,
displayName,
UnknownFieldSet.from(unknownFields)
)
10 -> name = deserializer.readString()
18 ->
labels =
(labels ?: mutableListOf()).apply {
deserializer.readRepeated(false) {
add(deserializer.readMessage(LabelDescriptor))
}
}
26 -> description = deserializer.readString()
34 -> displayName = deserializer.readString()
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): LogDescriptor = Builder().apply(dsl).build()
}
}