File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
controller-api/src/main/kotlin/app/simplecloud/controller/api Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,12 @@ interface ServerApi {
107107 stopCause : ServerStopCause = ServerStopCause .API_STOP
108108 ): CompletableFuture <List <Server >>
109109
110+ /* *
111+ * @param server the [Server] to update.
112+ * @return the updated [Server].
113+ */
114+ fun updateServer (server : Server ): CompletableFuture <Server >
115+
110116 /* *
111117 * @param id the id of the server.
112118 * @param state the new state of the server.
@@ -218,6 +224,12 @@ interface ServerApi {
218224 stopCause : ServerStopCause = ServerStopCause .API_STOP
219225 ): List <Server >
220226
227+ /* *
228+ * @param server the [Server] to update.
229+ * @return the updated [Server].
230+ */
231+ suspend fun updateServer (server : Server ): Server
232+
221233 /* *
222234 * @param id the id of the server.
223235 * @param state the new state of the server.
Original file line number Diff line number Diff line change @@ -120,6 +120,14 @@ class ServerApiCoroutineImpl(
120120 }
121121 }
122122
123+ override suspend fun updateServer (server : Server ): Server {
124+ return Server .fromDefinition(
125+ serverServiceStub.updateServer(updateServerRequest {
126+ this .server = server.toDefinition()
127+ })
128+ )
129+ }
130+
123131 override suspend fun updateServerState (id : String , state : ServerState ): Server {
124132 return Server .fromDefinition(
125133 serverServiceStub.updateServerState(
Original file line number Diff line number Diff line change @@ -133,6 +133,16 @@ class ServerApiFutureImpl(
133133 }
134134 }
135135
136+ override fun updateServer (server : Server ): CompletableFuture <Server > {
137+ return serverServiceStub.updateServer(
138+ UpdateServerRequest .newBuilder()
139+ .setServer(server.toDefinition())
140+ .build()
141+ ).toCompletable().thenApply {
142+ return @thenApply Server .fromDefinition(it)
143+ }
144+ }
145+
136146 override fun updateServerState (id : String , state : ServerState ): CompletableFuture <Server > {
137147 return serverServiceStub.updateServerState(
138148 UpdateServerStateRequest .newBuilder()
You can’t perform that action at this time.
0 commit comments