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

commonMain.protokt.v1.google.rpc.context.attribute_context.kt Maven / Gradle / Ivy

// Generated by protokt version 1.0.0-alpha.8. Do not modify.
// Source: google/rpc/context/attribute_context.proto
@file:Suppress("DEPRECATION")

package protokt.v1.google.rpc.context

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.Duration
import protokt.v1.google.protobuf.Struct
import protokt.v1.google.protobuf.Timestamp
import kotlin.Boolean
import kotlin.Int
import kotlin.Long
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 kotlin.Any as KotlinAny
import protokt.v1.KtGeneratedMessage as V1KtGeneratedMessage
import protokt.v1.google.protobuf.Any as ProtobufAny

/**
 * This message defines the standard attribute vocabulary for Google APIs.
 *
 *  An attribute is a piece of metadata that describes an activity on a network service. For
 * example, the size of an HTTP request, or the status code of an HTTP response.
 *
 *  Each attribute has a type and a name, which is logically defined as a proto message field in
 * `AttributeContext`. The field type becomes the attribute type, and the field path becomes the
 * attribute name. For example, the attribute `source.ip` maps to field `AttributeContext.source.ip`.
 *
 *  This message definition is guaranteed not to have any wire breaking change. So you can use it
 * directly for passing attributes across different systems.
 *
 *  NOTE: Different system may generate different subset of attributes. Please verify the system
 * specification before relying on an attribute generated a system.
 */
@V1KtGeneratedMessage("google.rpc.context.AttributeContext")
@RtKtGeneratedMessage("google.rpc.context.AttributeContext")
public class AttributeContext private constructor(
  /**
   * The source of a network activity, such as starting a TCP connection. In a multi hop network
   * activity, the source represents the sender of the last hop.
   */
  public val source: Peer?,
  /**
   * The destination of a network activity, such as accepting a TCP connection. In a multi hop
   * network activity, the destination represents the receiver of the last hop.
   */
  public val destination: Peer?,
  /**
   * Represents a network request, such as an HTTP request.
   */
  public val request: Request?,
  /**
   * Represents a network response, such as an HTTP response.
   */
  public val response: Response?,
  /**
   * Represents a target resource that is involved with a network activity. If multiple resources
   * are involved with an activity, this must be the primary one.
   */
  public val resource: Resource?,
  /**
   * Represents an API operation that is involved to a network activity.
   */
  public val api: Api?,
  /**
   * The origin of a network activity. In a multi hop network activity, the origin represents the
   * sender of the first hop. For the first hop, the `source` and the `origin` must have the same
   * content.
   */
  public val origin: Peer?,
  /**
   * Supports extensions for advanced use cases, such as logs and metrics.
   */
  public val extensions: List,
  public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
  override val messageSize: Int by lazy { messageSize() }

  private fun messageSize(): Int {
    var result = 0
    if (source != null) {
      result += sizeOf(10u) + sizeOf(source)
    }
    if (destination != null) {
      result += sizeOf(18u) + sizeOf(destination)
    }
    if (request != null) {
      result += sizeOf(26u) + sizeOf(request)
    }
    if (response != null) {
      result += sizeOf(34u) + sizeOf(response)
    }
    if (resource != null) {
      result += sizeOf(42u) + sizeOf(resource)
    }
    if (api != null) {
      result += sizeOf(50u) + sizeOf(api)
    }
    if (origin != null) {
      result += sizeOf(58u) + sizeOf(origin)
    }
    if (extensions.isNotEmpty()) {
      result += (sizeOf(66u) * extensions.size) + extensions.sumOf { sizeOf(it) }
    }
    result += unknownFields.size()
    return result
  }

  override fun serialize(serializer: KtMessageSerializer) {
    if (source != null) {
      serializer.writeTag(10u).write(source)
    }
    if (destination != null) {
      serializer.writeTag(18u).write(destination)
    }
    if (request != null) {
      serializer.writeTag(26u).write(request)
    }
    if (response != null) {
      serializer.writeTag(34u).write(response)
    }
    if (resource != null) {
      serializer.writeTag(42u).write(resource)
    }
    if (api != null) {
      serializer.writeTag(50u).write(api)
    }
    if (origin != null) {
      serializer.writeTag(58u).write(origin)
    }
    extensions.forEach { serializer.writeTag(66u).write(it) }
    serializer.writeUnknown(unknownFields)
  }

  override fun equals(other: KotlinAny?): Boolean =
    other is AttributeContext &&
      other.source == source &&
      other.destination == destination &&
      other.request == request &&
      other.response == response &&
      other.resource == resource &&
      other.api == api &&
      other.origin == origin &&
      other.extensions == extensions &&
      other.unknownFields == unknownFields

  override fun hashCode(): Int {
    var result = unknownFields.hashCode()
    result = 31 * result + source.hashCode()
    result = 31 * result + destination.hashCode()
    result = 31 * result + request.hashCode()
    result = 31 * result + response.hashCode()
    result = 31 * result + resource.hashCode()
    result = 31 * result + api.hashCode()
    result = 31 * result + origin.hashCode()
    result = 31 * result + extensions.hashCode()
    return result
  }

  override fun toString(): String =
    "AttributeContext(" +
      "source=$source, " +
      "destination=$destination, " +
      "request=$request, " +
      "response=$response, " +
      "resource=$resource, " +
      "api=$api, " +
      "origin=$origin, " +
      "extensions=$extensions" +
      if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"

  public fun copy(builder: Builder.() -> Unit): AttributeContext =
    Builder().apply {
      source = [email protected]
      destination = [email protected]
      request = [email protected]
      response = [email protected]
      resource = [email protected]
      api = [email protected]
      origin = [email protected]
      extensions = [email protected]
      unknownFields = [email protected]
      builder()
    }.build()

  @KtBuilderDsl
  public class Builder {
    public var source: Peer? = null

    public var destination: Peer? = null

    public var request: Request? = null

    public var response: Response? = null

    public var resource: Resource? = null

    public var api: Api? = null

    public var origin: Peer? = null

    public var extensions: List = emptyList()
      set(newValue) {
        field = copyList(newValue)
      }

    public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

    public fun build(): AttributeContext =
      AttributeContext(
        source,
        destination,
        request,
        response,
        resource,
        api,
        origin,
        unmodifiableList(extensions),
        unknownFields
      )
  }

  public companion object Deserializer : AbstractKtDeserializer() {
    @JvmStatic
    override fun deserialize(deserializer: KtMessageDeserializer): AttributeContext {
      var source: Peer? = null
      var destination: Peer? = null
      var request: Request? = null
      var response: Response? = null
      var resource: Resource? = null
      var api: Api? = null
      var origin: Peer? = null
      var extensions: MutableList? = null
      var unknownFields: UnknownFieldSet.Builder? = null

      while (true) {
        when (deserializer.readTag()) {
          0 -> return AttributeContext(
            source,
            destination,
            request,
            response,
            resource,
            api,
            origin,
            unmodifiableList(extensions),
            UnknownFieldSet.from(unknownFields)
          )
          10 -> source = deserializer.readMessage(Peer)
          18 -> destination = deserializer.readMessage(Peer)
          26 -> request = deserializer.readMessage(Request)
          34 -> response = deserializer.readMessage(Response)
          42 -> resource = deserializer.readMessage(Resource)
          50 -> api = deserializer.readMessage(Api)
          58 -> origin = deserializer.readMessage(Peer)
          66 ->
            extensions =
              (extensions ?: mutableListOf()).apply {
                deserializer.readRepeated(false) {
                  add(deserializer.readMessage(ProtobufAny))
                }
              }
          else ->
            unknownFields =
              (unknownFields ?: UnknownFieldSet.Builder()).also {
                it.add(deserializer.readUnknown())
              }
        }
      }
    }

    @JvmStatic
    public operator fun invoke(dsl: Builder.() -> Unit): AttributeContext = Builder().apply(dsl).build()
  }

  /**
   * This message defines attributes for a node that handles a network request. The node can be
   * either a service or an application that sends, forwards, or receives the request. Service peers
   * should fill in `principal` and `labels` as appropriate.
   */
  @V1KtGeneratedMessage("google.rpc.context.Peer")
  @RtKtGeneratedMessage("google.rpc.context.Peer")
  public class Peer private constructor(
    /**
     * The IP address of the peer.
     */
    public val ip: String,
    /**
     * The network port of the peer.
     */
    public val port: Long,
    /**
     * The labels associated with the peer.
     */
    public val labels: Map,
    /**
     * The identity of this peer. Similar to `Request.auth.principal`, but relative to the peer
     * instead of the request. For example, the identity associated with a load balancer that forwarded
     * the request.
     */
    public val principal: String,
    /**
     * The CLDR country/region code associated with the above IP address. If the IP address is
     * private, the `region_code` should reflect the physical location where this peer is running.
     */
    public val regionCode: String,
    public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
  ) : AbstractKtMessage() {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
      var result = 0
      if (ip.isNotEmpty()) {
        result += sizeOf(10u) + sizeOf(ip)
      }
      if (port != 0L) {
        result += sizeOf(16u) + sizeOf(port)
      }
      if (labels.isNotEmpty()) {
        result +=
          sizeOf(labels, 50u) { k, v ->
            LabelsEntry.entrySize(k, v)
          }
      }
      if (principal.isNotEmpty()) {
        result += sizeOf(58u) + sizeOf(principal)
      }
      if (regionCode.isNotEmpty()) {
        result += sizeOf(66u) + sizeOf(regionCode)
      }
      result += unknownFields.size()
      return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
      if (ip.isNotEmpty()) {
        serializer.writeTag(10u).write(ip)
      }
      if (port != 0L) {
        serializer.writeTag(16u).write(port)
      }
      labels.entries.forEach {
        serializer.writeTag(50u).write(LabelsEntry(it.key, it.value))
      }
      if (principal.isNotEmpty()) {
        serializer.writeTag(58u).write(principal)
      }
      if (regionCode.isNotEmpty()) {
        serializer.writeTag(66u).write(regionCode)
      }
      serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: KotlinAny?): Boolean =
      other is Peer &&
        other.ip == ip &&
        other.port == port &&
        other.labels == labels &&
        other.principal == principal &&
        other.regionCode == regionCode &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
      var result = unknownFields.hashCode()
      result = 31 * result + ip.hashCode()
      result = 31 * result + port.hashCode()
      result = 31 * result + labels.hashCode()
      result = 31 * result + principal.hashCode()
      result = 31 * result + regionCode.hashCode()
      return result
    }

    override fun toString(): String =
      "Peer(" +
        "ip=$ip, " +
        "port=$port, " +
        "labels=$labels, " +
        "principal=$principal, " +
        "regionCode=$regionCode" +
        if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"

    public fun copy(builder: Builder.() -> Unit): Peer =
      Builder().apply {
        ip = [email protected]
        port = [email protected]
        labels = [email protected]
        principal = [email protected]
        regionCode = [email protected]
        unknownFields = [email protected]
        builder()
      }.build()

    @KtBuilderDsl
    public class Builder {
      public var ip: String = ""

      public var port: Long = 0L

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

      public var principal: String = ""

      public var regionCode: String = ""

      public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

      public fun build(): Peer =
        Peer(
          ip,
          port,
          unmodifiableMap(labels),
          principal,
          regionCode,
          unknownFields
        )
    }

    public companion object Deserializer : AbstractKtDeserializer() {
      @JvmStatic
      override fun deserialize(deserializer: KtMessageDeserializer): Peer {
        var ip = ""
        var port = 0L
        var labels: MutableMap? = null
        var principal = ""
        var regionCode = ""
        var unknownFields: UnknownFieldSet.Builder? = null

        while (true) {
          when (deserializer.readTag()) {
            0 -> return Peer(
              ip,
              port,
              unmodifiableMap(labels),
              principal,
              regionCode,
              UnknownFieldSet.from(unknownFields)
            )
            10 -> ip = deserializer.readString()
            16 -> port = deserializer.readInt64()
            50 ->
              labels =
                (labels ?: mutableMapOf()).apply {
                  deserializer.readRepeated(false) {
                    deserializer.readMessage(LabelsEntry).let {
                      put(it.key, it.value)
                    }
                  }
                }
            58 -> principal = deserializer.readString()
            66 -> regionCode = deserializer.readString()
            else ->
              unknownFields =
                (unknownFields ?: UnknownFieldSet.Builder()).also {
                  it.add(deserializer.readUnknown())
                }
          }
        }
      }

      @JvmStatic
      public operator fun invoke(dsl: Builder.() -> Unit): Peer = 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()
            }
          }
        }
      }
    }
  }

  /**
   * This message defines attributes associated with API operations, such as a network API request.
   * The terminology is based on the conventions used by Google APIs, Istio, and OpenAPI.
   */
  @V1KtGeneratedMessage("google.rpc.context.Api")
  @RtKtGeneratedMessage("google.rpc.context.Api")
  public class Api private constructor(
    /**
     * The API service name. It is a logical identifier for a networked API, such as
     * "pubsub.googleapis.com". The naming syntax depends on the API management system being used for
     * handling the request.
     */
    public val service: String,
    /**
     * The API operation name. For gRPC requests, it is the fully qualified API method name, such as
     * "google.pubsub.v1.Publisher.Publish". For OpenAPI requests, it is the `operationId`, such as
     * "getPet".
     */
    public val operation: String,
    /**
     * The API protocol used for sending the request, such as "http", "https", "grpc", or
     * "internal".
     */
    public val protocol: String,
    /**
     * The API version associated with the API operation above, such as "v1" or "v1alpha1".
     */
    public val version: String,
    public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
  ) : AbstractKtMessage() {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
      var result = 0
      if (service.isNotEmpty()) {
        result += sizeOf(10u) + sizeOf(service)
      }
      if (operation.isNotEmpty()) {
        result += sizeOf(18u) + sizeOf(operation)
      }
      if (protocol.isNotEmpty()) {
        result += sizeOf(26u) + sizeOf(protocol)
      }
      if (version.isNotEmpty()) {
        result += sizeOf(34u) + sizeOf(version)
      }
      result += unknownFields.size()
      return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
      if (service.isNotEmpty()) {
        serializer.writeTag(10u).write(service)
      }
      if (operation.isNotEmpty()) {
        serializer.writeTag(18u).write(operation)
      }
      if (protocol.isNotEmpty()) {
        serializer.writeTag(26u).write(protocol)
      }
      if (version.isNotEmpty()) {
        serializer.writeTag(34u).write(version)
      }
      serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: KotlinAny?): Boolean =
      other is Api &&
        other.service == service &&
        other.operation == operation &&
        other.protocol == protocol &&
        other.version == version &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
      var result = unknownFields.hashCode()
      result = 31 * result + service.hashCode()
      result = 31 * result + operation.hashCode()
      result = 31 * result + protocol.hashCode()
      result = 31 * result + version.hashCode()
      return result
    }

    override fun toString(): String =
      "Api(" +
        "service=$service, " +
        "operation=$operation, " +
        "protocol=$protocol, " +
        "version=$version" +
        if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"

    public fun copy(builder: Builder.() -> Unit): Api =
      Builder().apply {
        service = [email protected]
        operation = [email protected]
        protocol = [email protected]
        version = [email protected]
        unknownFields = [email protected]
        builder()
      }.build()

    @KtBuilderDsl
    public class Builder {
      public var service: String = ""

      public var operation: String = ""

      public var protocol: String = ""

      public var version: String = ""

      public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

      public fun build(): Api =
        Api(
          service,
          operation,
          protocol,
          version,
          unknownFields
        )
    }

    public companion object Deserializer : AbstractKtDeserializer() {
      @JvmStatic
      override fun deserialize(deserializer: KtMessageDeserializer): Api {
        var service = ""
        var operation = ""
        var protocol = ""
        var version = ""
        var unknownFields: UnknownFieldSet.Builder? = null

        while (true) {
          when (deserializer.readTag()) {
            0 -> return Api(
              service,
              operation,
              protocol,
              version,
              UnknownFieldSet.from(unknownFields)
            )
            10 -> service = deserializer.readString()
            18 -> operation = deserializer.readString()
            26 -> protocol = deserializer.readString()
            34 -> version = deserializer.readString()
            else ->
              unknownFields =
                (unknownFields ?: UnknownFieldSet.Builder()).also {
                  it.add(deserializer.readUnknown())
                }
          }
        }
      }

      @JvmStatic
      public operator fun invoke(dsl: Builder.() -> Unit): Api = Builder().apply(dsl).build()
    }
  }

  /**
   * This message defines request authentication attributes. Terminology is based on the JSON Web
   * Token (JWT) standard, but the terms also correlate to concepts in other standards.
   */
  @V1KtGeneratedMessage("google.rpc.context.Auth")
  @RtKtGeneratedMessage("google.rpc.context.Auth")
  public class Auth private constructor(
    /**
     * The authenticated principal. Reflects the issuer (`iss`) and subject (`sub`) claims within a
     * JWT. The issuer and subject should be `/` delimited, with `/` percent-encoded within the subject
     * fragment. For Google accounts, the principal format is: "https://accounts.google.com/{id}"
     */
    public val principal: String,
    /**
     * The intended audience(s) for this authentication information. Reflects the audience (`aud`)
     * claim within a JWT. The audience value(s) depends on the `issuer`, but typically include one or
     * more of the following pieces of information:
     *
     *  *  The services intended to receive the credential. For example,
     * ["https://pubsub.googleapis.com/", "https://storage.googleapis.com/"]. *  A set of service-based
     * scopes. For example,    ["https://www.googleapis.com/auth/cloud-platform"]. *  The client id of
     * an app, such as the Firebase project id for JWTs    from Firebase Auth.
     *
     *  Consult the documentation for the credential issuer to determine the information provided.
     */
    public val audiences: List,
    /**
     * The authorized presenter of the credential. Reflects the optional Authorized Presenter
     * (`azp`) claim within a JWT or the OAuth client id. For example, a Google Cloud Platform client
     * id looks as follows: "123456789012.apps.googleusercontent.com".
     */
    public val presenter: String,
    /**
     * Structured claims presented with the credential. JWTs include `{key: value}` pairs for
     * standard and private claims. The following is a subset of the standard required and optional
     * claims that would typically be presented for a Google-based JWT:
     *
     *     {'iss': 'accounts.google.com',     'sub': '113289723416554971153',     'aud':
     * ['123456789012', 'pubsub.googleapis.com'],     'azp': '123456789012.apps.googleusercontent.com',
     *     'email': '[email protected]',     'iat': 1353601026,     'exp': 1353604926}
     *
     *  SAML assertions are similarly specified, but with an identity provider dependent structure.
     */
    public val claims: Struct?,
    /**
     * A list of access level resource names that allow resources to be accessed by authenticated
     * requester. It is part of Secure GCP processing for the incoming request. An access level string
     * has the format: "//{api_service_name}/accessPolicies/{policy_id}/accessLevels/{short_name}"
     *
     *  Example:
     * "//accesscontextmanager.googleapis.com/accessPolicies/MY_POLICY_ID/accessLevels/MY_LEVEL"
     */
    public val accessLevels: List,
    public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
  ) : AbstractKtMessage() {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
      var result = 0
      if (principal.isNotEmpty()) {
        result += sizeOf(10u) + sizeOf(principal)
      }
      if (audiences.isNotEmpty()) {
        result += (sizeOf(18u) * audiences.size) + audiences.sumOf { sizeOf(it) }
      }
      if (presenter.isNotEmpty()) {
        result += sizeOf(26u) + sizeOf(presenter)
      }
      if (claims != null) {
        result += sizeOf(34u) + sizeOf(claims)
      }
      if (accessLevels.isNotEmpty()) {
        result += (sizeOf(42u) * accessLevels.size) + accessLevels.sumOf { sizeOf(it) }
      }
      result += unknownFields.size()
      return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
      if (principal.isNotEmpty()) {
        serializer.writeTag(10u).write(principal)
      }
      audiences.forEach { serializer.writeTag(18u).write(it) }
      if (presenter.isNotEmpty()) {
        serializer.writeTag(26u).write(presenter)
      }
      if (claims != null) {
        serializer.writeTag(34u).write(claims)
      }
      accessLevels.forEach { serializer.writeTag(42u).write(it) }
      serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: KotlinAny?): Boolean =
      other is Auth &&
        other.principal == principal &&
        other.audiences == audiences &&
        other.presenter == presenter &&
        other.claims == claims &&
        other.accessLevels == accessLevels &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
      var result = unknownFields.hashCode()
      result = 31 * result + principal.hashCode()
      result = 31 * result + audiences.hashCode()
      result = 31 * result + presenter.hashCode()
      result = 31 * result + claims.hashCode()
      result = 31 * result + accessLevels.hashCode()
      return result
    }

    override fun toString(): String =
      "Auth(" +
        "principal=$principal, " +
        "audiences=$audiences, " +
        "presenter=$presenter, " +
        "claims=$claims, " +
        "accessLevels=$accessLevels" +
        if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"

    public fun copy(builder: Builder.() -> Unit): Auth =
      Builder().apply {
        principal = [email protected]
        audiences = [email protected]
        presenter = [email protected]
        claims = [email protected]
        accessLevels = [email protected]
        unknownFields = [email protected]
        builder()
      }.build()

    @KtBuilderDsl
    public class Builder {
      public var principal: String = ""

      public var audiences: List = emptyList()
        set(newValue) {
          field = copyList(newValue)
        }

      public var presenter: String = ""

      public var claims: Struct? = null

      public var accessLevels: List = emptyList()
        set(newValue) {
          field = copyList(newValue)
        }

      public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

      public fun build(): Auth =
        Auth(
          principal,
          unmodifiableList(audiences),
          presenter,
          claims,
          unmodifiableList(accessLevels),
          unknownFields
        )
    }

    public companion object Deserializer : AbstractKtDeserializer() {
      @JvmStatic
      override fun deserialize(deserializer: KtMessageDeserializer): Auth {
        var principal = ""
        var audiences: MutableList? = null
        var presenter = ""
        var claims: Struct? = null
        var accessLevels: MutableList? = null
        var unknownFields: UnknownFieldSet.Builder? = null

        while (true) {
          when (deserializer.readTag()) {
            0 -> return Auth(
              principal,
              unmodifiableList(audiences),
              presenter,
              claims,
              unmodifiableList(accessLevels),
              UnknownFieldSet.from(unknownFields)
            )
            10 -> principal = deserializer.readString()
            18 ->
              audiences =
                (audiences ?: mutableListOf()).apply {
                  deserializer.readRepeated(false) {
                    add(deserializer.readString())
                  }
                }
            26 -> presenter = deserializer.readString()
            34 -> claims = deserializer.readMessage(Struct)
            42 ->
              accessLevels =
                (accessLevels ?: mutableListOf()).apply {
                  deserializer.readRepeated(false) {
                    add(deserializer.readString())
                  }
                }
            else ->
              unknownFields =
                (unknownFields ?: UnknownFieldSet.Builder()).also {
                  it.add(deserializer.readUnknown())
                }
          }
        }
      }

      @JvmStatic
      public operator fun invoke(dsl: Builder.() -> Unit): Auth = Builder().apply(dsl).build()
    }
  }

  /**
   * This message defines attributes for an HTTP request. If the actual request is not an HTTP
   * request, the runtime system should try to map the actual request to an equivalent HTTP request.
   */
  @V1KtGeneratedMessage("google.rpc.context.Request")
  @RtKtGeneratedMessage("google.rpc.context.Request")
  public class Request private constructor(
    /**
     * The unique ID for a request, which can be propagated to downstream systems. The ID should
     * have low probability of collision within a single day for a specific service.
     */
    public val id: String,
    /**
     * The HTTP request method, such as `GET`, `POST`.
     */
    public val method: String,
    /**
     * The HTTP request headers. If multiple headers share the same key, they must be merged
     * according to the HTTP spec. All header keys must be lowercased, because HTTP header keys are
     * case-insensitive.
     */
    public val headers: Map,
    /**
     * The HTTP URL path, excluding the query parameters.
     */
    public val path: String,
    /**
     * The HTTP request `Host` header value.
     */
    public val host: String,
    /**
     * The HTTP URL scheme, such as `http` and `https`.
     */
    public val scheme: String,
    /**
     * The HTTP URL query in the format of `name1=value1&name2=value2`, as it appears in the first
     * line of the HTTP request. No decoding is performed.
     */
    public val query: String,
    /**
     * The timestamp when the `destination` service receives the last byte of the request.
     */
    public val time: Timestamp?,
    /**
     * The HTTP request size in bytes. If unknown, it must be -1.
     */
    public val size: Long,
    /**
     * The network protocol used with the request, such as "http/1.1", "spdy/3", "h2", "h2c",
     * "webrtc", "tcp", "udp", "quic". See
     * https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids
     * for details.
     */
    public val protocol: String,
    /**
     * A special parameter for request reason. It is used by security systems to associate auditing
     * information with a request.
     */
    public val reason: String,
    /**
     * The request authentication. May be absent for unauthenticated requests. Derived from the HTTP
     * request `Authorization` header or equivalent.
     */
    public val auth: Auth?,
    public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
  ) : AbstractKtMessage() {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
      var result = 0
      if (id.isNotEmpty()) {
        result += sizeOf(10u) + sizeOf(id)
      }
      if (method.isNotEmpty()) {
        result += sizeOf(18u) + sizeOf(method)
      }
      if (headers.isNotEmpty()) {
        result +=
          sizeOf(headers, 26u) { k, v ->
            HeadersEntry.entrySize(k, v)
          }
      }
      if (path.isNotEmpty()) {
        result += sizeOf(34u) + sizeOf(path)
      }
      if (host.isNotEmpty()) {
        result += sizeOf(42u) + sizeOf(host)
      }
      if (scheme.isNotEmpty()) {
        result += sizeOf(50u) + sizeOf(scheme)
      }
      if (query.isNotEmpty()) {
        result += sizeOf(58u) + sizeOf(query)
      }
      if (time != null) {
        result += sizeOf(74u) + sizeOf(time)
      }
      if (size != 0L) {
        result += sizeOf(80u) + sizeOf(size)
      }
      if (protocol.isNotEmpty()) {
        result += sizeOf(90u) + sizeOf(protocol)
      }
      if (reason.isNotEmpty()) {
        result += sizeOf(98u) + sizeOf(reason)
      }
      if (auth != null) {
        result += sizeOf(106u) + sizeOf(auth)
      }
      result += unknownFields.size()
      return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
      if (id.isNotEmpty()) {
        serializer.writeTag(10u).write(id)
      }
      if (method.isNotEmpty()) {
        serializer.writeTag(18u).write(method)
      }
      headers.entries.forEach {
        serializer.writeTag(26u).write(HeadersEntry(it.key, it.value))
      }
      if (path.isNotEmpty()) {
        serializer.writeTag(34u).write(path)
      }
      if (host.isNotEmpty()) {
        serializer.writeTag(42u).write(host)
      }
      if (scheme.isNotEmpty()) {
        serializer.writeTag(50u).write(scheme)
      }
      if (query.isNotEmpty()) {
        serializer.writeTag(58u).write(query)
      }
      if (time != null) {
        serializer.writeTag(74u).write(time)
      }
      if (size != 0L) {
        serializer.writeTag(80u).write(size)
      }
      if (protocol.isNotEmpty()) {
        serializer.writeTag(90u).write(protocol)
      }
      if (reason.isNotEmpty()) {
        serializer.writeTag(98u).write(reason)
      }
      if (auth != null) {
        serializer.writeTag(106u).write(auth)
      }
      serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: KotlinAny?): Boolean =
      other is Request &&
        other.id == id &&
        other.method == method &&
        other.headers == headers &&
        other.path == path &&
        other.host == host &&
        other.scheme == scheme &&
        other.query == query &&
        other.time == time &&
        other.size == size &&
        other.protocol == protocol &&
        other.reason == reason &&
        other.auth == auth &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
      var result = unknownFields.hashCode()
      result = 31 * result + id.hashCode()
      result = 31 * result + method.hashCode()
      result = 31 * result + headers.hashCode()
      result = 31 * result + path.hashCode()
      result = 31 * result + host.hashCode()
      result = 31 * result + scheme.hashCode()
      result = 31 * result + query.hashCode()
      result = 31 * result + time.hashCode()
      result = 31 * result + size.hashCode()
      result = 31 * result + protocol.hashCode()
      result = 31 * result + reason.hashCode()
      result = 31 * result + auth.hashCode()
      return result
    }

    override fun toString(): String =
      "Request(" +
        "id=$id, " +
        "method=$method, " +
        "headers=$headers, " +
        "path=$path, " +
        "host=$host, " +
        "scheme=$scheme, " +
        "query=$query, " +
        "time=$time, " +
        "size=$size, " +
        "protocol=$protocol, " +
        "reason=$reason, " +
        "auth=$auth" +
        if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"

    public fun copy(builder: Builder.() -> Unit): Request =
      Builder().apply {
        id = [email protected]
        method = [email protected]
        headers = [email protected]
        path = [email protected]
        host = [email protected]
        scheme = [email protected]
        query = [email protected]
        time = [email protected]
        size = [email protected]
        protocol = [email protected]
        reason = [email protected]
        auth = [email protected]
        unknownFields = [email protected]
        builder()
      }.build()

    @KtBuilderDsl
    public class Builder {
      public var id: String = ""

      public var method: String = ""

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

      public var path: String = ""

      public var host: String = ""

      public var scheme: String = ""

      public var query: String = ""

      public var time: Timestamp? = null

      public var size: Long = 0L

      public var protocol: String = ""

      public var reason: String = ""

      public var auth: Auth? = null

      public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

      public fun build(): Request =
        Request(
          id,
          method,
          unmodifiableMap(headers),
          path,
          host,
          scheme,
          query,
          time,
          size,
          protocol,
          reason,
          auth,
          unknownFields
        )
    }

    public companion object Deserializer : AbstractKtDeserializer() {
      @JvmStatic
      override fun deserialize(deserializer: KtMessageDeserializer): Request {
        var id = ""
        var method = ""
        var headers: MutableMap? = null
        var path = ""
        var host = ""
        var scheme = ""
        var query = ""
        var time: Timestamp? = null
        var size = 0L
        var protocol = ""
        var reason = ""
        var auth: Auth? = null
        var unknownFields: UnknownFieldSet.Builder? = null

        while (true) {
          when (deserializer.readTag()) {
            0 -> return Request(
              id,
              method,
              unmodifiableMap(headers),
              path,
              host,
              scheme,
              query,
              time,
              size,
              protocol,
              reason,
              auth,
              UnknownFieldSet.from(unknownFields)
            )
            10 -> id = deserializer.readString()
            18 -> method = deserializer.readString()
            26 ->
              headers =
                (headers ?: mutableMapOf()).apply {
                  deserializer.readRepeated(false) {
                    deserializer.readMessage(HeadersEntry).let {
                      put(it.key, it.value)
                    }
                  }
                }
            34 -> path = deserializer.readString()
            42 -> host = deserializer.readString()
            50 -> scheme = deserializer.readString()
            58 -> query = deserializer.readString()
            74 -> time = deserializer.readMessage(Timestamp)
            80 -> size = deserializer.readInt64()
            90 -> protocol = deserializer.readString()
            98 -> reason = deserializer.readString()
            106 -> auth = deserializer.readMessage(Auth)
            else ->
              unknownFields =
                (unknownFields ?: UnknownFieldSet.Builder()).also {
                  it.add(deserializer.readUnknown())
                }
          }
        }
      }

      @JvmStatic
      public operator fun invoke(dsl: Builder.() -> Unit): Request = Builder().apply(dsl).build()
    }

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

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

  /**
   * This message defines attributes for a typical network response. It generally models semantics
   * of an HTTP response.
   */
  @V1KtGeneratedMessage("google.rpc.context.Response")
  @RtKtGeneratedMessage("google.rpc.context.Response")
  public class Response private constructor(
    /**
     * The HTTP response status code, such as `200` and `404`.
     */
    public val code: Long,
    /**
     * The HTTP response size in bytes. If unknown, it must be -1.
     */
    public val size: Long,
    /**
     * The HTTP response headers. If multiple headers share the same key, they must be merged
     * according to HTTP spec. All header keys must be lowercased, because HTTP header keys are
     * case-insensitive.
     */
    public val headers: Map,
    /**
     * The timestamp when the `destination` service sends the last byte of the response.
     */
    public val time: Timestamp?,
    /**
     * The amount of time it takes the backend service to fully respond to a request. Measured from
     * when the destination service starts to send the request to the backend until when the
     * destination service receives the complete response from the backend.
     */
    public val backendLatency: Duration?,
    public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
  ) : AbstractKtMessage() {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
      var result = 0
      if (code != 0L) {
        result += sizeOf(8u) + sizeOf(code)
      }
      if (size != 0L) {
        result += sizeOf(16u) + sizeOf(size)
      }
      if (headers.isNotEmpty()) {
        result +=
          sizeOf(headers, 26u) { k, v ->
            HeadersEntry.entrySize(k, v)
          }
      }
      if (time != null) {
        result += sizeOf(34u) + sizeOf(time)
      }
      if (backendLatency != null) {
        result += sizeOf(42u) + sizeOf(backendLatency)
      }
      result += unknownFields.size()
      return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
      if (code != 0L) {
        serializer.writeTag(8u).write(code)
      }
      if (size != 0L) {
        serializer.writeTag(16u).write(size)
      }
      headers.entries.forEach {
        serializer.writeTag(26u).write(HeadersEntry(it.key, it.value))
      }
      if (time != null) {
        serializer.writeTag(34u).write(time)
      }
      if (backendLatency != null) {
        serializer.writeTag(42u).write(backendLatency)
      }
      serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: KotlinAny?): Boolean =
      other is Response &&
        other.code == code &&
        other.size == size &&
        other.headers == headers &&
        other.time == time &&
        other.backendLatency == backendLatency &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
      var result = unknownFields.hashCode()
      result = 31 * result + code.hashCode()
      result = 31 * result + size.hashCode()
      result = 31 * result + headers.hashCode()
      result = 31 * result + time.hashCode()
      result = 31 * result + backendLatency.hashCode()
      return result
    }

    override fun toString(): String =
      "Response(" +
        "code=$code, " +
        "size=$size, " +
        "headers=$headers, " +
        "time=$time, " +
        "backendLatency=$backendLatency" +
        if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"

    public fun copy(builder: Builder.() -> Unit): Response =
      Builder().apply {
        code = [email protected]
        size = [email protected]
        headers = [email protected]
        time = [email protected]
        backendLatency = [email protected]
        unknownFields = [email protected]
        builder()
      }.build()

    @KtBuilderDsl
    public class Builder {
      public var code: Long = 0L

      public var size: Long = 0L

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

      public var time: Timestamp? = null

      public var backendLatency: Duration? = null

      public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

      public fun build(): Response =
        Response(
          code,
          size,
          unmodifiableMap(headers),
          time,
          backendLatency,
          unknownFields
        )
    }

    public companion object Deserializer : AbstractKtDeserializer() {
      @JvmStatic
      override fun deserialize(deserializer: KtMessageDeserializer): Response {
        var code = 0L
        var size = 0L
        var headers: MutableMap? = null
        var time: Timestamp? = null
        var backendLatency: Duration? = null
        var unknownFields: UnknownFieldSet.Builder? = null

        while (true) {
          when (deserializer.readTag()) {
            0 -> return Response(
              code,
              size,
              unmodifiableMap(headers),
              time,
              backendLatency,
              UnknownFieldSet.from(unknownFields)
            )
            8 -> code = deserializer.readInt64()
            16 -> size = deserializer.readInt64()
            26 ->
              headers =
                (headers ?: mutableMapOf()).apply {
                  deserializer.readRepeated(false) {
                    deserializer.readMessage(HeadersEntry).let {
                      put(it.key, it.value)
                    }
                  }
                }
            34 -> time = deserializer.readMessage(Timestamp)
            42 -> backendLatency = deserializer.readMessage(Duration)
            else ->
              unknownFields =
                (unknownFields ?: UnknownFieldSet.Builder()).also {
                  it.add(deserializer.readUnknown())
                }
          }
        }
      }

      @JvmStatic
      public operator fun invoke(dsl: Builder.() -> Unit): Response = Builder().apply(dsl).build()
    }

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

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

  /**
   * This message defines core attributes for a resource. A resource is an addressable (named)
   * entity provided by the destination service. For example, a file stored on a network storage
   * service.
   */
  @V1KtGeneratedMessage("google.rpc.context.Resource")
  @RtKtGeneratedMessage("google.rpc.context.Resource")
  public class Resource private constructor(
    /**
     * The name of the service that this resource belongs to, such as `pubsub.googleapis.com`. The
     * service may be different from the DNS hostname that actually serves the request.
     */
    public val service: String,
    /**
     * The stable identifier (name) of a resource on the `service`. A resource can be logically
     * identified as "//{resource.service}/{resource.name}". The differences between a resource name
     * and a URI are:
     *
     *  *   Resource name is a logical identifier, independent of network     protocol and API
     * version. For example,     `//pubsub.googleapis.com/projects/123/topics/news-feed`. *   URI often
     * includes protocol and version information, so it can     be used directly by applications. For
     * example,     `https://pubsub.googleapis.com/v1/projects/123/topics/news-feed`.
     *
     *  See https://cloud.google.com/apis/design/resource_names for details.
     */
    public val name: String,
    /**
     * The type of the resource. The syntax is platform-specific because different platforms define
     * their resources differently.
     *
     *  For Google APIs, the type format must be "{service}/{kind}", such as
     * "pubsub.googleapis.com/Topic".
     */
    public val type: String,
    /**
     * The labels or tags on the resource, such as AWS resource tags and Kubernetes resource labels.
     */
    public val labels: Map,
    /**
     * The unique identifier of the resource. UID is unique in the time and space for this resource
     * within the scope of the service. It is typically generated by the server on successful creation
     * of a resource and must not be changed. UID is used to uniquely identify resources with resource
     * name reuses. This should be a UUID4.
     */
    public val uid: String,
    /**
     * Annotations is an unstructured key-value map stored with a resource that may be set by
     * external tools to store and retrieve arbitrary metadata. They are not queryable and should be
     * preserved when modifying objects.
     *
     *  More info: https://kubernetes.io/docs/user-guide/annotations
     */
    public val annotations: Map,
    /**
     * Mutable. The display name set by clients. Must be <= 63 characters.
     */
    public val displayName: String,
    /**
     * Output only. The timestamp when the resource was created. This may be either the time
     * creation was initiated or when it was completed.
     */
    public val createTime: Timestamp?,
    /**
     * Output only. The timestamp when the resource was last updated. Any change to the resource
     * made by users must refresh this value. Changes to a resource made by the service should refresh
     * this value.
     */
    public val updateTime: Timestamp?,
    /**
     * Output only. The timestamp when the resource was deleted. If the resource is not deleted,
     * this must be empty.
     */
    public val deleteTime: Timestamp?,
    /**
     * Output only. An opaque value that uniquely identifies a version or generation of a resource.
     * It can be used to confirm that the client and server agree on the ordering of a resource being
     * written.
     */
    public val etag: String,
    /**
     * Immutable. The location of the resource. The location encoding is specific to the service
     * provider, and new encoding may be introduced as the service evolves.
     *
     *  For Google Cloud products, the encoding is what is used by Google Cloud APIs, such as
     * `us-east1`, `aws-us-east-1`, and `azure-eastus2`. The semantics of `location` is identical to
     * the `cloud.googleapis.com/location` label used by some Google Cloud APIs.
     */
    public val location: String,
    public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
  ) : AbstractKtMessage() {
    override val messageSize: Int by lazy { messageSize() }

    private fun messageSize(): Int {
      var result = 0
      if (service.isNotEmpty()) {
        result += sizeOf(10u) + sizeOf(service)
      }
      if (name.isNotEmpty()) {
        result += sizeOf(18u) + sizeOf(name)
      }
      if (type.isNotEmpty()) {
        result += sizeOf(26u) + sizeOf(type)
      }
      if (labels.isNotEmpty()) {
        result +=
          sizeOf(labels, 34u) { k, v ->
            LabelsEntry.entrySize(k, v)
          }
      }
      if (uid.isNotEmpty()) {
        result += sizeOf(42u) + sizeOf(uid)
      }
      if (annotations.isNotEmpty()) {
        result +=
          sizeOf(annotations, 50u) { k, v ->
            AnnotationsEntry.entrySize(k, v)
          }
      }
      if (displayName.isNotEmpty()) {
        result += sizeOf(58u) + sizeOf(displayName)
      }
      if (createTime != null) {
        result += sizeOf(66u) + sizeOf(createTime)
      }
      if (updateTime != null) {
        result += sizeOf(74u) + sizeOf(updateTime)
      }
      if (deleteTime != null) {
        result += sizeOf(82u) + sizeOf(deleteTime)
      }
      if (etag.isNotEmpty()) {
        result += sizeOf(90u) + sizeOf(etag)
      }
      if (location.isNotEmpty()) {
        result += sizeOf(98u) + sizeOf(location)
      }
      result += unknownFields.size()
      return result
    }

    override fun serialize(serializer: KtMessageSerializer) {
      if (service.isNotEmpty()) {
        serializer.writeTag(10u).write(service)
      }
      if (name.isNotEmpty()) {
        serializer.writeTag(18u).write(name)
      }
      if (type.isNotEmpty()) {
        serializer.writeTag(26u).write(type)
      }
      labels.entries.forEach {
        serializer.writeTag(34u).write(LabelsEntry(it.key, it.value))
      }
      if (uid.isNotEmpty()) {
        serializer.writeTag(42u).write(uid)
      }
      annotations.entries.forEach {
        serializer.writeTag(50u).write(AnnotationsEntry(it.key, it.value))
      }
      if (displayName.isNotEmpty()) {
        serializer.writeTag(58u).write(displayName)
      }
      if (createTime != null) {
        serializer.writeTag(66u).write(createTime)
      }
      if (updateTime != null) {
        serializer.writeTag(74u).write(updateTime)
      }
      if (deleteTime != null) {
        serializer.writeTag(82u).write(deleteTime)
      }
      if (etag.isNotEmpty()) {
        serializer.writeTag(90u).write(etag)
      }
      if (location.isNotEmpty()) {
        serializer.writeTag(98u).write(location)
      }
      serializer.writeUnknown(unknownFields)
    }

    override fun equals(other: KotlinAny?): Boolean =
      other is Resource &&
        other.service == service &&
        other.name == name &&
        other.type == type &&
        other.labels == labels &&
        other.uid == uid &&
        other.annotations == annotations &&
        other.displayName == displayName &&
        other.createTime == createTime &&
        other.updateTime == updateTime &&
        other.deleteTime == deleteTime &&
        other.etag == etag &&
        other.location == location &&
        other.unknownFields == unknownFields

    override fun hashCode(): Int {
      var result = unknownFields.hashCode()
      result = 31 * result + service.hashCode()
      result = 31 * result + name.hashCode()
      result = 31 * result + type.hashCode()
      result = 31 * result + labels.hashCode()
      result = 31 * result + uid.hashCode()
      result = 31 * result + annotations.hashCode()
      result = 31 * result + displayName.hashCode()
      result = 31 * result + createTime.hashCode()
      result = 31 * result + updateTime.hashCode()
      result = 31 * result + deleteTime.hashCode()
      result = 31 * result + etag.hashCode()
      result = 31 * result + location.hashCode()
      return result
    }

    override fun toString(): String =
      "Resource(" +
        "service=$service, " +
        "name=$name, " +
        "type=$type, " +
        "labels=$labels, " +
        "uid=$uid, " +
        "annotations=$annotations, " +
        "displayName=$displayName, " +
        "createTime=$createTime, " +
        "updateTime=$updateTime, " +
        "deleteTime=$deleteTime, " +
        "etag=$etag, " +
        "location=$location" +
        if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"

    public fun copy(builder: Builder.() -> Unit): Resource =
      Builder().apply {
        service = [email protected]
        name = [email protected]
        type = [email protected]
        labels = [email protected]
        uid = [email protected]
        annotations = [email protected]
        displayName = [email protected]
        createTime = [email protected]
        updateTime = [email protected]
        deleteTime = [email protected]
        etag = [email protected]
        location = [email protected]
        unknownFields = [email protected]
        builder()
      }.build()

    @KtBuilderDsl
    public class Builder {
      public var service: String = ""

      public var name: String = ""

      public var type: String = ""

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

      public var uid: String = ""

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

      public var displayName: String = ""

      public var createTime: Timestamp? = null

      public var updateTime: Timestamp? = null

      public var deleteTime: Timestamp? = null

      public var etag: String = ""

      public var location: String = ""

      public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

      public fun build(): Resource =
        Resource(
          service,
          name,
          type,
          unmodifiableMap(labels),
          uid,
          unmodifiableMap(annotations),
          displayName,
          createTime,
          updateTime,
          deleteTime,
          etag,
          location,
          unknownFields
        )
    }

    public companion object Deserializer : AbstractKtDeserializer() {
      @JvmStatic
      override fun deserialize(deserializer: KtMessageDeserializer): Resource {
        var service = ""
        var name = ""
        var type = ""
        var labels: MutableMap? = null
        var uid = ""
        var annotations: MutableMap? = null
        var displayName = ""
        var createTime: Timestamp? = null
        var updateTime: Timestamp? = null
        var deleteTime: Timestamp? = null
        var etag = ""
        var location = ""
        var unknownFields: UnknownFieldSet.Builder? = null

        while (true) {
          when (deserializer.readTag()) {
            0 -> return Resource(
              service,
              name,
              type,
              unmodifiableMap(labels),
              uid,
              unmodifiableMap(annotations),
              displayName,
              createTime,
              updateTime,
              deleteTime,
              etag,
              location,
              UnknownFieldSet.from(unknownFields)
            )
            10 -> service = deserializer.readString()
            18 -> name = deserializer.readString()
            26 -> type = deserializer.readString()
            34 ->
              labels =
                (labels ?: mutableMapOf()).apply {
                  deserializer.readRepeated(false) {
                    deserializer.readMessage(LabelsEntry).let {
                      put(it.key, it.value)
                    }
                  }
                }
            42 -> uid = deserializer.readString()
            50 ->
              annotations =
                (annotations ?: mutableMapOf()).apply {
                  deserializer.readRepeated(false) {
                    deserializer.readMessage(AnnotationsEntry).let {
                      put(it.key, it.value)
                    }
                  }
                }
            58 -> displayName = deserializer.readString()
            66 -> createTime = deserializer.readMessage(Timestamp)
            74 -> updateTime = deserializer.readMessage(Timestamp)
            82 -> deleteTime = deserializer.readMessage(Timestamp)
            90 -> etag = deserializer.readString()
            98 -> location = deserializer.readString()
            else ->
              unknownFields =
                (unknownFields ?: UnknownFieldSet.Builder()).also {
                  it.add(deserializer.readUnknown())
                }
          }
        }
      }

      @JvmStatic
      public operator fun invoke(dsl: Builder.() -> Unit): Resource = 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()
            }
          }
        }
      }
    }

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy