summaryrefslogtreecommitdiff
path: root/simulator/opendc-compute/opendc-compute-api
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-03-09 19:38:29 +0100
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-03-09 20:33:27 +0100
commitb3f390be783cad21cd4925bcbe8077b91f869b5d (patch)
treedadd8b4eb8af12120e8b334270f0d49c725b54e6 /simulator/opendc-compute/opendc-compute-api
parentb3a271794d64bd97ef93abf650137c5a0a1785df (diff)
compute: Model storage of VM images
Diffstat (limited to 'simulator/opendc-compute/opendc-compute-api')
-rw-r--r--simulator/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ComputeClient.kt25
-rw-r--r--simulator/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Image.kt14
2 files changed, 30 insertions, 9 deletions
diff --git a/simulator/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ComputeClient.kt b/simulator/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ComputeClient.kt
index 4fd32f98..b4fc03f7 100644
--- a/simulator/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ComputeClient.kt
+++ b/simulator/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ComputeClient.kt
@@ -29,6 +29,31 @@ import java.util.UUID
*/
public interface ComputeClient : AutoCloseable {
/**
+ * Obtain the list of [Image]s accessible by the requesting user.
+ */
+ public suspend fun queryImages(): List<Image>
+
+ /**
+ * Obtain a [Image] by its unique identifier.
+ *
+ * @param id The identifier of the image.
+ */
+ public suspend fun findImage(id: UUID): Image?
+
+ /**
+ * Create a new [Image] instance at this compute service.
+ *
+ * @param name The name of the image.
+ * @param labels The identifying labels of the image.
+ * @param meta The non-identifying meta-data of the image.
+ */
+ public suspend fun newImage(
+ name: String,
+ labels: Map<String, String> = emptyMap(),
+ meta: Map<String, Any> = emptyMap()
+ ): Image
+
+ /**
* Obtain the list of [Server]s accessible by the requesting user.
*/
public suspend fun queryServers(): List<Server>
diff --git a/simulator/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Image.kt b/simulator/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Image.kt
index 8b673e84..83e63b81 100644
--- a/simulator/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Image.kt
+++ b/simulator/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Image.kt
@@ -22,16 +22,12 @@
package org.opendc.compute.api
-import java.util.UUID
-
/**
* An image containing a bootable operating system that can directly be executed by physical or virtual server.
*/
-public data class Image(
- public override val uid: UUID,
- public override val name: String,
- override val labels: Map<String, String>,
- override val meta: Map<String, Any>
-) : Resource {
- override suspend fun refresh() {}
+public interface Image : Resource {
+ /**
+ * Delete the image instance.
+ */
+ public suspend fun delete()
}