1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Feature #872: one.template.clone method added to Java OCA

This commit is contained in:
Carlos Martín 2012-05-10 18:39:02 +02:00
parent 6e7744f7bf
commit a1e50125ed

View File

@ -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
// =================================