1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

Feature #1713: Add rename actions to Java OCA

This commit is contained in:
Carlos Martín 2013-09-02 15:27:34 +02:00
parent 6641d15469
commit a0e538310e
3 changed files with 75 additions and 0 deletions

View File

@ -37,6 +37,7 @@ public class Cluster extends PoolElement{
private static final String DELDATASTORE = METHOD_PREFIX + "deldatastore";
private static final String ADDVNET = METHOD_PREFIX + "addvnet";
private static final String DELVNET = METHOD_PREFIX + "delvnet";
private static final String RENAME = METHOD_PREFIX + "rename";
/**
* Creates a new Cluster representation.
@ -199,6 +200,19 @@ public class Cluster extends PoolElement{
return client.call(DELVNET, id, vnetId);
}
/**
* Renames this Cluster.
*
* @param client XML-RPC Client.
* @param id The image id of the target host we want to modify.
* @param name New name for the Cluster
* @return If successful the message contains the cluster id.
*/
public static OneResponse rename(Client client, int id, String name)
{
return client.call(RENAME, id, name);
}
// =================================
// Instanced object XML-RPC methods
// =================================
@ -315,6 +329,17 @@ public class Cluster extends PoolElement{
return delVnet(client, id, vnetId);
}
/**
* Renames this Cluster
*
* @param name New name for the Cluster.
* @return If an error occurs the error message contains the reason.
*/
public OneResponse rename(String name)
{
return rename(client, id, name);
}
// =================================
// Helpers
// =================================

View File

@ -35,6 +35,7 @@ public class Datastore extends PoolElement
private static final String UPDATE = METHOD_PREFIX + "update";
private static final String CHOWN = METHOD_PREFIX + "chown";
private static final String CHMOD = METHOD_PREFIX + "chmod";
private static final String RENAME = METHOD_PREFIX + "rename";
private static final String[] DATASTORE_TYPES = {"IMAGE", "SYSTEM", "FILE"};
@ -212,6 +213,19 @@ public class Datastore extends PoolElement
return chmod(client, CHMOD, id, octet);
}
/**
* Renames this Datastore.
*
* @param client XML-RPC Client.
* @param id The image id of the target host we want to modify.
* @param name New name for the Datastore
* @return If successful the message contains the datastore id.
*/
public static OneResponse rename(Client client, int id, String name)
{
return client.call(RENAME, id, name);
}
// =================================
// Instanced object XML-RPC methods
// =================================
@ -373,6 +387,17 @@ public class Datastore extends PoolElement
return chmod(client, id, octet);
}
/**
* Renames this Datastore
*
* @param name New name for the Datastore.
* @return If an error occurs the error message contains the reason.
*/
public OneResponse rename(String name)
{
return rename(client, id, name);
}
// =================================
// Helpers
// =================================

View File

@ -34,6 +34,7 @@ public class Host extends PoolElement{
private static final String ENABLE = METHOD_PREFIX + "enable";
private static final String UPDATE = METHOD_PREFIX + "update";
private static final String MONITORING = METHOD_PREFIX + "monitoring";
private static final String RENAME = METHOD_PREFIX + "rename";
private static final String[] HOST_STATES =
{"INIT", "MONITORING_MONITORED", "MONITORED", "ERROR", "DISABLED",
@ -189,6 +190,19 @@ public class Host extends PoolElement{
return client.call(MONITORING, id);
}
/**
* Renames this Host.
*
* @param client XML-RPC Client.
* @param id The image id of the target host we want to modify.
* @param name New name for the Host
* @return If successful the message contains the host id.
*/
public static OneResponse rename(Client client, int id, String name)
{
return client.call(RENAME, id, name);
}
// =================================
// Instanced object XML-RPC methods
// =================================
@ -280,6 +294,17 @@ public class Host extends PoolElement{
return monitoring(client, id);
}
/**
* Renames this Host.
*
* @param name New name for the Host
* @return If successful the message contains the host id.
*/
public OneResponse rename(String name)
{
return rename(client, id, name);
}
// =================================
// Helpers
// =================================