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

The newest version!
// Generated by protokt version 1.0.0-beta.2. Do not modify.
// Source: google/api/config_change.proto
@file:Suppress("DEPRECATION")

package protokt.v1.google.api

import protokt.v1.AbstractDeserializer
import protokt.v1.AbstractMessage
import protokt.v1.BuilderDsl
import protokt.v1.Collections.copyList
import protokt.v1.Collections.unmodifiableList
import protokt.v1.Enum
import protokt.v1.EnumReader
import protokt.v1.GeneratedMessage
import protokt.v1.GeneratedProperty
import protokt.v1.Reader
import protokt.v1.SizeCodecs.sizeOf
import protokt.v1.UnknownFieldSet
import protokt.v1.Writer
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

/**
 * 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
) : Enum() {
  /**
   * 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 : EnumReader {
    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.
 */
@GeneratedMessage("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]
   */
  @GeneratedProperty(1)
  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.
   */
  @GeneratedProperty(2)
  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.
   */
  @GeneratedProperty(3)
  public val newValue: String,
  /**
   * The type for this change, either ADDED, REMOVED, or MODIFIED.
   */
  @GeneratedProperty(4)
  public val changeType: ChangeType,
  /**
   * Collection of advice provided for this change, useful for determining the possible impact of
   * this change.
   */
  @GeneratedProperty(5)
  public val advices: List,
  public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractMessage() {
  private val `$messageSize`: Int by lazy {
    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()
    result
  }

  override fun messageSize(): Int = `$messageSize`

  override fun serialize(writer: Writer) {
    if (element.isNotEmpty()) {
      writer.writeTag(10u).write(element)
    }
    if (oldValue.isNotEmpty()) {
      writer.writeTag(18u).write(oldValue)
    }
    if (newValue.isNotEmpty()) {
      writer.writeTag(26u).write(newValue)
    }
    if (changeType.value != 0) {
      writer.writeTag(32u).write(changeType)
    }
    advices.forEach { writer.writeTag(42u).write(it) }
    writer.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()

  @BuilderDsl
  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 : AbstractDeserializer() {
    @JvmStatic
    override fun deserialize(reader: Reader): ConfigChange {
      var element = ""
      var oldValue = ""
      var newValue = ""
      var changeType = ChangeType.from(0)
      var advices: MutableList? = null
      var unknownFields: UnknownFieldSet.Builder? = null

      while (true) {
        when (reader.readTag()) {
          0u -> return ConfigChange(
            element,
            oldValue,
            newValue,
            changeType,
            unmodifiableList(advices),
            UnknownFieldSet.from(unknownFields)
          )
          10u -> element = reader.readString()
          18u -> oldValue = reader.readString()
          26u -> newValue = reader.readString()
          32u -> changeType = reader.readEnum(ChangeType)
          42u ->
            advices =
              (advices ?: mutableListOf()).apply {
                reader.readRepeated(false) {
                  add(reader.readMessage(Advice))
                }
              }
          else ->
            unknownFields =
              (unknownFields ?: UnknownFieldSet.Builder()).also {
                it.add(reader.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.
 */
@GeneratedMessage("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.
   */
  @GeneratedProperty(2)
  public val description: String,
  public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractMessage() {
  private val `$messageSize`: Int by lazy {
    var result = 0
    if (description.isNotEmpty()) {
      result += sizeOf(18u) + sizeOf(description)
    }
    result += unknownFields.size()
    result
  }

  override fun messageSize(): Int = `$messageSize`

  override fun serialize(writer: Writer) {
    if (description.isNotEmpty()) {
      writer.writeTag(18u).write(description)
    }
    writer.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()

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

    public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy