make helper functions in rented instance data class
This commit is contained in:
parent
643006f9c4
commit
0b4bc2e524
1 changed files with 22 additions and 0 deletions
|
@ -72,4 +72,26 @@ data class RentedInstance(
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns whether the instance is running
|
||||
* this is true also if the instance is stopping
|
||||
* vice versa, false if stopped or starting
|
||||
* @return is the instance running
|
||||
*/
|
||||
fun isRunning(): Boolean {
|
||||
return status == "running"
|
||||
}
|
||||
|
||||
fun isStopping(): Boolean {
|
||||
return status == "running" && targetStatus == "stopped"
|
||||
}
|
||||
|
||||
fun isStarting(): Boolean {
|
||||
return status == "exited" && targetStatus == "running"
|
||||
}
|
||||
|
||||
fun isChangingState(): Boolean {
|
||||
return isStopping() || isStarting()
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue