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

protokt.com.google.rpc.error_details.kt Maven / Gradle / Ivy

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

import com.toasttab.protokt.Duration
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

/**
 * Describes when the clients can retry a failed request. Clients could ignore the recommendation
 * here or retry when this information is missing from error responses. 
 *
 *  It's always recommended that clients should use exponential backoff when retrying. 
 *
 *  Clients should wait until `retry_delay` amount of time has passed since receiving the error
 * response before retrying.  If retrying requests also fail, clients should use an exponential backoff
 * scheme to gradually increase the delay between retries based on `retry_delay`, until either a
 * maximum number of retries have been reached or a maximum retry delay cap has been reached.
 */
@KtGeneratedMessage("google.rpc.RetryInfo")
class RetryInfo private constructor(
    /**
     * Clients should wait at least this long between retrying the same request.
     */
    val retryDelay: Duration?,
    val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : KtMessage {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
        var result = 0
        if (retryDelay  != null) {
            result += sizeof(Tag(1)) + sizeof(retryDelay) 
        }
        result += unknownFields.size()
        return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
        if (retryDelay  != null) {
            serializer.write(Tag(10)).write(retryDelay)
        }
        serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: Any?): Boolean = other is RetryInfo &&
        other.retryDelay == retryDelay &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
        var result = unknownFields.hashCode()
        result = 31 * result + retryDelay.hashCode()
        return result
    }

    override fun toString(): String = "RetryInfo(" +
        "retryDelay=$retryDelay, " +
        "unknownFields=$unknownFields)"

    fun copy(dsl: RetryInfoDsl.() -> Unit): RetryInfo = RetryInfo.Deserializer {
        retryDelay = [email protected]
        unknownFields = [email protected]
        dsl()
    }

    class RetryInfoDsl {
        var retryDelay: Duration? = null

        var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

        fun build(): RetryInfo = RetryInfo(retryDelay,
         unknownFields)
    }

    companion object Deserializer : KtDeserializer, (RetryInfoDsl.() -> Unit) ->
            RetryInfo {
        override fun deserialize(deserializer: KtMessageDeserializer): RetryInfo {
            var retryDelay : Duration? = null
            var unknownFields: UnknownFieldSet.Builder? = null
            while (true) {
                when(deserializer.readTag()) {
                    0 -> return RetryInfo(retryDelay,
                            UnknownFieldSet.from(unknownFields))
                    10 -> retryDelay = deserializer.readMessage(com.toasttab.protokt.Duration)
                    else -> unknownFields = (unknownFields ?:
                            UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
                }
            }
        }

        override fun invoke(dsl: RetryInfoDsl.() -> Unit): RetryInfo =
                RetryInfoDsl().apply(dsl).build()
    }
}

/**
 * Describes additional debugging info.
 */
@KtGeneratedMessage("google.rpc.DebugInfo")
class DebugInfo private constructor(
    /**
     * The stack trace entries indicating where the error occurred.
     */
    val stackEntries: List,
    /**
     * Additional debugging information provided by the server.
     */
    val detail: String,
    val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : KtMessage {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
        var result = 0
        if (stackEntries.isNotEmpty()) {
            result += (sizeof(Tag(1)) * stackEntries.size) + stackEntries.sumOf { sizeof(it) } 
        }
        if (detail.isNotEmpty()) {
            result += sizeof(Tag(2)) + sizeof(detail) 
        }
        result += unknownFields.size()
        return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
        if (stackEntries.isNotEmpty()) {
            stackEntries.forEach { serializer.write(Tag(10)).write(it) }
        }
        if (detail.isNotEmpty()) {
            serializer.write(Tag(18)).write(detail)
        }
        serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: Any?): Boolean = other is DebugInfo &&
        other.stackEntries == stackEntries &&
        other.detail == detail &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
        var result = unknownFields.hashCode()
        result = 31 * result + stackEntries.hashCode()
        result = 31 * result + detail.hashCode()
        return result
    }

    override fun toString(): String = "DebugInfo(" +
        "stackEntries=$stackEntries, " +
        "detail=$detail, " +
        "unknownFields=$unknownFields)"

    fun copy(dsl: DebugInfoDsl.() -> Unit): DebugInfo = DebugInfo.Deserializer {
        stackEntries = [email protected]
        detail = [email protected]
        unknownFields = [email protected]
        dsl()
    }

    class DebugInfoDsl {
        var stackEntries: List = emptyList()
            set(newValue) {
                field = copyList(newValue)
            }

        var detail: String = ""

        var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

        fun build(): DebugInfo = DebugInfo(finishList(stackEntries),
        detail,
         unknownFields)
    }

    companion object Deserializer : KtDeserializer, (DebugInfoDsl.() -> Unit) ->
            DebugInfo {
        override fun deserialize(deserializer: KtMessageDeserializer): DebugInfo {
            var stackEntries : MutableList? = null
            var detail = ""
            var unknownFields: UnknownFieldSet.Builder? = null
            while (true) {
                when(deserializer.readTag()) {
                    0 -> return DebugInfo(finishList(stackEntries),
                            detail,
                            UnknownFieldSet.from(unknownFields))
                    10 -> stackEntries = (stackEntries ?: mutableListOf()).apply {
                                   deserializer.readRepeated(false) {
                                       add(deserializer.readString())
                                   }
                               }
                    18 -> detail = deserializer.readString()
                    else -> unknownFields = (unknownFields ?:
                            UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
                }
            }
        }

        override fun invoke(dsl: DebugInfoDsl.() -> Unit): DebugInfo =
                DebugInfoDsl().apply(dsl).build()
    }
}

/**
 * Describes how a quota check failed. 
 *
 *  For example if a daily limit was exceeded for the calling project, a service could respond with
 * a QuotaFailure detail containing the project id and the description of the quota limit that was
 * exceeded.  If the calling project hasn't enabled the service in the developer console, then a
 * service could respond with the project id and set `service_disabled` to true. 
 *
 *  Also see RetryInfo and Help types for other details about handling a quota failure.
 */
@KtGeneratedMessage("google.rpc.QuotaFailure")
class QuotaFailure private constructor(
    /**
     * Describes all quota violations.
     */
    val violations: List,
    val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : KtMessage {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
        var result = 0
        if (violations.isNotEmpty()) {
            result += (sizeof(Tag(1)) * violations.size) + violations.sumOf { sizeof(it) } 
        }
        result += unknownFields.size()
        return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
        if (violations.isNotEmpty()) {
            violations.forEach { serializer.write(Tag(10)).write(it) }
        }
        serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: Any?): Boolean = other is QuotaFailure &&
        other.violations == violations &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
        var result = unknownFields.hashCode()
        result = 31 * result + violations.hashCode()
        return result
    }

    override fun toString(): String = "QuotaFailure(" +
        "violations=$violations, " +
        "unknownFields=$unknownFields)"

    fun copy(dsl: QuotaFailureDsl.() -> Unit): QuotaFailure = QuotaFailure.Deserializer {
        violations = [email protected]
        unknownFields = [email protected]
        dsl()
    }

    class QuotaFailureDsl {
        var violations: List = emptyList()
            set(newValue) {
                field = copyList(newValue)
            }

        var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

        fun build(): QuotaFailure = QuotaFailure(finishList(violations),
         unknownFields)
    }

    companion object Deserializer : KtDeserializer, (QuotaFailureDsl.() ->
            Unit) -> QuotaFailure {
        override fun deserialize(deserializer: KtMessageDeserializer): QuotaFailure {
            var violations : MutableList? = null
            var unknownFields: UnknownFieldSet.Builder? = null
            while (true) {
                when(deserializer.readTag()) {
                    0 -> return QuotaFailure(finishList(violations),
                            UnknownFieldSet.from(unknownFields))
                    10 -> violations = (violations ?: mutableListOf()).apply {
                                   deserializer.readRepeated(false) {
                                      
                                    add(deserializer.readMessage(com.google.rpc.QuotaFailure.Violation))
                                   }
                               }
                    else -> unknownFields = (unknownFields ?:
                            UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
                }
            }
        }

        override fun invoke(dsl: QuotaFailureDsl.() -> Unit): QuotaFailure =
                QuotaFailureDsl().apply(dsl).build()
    }

    /**
     * A message type used to describe a single quota violation.  For example, a daily quota or a
     * custom quota that was exceeded.
     */
    @KtGeneratedMessage("google.rpc.Violation")
    class Violation private constructor(
        /**
         * The subject on which the quota check failed. For example, "clientip:" or "project:".
         */
        val subject: String,
        /**
         * A description of how the quota check failed. Clients can use this description to find
         * more about the quota configuration in the service's public documentation, or find the
         * relevant quota limit to adjust through developer console. 
         *
         *  For example: "Service disabled" or "Daily Limit for read operations exceeded".
         */
        val description: String,
        val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
    ) : KtMessage {
        override val messageSize: Int by lazy { messageSize() }

        private fun messageSize(): Int {
            var result = 0
            if (subject.isNotEmpty()) {
                result += sizeof(Tag(1)) + sizeof(subject) 
            }
            if (description.isNotEmpty()) {
                result += sizeof(Tag(2)) + sizeof(description) 
            }
            result += unknownFields.size()
            return result
        }

        override fun serialize(serializer: KtMessageSerializer) {
            if (subject.isNotEmpty()) {
                serializer.write(Tag(10)).write(subject)
            }
            if (description.isNotEmpty()) {
                serializer.write(Tag(18)).write(description)
            }
            serializer.writeUnknown(unknownFields)
        }

        override fun equals(other: Any?): Boolean = other is Violation &&
            other.subject == subject &&
            other.description == description &&
            other.unknownFields == unknownFields

        override fun hashCode(): Int {
            var result = unknownFields.hashCode()
            result = 31 * result + subject.hashCode()
            result = 31 * result + description.hashCode()
            return result
        }

        override fun toString(): String = "Violation(" +
            "subject=$subject, " +
            "description=$description, " +
            "unknownFields=$unknownFields)"

        fun copy(dsl: ViolationDsl.() -> Unit): Violation = Violation.Deserializer {
            subject = [email protected]
            description = [email protected]
            unknownFields = [email protected]
            dsl()
        }

        class ViolationDsl {
            var subject: String = ""

            var description: String = ""

            var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

            fun build(): Violation = Violation(subject,
            description,
             unknownFields)
        }

        companion object Deserializer : KtDeserializer, (ViolationDsl.() ->
                Unit) -> Violation {
            override fun deserialize(deserializer: KtMessageDeserializer): Violation {
                var subject = ""
                var description = ""
                var unknownFields: UnknownFieldSet.Builder? = null
                while (true) {
                    when(deserializer.readTag()) {
                        0 -> return Violation(subject,
                                description,
                                UnknownFieldSet.from(unknownFields))
                        10 -> subject = deserializer.readString()
                        18 -> description = deserializer.readString()
                        else -> unknownFields = (unknownFields ?:
                                UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown())
                                }
                    }
                }
            }

            override fun invoke(dsl: ViolationDsl.() -> Unit): Violation =
                    ViolationDsl().apply(dsl).build()
        }
    }
}

/**
 * Describes the cause of the error with structured details. 
 *
 *  Example of an error when contacting the "pubsub.googleapis.com" API when it is not enabled: 
 *
 *      { "reason": "API_DISABLED"       "domain": "googleapis.com"       "metadata": {        
 * "resource": "projects/123",         "service": "pubsub.googleapis.com"       }     } 
 *
 *  This response indicates that the pubsub.googleapis.com API is not enabled. 
 *
 *  Example of an error that is returned when attempting to create a Spanner instance in a region
 * that is out of stock: 
 *
 *      { "reason": "STOCKOUT"       "domain": "spanner.googleapis.com",       "metadata": {        
 * "availableRegions": "us-central1,us-east2"       }     }
 */
@KtGeneratedMessage("google.rpc.ErrorInfo")
class ErrorInfo private constructor(
    /**
     * The reason of the error. This is a constant value that identifies the proximate cause of the
     * error. Error reasons are unique within a particular domain of errors. This should be at most 63
     * characters and match /[A-Z0-9_]+/.
     */
    val reason: String,
    /**
     * The logical grouping to which the "reason" belongs. The error domain is typically the
     * registered service name of the tool or product that generates the error. Example:
     * "pubsub.googleapis.com". If the error is generated by some common infrastructure, the error
     * domain must be a globally unique value that identifies the infrastructure. For Google API
     * infrastructure, the error domain is "googleapis.com".
     */
    val domain: String,
    /**
     * Additional structured details about this error. 
     *
     *  Keys should match /[a-zA-Z0-9-_]/ and be limited to 64 characters in length. When
     * identifying the current value of an exceeded limit, the units should be contained in the key,
     * not the value.  For example, rather than {"instanceLimit": "100/request"}, should be returned
     * as, {"instanceLimitPerRequest": "100"}, if the client exceeds the number of instances that can
     * be created in a single (batch) request.
     */
    val metadata: Map,
    val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : KtMessage {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
        var result = 0
        if (reason.isNotEmpty()) {
            result += sizeof(Tag(1)) + sizeof(reason) 
        }
        if (domain.isNotEmpty()) {
            result += sizeof(Tag(2)) + sizeof(domain) 
        }
        if (metadata.isNotEmpty()) {
            result += sizeofMap(metadata, Tag(3)) { k, v -> MetadataEntry.sizeof(k, v)} 
        }
        result += unknownFields.size()
        return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
        if (reason.isNotEmpty()) {
            serializer.write(Tag(10)).write(reason)
        }
        if (domain.isNotEmpty()) {
            serializer.write(Tag(18)).write(domain)
        }
        if (metadata.isNotEmpty()) {
            metadata.entries.forEach { serializer.write(Tag(26)).write(MetadataEntry(it.key,
                    it.value)) }
        }
        serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: Any?): Boolean = other is ErrorInfo &&
        other.reason == reason &&
        other.domain == domain &&
        other.metadata == metadata &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
        var result = unknownFields.hashCode()
        result = 31 * result + reason.hashCode()
        result = 31 * result + domain.hashCode()
        result = 31 * result + metadata.hashCode()
        return result
    }

    override fun toString(): String = "ErrorInfo(" +
        "reason=$reason, " +
        "domain=$domain, " +
        "metadata=$metadata, " +
        "unknownFields=$unknownFields)"

    fun copy(dsl: ErrorInfoDsl.() -> Unit): ErrorInfo = ErrorInfo.Deserializer {
        reason = [email protected]
        domain = [email protected]
        metadata = [email protected]
        unknownFields = [email protected]
        dsl()
    }

    class ErrorInfoDsl {
        var reason: String = ""

        var domain: String = ""

        var metadata: Map = emptyMap()
            set(newValue) {
                field = copyMap(newValue)
            }

        var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

        fun build(): ErrorInfo = ErrorInfo(reason,
        domain,
        finishMap(metadata),
         unknownFields)
    }

    companion object Deserializer : KtDeserializer, (ErrorInfoDsl.() -> Unit) ->
            ErrorInfo {
        override fun deserialize(deserializer: KtMessageDeserializer): ErrorInfo {
            var reason = ""
            var domain = ""
            var metadata : MutableMap? = null
            var unknownFields: UnknownFieldSet.Builder? = null
            while (true) {
                when(deserializer.readTag()) {
                    0 -> return ErrorInfo(reason,
                            domain,
                            finishMap(metadata),
                            UnknownFieldSet.from(unknownFields))
                    10 -> reason = deserializer.readString()
                    18 -> domain = deserializer.readString()
                    26 -> metadata = (metadata ?: mutableMapOf()).apply {
                                   deserializer.readRepeated(false) {
                                      
                                    deserializer.readMessage(com.google.rpc.ErrorInfo.MetadataEntry)
                                       .let { put(
                                           it.key,
                                           it.value
                                       ) }
                                   }
                               }
                    else -> unknownFields = (unknownFields ?:
                            UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
                }
            }
        }

        override fun invoke(dsl: ErrorInfoDsl.() -> Unit): ErrorInfo =
                ErrorInfoDsl().apply(dsl).build()
    }

    private class MetadataEntry(
        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): MetadataEntry {
                var key = ""
                var value = ""

                while (true) {
                  when (deserializer.readTag()) {
                    0 -> return MetadataEntry(key, value)
                    10 -> key = deserializer.readString()
                    18 -> value = deserializer.readString()
                  }
                }
            }
        }
    }
}

/**
 * Describes what preconditions have failed. 
 *
 *  For example, if an RPC failed because it required the Terms of Service to be acknowledged, it
 * could list the terms of service violation in the PreconditionFailure message.
 */
@KtGeneratedMessage("google.rpc.PreconditionFailure")
class PreconditionFailure private constructor(
    /**
     * Describes all precondition violations.
     */
    val violations: List,
    val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : KtMessage {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
        var result = 0
        if (violations.isNotEmpty()) {
            result += (sizeof(Tag(1)) * violations.size) + violations.sumOf { sizeof(it) } 
        }
        result += unknownFields.size()
        return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
        if (violations.isNotEmpty()) {
            violations.forEach { serializer.write(Tag(10)).write(it) }
        }
        serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: Any?): Boolean = other is PreconditionFailure &&
        other.violations == violations &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
        var result = unknownFields.hashCode()
        result = 31 * result + violations.hashCode()
        return result
    }

    override fun toString(): String = "PreconditionFailure(" +
        "violations=$violations, " +
        "unknownFields=$unknownFields)"

    fun copy(dsl: PreconditionFailureDsl.() -> Unit): PreconditionFailure =
            PreconditionFailure.Deserializer {
        violations = [email protected]
        unknownFields = [email protected]
        dsl()
    }

    class PreconditionFailureDsl {
        var violations: List = emptyList()
            set(newValue) {
                field = copyList(newValue)
            }

        var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

        fun build(): PreconditionFailure = PreconditionFailure(finishList(violations),
         unknownFields)
    }

    companion object Deserializer : KtDeserializer,
            (PreconditionFailureDsl.() -> Unit) -> PreconditionFailure {
        override fun deserialize(deserializer: KtMessageDeserializer): PreconditionFailure {
            var violations : MutableList? = null
            var unknownFields: UnknownFieldSet.Builder? = null
            while (true) {
                when(deserializer.readTag()) {
                    0 -> return PreconditionFailure(finishList(violations),
                            UnknownFieldSet.from(unknownFields))
                    10 -> violations = (violations ?: mutableListOf()).apply {
                                   deserializer.readRepeated(false) {
                                      
                                    add(deserializer.readMessage(com.google.rpc.PreconditionFailure.Violation))
                                   }
                               }
                    else -> unknownFields = (unknownFields ?:
                            UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
                }
            }
        }

        override fun invoke(dsl: PreconditionFailureDsl.() -> Unit): PreconditionFailure =
                PreconditionFailureDsl().apply(dsl).build()
    }

    /**
     * A message type used to describe a single precondition failure.
     */
    @KtGeneratedMessage("google.rpc.Violation")
    class Violation private constructor(
        /**
         * The type of PreconditionFailure. We recommend using a service-specific enum type to
         * define the supported precondition violation subjects. For example, "TOS" for "Terms of
         * Service violation".
         */
        val type: String,
        /**
         * The subject, relative to the type, that failed. For example, "google.com/cloud" relative
         * to the "TOS" type would indicate which terms of service is being referenced.
         */
        val subject: String,
        /**
         * A description of how the precondition failed. Developers can use this description to
         * understand how to fix the failure. 
         *
         *  For example: "Terms of service not accepted".
         */
        val description: String,
        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 (subject.isNotEmpty()) {
                result += sizeof(Tag(2)) + sizeof(subject) 
            }
            if (description.isNotEmpty()) {
                result += sizeof(Tag(3)) + sizeof(description) 
            }
            result += unknownFields.size()
            return result
        }

        override fun serialize(serializer: KtMessageSerializer) {
            if (type.isNotEmpty()) {
                serializer.write(Tag(10)).write(type)
            }
            if (subject.isNotEmpty()) {
                serializer.write(Tag(18)).write(subject)
            }
            if (description.isNotEmpty()) {
                serializer.write(Tag(26)).write(description)
            }
            serializer.writeUnknown(unknownFields)
        }

        override fun equals(other: Any?): Boolean = other is Violation &&
            other.type == type &&
            other.subject == subject &&
            other.description == description &&
            other.unknownFields == unknownFields

        override fun hashCode(): Int {
            var result = unknownFields.hashCode()
            result = 31 * result + type.hashCode()
            result = 31 * result + subject.hashCode()
            result = 31 * result + description.hashCode()
            return result
        }

        override fun toString(): String = "Violation(" +
            "type=$type, " +
            "subject=$subject, " +
            "description=$description, " +
            "unknownFields=$unknownFields)"

        fun copy(dsl: ViolationDsl.() -> Unit): Violation = Violation.Deserializer {
            type = [email protected]
            subject = [email protected]
            description = [email protected]
            unknownFields = [email protected]
            dsl()
        }

        class ViolationDsl {
            var type: String = ""

            var subject: String = ""

            var description: String = ""

            var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

            fun build(): Violation = Violation(type,
            subject,
            description,
             unknownFields)
        }

        companion object Deserializer : KtDeserializer, (ViolationDsl.() ->
                Unit) -> Violation {
            override fun deserialize(deserializer: KtMessageDeserializer): Violation {
                var type = ""
                var subject = ""
                var description = ""
                var unknownFields: UnknownFieldSet.Builder? = null
                while (true) {
                    when(deserializer.readTag()) {
                        0 -> return Violation(type,
                                subject,
                                description,
                                UnknownFieldSet.from(unknownFields))
                        10 -> type = deserializer.readString()
                        18 -> subject = deserializer.readString()
                        26 -> description = deserializer.readString()
                        else -> unknownFields = (unknownFields ?:
                                UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown())
                                }
                    }
                }
            }

            override fun invoke(dsl: ViolationDsl.() -> Unit): Violation =
                    ViolationDsl().apply(dsl).build()
        }
    }
}

/**
 * Describes violations in a client request. This error type focuses on the syntactic aspects of the
 * request.
 */
@KtGeneratedMessage("google.rpc.BadRequest")
class BadRequest private constructor(
    /**
     * Describes all violations in a client request.
     */
    val fieldViolations: List,
    val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : KtMessage {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
        var result = 0
        if (fieldViolations.isNotEmpty()) {
            result += (sizeof(Tag(1)) * fieldViolations.size) + fieldViolations.sumOf { sizeof(it) }
                    
        }
        result += unknownFields.size()
        return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
        if (fieldViolations.isNotEmpty()) {
            fieldViolations.forEach { serializer.write(Tag(10)).write(it) }
        }
        serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: Any?): Boolean = other is BadRequest &&
        other.fieldViolations == fieldViolations &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
        var result = unknownFields.hashCode()
        result = 31 * result + fieldViolations.hashCode()
        return result
    }

    override fun toString(): String = "BadRequest(" +
        "fieldViolations=$fieldViolations, " +
        "unknownFields=$unknownFields)"

    fun copy(dsl: BadRequestDsl.() -> Unit): BadRequest = BadRequest.Deserializer {
        fieldViolations = [email protected]
        unknownFields = [email protected]
        dsl()
    }

    class BadRequestDsl {
        var fieldViolations: List = emptyList()
            set(newValue) {
                field = copyList(newValue)
            }

        var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

        fun build(): BadRequest = BadRequest(finishList(fieldViolations),
         unknownFields)
    }

    companion object Deserializer : KtDeserializer, (BadRequestDsl.() -> Unit) ->
            BadRequest {
        override fun deserialize(deserializer: KtMessageDeserializer): BadRequest {
            var fieldViolations : MutableList? = null
            var unknownFields: UnknownFieldSet.Builder? = null
            while (true) {
                when(deserializer.readTag()) {
                    0 -> return BadRequest(finishList(fieldViolations),
                            UnknownFieldSet.from(unknownFields))
                    10 -> fieldViolations = (fieldViolations ?: mutableListOf()).apply {
                                   deserializer.readRepeated(false) {
                                      
                                    add(deserializer.readMessage(com.google.rpc.BadRequest.FieldViolation))
                                   }
                               }
                    else -> unknownFields = (unknownFields ?:
                            UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
                }
            }
        }

        override fun invoke(dsl: BadRequestDsl.() -> Unit): BadRequest =
                BadRequestDsl().apply(dsl).build()
    }

    /**
     * A message type used to describe a single bad request field.
     */
    @KtGeneratedMessage("google.rpc.FieldViolation")
    class FieldViolation private constructor(
        /**
         * A path leading to a field in the request body. The value will be a sequence of
         * dot-separated identifiers that identify a protocol buffer field. E.g.,
         * "field_violations.field" would identify this field.
         */
        val `field`: String,
        /**
         * A description of why the request element is bad.
         */
        val description: String,
        val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
    ) : KtMessage {
        override val messageSize: Int by lazy { messageSize() }

        private fun messageSize(): Int {
            var result = 0
            if (field.isNotEmpty()) {
                result += sizeof(Tag(1)) + sizeof(field) 
            }
            if (description.isNotEmpty()) {
                result += sizeof(Tag(2)) + sizeof(description) 
            }
            result += unknownFields.size()
            return result
        }

        override fun serialize(serializer: KtMessageSerializer) {
            if (field.isNotEmpty()) {
                serializer.write(Tag(10)).write(field)
            }
            if (description.isNotEmpty()) {
                serializer.write(Tag(18)).write(description)
            }
            serializer.writeUnknown(unknownFields)
        }

        override fun equals(other: Any?): Boolean = other is FieldViolation &&
            other.field == field &&
            other.description == description &&
            other.unknownFields == unknownFields

        override fun hashCode(): Int {
            var result = unknownFields.hashCode()
            result = 31 * result + field.hashCode()
            result = 31 * result + description.hashCode()
            return result
        }

        override fun toString(): String = "FieldViolation(" +
            "field=$field, " +
            "description=$description, " +
            "unknownFields=$unknownFields)"

        fun copy(dsl: FieldViolationDsl.() -> Unit): FieldViolation =
                FieldViolation.Deserializer {
            field = [email protected]
            description = [email protected]
            unknownFields = [email protected]
            dsl()
        }

        class FieldViolationDsl {
            var `field`: String = ""

            var description: String = ""

            var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

            fun build(): FieldViolation = FieldViolation(field,
            description,
             unknownFields)
        }

        companion object Deserializer : KtDeserializer,
                (FieldViolationDsl.() -> Unit) -> FieldViolation {
            override fun deserialize(deserializer: KtMessageDeserializer): FieldViolation {
                var field = ""
                var description = ""
                var unknownFields: UnknownFieldSet.Builder? = null
                while (true) {
                    when(deserializer.readTag()) {
                        0 -> return FieldViolation(field,
                                description,
                                UnknownFieldSet.from(unknownFields))
                        10 -> field = deserializer.readString()
                        18 -> description = deserializer.readString()
                        else -> unknownFields = (unknownFields ?:
                                UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown())
                                }
                    }
                }
            }

            override fun invoke(dsl: FieldViolationDsl.() -> Unit): FieldViolation =
                    FieldViolationDsl().apply(dsl).build()
        }
    }
}

/**
 * Contains metadata about the request that clients can attach when filing a bug or providing other
 * forms of feedback.
 */
@KtGeneratedMessage("google.rpc.RequestInfo")
class RequestInfo private constructor(
    /**
     * An opaque string that should only be interpreted by the service generating it. For example,
     * it can be used to identify requests in the service's logs.
     */
    val requestId: String,
    /**
     * Any data that was used to serve this request. For example, an encrypted stack trace that can
     * be sent back to the service provider for debugging.
     */
    val servingData: String,
    val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : KtMessage {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
        var result = 0
        if (requestId.isNotEmpty()) {
            result += sizeof(Tag(1)) + sizeof(requestId) 
        }
        if (servingData.isNotEmpty()) {
            result += sizeof(Tag(2)) + sizeof(servingData) 
        }
        result += unknownFields.size()
        return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
        if (requestId.isNotEmpty()) {
            serializer.write(Tag(10)).write(requestId)
        }
        if (servingData.isNotEmpty()) {
            serializer.write(Tag(18)).write(servingData)
        }
        serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: Any?): Boolean = other is RequestInfo &&
        other.requestId == requestId &&
        other.servingData == servingData &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
        var result = unknownFields.hashCode()
        result = 31 * result + requestId.hashCode()
        result = 31 * result + servingData.hashCode()
        return result
    }

    override fun toString(): String = "RequestInfo(" +
        "requestId=$requestId, " +
        "servingData=$servingData, " +
        "unknownFields=$unknownFields)"

    fun copy(dsl: RequestInfoDsl.() -> Unit): RequestInfo = RequestInfo.Deserializer {
        requestId = [email protected]
        servingData = [email protected]
        unknownFields = [email protected]
        dsl()
    }

    class RequestInfoDsl {
        var requestId: String = ""

        var servingData: String = ""

        var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

        fun build(): RequestInfo = RequestInfo(requestId,
        servingData,
         unknownFields)
    }

    companion object Deserializer : KtDeserializer, (RequestInfoDsl.() ->
            Unit) -> RequestInfo {
        override fun deserialize(deserializer: KtMessageDeserializer): RequestInfo {
            var requestId = ""
            var servingData = ""
            var unknownFields: UnknownFieldSet.Builder? = null
            while (true) {
                when(deserializer.readTag()) {
                    0 -> return RequestInfo(requestId,
                            servingData,
                            UnknownFieldSet.from(unknownFields))
                    10 -> requestId = deserializer.readString()
                    18 -> servingData = deserializer.readString()
                    else -> unknownFields = (unknownFields ?:
                            UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
                }
            }
        }

        override fun invoke(dsl: RequestInfoDsl.() -> Unit): RequestInfo =
                RequestInfoDsl().apply(dsl).build()
    }
}

/**
 * Describes the resource that is being accessed.
 */
@KtGeneratedMessage("google.rpc.ResourceInfo")
class ResourceInfo private constructor(
    /**
     * A name for the type of resource being accessed, e.g. "sql table", "cloud storage bucket",
     * "file", "Google calendar"; or the type URL of the resource: e.g.
     * "type.googleapis.com/google.pubsub.v1.Topic".
     */
    val resourceType: String,
    /**
     * The name of the resource being accessed.  For example, a shared calendar name:
     * "[email protected]", if the current error is
     * [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
     */
    val resourceName: String,
    /**
     * The owner of the resource (optional). For example, "user:" or "project:".
     */
    val owner: String,
    /**
     * Describes what error is encountered when accessing this resource. For example, updating a
     * cloud project may require the `writer` permission on the developer console project.
     */
    val description: String,
    val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : KtMessage {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
        var result = 0
        if (resourceType.isNotEmpty()) {
            result += sizeof(Tag(1)) + sizeof(resourceType) 
        }
        if (resourceName.isNotEmpty()) {
            result += sizeof(Tag(2)) + sizeof(resourceName) 
        }
        if (owner.isNotEmpty()) {
            result += sizeof(Tag(3)) + sizeof(owner) 
        }
        if (description.isNotEmpty()) {
            result += sizeof(Tag(4)) + sizeof(description) 
        }
        result += unknownFields.size()
        return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
        if (resourceType.isNotEmpty()) {
            serializer.write(Tag(10)).write(resourceType)
        }
        if (resourceName.isNotEmpty()) {
            serializer.write(Tag(18)).write(resourceName)
        }
        if (owner.isNotEmpty()) {
            serializer.write(Tag(26)).write(owner)
        }
        if (description.isNotEmpty()) {
            serializer.write(Tag(34)).write(description)
        }
        serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: Any?): Boolean = other is ResourceInfo &&
        other.resourceType == resourceType &&
        other.resourceName == resourceName &&
        other.owner == owner &&
        other.description == description &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
        var result = unknownFields.hashCode()
        result = 31 * result + resourceType.hashCode()
        result = 31 * result + resourceName.hashCode()
        result = 31 * result + owner.hashCode()
        result = 31 * result + description.hashCode()
        return result
    }

    override fun toString(): String = "ResourceInfo(" +
        "resourceType=$resourceType, " +
        "resourceName=$resourceName, " +
        "owner=$owner, " +
        "description=$description, " +
        "unknownFields=$unknownFields)"

    fun copy(dsl: ResourceInfoDsl.() -> Unit): ResourceInfo = ResourceInfo.Deserializer {
        resourceType = [email protected]
        resourceName = [email protected]
        owner = [email protected]
        description = [email protected]
        unknownFields = [email protected]
        dsl()
    }

    class ResourceInfoDsl {
        var resourceType: String = ""

        var resourceName: String = ""

        var owner: String = ""

        var description: String = ""

        var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

        fun build(): ResourceInfo = ResourceInfo(resourceType,
        resourceName,
        owner,
        description,
         unknownFields)
    }

    companion object Deserializer : KtDeserializer, (ResourceInfoDsl.() ->
            Unit) -> ResourceInfo {
        override fun deserialize(deserializer: KtMessageDeserializer): ResourceInfo {
            var resourceType = ""
            var resourceName = ""
            var owner = ""
            var description = ""
            var unknownFields: UnknownFieldSet.Builder? = null
            while (true) {
                when(deserializer.readTag()) {
                    0 -> return ResourceInfo(resourceType,
                            resourceName,
                            owner,
                            description,
                            UnknownFieldSet.from(unknownFields))
                    10 -> resourceType = deserializer.readString()
                    18 -> resourceName = deserializer.readString()
                    26 -> owner = deserializer.readString()
                    34 -> description = deserializer.readString()
                    else -> unknownFields = (unknownFields ?:
                            UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
                }
            }
        }

        override fun invoke(dsl: ResourceInfoDsl.() -> Unit): ResourceInfo =
                ResourceInfoDsl().apply(dsl).build()
    }
}

/**
 * Provides links to documentation or for performing an out of band action. 
 *
 *  For example, if a quota check failed with an error indicating the calling project hasn't enabled
 * the accessed service, this can contain a URL pointing directly to the right place in the developer
 * console to flip the bit.
 */
@KtGeneratedMessage("google.rpc.Help")
class Help private constructor(
    /**
     * URL(s) pointing to additional information on handling the current error.
     */
    val links: List,
    val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : KtMessage {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
        var result = 0
        if (links.isNotEmpty()) {
            result += (sizeof(Tag(1)) * links.size) + links.sumOf { sizeof(it) } 
        }
        result += unknownFields.size()
        return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
        if (links.isNotEmpty()) {
            links.forEach { serializer.write(Tag(10)).write(it) }
        }
        serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: Any?): Boolean = other is Help &&
        other.links == links &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
        var result = unknownFields.hashCode()
        result = 31 * result + links.hashCode()
        return result
    }

    override fun toString(): String = "Help(" +
        "links=$links, " +
        "unknownFields=$unknownFields)"

    fun copy(dsl: HelpDsl.() -> Unit): Help = Help.Deserializer {
        links = [email protected]
        unknownFields = [email protected]
        dsl()
    }

    class HelpDsl {
        var links: List = emptyList()
            set(newValue) {
                field = copyList(newValue)
            }

        var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

        fun build(): Help = Help(finishList(links),
         unknownFields)
    }

    companion object Deserializer : KtDeserializer, (HelpDsl.() -> Unit) -> Help {
        override fun deserialize(deserializer: KtMessageDeserializer): Help {
            var links : MutableList? = null
            var unknownFields: UnknownFieldSet.Builder? = null
            while (true) {
                when(deserializer.readTag()) {
                    0 -> return Help(finishList(links),
                            UnknownFieldSet.from(unknownFields))
                    10 -> links = (links ?: mutableListOf()).apply {
                                   deserializer.readRepeated(false) {
                                       add(deserializer.readMessage(com.google.rpc.Help.Link))
                                   }
                               }
                    else -> unknownFields = (unknownFields ?:
                            UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
                }
            }
        }

        override fun invoke(dsl: HelpDsl.() -> Unit): Help = HelpDsl().apply(dsl).build()
    }

    /**
     * Describes a URL link.
     */
    @KtGeneratedMessage("google.rpc.Link")
    class Link private constructor(
        /**
         * Describes what the link offers.
         */
        val description: String,
        /**
         * The URL of the link.
         */
        val url: String,
        val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
    ) : KtMessage {
        override val messageSize: Int by lazy { messageSize() }

        private fun messageSize(): Int {
            var result = 0
            if (description.isNotEmpty()) {
                result += sizeof(Tag(1)) + sizeof(description) 
            }
            if (url.isNotEmpty()) {
                result += sizeof(Tag(2)) + sizeof(url) 
            }
            result += unknownFields.size()
            return result
        }

        override fun serialize(serializer: KtMessageSerializer) {
            if (description.isNotEmpty()) {
                serializer.write(Tag(10)).write(description)
            }
            if (url.isNotEmpty()) {
                serializer.write(Tag(18)).write(url)
            }
            serializer.writeUnknown(unknownFields)
        }

        override fun equals(other: Any?): Boolean = other is Link &&
            other.description == description &&
            other.url == url &&
            other.unknownFields == unknownFields

        override fun hashCode(): Int {
            var result = unknownFields.hashCode()
            result = 31 * result + description.hashCode()
            result = 31 * result + url.hashCode()
            return result
        }

        override fun toString(): String = "Link(" +
            "description=$description, " +
            "url=$url, " +
            "unknownFields=$unknownFields)"

        fun copy(dsl: LinkDsl.() -> Unit): Link = Link.Deserializer {
            description = [email protected]
            url = [email protected]
            unknownFields = [email protected]
            dsl()
        }

        class LinkDsl {
            var description: String = ""

            var url: String = ""

            var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

            fun build(): Link = Link(description,
            url,
             unknownFields)
        }

        companion object Deserializer : KtDeserializer, (LinkDsl.() -> Unit) -> Link {
            override fun deserialize(deserializer: KtMessageDeserializer): Link {
                var description = ""
                var url = ""
                var unknownFields: UnknownFieldSet.Builder? = null
                while (true) {
                    when(deserializer.readTag()) {
                        0 -> return Link(description,
                                url,
                                UnknownFieldSet.from(unknownFields))
                        10 -> description = deserializer.readString()
                        18 -> url = deserializer.readString()
                        else -> unknownFields = (unknownFields ?:
                                UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown())
                                }
                    }
                }
            }

            override fun invoke(dsl: LinkDsl.() -> Unit): Link = LinkDsl().apply(dsl).build()
        }
    }
}

/**
 * Provides a localized error message that is safe to return to the user which can be attached to an
 * RPC error.
 */
@KtGeneratedMessage("google.rpc.LocalizedMessage")
class LocalizedMessage private constructor(
    /**
     * The locale used following the specification defined at
     * http://www.rfc-editor.org/rfc/bcp/bcp47.txt. Examples are: "en-US", "fr-CH", "es-MX"
     */
    val locale: String,
    /**
     * The localized error message in the above locale.
     */
    val message: String,
    val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : KtMessage {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
        var result = 0
        if (locale.isNotEmpty()) {
            result += sizeof(Tag(1)) + sizeof(locale) 
        }
        if (message.isNotEmpty()) {
            result += sizeof(Tag(2)) + sizeof(message) 
        }
        result += unknownFields.size()
        return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
        if (locale.isNotEmpty()) {
            serializer.write(Tag(10)).write(locale)
        }
        if (message.isNotEmpty()) {
            serializer.write(Tag(18)).write(message)
        }
        serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: Any?): Boolean = other is LocalizedMessage &&
        other.locale == locale &&
        other.message == message &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
        var result = unknownFields.hashCode()
        result = 31 * result + locale.hashCode()
        result = 31 * result + message.hashCode()
        return result
    }

    override fun toString(): String = "LocalizedMessage(" +
        "locale=$locale, " +
        "message=$message, " +
        "unknownFields=$unknownFields)"

    fun copy(dsl: LocalizedMessageDsl.() -> Unit): LocalizedMessage =
            LocalizedMessage.Deserializer {
        locale = [email protected]
        message = [email protected]
        unknownFields = [email protected]
        dsl()
    }

    class LocalizedMessageDsl {
        var locale: String = ""

        var message: String = ""

        var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

        fun build(): LocalizedMessage = LocalizedMessage(locale,
        message,
         unknownFields)
    }

    companion object Deserializer : KtDeserializer,
            (LocalizedMessageDsl.() -> Unit) -> LocalizedMessage {
        override fun deserialize(deserializer: KtMessageDeserializer): LocalizedMessage {
            var locale = ""
            var message = ""
            var unknownFields: UnknownFieldSet.Builder? = null
            while (true) {
                when(deserializer.readTag()) {
                    0 -> return LocalizedMessage(locale,
                            message,
                            UnknownFieldSet.from(unknownFields))
                    10 -> locale = deserializer.readString()
                    18 -> message = deserializer.readString()
                    else -> unknownFields = (unknownFields ?:
                            UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
                }
            }
        }

        override fun invoke(dsl: LocalizedMessageDsl.() -> Unit): LocalizedMessage =
                LocalizedMessageDsl().apply(dsl).build()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy