protokt.com.google.api.monitored_resource.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of proto-google-common-protos-lite Show documentation
Show all versions of proto-google-common-protos-lite Show documentation
Protobuf compiler and runtime for Kotlin
// Generated by protokt version 0.12.0. Do not modify.
// Source: google/api/monitored_resource.proto
package com.google.api
import com.toasttab.protokt.Struct
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.copyMap
import com.toasttab.protokt.rt.finishList
import com.toasttab.protokt.rt.finishMap
import com.toasttab.protokt.rt.sizeof
import com.toasttab.protokt.rt.sizeofMap
import kotlin.Any
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.collections.MutableList
import kotlin.collections.MutableMap
/**
* An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object
* using a type name and a set of labels. For example, the monitored resource descriptor for Google
* Compute Engine VM instances has a type of `"gce_instance"` and specifies the use of the labels
* `"instance_id"` and `"zone"` to identify particular VM instances.
*
* Different APIs can support different monitored resource types. APIs generally provide a `list`
* method that returns the monitored resource descriptors used by the API.
*/
@KtGeneratedMessage("google.api.MonitoredResourceDescriptor")
class MonitoredResourceDescriptor private constructor(
/**
* Required. The monitored resource type. For example, the type `"cloudsql_database"` represents
* databases in Google Cloud SQL.
*/
val type: String,
/**
* Optional. A concise name for the monitored resource type that might be displayed in user
* interfaces. It should be a Title Cased Noun Phrase, without any article or other determiners.
* For example, `"Google Cloud SQL Database"`.
*/
val displayName: String,
/**
* Optional. A detailed description of the monitored resource type that might be used in
* documentation.
*/
val description: String,
/**
* Required. A set of labels used to describe instances of this monitored resource type. For
* example, an individual Google Cloud SQL database is identified by values for the labels
* `"database_id"` and `"zone"`.
*/
val labels: List,
/**
* Optional. The resource name of the monitored resource descriptor:
* `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where {type} is the value of the
* `type` field in this object and {project_id} is a project ID that provides API-specific context
* for accessing the type. APIs that do not use project information can use the resource name
* format `"monitoredResourceDescriptors/{type}"`.
*/
val name: String,
/**
* Optional. The launch stage of the monitored resource definition.
*/
val launchStage: LaunchStage,
val unknownFields: UnknownFieldSet = UnknownFieldSet.empty(),
) : KtMessage {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (type.isNotEmpty()) {
result += sizeof(Tag(1)) + sizeof(type)
}
if (displayName.isNotEmpty()) {
result += sizeof(Tag(2)) + sizeof(displayName)
}
if (description.isNotEmpty()) {
result += sizeof(Tag(3)) + sizeof(description)
}
if (labels.isNotEmpty()) {
result += (sizeof(Tag(4)) * labels.size) + labels.sumOf { sizeof(it) }
}
if (name.isNotEmpty()) {
result += sizeof(Tag(5)) + sizeof(name)
}
if (launchStage.value != 0) {
result += sizeof(Tag(7)) + sizeof(launchStage)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (type.isNotEmpty()) {
serializer.write(Tag(10)).write(type)
}
if (displayName.isNotEmpty()) {
serializer.write(Tag(18)).write(displayName)
}
if (description.isNotEmpty()) {
serializer.write(Tag(26)).write(description)
}
if (labels.isNotEmpty()) {
labels.forEach { serializer.write(Tag(34)).write(it) }
}
if (name.isNotEmpty()) {
serializer.write(Tag(42)).write(name)
}
if (launchStage.value != 0) {
serializer.write(Tag(56)).write(launchStage)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: Any?): Boolean = other is MonitoredResourceDescriptor &&
other.type == type &&
other.displayName == displayName &&
other.description == description &&
other.labels == labels &&
other.name == name &&
other.launchStage == launchStage &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + type.hashCode()
result = 31 * result + displayName.hashCode()
result = 31 * result + description.hashCode()
result = 31 * result + labels.hashCode()
result = 31 * result + name.hashCode()
result = 31 * result + launchStage.hashCode()
return result
}
override fun toString(): String = "MonitoredResourceDescriptor(" +
"type=$type, " +
"displayName=$displayName, " +
"description=$description, " +
"labels=$labels, " +
"name=$name, " +
"launchStage=$launchStage" +
"${if (unknownFields.isEmpty()) "" else ", unknownFields=$unknownFields"})"
fun copy(dsl: MonitoredResourceDescriptorDsl.() -> Unit): MonitoredResourceDescriptor =
MonitoredResourceDescriptor.Deserializer {
type = [email protected]
displayName = [email protected]
description = [email protected]
labels = [email protected]
name = [email protected]
launchStage = [email protected]
unknownFields = [email protected]
dsl()
}
class MonitoredResourceDescriptorDsl {
var type: String = ""
var displayName: String = ""
var description: String = ""
var labels: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
var name: String = ""
var launchStage: LaunchStage = LaunchStage.from(0)
var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
fun build(): MonitoredResourceDescriptor = MonitoredResourceDescriptor(type,
displayName,
description,
finishList(labels),
name,
launchStage,
unknownFields)
}
companion object Deserializer : KtDeserializer,
(MonitoredResourceDescriptorDsl.() -> Unit) -> MonitoredResourceDescriptor {
override fun deserialize(deserializer: KtMessageDeserializer):
MonitoredResourceDescriptor {
var type = ""
var displayName = ""
var description = ""
var labels : MutableList? = null
var name = ""
var launchStage = LaunchStage.from(0)
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when(deserializer.readTag()) {
0 -> return MonitoredResourceDescriptor(type,
displayName,
description,
finishList(labels),
name,
launchStage,
UnknownFieldSet.from(unknownFields))
10 -> type = deserializer.readString()
18 -> displayName = deserializer.readString()
26 -> description = deserializer.readString()
34 -> labels = (labels ?: mutableListOf()).apply {
deserializer.readRepeated(false) {
add(deserializer.readMessage(com.google.api.LabelDescriptor))
}
}
42 -> name = deserializer.readString()
56 -> launchStage = deserializer.readEnum(com.google.api.LaunchStage)
else -> unknownFields = (unknownFields ?:
UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
}
}
}
override fun invoke(dsl: MonitoredResourceDescriptorDsl.() -> Unit):
MonitoredResourceDescriptor = MonitoredResourceDescriptorDsl().apply(dsl).build()
}
}
/**
* An object representing a resource that can be used for monitoring, logging, billing, or other
* purposes. Examples include virtual machine instances, databases, and storage devices such as disks.
* The `type` field identifies a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor]
* object that describes the resource's schema. Information in the `labels` field identifies the actual
* resource and its attributes according to the schema. For example, a particular Compute Engine VM
* instance could be represented by the following object, because the
* [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for `"gce_instance"` has
* labels `"instance_id"` and `"zone"`:
*
* { "type": "gce_instance", "labels": { "instance_id": "12345678901234",
* "zone": "us-central1-a" }}
*/
@KtGeneratedMessage("google.api.MonitoredResource")
class MonitoredResource private constructor(
/**
* Required. The monitored resource type. This field must match the `type` field of a
* [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For example, the
* type of a Compute Engine VM instance is `gce_instance`.
*/
val type: String,
/**
* Required. Values for all of the labels listed in the associated monitored resource
* descriptor. For example, Compute Engine VM instances use the labels `"project_id"`,
* `"instance_id"`, and `"zone"`.
*/
val labels: Map,
val unknownFields: UnknownFieldSet = UnknownFieldSet.empty(),
) : KtMessage {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (type.isNotEmpty()) {
result += sizeof(Tag(1)) + sizeof(type)
}
if (labels.isNotEmpty()) {
result += sizeofMap(labels, Tag(2)) { k, v -> LabelsEntry.sizeof(k, v)}
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (type.isNotEmpty()) {
serializer.write(Tag(10)).write(type)
}
if (labels.isNotEmpty()) {
labels.entries.forEach { serializer.write(Tag(18)).write(LabelsEntry(it.key, it.value))
}
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: Any?): Boolean = other is MonitoredResource &&
other.type == type &&
other.labels == labels &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + type.hashCode()
result = 31 * result + labels.hashCode()
return result
}
override fun toString(): String = "MonitoredResource(" +
"type=$type, " +
"labels=$labels" +
"${if (unknownFields.isEmpty()) "" else ", unknownFields=$unknownFields"})"
fun copy(dsl: MonitoredResourceDsl.() -> Unit): MonitoredResource =
MonitoredResource.Deserializer {
type = [email protected]
labels = [email protected]
unknownFields = [email protected]
dsl()
}
class MonitoredResourceDsl {
var type: String = ""
var labels: Map = emptyMap()
set(newValue) {
field = copyMap(newValue)
}
var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
fun build(): MonitoredResource = MonitoredResource(type,
finishMap(labels),
unknownFields)
}
companion object Deserializer : KtDeserializer,
(MonitoredResourceDsl.() -> Unit) -> MonitoredResource {
override fun deserialize(deserializer: KtMessageDeserializer): MonitoredResource {
var type = ""
var labels : MutableMap? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when(deserializer.readTag()) {
0 -> return MonitoredResource(type,
finishMap(labels),
UnknownFieldSet.from(unknownFields))
10 -> type = deserializer.readString()
18 -> labels = (labels ?: mutableMapOf()).apply {
deserializer.readRepeated(false) {
deserializer.readMessage(com.google.api.MonitoredResource.LabelsEntry)
.let { put(
it.key,
it.value
) }
}
}
else -> unknownFields = (unknownFields ?:
UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
}
}
}
override fun invoke(dsl: MonitoredResourceDsl.() -> Unit): MonitoredResource =
MonitoredResourceDsl().apply(dsl).build()
}
private class LabelsEntry(
val key: String,
val `value`: String,
) : KtMessage {
override val messageSize: Int
get() = sizeof(key, value)
override fun serialize(serializer: KtMessageSerializer) {
serializer.write(Tag(10)).write(key)
serializer.write(Tag(18)).write(value)
}
companion object Deserializer : KtDeserializer {
fun sizeof(key: String, `value`: String) =
com.toasttab.protokt.rt.sizeof(com.toasttab.protokt.rt.Tag(1)) + com.toasttab.protokt.rt.sizeof(key) + com.toasttab.protokt.rt.sizeof(com.toasttab.protokt.rt.Tag(2)) + com.toasttab.protokt.rt.sizeof(value)
override fun deserialize(deserializer: KtMessageDeserializer): LabelsEntry {
var key = ""
var value = ""
while (true) {
when (deserializer.readTag()) {
0 -> return LabelsEntry(key, value)
10 -> key = deserializer.readString()
18 -> value = deserializer.readString()
}
}
}
}
}
}
/**
* Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource] object.
* [MonitoredResource][google.api.MonitoredResource] objects contain the minimum set of information to
* uniquely identify a monitored resource instance. There is some other useful auxiliary metadata.
* Monitoring and Logging use an ingestion pipeline to extract metadata for cloud resources of all
* types, and store the metadata in this message.
*/
@KtGeneratedMessage("google.api.MonitoredResourceMetadata")
class MonitoredResourceMetadata private constructor(
/**
* Output only. Values for predefined system metadata labels. System labels are a kind of
* metadata extracted by Google, including "machine_image", "vpc", "subnet_id", "security_group",
* "name", etc. System label values can be only strings, Boolean values, or a list of strings. For
* example:
*
* { "name": "my-test-instance", "security_group": ["a", "b", "c"],
* "spot_instance": false }
*/
val systemLabels: Struct?,
/**
* Output only. A map of user-defined metadata labels.
*/
val userLabels: Map,
val unknownFields: UnknownFieldSet = UnknownFieldSet.empty(),
) : KtMessage {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (systemLabels != null) {
result += sizeof(Tag(1)) + sizeof(systemLabels)
}
if (userLabels.isNotEmpty()) {
result += sizeofMap(userLabels, Tag(2)) { k, v -> UserLabelsEntry.sizeof(k, v)}
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (systemLabels != null) {
serializer.write(Tag(10)).write(systemLabels)
}
if (userLabels.isNotEmpty()) {
userLabels.entries.forEach { serializer.write(Tag(18)).write(UserLabelsEntry(it.key,
it.value)) }
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: Any?): Boolean = other is MonitoredResourceMetadata &&
other.systemLabels == systemLabels &&
other.userLabels == userLabels &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + systemLabels.hashCode()
result = 31 * result + userLabels.hashCode()
return result
}
override fun toString(): String = "MonitoredResourceMetadata(" +
"systemLabels=$systemLabels, " +
"userLabels=$userLabels" +
"${if (unknownFields.isEmpty()) "" else ", unknownFields=$unknownFields"})"
fun copy(dsl: MonitoredResourceMetadataDsl.() -> Unit): MonitoredResourceMetadata =
MonitoredResourceMetadata.Deserializer {
systemLabels = [email protected]
userLabels = [email protected]
unknownFields = [email protected]
dsl()
}
class MonitoredResourceMetadataDsl {
var systemLabels: Struct? = null
var userLabels: Map = emptyMap()
set(newValue) {
field = copyMap(newValue)
}
var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
fun build(): MonitoredResourceMetadata = MonitoredResourceMetadata(systemLabels,
finishMap(userLabels),
unknownFields)
}
companion object Deserializer : KtDeserializer,
(MonitoredResourceMetadataDsl.() -> Unit) -> MonitoredResourceMetadata {
override fun deserialize(deserializer: KtMessageDeserializer):
MonitoredResourceMetadata {
var systemLabels : Struct? = null
var userLabels : MutableMap? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when(deserializer.readTag()) {
0 -> return MonitoredResourceMetadata(systemLabels,
finishMap(userLabels),
UnknownFieldSet.from(unknownFields))
10 -> systemLabels = deserializer.readMessage(com.toasttab.protokt.Struct)
18 -> userLabels = (userLabels ?: mutableMapOf()).apply {
deserializer.readRepeated(false) {
deserializer.readMessage(com.google.api.MonitoredResourceMetadata.UserLabelsEntry)
.let { put(
it.key,
it.value
) }
}
}
else -> unknownFields = (unknownFields ?:
UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
}
}
}
override fun invoke(dsl: MonitoredResourceMetadataDsl.() -> Unit):
MonitoredResourceMetadata = MonitoredResourceMetadataDsl().apply(dsl).build()
}
private class UserLabelsEntry(
val key: String,
val `value`: String,
) : KtMessage {
override val messageSize: Int
get() = sizeof(key, value)
override fun serialize(serializer: KtMessageSerializer) {
serializer.write(Tag(10)).write(key)
serializer.write(Tag(18)).write(value)
}
companion object Deserializer : KtDeserializer {
fun sizeof(key: String, `value`: String) =
com.toasttab.protokt.rt.sizeof(com.toasttab.protokt.rt.Tag(1)) + com.toasttab.protokt.rt.sizeof(key) + com.toasttab.protokt.rt.sizeof(com.toasttab.protokt.rt.Tag(2)) + com.toasttab.protokt.rt.sizeof(value)
override fun deserialize(deserializer: KtMessageDeserializer): UserLabelsEntry {
var key = ""
var value = ""
while (true) {
when (deserializer.readTag()) {
0 -> return UserLabelsEntry(key, value)
10 -> key = deserializer.readString()
18 -> value = deserializer.readString()
}
}
}
}
}
}