Define some more constants.

This commit is contained in:
Michael Lipp 2025-03-01 22:51:51 +01:00
parent 41ae658e0c
commit f8cc26e657
6 changed files with 41 additions and 22 deletions

View file

@ -50,6 +50,19 @@ public class Constants {
* Status related constants.
*/
public static class Status {
/** The Constant CPUS. */
public static final String CPUS = "cpus";
/** The Constant RAM. */
public static final String RAM = "ram";
/** The Constant OSINFO. */
public static final String OSINFO = "osinfo";
/** The Constant DISPLAY_PASSWORD_SERIAL. */
public static final String DISPLAY_PASSWORD_SERIAL
= "displayPasswordSerial";
/** The Constant LOGGED_IN_USER. */
public static final String LOGGED_IN_USER = "loggedInUser";
@ -58,6 +71,9 @@ public class Constants {
/** The Constant CONSOLE_USER. */
public static final String CONSOLE_USER = "consoleUser";
/** The Constant ASSIGNMENT. */
public static final String ASSIGNMENT = "assignment";
}
/**

View file

@ -220,7 +220,7 @@ public class VmDefinition extends K8sDynamicModel {
* @return the optional
*/
public Optional<String> assignedFrom() {
return fromStatus("assignment", "pool");
return fromStatus(Status.ASSIGNMENT, "pool");
}
/**
@ -229,7 +229,7 @@ public class VmDefinition extends K8sDynamicModel {
* @return the optional
*/
public Optional<String> assignedTo() {
return fromStatus("assignment", "user");
return fromStatus(Status.ASSIGNMENT, "user");
}
/**
@ -238,7 +238,7 @@ public class VmDefinition extends K8sDynamicModel {
* @return the optional
*/
public Optional<Instant> assignmentLastUsed() {
return this.<String> fromStatus("assignment", "lastUsed")
return this.<String> fromStatus(Status.ASSIGNMENT, "lastUsed")
.map(Instant::parse);
}
@ -389,7 +389,7 @@ public class VmDefinition extends K8sDynamicModel {
* @return the optional
*/
public Optional<Long> displayPasswordSerial() {
return this.<Number> fromStatus("displayPasswordSerial")
return this.<Number> fromStatus(Status.DISPLAY_PASSWORD_SERIAL)
.map(Number::longValue);
}