summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-api
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-compute/opendc-compute-api')
-rw-r--r--opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ComputeClient.kt18
-rw-r--r--opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Flavor.kt5
-rw-r--r--opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Image.kt7
-rw-r--r--opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Resource.kt9
-rw-r--r--opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Server.kt18
-rw-r--r--opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ServerWatcher.kt3
6 files changed, 19 insertions, 41 deletions
diff --git a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ComputeClient.kt b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ComputeClient.kt
index 577fbc73..c26d0b8b 100644
--- a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ComputeClient.kt
+++ b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ComputeClient.kt
@@ -31,14 +31,14 @@ public interface ComputeClient : AutoCloseable {
/**
* Obtain the list of [Flavor]s accessible by the requesting user.
*/
- public suspend fun queryFlavors(): List<Flavor>
+ public fun queryFlavors(): List<Flavor>
/**
* Obtain a [Flavor] by its unique identifier.
*
* @param id The identifier of the flavor.
*/
- public suspend fun findFlavor(id: UUID): Flavor?
+ public fun findFlavor(id: UUID): Flavor?
/**
* Create a new [Flavor] instance at this compute service.
@@ -49,7 +49,7 @@ public interface ComputeClient : AutoCloseable {
* @param labels The identifying labels of the image.
* @param meta The non-identifying meta-data of the image.
*/
- public suspend fun newFlavor(
+ public fun newFlavor(
name: String,
cpuCount: Int,
memorySize: Long,
@@ -60,14 +60,14 @@ public interface ComputeClient : AutoCloseable {
/**
* Obtain the list of [Image]s accessible by the requesting user.
*/
- public suspend fun queryImages(): List<Image>
+ public 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?
+ public fun findImage(id: UUID): Image?
/**
* Create a new [Image] instance at this compute service.
@@ -76,7 +76,7 @@ public interface ComputeClient : AutoCloseable {
* @param labels The identifying labels of the image.
* @param meta The non-identifying meta-data of the image.
*/
- public suspend fun newImage(
+ public fun newImage(
name: String,
labels: Map<String, String> = emptyMap(),
meta: Map<String, Any> = emptyMap()
@@ -85,14 +85,14 @@ public interface ComputeClient : AutoCloseable {
/**
* Obtain the list of [Server]s accessible by the requesting user.
*/
- public suspend fun queryServers(): List<Server>
+ public fun queryServers(): List<Server>
/**
* Obtain a [Server] by its unique identifier.
*
* @param id The identifier of the server.
*/
- public suspend fun findServer(id: UUID): Server?
+ public fun findServer(id: UUID): Server?
/**
* Create a new [Server] instance at this compute service.
@@ -104,7 +104,7 @@ public interface ComputeClient : AutoCloseable {
* @param meta The non-identifying meta-data of the server.
* @param start A flag to indicate that the server should be started immediately.
*/
- public suspend fun newServer(
+ public fun newServer(
name: String,
image: Image,
flavor: Flavor,
diff --git a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Flavor.kt b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Flavor.kt
index 5f511f91..d76e0fba 100644
--- a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Flavor.kt
+++ b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Flavor.kt
@@ -36,9 +36,4 @@ public interface Flavor : Resource {
* The amount of RAM available to the server (in MB).
*/
public val memorySize: Long
-
- /**
- * Delete the flavor instance.
- */
- public suspend fun delete()
}
diff --git a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Image.kt b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Image.kt
index 83e63b81..c4a04b96 100644
--- a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Image.kt
+++ b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Image.kt
@@ -25,9 +25,4 @@ package org.opendc.compute.api
/**
* An image containing a bootable operating system that can directly be executed by physical or virtual server.
*/
-public interface Image : Resource {
- /**
- * Delete the image instance.
- */
- public suspend fun delete()
-}
+public interface Image : Resource
diff --git a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Resource.kt b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Resource.kt
index 08120848..58082130 100644
--- a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Resource.kt
+++ b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Resource.kt
@@ -49,7 +49,12 @@ public interface Resource {
public val meta: Map<String, Any>
/**
- * Refresh the local state of the resource.
+ * Reload the attributes of the resource.
*/
- public suspend fun refresh()
+ public fun reload()
+
+ /**
+ * Delete the resource.
+ */
+ public fun delete()
}
diff --git a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Server.kt b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Server.kt
index 64b73d0b..b4cc5129 100644
--- a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Server.kt
+++ b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/Server.kt
@@ -50,27 +50,13 @@ public interface Server : Resource {
/**
* Request the server to be started.
- *
- * This method is guaranteed to return after the request was acknowledged, but might return before the server was
- * started.
*/
- public suspend fun start()
+ public fun start()
/**
* Request the server to be stopped.
- *
- * This method is guaranteed to return after the request was acknowledged, but might return before the server was
- * stopped.
- */
- public suspend fun stop()
-
- /**
- * Request the server to be deleted.
- *
- * This method is guaranteed to return after the request was acknowledged, but might return before the server was
- * deleted.
*/
- public suspend fun delete()
+ public fun stop()
/**
* Register the specified [ServerWatcher] to watch the state of the server.
diff --git a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ServerWatcher.kt b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ServerWatcher.kt
index 48a17b30..cf995fc3 100644
--- a/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ServerWatcher.kt
+++ b/opendc-compute/opendc-compute-api/src/main/kotlin/org/opendc/compute/api/ServerWatcher.kt
@@ -29,9 +29,6 @@ public interface ServerWatcher {
/**
* This method is invoked when the state of a [Server] changes.
*
- * Note that the state of [server] might not reflect the state as reported by the invocation, as a call to
- * [Server.refresh] is required to update its state.
- *
* @param server The server whose state has changed.
* @param newState The new state of the server.
*/