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

commonMain.protokt.v1.google.api.config_change.kt Maven / Gradle / Ivy

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

package protokt.v1.google.api

import protokt.v1.AbstractKtDeserializer
import protokt.v1.AbstractKtMessage
import protokt.v1.Collections.copyList
import protokt.v1.Collections.unmodifiableList
import protokt.v1.KtBuilderDsl
import protokt.v1.KtEnum
import protokt.v1.KtEnumDeserializer
import protokt.v1.KtMessageDeserializer
import protokt.v1.KtMessageSerializer
import protokt.v1.SizeCodecs.sizeOf
import protokt.v1.UnknownFieldSet
import kotlin.Any
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.MutableList
import kotlin.jvm.JvmStatic
import com.toasttab.protokt.rt.KtGeneratedMessage as RtKtGeneratedMessage
import protokt.v1.KtGeneratedMessage as V1KtGeneratedMessage

/**
 * Output generated from semantically comparing two versions of a service configuration.
 *
 *  Includes detailed information about a field that have changed with applicable advice about
 * potential consequences for the change, such as backwards-incompatibility.
 */
public sealed class ChangeType(
  override val `value`: Int,
  override val name: String
) : KtEnum() {
  /**
   * Object hierarchy path to the change, with levels separated by a '.' character. For repeated
   * fields, an applicable unique identifier field is used for the index (usually selector, name, or
   * id). For maps, the term 'key' is used. If the field has no unique identifier, the numeric index is
   * used. Examples: - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction -
   * quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value -
   * logging.producer_destinations[0]
   */
  public object CHANGE_TYPE_UNSPECIFIED : ChangeType(0, "CHANGE_TYPE_UNSPECIFIED")

  /**
   * Value of the changed object in the old Service configuration, in JSON format. This field will
   * not be populated if ChangeType == ADDED.
   */
  public object ADDED : ChangeType(1, "ADDED")

  /**
   * Value of the changed object in the new Service configuration, in JSON format. This field will
   * not be populated if ChangeType == REMOVED.
   */
  public object REMOVED : ChangeType(2, "REMOVED")

  /**
   * The type for this change, either ADDED, REMOVED, or MODIFIED.
   */
  public object MODIFIED : ChangeType(3, "MODIFIED")

  public class UNRECOGNIZED(
    `value`: Int
  ) : ChangeType(value, "UNRECOGNIZED")

  public companion object Deserializer : KtEnumDeserializer {
    override fun from(`value`: Int): ChangeType =
      when (value) {
        0 -> CHANGE_TYPE_UNSPECIFIED
        1 -> ADDED
        2 -> REMOVED
        3 -> MODIFIED
        else -> UNRECOGNIZED(value)
      }
  }
}

/**
 * Output generated from semantically comparing two versions of a service configuration.
 *
 *  Includes detailed information about a field that have changed with applicable advice about
 * potential consequences for the change, such as backwards-incompatibility.
 */
@V1KtGeneratedMessage("google.api.ConfigChange")
@RtKtGeneratedMessage("google.api.ConfigChange")
public class ConfigChange private constructor(
  /**
   * Object hierarchy path to the change, with levels separated by a '.' character. For repeated
   * fields, an applicable unique identifier field is used for the index (usually selector, name, or
   * id). For maps, the term 'key' is used. If the field has no unique identifier, the numeric index is
   * used. Examples: - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction -
   * quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value -
   * logging.producer_destinations[0]
   */
  public val element: String,
  /**
   * Value of the changed object in the old Service configuration, in JSON format. This field will
   * not be populated if ChangeType == ADDED.
   */
  public val oldValue: String,
  /**
   * Value of the changed object in the new Service configuration, in JSON format. This field will
   * not be populated if ChangeType == REMOVED.
   */
  public val newValue: String,
  /**
   * The type for this change, either ADDED, REMOVED, or MODIFIED.
   */
  public val changeType: ChangeType,
  /**
   * Collection of advice provided for this change, useful for determining the possible impact of
   * this change.
   */
  public val advices: List,
  public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
  override val messageSize: Int by lazy { messageSize() }

  private fun messageSize(): Int {
    var result = 0
    if (element.isNotEmpty()) {
      result += sizeOf(10u) + sizeOf(element)
    }
    if (oldValue.isNotEmpty()) {
      result += sizeOf(18u) + sizeOf(oldValue)
    }
    if (newValue.isNotEmpty()) {
      result += sizeOf(26u) + sizeOf(newValue)
    }
    if (changeType.value != 0) {
      result += sizeOf(32u) + sizeOf(changeType)
    }
    if (advices.isNotEmpty()) {
      result += (sizeOf(42u) * advices.size) + advices.sumOf { sizeOf(it) }
    }
    result += unknownFields.size()
    return result
  }

  override fun serialize(serializer: KtMessageSerializer) {
    if (element.isNotEmpty()) {
      serializer.writeTag(10u).write(element)
    }
    if (oldValue.isNotEmpty()) {
      serializer.writeTag(18u).write(oldValue)
    }
    if (newValue.isNotEmpty()) {
      serializer.writeTag(26u).write(newValue)
    }
    if (changeType.value != 0) {
      serializer.writeTag(32u).write(changeType)
    }
    advices.forEach { serializer.writeTag(42u).write(it) }
    serializer.writeUnknown(unknownFields)
  }

  override fun equals(other: Any?): Boolean =
    other is ConfigChange &&
      other.element == element &&
      other.oldValue == oldValue &&
      other.newValue == newValue &&
      other.changeType == changeType &&
      other.advices == advices &&
      other.unknownFields == unknownFields

  override fun hashCode(): Int {
    var result = unknownFields.hashCode()
    result = 31 * result + element.hashCode()
    result = 31 * result + oldValue.hashCode()
    result = 31 * result + newValue.hashCode()
    result = 31 * result + changeType.hashCode()
    result = 31 * result + advices.hashCode()
    return result
  }

  override fun toString(): String =
    "ConfigChange(" +
      "element=$element, " +
      "oldValue=$oldValue, " +
      "newValue=$newValue, " +
      "changeType=$changeType, " +
      "advices=$advices" +
      if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"

  public fun copy(builder: Builder.() -> Unit): ConfigChange =
    Builder().apply {
      element = [email protected]
      oldValue = [email protected]
      newValue = [email protected]
      changeType = [email protected]
      advices = [email protected]
      unknownFields = [email protected]
      builder()
    }.build()

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

    public var oldValue: String = ""

    public var newValue: String = ""

    public var changeType: ChangeType = ChangeType.from(0)

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

    public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

    public fun build(): ConfigChange =
      ConfigChange(
        element,
        oldValue,
        newValue,
        changeType,
        unmodifiableList(advices),
        unknownFields
      )
  }

  public companion object Deserializer : AbstractKtDeserializer() {
    @JvmStatic
    override fun deserialize(deserializer: KtMessageDeserializer): ConfigChange {
      var element = ""
      var oldValue = ""
      var newValue = ""
      var changeType = ChangeType.from(0)
      var advices: MutableList? = null
      var unknownFields: UnknownFieldSet.Builder? = null

      while (true) {
        when (deserializer.readTag()) {
          0 -> return ConfigChange(
            element,
            oldValue,
            newValue,
            changeType,
            unmodifiableList(advices),
            UnknownFieldSet.from(unknownFields)
          )
          10 -> element = deserializer.readString()
          18 -> oldValue = deserializer.readString()
          26 -> newValue = deserializer.readString()
          32 -> changeType = deserializer.readEnum(ChangeType)
          42 ->
            advices =
              (advices ?: mutableListOf()).apply {
                deserializer.readRepeated(false) {
                  add(deserializer.readMessage(Advice))
                }
              }
          else ->
            unknownFields =
              (unknownFields ?: UnknownFieldSet.Builder()).also {
                it.add(deserializer.readUnknown())
              }
        }
      }
    }

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

/**
 * Generated advice about this change, used for providing more information about how a change will
 * affect the existing service.
 */
@V1KtGeneratedMessage("google.api.Advice")
@RtKtGeneratedMessage("google.api.Advice")
public class Advice private constructor(
  /**
   * Useful description for why this advice was applied and what actions should be taken to mitigate
   * any implied risks.
   */
  public val description: String,
  public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
  override val messageSize: Int by lazy { messageSize() }

  private fun messageSize(): Int {
    var result = 0
    if (description.isNotEmpty()) {
      result += sizeOf(18u) + sizeOf(description)
    }
    result += unknownFields.size()
    return result
  }

  override fun serialize(serializer: KtMessageSerializer) {
    if (description.isNotEmpty()) {
      serializer.writeTag(18u).write(description)
    }
    serializer.writeUnknown(unknownFields)
  }

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

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

  override fun toString(): String =
    "Advice(" +
      "description=$description" +
      if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"

  public fun copy(builder: Builder.() -> Unit): Advice =
    Builder().apply {
      description = [email protected]
      unknownFields = [email protected]
      builder()
    }.build()

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

    public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

    public fun build(): Advice =
      Advice(
        description,
        unknownFields
      )
  }

  public companion object Deserializer : AbstractKtDeserializer() {
    @JvmStatic
    override fun deserialize(deserializer: KtMessageDeserializer): Advice {
      var description = ""
      var unknownFields: UnknownFieldSet.Builder? = null

      while (true) {
        when (deserializer.readTag()) {
          0 -> return Advice(
            description,
            UnknownFieldSet.from(unknownFields)
          )
          18 -> description = deserializer.readString()
          else ->
            unknownFields =
              (unknownFields ?: UnknownFieldSet.Builder()).also {
                it.add(deserializer.readUnknown())
              }
        }
      }
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy