Package org.jdrupes.vmoperator.common
Class VmDefinition
java.lang.Object
org.jdrupes.vmoperator.common.K8sDynamicModel
org.jdrupes.vmoperator.common.VmDefinition
- All Implemented Interfaces:
io.kubernetes.client.common.KubernetesObject
,io.kubernetes.client.common.KubernetesType
Represents a VM definition.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
Permissions granted to a user or role.static class
The Class Model.static enum
Permissions for accessing and manipulating the VM.static enum
The VM state from the VM definition. -
Constructor Summary
ConstructorsConstructorDescriptionVmDefinition
(com.google.gson.Gson delegate, com.google.gson.JsonObject json) Instantiates a new vm definition. -
Method Summary
Modifier and TypeMethodDescriptionThe pool that the VM was taken from.The user that the VM was assigned to.Last usage of assigned VM.Optional
<io.kubernetes.client.openapi.models.V1Condition> Return a condition from the status.conditionStatus
(String name) Return a condition’s status.boolean
consoleAccessible
(String user, Set<VmDefinition.Permission> permissions) Check if the console is accessible.boolean
Return true if the console is in use.Return the last known console user.Get the display password serial.boolean
Equals.extra()
Return the extra data.(package private) VmDefinition
extra
(VmExtraData extraData) Set extra data (unknown to kubernetes).<T> Optional
<T> Get a value from the spec usingDataPath.get(java.lang.Object, java.lang.Object...)
.<T> Optional
<T> fromStatus
(Object... selectors) Get a value from the status usingDataPath.get(java.lang.Object, java.lang.Object...)
.<T> Optional
<T> Get a value from thespec().get("vm")
usingDataPath.get(java.lang.Object, java.lang.Object...)
.int
hashCode()
Hash code.name()
Returns the definition’s name.Returns the definition’s namespace.permissionsFor
(String user, Collection<String> roles) Collect all permissions for the given user with the given roles.pools()
The pools that this VM belongs to.spec()
Gets the spec.status()
Gets the status.vmState()
Return the requested VM state.Methods inherited from class org.jdrupes.vmoperator.common.K8sDynamicModel
apiVersion, data, getApiVersion, getKind, getMetadata, kind, metadata, statusJson, toString
-
Constructor Details
-
VmDefinition
Instantiates a new vm definition.- Parameters:
delegate
- the delegatejson
- the json
-
-
Method Details
-
spec
Gets the spec.- Returns:
- the spec
-
fromSpec
Get a value from the spec usingDataPath.get(java.lang.Object, java.lang.Object...)
.- Type Parameters:
T
- the generic type- Parameters:
selectors
- the selectors- Returns:
- the value, if found
-
pools
The pools that this VM belongs to.- Returns:
- the list
-
fromVm
Get a value from thespec().get("vm")
usingDataPath.get(java.lang.Object, java.lang.Object...)
.- Type Parameters:
T
- the generic type- Parameters:
selectors
- the selectors- Returns:
- the value, if found
-
status
Gets the status.- Returns:
- the status
-
fromStatus
Get a value from the status usingDataPath.get(java.lang.Object, java.lang.Object...)
.- Type Parameters:
T
- the generic type- Parameters:
selectors
- the selectors- Returns:
- the value, if found
-
assignedFrom
The pool that the VM was taken from.- Returns:
- the optional
-
assignedTo
The user that the VM was assigned to.- Returns:
- the optional
-
assignmentLastUsed
Last usage of assigned VM.- Returns:
- the optional
-
condition
Return a condition from the status.- Parameters:
name
- the condition’s name- Returns:
- the status, if the condition is defined
-
conditionStatus
Return a condition’s status.- Parameters:
name
- the condition’s name- Returns:
- the status, if the condition is defined
-
consoleConnected
Return true if the console is in use.- Returns:
- true, if successful
-
consoleUser
Return the last known console user.- Returns:
- the optional
-
extra
Set extra data (unknown to kubernetes).- Returns:
- the VM definition
-
extra
Return the extra data.- Returns:
- the data
-
name
Returns the definition’s name.- Returns:
- the string
-
namespace
Returns the definition’s namespace.- Returns:
- the string
-
vmState
Return the requested VM state.- Returns:
- the string
-
permissionsFor
Collect all permissions for the given user with the given roles.If permission “takeConsole” is granted, the result will also contain “accessConsole” to simplify checks.
- Parameters:
user
- the userroles
- the roles- Returns:
- the sets the
-
consoleAccessible
Check if the console is accessible.Returns true if the console is currently unused, used by the given user or if the permissions allow taking over the console.
- Parameters:
user
- the userpermissions
- the permissions- Returns:
- true, if successful
-
displayPasswordSerial
Get the display password serial.- Returns:
- the optional
-
hashCode
Hash code. -
equals
Equals.
-