From 81ed84f2b475fd6b1c2ea69f23cc1bcfb39d5e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Czern=C3=BD?= Date: Mon, 21 Jun 2021 09:45:10 +0200 Subject: [PATCH] F #5289: Java api for sched actions (#1318) --- .../opennebula/client/vm/VirtualMachine.java | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java index a7b44d8031..5e2e2ac909 100644 --- a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java +++ b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java @@ -54,6 +54,9 @@ public class VirtualMachine extends PoolElement{ private static final String DISKSNAPSHOTRENAME = METHOD_PREFIX + "disksnapshotrename"; private static final String DISKRESIZE = METHOD_PREFIX + "diskresize"; private static final String UPDATECONF = METHOD_PREFIX + "updateconf"; + private static final String SCHEDADD = METHOD_PREFIX + "schedadd"; + private static final String SCHEDDELETE = METHOD_PREFIX + "scheddelete"; + private static final String SCHEDUPDATE = METHOD_PREFIX + "schedupdate"; private static final String[] VM_STATES = { @@ -642,6 +645,43 @@ public class VirtualMachine extends PoolElement{ return client.call(UPDATECONF, id, new_conf); } + /** + * Create new scheduled action + * @param client XML-RPC Client. + * @param id The VM id of the target VM. + * @param new_add New scheduled action + * @return If an error occurs the error message contains the reason. + */ + public static OneResponse schedadd(Client client, int id, String new_sched) + { + return client.call(SCHEDADD, id, new_sched); + } + + /** + * Delete scheduled action + * @param client XML-RPC Client. + * @param id The VM id of the target VM. + * @param sched_id The sched action id to delete + * @return If an error occurs the error message contains the reason. + */ + public static OneResponse scheddelete(Client client, int id, int sched_id) + { + return client.call(SCHEDDELETE, id, sched_id); + } + + /** + * Update VM scheduled action + * @param client XML-RPC Client. + * @param id The VM id of the target VM. + * @param sched_id The sched action id + * @param updated_sched Updated template of the sched action + * @return If an error occurs the error message contains the reason. + */ + public static OneResponse schedupdate(Client client, int id, int sched_id, String updated_sched) + { + return client.call(SCHEDUPDATE, id, sched_id, updated_sched); + } + /** * Recovers a stuck VM. * @@ -1107,6 +1147,47 @@ public class VirtualMachine extends PoolElement{ return diskResize(client, id, diskId, newSize); } + /** + * Update VM Configuration + * @param new_conf New Configuration of the target VM + * @return If an error occurs the error message contains the reason. + */ + public OneResponse updateconf(String new_conf) + { + return updateconf(client, id, new_conf); + } + + /** + * Create new scheduled action + * @param new_add New scheduled action + * @return If an error occurs the error message contains the reason. + */ + public OneResponse schedadd(String new_sched) + { + return schedadd(client, id, new_sched); + } + + /** + * Delete scheduled action + * @param sched_id The sched action id to delete + * @return If an error occurs the error message contains the reason. + */ + public OneResponse scheddelete(int sched_id) + { + return scheddelete(client, id, sched_id); + } + + /** + * Update VM scheduled action + * @param sched_id The sched action id + * @param updated_sched Updated template of the sched action + * @return If an error occurs the error message contains the reason. + */ + public OneResponse schedupdate(int sched_id, String updated_sched) + { + return schedupdate(client, id, sched_id, updated_sched); + } + /** * Recovers a stuck VM. *