From a1e50125ed9db16cf8d09525b265fe9f84dc08f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 10 May 2012 18:39:02 +0200 Subject: [PATCH] Feature #872: one.template.clone method added to Java OCA --- .../opennebula/client/template/Template.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/oca/java/src/org/opennebula/client/template/Template.java b/src/oca/java/src/org/opennebula/client/template/Template.java index dff2fc1a2c..dd48c96254 100644 --- a/src/oca/java/src/org/opennebula/client/template/Template.java +++ b/src/oca/java/src/org/opennebula/client/template/Template.java @@ -35,6 +35,7 @@ public class Template extends PoolElement private static final String CHOWN = METHOD_PREFIX + "chown"; private static final String CHMOD = METHOD_PREFIX + "chmod"; private static final String INSTANTIATE = METHOD_PREFIX + "instantiate"; + private static final String CLONE = METHOD_PREFIX + "clone"; /** * Creates a new Template representation. @@ -205,6 +206,19 @@ public class Template extends PoolElement return client.call(INSTANTIATE, id, name); } + /** + * Clones this template into a new one + * + * @param client XML-RPC Client. + * @param id The template id of the target template. + * @param name Name for the new template. + * @return If successful the message contains the new template ID. + */ + public static OneResponse clone(Client client, int id, String name) + { + return client.call(CLONE, id, name); + } + // ================================= // Instanced object XML-RPC methods // ================================= @@ -375,6 +389,17 @@ public class Template extends PoolElement return instantiate(client, id, ""); } + /** + * Clones this template into a new one + * + * @param name Name for the new template. + * @return If successful the message contains the new template ID. + */ + public OneResponse clone(String name) + { + return clone(client, id, name); + } + // ================================= // Helpers // =================================