Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
// Generated by protokt version 1.0.0-alpha.8. Do not modify.
// Source: google/api/monitored_resource.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.copyMap
import protokt.v1.Collections.unmodifiableList
import protokt.v1.Collections.unmodifiableMap
import protokt.v1.KtBuilderDsl
import protokt.v1.KtMessageDeserializer
import protokt.v1.KtMessageSerializer
import protokt.v1.SizeCodecs.sizeOf
import protokt.v1.UnknownFieldSet
import protokt.v1.google.protobuf.Struct
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.Map
import kotlin.collections.MutableList
import kotlin.collections.MutableMap
import kotlin.jvm.JvmStatic
import com.toasttab.protokt.rt.KtGeneratedMessage as RtKtGeneratedMessage
import protokt.v1.KtGeneratedMessage as V1KtGeneratedMessage
/**
* 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.
*/
@V1KtGeneratedMessage("google.api.MonitoredResourceDescriptor")
@RtKtGeneratedMessage("google.api.MonitoredResourceDescriptor")
public class MonitoredResourceDescriptor private constructor(
/**
* Required. The monitored resource type. For example, the type `"cloudsql_database"` represents
* databases in Google Cloud SQL. For a list of types, see [Monitoring resource
* types](https://cloud.google.com/monitoring/api/resources) and [Logging resource
* types](https://cloud.google.com/logging/docs/api/v2/resource-list).
*/
public 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"`.
*/
public val displayName: String,
/**
* Optional. A detailed description of the monitored resource type that might be used in
* documentation.
*/
public 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"`.
*/
public 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}"`.
*/
public val name: String,
/**
* Optional. The launch stage of the monitored resource definition.
*/
public val launchStage: LaunchStage,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (type.isNotEmpty()) {
result += sizeOf(10u) + sizeOf(type)
}
if (displayName.isNotEmpty()) {
result += sizeOf(18u) + sizeOf(displayName)
}
if (description.isNotEmpty()) {
result += sizeOf(26u) + sizeOf(description)
}
if (labels.isNotEmpty()) {
result += (sizeOf(34u) * labels.size) + labels.sumOf { sizeOf(it) }
}
if (name.isNotEmpty()) {
result += sizeOf(42u) + sizeOf(name)
}
if (launchStage.value != 0) {
result += sizeOf(56u) + sizeOf(launchStage)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (type.isNotEmpty()) {
serializer.writeTag(10u).write(type)
}
if (displayName.isNotEmpty()) {
serializer.writeTag(18u).write(displayName)
}
if (description.isNotEmpty()) {
serializer.writeTag(26u).write(description)
}
labels.forEach { serializer.writeTag(34u).write(it) }
if (name.isNotEmpty()) {
serializer.writeTag(42u).write(name)
}
if (launchStage.value != 0) {
serializer.writeTag(56u).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)"
public fun copy(builder: Builder.() -> Unit): MonitoredResourceDescriptor =
Builder().apply {
type = [email protected]
displayName = [email protected]
description = [email protected]
labels = [email protected]
name = [email protected]
launchStage = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var type: String = ""
public var displayName: String = ""
public var description: String = ""
public var labels: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
public var name: String = ""
public var launchStage: LaunchStage = LaunchStage.from(0)
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): MonitoredResourceDescriptor =
MonitoredResourceDescriptor(
type,
displayName,
description,
unmodifiableList(labels),
name,
launchStage,
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
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,
unmodifiableList(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(LabelDescriptor))
}
}
42 -> name = deserializer.readString()
56 -> launchStage = deserializer.readEnum(LaunchStage)
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): MonitoredResourceDescriptor = Builder().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 `"project_id"`, `"instance_id"` and `"zone"`:
*
* { "type": "gce_instance", "labels": { "project_id": "my-project",
* "instance_id": "12345678901234", "zone": "us-central1-a" }}
*/
@V1KtGeneratedMessage("google.api.MonitoredResource")
@RtKtGeneratedMessage("google.api.MonitoredResource")
public 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`. Some descriptors include the service name
* in the type; for example, the type of a Datastream stream is `datastream.googleapis.com/Stream`.
*/
public 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"`.
*/
public val labels: Map,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (type.isNotEmpty()) {
result += sizeOf(10u) + sizeOf(type)
}
if (labels.isNotEmpty()) {
result +=
sizeOf(labels, 18u) { k, v ->
LabelsEntry.entrySize(k, v)
}
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (type.isNotEmpty()) {
serializer.writeTag(10u).write(type)
}
labels.entries.forEach {
serializer.writeTag(18u).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)"
public fun copy(builder: Builder.() -> Unit): MonitoredResource =
Builder().apply {
type = [email protected]
labels = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var type: String = ""
public var labels: Map = emptyMap()
set(newValue) {
field = copyMap(newValue)
}
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): MonitoredResource =
MonitoredResource(
type,
unmodifiableMap(labels),
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
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,
unmodifiableMap(labels),
UnknownFieldSet.from(unknownFields)
)
10 -> type = deserializer.readString()
18 ->
labels =
(labels ?: mutableMapOf()).apply {
deserializer.readRepeated(false) {
deserializer.readMessage(LabelsEntry).let {
put(it.key, it.value)
}
}
}
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): MonitoredResource = Builder().apply(dsl).build()
}
private class LabelsEntry(
public val key: String,
public val `value`: String
) : AbstractKtMessage() {
override val messageSize: Int
get() = entrySize(key, value)
override fun serialize(serializer: KtMessageSerializer) {
serializer.writeTag(10u).write(key)
serializer.writeTag(18u).write(`value`)
}
public companion object Deserializer : AbstractKtDeserializer() {
public fun entrySize(
key: String,
`value`: String
): Int =
sizeOf(10u) + sizeOf(key) +
sizeOf(18u) + 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.
*/
@V1KtGeneratedMessage("google.api.MonitoredResourceMetadata")
@RtKtGeneratedMessage("google.api.MonitoredResourceMetadata")
public 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 }
*/
public val systemLabels: Struct?,
/**
* Output only. A map of user-defined metadata labels.
*/
public val userLabels: Map,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (systemLabels != null) {
result += sizeOf(10u) + sizeOf(systemLabels)
}
if (userLabels.isNotEmpty()) {
result +=
sizeOf(userLabels, 18u) { k, v ->
UserLabelsEntry.entrySize(k, v)
}
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (systemLabels != null) {
serializer.writeTag(10u).write(systemLabels)
}
userLabels.entries.forEach {
serializer.writeTag(18u).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)"
public fun copy(builder: Builder.() -> Unit): MonitoredResourceMetadata =
Builder().apply {
systemLabels = [email protected]
userLabels = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var systemLabels: Struct? = null
public var userLabels: Map = emptyMap()
set(newValue) {
field = copyMap(newValue)
}
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): MonitoredResourceMetadata =
MonitoredResourceMetadata(
systemLabels,
unmodifiableMap(userLabels),
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
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,
unmodifiableMap(userLabels),
UnknownFieldSet.from(unknownFields)
)
10 -> systemLabels = deserializer.readMessage(Struct)
18 ->
userLabels =
(userLabels ?: mutableMapOf()).apply {
deserializer.readRepeated(false) {
deserializer.readMessage(UserLabelsEntry).let {
put(it.key, it.value)
}
}
}
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): MonitoredResourceMetadata = Builder().apply(dsl).build()
}
private class UserLabelsEntry(
public val key: String,
public val `value`: String
) : AbstractKtMessage() {
override val messageSize: Int
get() = entrySize(key, value)
override fun serialize(serializer: KtMessageSerializer) {
serializer.writeTag(10u).write(key)
serializer.writeTag(18u).write(`value`)
}
public companion object Deserializer : AbstractKtDeserializer() {
public fun entrySize(
key: String,
`value`: String
): Int =
sizeOf(10u) + sizeOf(key) +
sizeOf(18u) + 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()
}
}
}
}
}
}