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

de.gesellix.docker.remote.api.LocalNodeState.kt Maven / Gradle / Ivy

/**
 *
 * Please note:
 * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * Do not edit this file manually.
 *
 */

@file:Suppress(
  "ArrayInDataClass",
  "EnumEntryName",
  "RemoveRedundantQualifierName",
  "UnusedImport"
)

package de.gesellix.docker.remote.api

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

/**
 * Current local status of this node.
 *
 * Values: EMPTY,Inactive,Pending,Active,Error,Locked
 */

@JsonClass(generateAdapter = false)
enum class LocalNodeState(val value: kotlin.String) {

  @Json(name = "")
  EMPTY(""),

  @Json(name = "inactive")
  Inactive("inactive"),

  @Json(name = "pending")
  Pending("pending"),

  @Json(name = "active")
  Active("active"),

  @Json(name = "error")
  Error("error"),

  @Json(name = "locked")
  Locked("locked");

  /**
   * Override toString() to avoid using the enum variable name as the value, and instead use
   * the actual value defined in the API spec file.
   *
   * This solves a problem when the variable name and its value are different, and ensures that
   * the client sends the correct enum values to the server always.
   */
  override fun toString(): String = value

  companion object {

    /**
     * Converts the provided [data] to a [String] on success, null otherwise.
     */
    fun encode(data: kotlin.Any?): kotlin.String? = if (data is LocalNodeState) "$data" else null

    /**
     * Returns a valid [LocalNodeState] for [data], null otherwise.
     */
    fun decode(data: kotlin.Any?): LocalNodeState? = data?.let {
      val normalizedData = "$it".lowercase()
      values().firstOrNull { value ->
        it == value || normalizedData == "$value".lowercase()
      }
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy