diff --git a/README.md b/README.md
index b47e023..bc88e8c 100644
--- a/README.md
+++ b/README.md
@@ -1,22 +1,41 @@
# eve2pve-api-java
ProxmoVE Client API JAVA
-General
-------------
+[ProxmoxVE Api](https://pve.proxmox.com/pve-docs/api-viewer/)
+#General
The client is generated from a JSON Api on ProxmoxVE.
The result is a complete response from server and converted in JSONObject.
-[ProxmoxVE Api](https://pve.proxmox.com/pve-docs/api-viewer/)
+#Main features
+* Easy to learn
+* Method named
+* Full method generated from documentation
+* Comment any method and parameters
+* Parameters indexed eg [n] is structured in array index and value
+* Tree structure
+ * client.getNodes().get("pve1").getQemu().vmlist().getJSONArray("data")
+* Return data proxmox
+* Return result status
+ * getStatusCode
+ * getReasonPhrase
+* Method directry access
+ * get
+ * post
+ * put
+ * delete
+* login return bool if access
-Usage
------
+#Usage
```java
Client client = new Client("192.168.22", 8006);
client.login("root", "password", "pam");
+System.out.println(client->get('/version'));
+// same for put/post/delete
+
//loop nodes for
JSONArray nodes = client.getNodes().index().getJSONArray("data");
for (int i = 0; i < nodes.length(); i++) {
diff --git a/pom.xml b/pom.xml
index bda42da..5a9857f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
com.enterpriseve.proxmoxve.api
eve2pve-api-java
- 1.0.1
+ 1.0.2
jar
diff --git a/src/main/java/com/enterpriseve/proxmoxve/api/Client.java b/src/main/java/com/enterpriseve/proxmoxve/api/Client.java
index 8aa21b3..9b219df 100644
--- a/src/main/java/com/enterpriseve/proxmoxve/api/Client.java
+++ b/src/main/java/com/enterpriseve/proxmoxve/api/Client.java
@@ -46,6 +46,8 @@ public class Client {
private Client _client;
private final String _hostName;
private final int _port;
+ private int _statusCode;
+ private String _reasonPhrase;
public Client(String hostName, int port) {
_client = this;
@@ -100,27 +102,35 @@ public boolean login(String userName, String password, String realm) throws JSON
}
}
- protected enum HttpMethod {
+ public String getReasonPhrase() {
+ return _reasonPhrase;
+ }
+
+ public int getStatusCode() {
+ return _statusCode;
+ }
+
+ private enum HttpMethod {
GET, POST, PUT, DELETE
}
- public JSONObject get(String resource, Map parameters) {
+ public JSONObject get(String resource, Map parameters) throws JSONException {
return executeAction(resource, HttpMethod.GET, parameters);
}
- public JSONObject put(String resource, Map parameters) {
+ public JSONObject put(String resource, Map parameters) throws JSONException {
return executeAction(resource, HttpMethod.PUT, parameters);
}
- public JSONObject post(String resource, Map parameters) {
+ public JSONObject post(String resource, Map parameters) throws JSONException {
return executeAction(resource, HttpMethod.POST, parameters);
}
- public JSONObject ddelete(String resource, Map parameters) {
+ public JSONObject delete(String resource, Map parameters) throws JSONException {
return executeAction(resource, HttpMethod.DELETE, parameters);
}
- protected JSONObject executeAction(String resource, HttpMethod method, Map parameters) {
+ private JSONObject executeAction(String resource, HttpMethod method, Map parameters) throws JSONException {
String url = "https://" + _hostName + ":" + _port + "/api2/json" + resource;
//fix parms
ArrayList parms = new ArrayList();
@@ -175,6 +185,7 @@ protected JSONObject executeAction(String resource, HttpMethod method, Map parameters = new HashMap();
parameters.put("force", force);
parameters.put("keep", keep);
- _client.executeAction("/cluster/replication/" + _id + "", HttpMethod.DELETE, parameters);
+ _client.delete("/cluster/replication/" + _id + "", parameters);
}
/**
* Mark replication job for removal.
*/
- public void delete() {
- _client.executeAction("/cluster/replication/" + _id + "", HttpMethod.DELETE, null);
+ public void delete() throws JSONException {
+ _client.delete("/cluster/replication/" + _id + "", null);
}
/**
* Read replication job configuration.
*/
- public JSONObject read() {
- return _client.executeAction("/cluster/replication/" + _id + "", HttpMethod.GET, null);
+ public JSONObject read() throws JSONException {
+ return _client.get("/cluster/replication/" + _id + "", null);
}
/**
@@ -462,7 +473,7 @@ public JSONObject read() {
* @param schedule Storage replication schedule. The format is a
* subset of `systemd` calender events.
*/
- public void update(String comment, String delete, String digest, Boolean disable, Integer rate, String remove_job, String schedule) {
+ public void update(String comment, String delete, String digest, Boolean disable, Integer rate, String remove_job, String schedule) throws JSONException {
Map parameters = new HashMap();
parameters.put("comment", comment);
parameters.put("delete", delete);
@@ -471,22 +482,22 @@ public void update(String comment, String delete, String digest, Boolean disable
parameters.put("rate", rate);
parameters.put("remove_job", remove_job);
parameters.put("schedule", schedule);
- _client.executeAction("/cluster/replication/" + _id + "", HttpMethod.PUT, parameters);
+ _client.put("/cluster/replication/" + _id + "", parameters);
}
/**
* Update replication job configuration.
*/
- public void update() {
- _client.executeAction("/cluster/replication/" + _id + "", HttpMethod.PUT, null);
+ public void update() throws JSONException {
+ _client.put("/cluster/replication/" + _id + "", null);
}
}
/**
* List replication jobs.
*/
- public JSONObject index() {
- return _client.executeAction("/cluster/replication", HttpMethod.GET, null);
+ public JSONObject index() throws JSONException {
+ return _client.get("/cluster/replication", null);
}
/**
@@ -508,7 +519,7 @@ public JSONObject index() {
* @param schedule Storage replication schedule. The format is a
* subset of `systemd` calender events.
*/
- public void create(String id, String target, String type, String comment, Boolean disable, Integer rate, String remove_job, String schedule) {
+ public void create(String id, String target, String type, String comment, Boolean disable, Integer rate, String remove_job, String schedule) throws JSONException {
Map parameters = new HashMap();
parameters.put("id", id);
parameters.put("target", target);
@@ -518,7 +529,7 @@ public void create(String id, String target, String type, String comment, Boolea
parameters.put("rate", rate);
parameters.put("remove_job", remove_job);
parameters.put("schedule", schedule);
- _client.executeAction("/cluster/replication", HttpMethod.POST, parameters);
+ _client.post("/cluster/replication", parameters);
}
/**
@@ -530,12 +541,12 @@ public void create(String id, String target, String type, String comment, Boolea
* @param target Target node.
* @param type Section type. Enum: local
*/
- public void create(String id, String target, String type) {
+ public void create(String id, String target, String type) throws JSONException {
Map parameters = new HashMap();
parameters.put("id", id);
parameters.put("target", target);
parameters.put("type", type);
- _client.executeAction("/cluster/replication", HttpMethod.POST, parameters);
+ _client.post("/cluster/replication", parameters);
}
}
@@ -570,8 +581,8 @@ protected PVENodes(Client client) {
/**
* Corosync node list.
*/
- public JSONObject nodes() {
- return _client.executeAction("/cluster/config/nodes", HttpMethod.GET, null);
+ public JSONObject nodes() throws JSONException {
+ return _client.get("/cluster/config/nodes", null);
}
}
@@ -584,16 +595,16 @@ protected PVETotem(Client client) {
/**
* Get corosync totem protocol settings.
*/
- public JSONObject totem() {
- return _client.executeAction("/cluster/config/totem", HttpMethod.GET, null);
+ public JSONObject totem() throws JSONException {
+ return _client.get("/cluster/config/totem", null);
}
}
/**
* Directory index.
*/
- public JSONObject index() {
- return _client.executeAction("/cluster/config", HttpMethod.GET, null);
+ public JSONObject index() throws JSONException {
+ return _client.get("/cluster/config", null);
}
}
@@ -700,24 +711,24 @@ protected PVEItemPos(Client client, Object group, Object pos) {
* configuration file has different SHA1 digest. This
* can be used to prevent concurrent modifications.
*/
- public void deleteRule(String digest) {
+ public void deleteRule(String digest) throws JSONException {
Map parameters = new HashMap();
parameters.put("digest", digest);
- _client.executeAction("/cluster/firewall/groups/" + _group + "/" + _pos + "", HttpMethod.DELETE, parameters);
+ _client.delete("/cluster/firewall/groups/" + _group + "/" + _pos + "", parameters);
}
/**
* Delete rule.
*/
- public void deleteRule() {
- _client.executeAction("/cluster/firewall/groups/" + _group + "/" + _pos + "", HttpMethod.DELETE, null);
+ public void deleteRule() throws JSONException {
+ _client.delete("/cluster/firewall/groups/" + _group + "/" + _pos + "", null);
}
/**
* Get single rule data.
*/
- public JSONObject getRule() {
- return _client.executeAction("/cluster/firewall/groups/" + _group + "/" + _pos + "", HttpMethod.GET, null);
+ public JSONObject getRule() throws JSONException {
+ return _client.get("/cluster/firewall/groups/" + _group + "/" + _pos + "", null);
}
/**
@@ -769,7 +780,7 @@ public JSONObject getRule() {
* ports or ranges.
* @param type Rule type. Enum: in,out,group
*/
- public void updateRule(String action, String comment, String delete, String dest, String digest, String dport, Integer enable, String iface, String macro, Integer moveto, String proto, String source, String sport, String type) {
+ public void updateRule(String action, String comment, String delete, String dest, String digest, String dport, Integer enable, String iface, String macro, Integer moveto, String proto, String source, String sport, String type) throws JSONException {
Map parameters = new HashMap();
parameters.put("action", action);
parameters.put("comment", comment);
@@ -785,29 +796,29 @@ public void updateRule(String action, String comment, String delete, String dest
parameters.put("source", source);
parameters.put("sport", sport);
parameters.put("type", type);
- _client.executeAction("/cluster/firewall/groups/" + _group + "/" + _pos + "", HttpMethod.PUT, parameters);
+ _client.put("/cluster/firewall/groups/" + _group + "/" + _pos + "", parameters);
}
/**
* Modify rule data.
*/
- public void updateRule() {
- _client.executeAction("/cluster/firewall/groups/" + _group + "/" + _pos + "", HttpMethod.PUT, null);
+ public void updateRule() throws JSONException {
+ _client.put("/cluster/firewall/groups/" + _group + "/" + _pos + "", null);
}
}
/**
* Delete security group.
*/
- public void deleteSecurityGroup() {
- _client.executeAction("/cluster/firewall/groups/" + _group + "", HttpMethod.DELETE, null);
+ public void deleteSecurityGroup() throws JSONException {
+ _client.delete("/cluster/firewall/groups/" + _group + "", null);
}
/**
* List rules.
*/
- public JSONObject getRules() {
- return _client.executeAction("/cluster/firewall/groups/" + _group + "", HttpMethod.GET, null);
+ public JSONObject getRules() throws JSONException {
+ return _client.get("/cluster/firewall/groups/" + _group + "", null);
}
/**
@@ -854,7 +865,7 @@ public JSONObject getRules() {
* '\d+:\d+', for example '80:85', and you can use comma
* separated list to match several ports or ranges.
*/
- public void createRule(String action, String type, String comment, String dest, String digest, String dport, Integer enable, String iface, String macro, Integer pos, String proto, String source, String sport) {
+ public void createRule(String action, String type, String comment, String dest, String digest, String dport, Integer enable, String iface, String macro, Integer pos, String proto, String source, String sport) throws JSONException {
Map parameters = new HashMap();
parameters.put("action", action);
parameters.put("type", type);
@@ -869,7 +880,7 @@ public void createRule(String action, String type, String comment, String dest,
parameters.put("proto", proto);
parameters.put("source", source);
parameters.put("sport", sport);
- _client.executeAction("/cluster/firewall/groups/" + _group + "", HttpMethod.POST, parameters);
+ _client.post("/cluster/firewall/groups/" + _group + "", parameters);
}
/**
@@ -879,19 +890,19 @@ public void createRule(String action, String type, String comment, String dest,
* security group name.
* @param type Rule type. Enum: in,out,group
*/
- public void createRule(String action, String type) {
+ public void createRule(String action, String type) throws JSONException {
Map parameters = new HashMap();
parameters.put("action", action);
parameters.put("type", type);
- _client.executeAction("/cluster/firewall/groups/" + _group + "", HttpMethod.POST, parameters);
+ _client.post("/cluster/firewall/groups/" + _group + "", parameters);
}
}
/**
* List security groups.
*/
- public JSONObject listSecurityGroups() {
- return _client.executeAction("/cluster/firewall/groups", HttpMethod.GET, null);
+ public JSONObject listSecurityGroups() throws JSONException {
+ return _client.get("/cluster/firewall/groups", null);
}
/**
@@ -906,13 +917,13 @@ public JSONObject listSecurityGroups() {
* can set 'rename' to the same value as 'name' to update the
* 'comment' of an existing group.
*/
- public void createSecurityGroup(String group, String comment, String digest, String rename) {
+ public void createSecurityGroup(String group, String comment, String digest, String rename) throws JSONException {
Map parameters = new HashMap();
parameters.put("group", group);
parameters.put("comment", comment);
parameters.put("digest", digest);
parameters.put("rename", rename);
- _client.executeAction("/cluster/firewall/groups", HttpMethod.POST, parameters);
+ _client.post("/cluster/firewall/groups", parameters);
}
/**
@@ -920,10 +931,10 @@ public void createSecurityGroup(String group, String comment, String digest, Str
*
* @param group Security Group name.
*/
- public void createSecurityGroup(String group) {
+ public void createSecurityGroup(String group) throws JSONException {
Map parameters = new HashMap();
parameters.put("group", group);
- _client.executeAction("/cluster/firewall/groups", HttpMethod.POST, parameters);
+ _client.post("/cluster/firewall/groups", parameters);
}
}
@@ -953,24 +964,24 @@ protected PVEItemPos(Client client, Object pos) {
* file has different SHA1 digest. This can be used to
* prevent concurrent modifications.
*/
- public void deleteRule(String digest) {
+ public void deleteRule(String digest) throws JSONException {
Map parameters = new HashMap();
parameters.put("digest", digest);
- _client.executeAction("/cluster/firewall/rules/" + _pos + "", HttpMethod.DELETE, parameters);
+ _client.delete("/cluster/firewall/rules/" + _pos + "", parameters);
}
/**
* Delete rule.
*/
- public void deleteRule() {
- _client.executeAction("/cluster/firewall/rules/" + _pos + "", HttpMethod.DELETE, null);
+ public void deleteRule() throws JSONException {
+ _client.delete("/cluster/firewall/rules/" + _pos + "", null);
}
/**
* Get single rule data.
*/
- public JSONObject getRule() {
- return _client.executeAction("/cluster/firewall/rules/" + _pos + "", HttpMethod.GET, null);
+ public JSONObject getRule() throws JSONException {
+ return _client.get("/cluster/firewall/rules/" + _pos + "", null);
}
/**
@@ -1019,7 +1030,7 @@ public JSONObject getRule() {
* separated list to match several ports or ranges.
* @param type Rule type. Enum: in,out,group
*/
- public void updateRule(String action, String comment, String delete, String dest, String digest, String dport, Integer enable, String iface, String macro, Integer moveto, String proto, String source, String sport, String type) {
+ public void updateRule(String action, String comment, String delete, String dest, String digest, String dport, Integer enable, String iface, String macro, Integer moveto, String proto, String source, String sport, String type) throws JSONException {
Map parameters = new HashMap();
parameters.put("action", action);
parameters.put("comment", comment);
@@ -1035,22 +1046,22 @@ public void updateRule(String action, String comment, String delete, String dest
parameters.put("source", source);
parameters.put("sport", sport);
parameters.put("type", type);
- _client.executeAction("/cluster/firewall/rules/" + _pos + "", HttpMethod.PUT, parameters);
+ _client.put("/cluster/firewall/rules/" + _pos + "", parameters);
}
/**
* Modify rule data.
*/
- public void updateRule() {
- _client.executeAction("/cluster/firewall/rules/" + _pos + "", HttpMethod.PUT, null);
+ public void updateRule() throws JSONException {
+ _client.put("/cluster/firewall/rules/" + _pos + "", null);
}
}
/**
* List rules.
*/
- public JSONObject getRules() {
- return _client.executeAction("/cluster/firewall/rules", HttpMethod.GET, null);
+ public JSONObject getRules() throws JSONException {
+ return _client.get("/cluster/firewall/rules", null);
}
/**
@@ -1095,7 +1106,7 @@ public JSONObject getRules() {
* for example '80:85', and you can use comma separated list to
* match several ports or ranges.
*/
- public void createRule(String action, String type, String comment, String dest, String digest, String dport, Integer enable, String iface, String macro, Integer pos, String proto, String source, String sport) {
+ public void createRule(String action, String type, String comment, String dest, String digest, String dport, Integer enable, String iface, String macro, Integer pos, String proto, String source, String sport) throws JSONException {
Map parameters = new HashMap();
parameters.put("action", action);
parameters.put("type", type);
@@ -1110,7 +1121,7 @@ public void createRule(String action, String type, String comment, String dest,
parameters.put("proto", proto);
parameters.put("source", source);
parameters.put("sport", sport);
- _client.executeAction("/cluster/firewall/rules", HttpMethod.POST, parameters);
+ _client.post("/cluster/firewall/rules", parameters);
}
/**
@@ -1120,11 +1131,11 @@ public void createRule(String action, String type, String comment, String dest,
* security group name.
* @param type Rule type. Enum: in,out,group
*/
- public void createRule(String action, String type) {
+ public void createRule(String action, String type) throws JSONException {
Map parameters = new HashMap();
parameters.put("action", action);
parameters.put("type", type);
- _client.executeAction("/cluster/firewall/rules", HttpMethod.POST, parameters);
+ _client.post("/cluster/firewall/rules", parameters);
}
}
@@ -1169,24 +1180,24 @@ protected PVEItemCidr(Client client, Object name, Object cidr) {
* configuration file has different SHA1 digest. This
* can be used to prevent concurrent modifications.
*/
- public void removeIp(String digest) {
+ public void removeIp(String digest) throws JSONException {
Map parameters = new HashMap();
parameters.put("digest", digest);
- _client.executeAction("/cluster/firewall/ipset/" + _name + "/" + _cidr + "", HttpMethod.DELETE, parameters);
+ _client.delete("/cluster/firewall/ipset/" + _name + "/" + _cidr + "", parameters);
}
/**
* Remove IP or Network from IPSet.
*/
- public void removeIp() {
- _client.executeAction("/cluster/firewall/ipset/" + _name + "/" + _cidr + "", HttpMethod.DELETE, null);
+ public void removeIp() throws JSONException {
+ _client.delete("/cluster/firewall/ipset/" + _name + "/" + _cidr + "", null);
}
/**
* Read IP or Network settings from IPSet.
*/
- public JSONObject readIp() {
- return _client.executeAction("/cluster/firewall/ipset/" + _name + "/" + _cidr + "", HttpMethod.GET, null);
+ public JSONObject readIp() throws JSONException {
+ return _client.get("/cluster/firewall/ipset/" + _name + "/" + _cidr + "", null);
}
/**
@@ -1198,34 +1209,34 @@ public JSONObject readIp() {
* can be used to prevent concurrent modifications.
* @param nomatch
*/
- public void updateIp(String comment, String digest, Boolean nomatch) {
+ public void updateIp(String comment, String digest, Boolean nomatch) throws JSONException {
Map parameters = new HashMap();
parameters.put("comment", comment);
parameters.put("digest", digest);
parameters.put("nomatch", nomatch);
- _client.executeAction("/cluster/firewall/ipset/" + _name + "/" + _cidr + "", HttpMethod.PUT, parameters);
+ _client.put("/cluster/firewall/ipset/" + _name + "/" + _cidr + "", parameters);
}
/**
* Update IP or Network settings
*/
- public void updateIp() {
- _client.executeAction("/cluster/firewall/ipset/" + _name + "/" + _cidr + "", HttpMethod.PUT, null);
+ public void updateIp() throws JSONException {
+ _client.put("/cluster/firewall/ipset/" + _name + "/" + _cidr + "", null);
}
}
/**
* Delete IPSet
*/
- public void deleteIpset() {
- _client.executeAction("/cluster/firewall/ipset/" + _name + "", HttpMethod.DELETE, null);
+ public void deleteIpset() throws JSONException {
+ _client.delete("/cluster/firewall/ipset/" + _name + "", null);
}
/**
* List IPSet content
*/
- public JSONObject getIpset() {
- return _client.executeAction("/cluster/firewall/ipset/" + _name + "", HttpMethod.GET, null);
+ public JSONObject getIpset() throws JSONException {
+ return _client.get("/cluster/firewall/ipset/" + _name + "", null);
}
/**
@@ -1235,12 +1246,12 @@ public JSONObject getIpset() {
* @param comment
* @param nomatch
*/
- public void createIp(String cidr, String comment, Boolean nomatch) {
+ public void createIp(String cidr, String comment, Boolean nomatch) throws JSONException {
Map parameters = new HashMap();
parameters.put("cidr", cidr);
parameters.put("comment", comment);
parameters.put("nomatch", nomatch);
- _client.executeAction("/cluster/firewall/ipset/" + _name + "", HttpMethod.POST, parameters);
+ _client.post("/cluster/firewall/ipset/" + _name + "", parameters);
}
/**
@@ -1248,18 +1259,18 @@ public void createIp(String cidr, String comment, Boolean nomatch) {
*
* @param cidr Network/IP specification in CIDR format.
*/
- public void createIp(String cidr) {
+ public void createIp(String cidr) throws JSONException {
Map parameters = new HashMap();
parameters.put("cidr", cidr);
- _client.executeAction("/cluster/firewall/ipset/" + _name + "", HttpMethod.POST, parameters);
+ _client.post("/cluster/firewall/ipset/" + _name + "", parameters);
}
}
/**
* List IPSets
*/
- public JSONObject ipsetIndex() {
- return _client.executeAction("/cluster/firewall/ipset", HttpMethod.GET, null);
+ public JSONObject ipsetIndex() throws JSONException {
+ return _client.get("/cluster/firewall/ipset", null);
}
/**
@@ -1274,13 +1285,13 @@ public JSONObject ipsetIndex() {
* to the same value as 'name' to update the 'comment' of an
* existing IPSet.
*/
- public void createIpset(String name, String comment, String digest, String rename) {
+ public void createIpset(String name, String comment, String digest, String rename) throws JSONException {
Map parameters = new HashMap();
parameters.put("name", name);
parameters.put("comment", comment);
parameters.put("digest", digest);
parameters.put("rename", rename);
- _client.executeAction("/cluster/firewall/ipset", HttpMethod.POST, parameters);
+ _client.post("/cluster/firewall/ipset", parameters);
}
/**
@@ -1288,10 +1299,10 @@ public void createIpset(String name, String comment, String digest, String renam
*
* @param name IP set name.
*/
- public void createIpset(String name) {
+ public void createIpset(String name) throws JSONException {
Map parameters = new HashMap();
parameters.put("name", name);
- _client.executeAction("/cluster/firewall/ipset", HttpMethod.POST, parameters);
+ _client.post("/cluster/firewall/ipset", parameters);
}
}
@@ -1321,24 +1332,24 @@ protected PVEItemName(Client client, Object name) {
* file has different SHA1 digest. This can be used to
* prevent concurrent modifications.
*/
- public void removeAlias(String digest) {
+ public void removeAlias(String digest) throws JSONException {
Map parameters = new HashMap();
parameters.put("digest", digest);
- _client.executeAction("/cluster/firewall/aliases/" + _name + "", HttpMethod.DELETE, parameters);
+ _client.delete("/cluster/firewall/aliases/" + _name + "", parameters);
}
/**
* Remove IP or Network alias.
*/
- public void removeAlias() {
- _client.executeAction("/cluster/firewall/aliases/" + _name + "", HttpMethod.DELETE, null);
+ public void removeAlias() throws JSONException {
+ _client.delete("/cluster/firewall/aliases/" + _name + "", null);
}
/**
* Read alias.
*/
- public JSONObject readAlias() {
- return _client.executeAction("/cluster/firewall/aliases/" + _name + "", HttpMethod.GET, null);
+ public JSONObject readAlias() throws JSONException {
+ return _client.get("/cluster/firewall/aliases/" + _name + "", null);
}
/**
@@ -1351,13 +1362,13 @@ public JSONObject readAlias() {
* prevent concurrent modifications.
* @param rename Rename an existing alias.
*/
- public void updateAlias(String cidr, String comment, String digest, String rename) {
+ public void updateAlias(String cidr, String comment, String digest, String rename) throws JSONException {
Map parameters = new HashMap();
parameters.put("cidr", cidr);
parameters.put("comment", comment);
parameters.put("digest", digest);
parameters.put("rename", rename);
- _client.executeAction("/cluster/firewall/aliases/" + _name + "", HttpMethod.PUT, parameters);
+ _client.put("/cluster/firewall/aliases/" + _name + "", parameters);
}
/**
@@ -1365,18 +1376,18 @@ public void updateAlias(String cidr, String comment, String digest, String renam
*
* @param cidr Network/IP specification in CIDR format.
*/
- public void updateAlias(String cidr) {
+ public void updateAlias(String cidr) throws JSONException {
Map parameters = new HashMap();
parameters.put("cidr", cidr);
- _client.executeAction("/cluster/firewall/aliases/" + _name + "", HttpMethod.PUT, parameters);
+ _client.put("/cluster/firewall/aliases/" + _name + "", parameters);
}
}
/**
* List aliases
*/
- public JSONObject getAliases() {
- return _client.executeAction("/cluster/firewall/aliases", HttpMethod.GET, null);
+ public JSONObject getAliases() throws JSONException {
+ return _client.get("/cluster/firewall/aliases", null);
}
/**
@@ -1386,12 +1397,12 @@ public JSONObject getAliases() {
* @param name Alias name.
* @param comment
*/
- public void createAlias(String cidr, String name, String comment) {
+ public void createAlias(String cidr, String name, String comment) throws JSONException {
Map parameters = new HashMap();
parameters.put("cidr", cidr);
parameters.put("name", name);
parameters.put("comment", comment);
- _client.executeAction("/cluster/firewall/aliases", HttpMethod.POST, parameters);
+ _client.post("/cluster/firewall/aliases", parameters);
}
/**
@@ -1400,11 +1411,11 @@ public void createAlias(String cidr, String name, String comment) {
* @param cidr Network/IP specification in CIDR format.
* @param name Alias name.
*/
- public void createAlias(String cidr, String name) {
+ public void createAlias(String cidr, String name) throws JSONException {
Map parameters = new HashMap();
parameters.put("cidr", cidr);
parameters.put("name", name);
- _client.executeAction("/cluster/firewall/aliases", HttpMethod.POST, parameters);
+ _client.post("/cluster/firewall/aliases", parameters);
}
}
@@ -1417,8 +1428,8 @@ protected PVEOptions(Client client) {
/**
* Get Firewall options.
*/
- public JSONObject getOptions() {
- return _client.executeAction("/cluster/firewall/options", HttpMethod.GET, null);
+ public JSONObject getOptions() throws JSONException {
+ return _client.get("/cluster/firewall/options", null);
}
/**
@@ -1432,21 +1443,21 @@ public JSONObject getOptions() {
* @param policy_in Input policy. Enum: ACCEPT,REJECT,DROP
* @param policy_out Output policy. Enum: ACCEPT,REJECT,DROP
*/
- public void setOptions(String delete, String digest, Integer enable, String policy_in, String policy_out) {
+ public void setOptions(String delete, String digest, Integer enable, String policy_in, String policy_out) throws JSONException {
Map parameters = new HashMap();
parameters.put("delete", delete);
parameters.put("digest", digest);
parameters.put("enable", enable);
parameters.put("policy_in", policy_in);
parameters.put("policy_out", policy_out);
- _client.executeAction("/cluster/firewall/options", HttpMethod.PUT, parameters);
+ _client.put("/cluster/firewall/options", parameters);
}
/**
* Set Firewall options.
*/
- public void setOptions() {
- _client.executeAction("/cluster/firewall/options", HttpMethod.PUT, null);
+ public void setOptions() throws JSONException {
+ _client.put("/cluster/firewall/options", null);
}
}
@@ -1459,8 +1470,8 @@ protected PVEMacros(Client client) {
/**
* List available macros
*/
- public JSONObject getMacros() {
- return _client.executeAction("/cluster/firewall/macros", HttpMethod.GET, null);
+ public JSONObject getMacros() throws JSONException {
+ return _client.get("/cluster/firewall/macros", null);
}
}
@@ -1477,26 +1488,26 @@ protected PVERefs(Client client) {
* @param type Only list references of specified type. Enum:
* alias,ipset
*/
- public JSONObject refs(String type) {
+ public JSONObject refs(String type) throws JSONException {
Map parameters = new HashMap();
parameters.put("type", type);
- return _client.executeAction("/cluster/firewall/refs", HttpMethod.GET, parameters);
+ return _client.get("/cluster/firewall/refs", parameters);
}
/**
* Lists possible IPSet/Alias reference which are allowed in
* source/dest properties.
*/
- public JSONObject refs() {
- return _client.executeAction("/cluster/firewall/refs", HttpMethod.GET, null);
+ public JSONObject refs() throws JSONException {
+ return _client.get("/cluster/firewall/refs", null);
}
}
/**
* Directory index.
*/
- public JSONObject index() {
- return _client.executeAction("/cluster/firewall", HttpMethod.GET, null);
+ public JSONObject index() throws JSONException {
+ return _client.get("/cluster/firewall", null);
}
}
@@ -1522,15 +1533,15 @@ protected PVEItemId(Client client, Object id) {
/**
* Delete vzdump backup job definition.
*/
- public void deleteJob() {
- _client.executeAction("/cluster/backup/" + _id + "", HttpMethod.DELETE, null);
+ public void deleteJob() throws JSONException {
+ _client.delete("/cluster/backup/" + _id + "", null);
}
/**
* Read vzdump backup job definition.
*/
- public JSONObject readJob() {
- return _client.executeAction("/cluster/backup/" + _id + "", HttpMethod.GET, null);
+ public JSONObject readJob() throws JSONException {
+ return _client.get("/cluster/backup/" + _id + "", null);
}
/**
@@ -1574,7 +1585,7 @@ public JSONObject readJob() {
* @param tmpdir Store temporary files to specified directory.
* @param vmid The ID of the guest system you want to backup.
*/
- public void updateJob(String starttime, Boolean all, Integer bwlimit, String compress, String delete, String dow, String dumpdir, Boolean enabled, String exclude, String exclude_path, Integer ionice, Integer lockwait, String mailnotification, String mailto, Integer maxfiles, String mode, String node, Integer pigz, Boolean quiet, Boolean remove, String script, Integer size, Boolean stdexcludes, Boolean stop, Integer stopwait, String storage, String tmpdir, String vmid) {
+ public void updateJob(String starttime, Boolean all, Integer bwlimit, String compress, String delete, String dow, String dumpdir, Boolean enabled, String exclude, String exclude_path, Integer ionice, Integer lockwait, String mailnotification, String mailto, Integer maxfiles, String mode, String node, Integer pigz, Boolean quiet, Boolean remove, String script, Integer size, Boolean stdexcludes, Boolean stop, Integer stopwait, String storage, String tmpdir, String vmid) throws JSONException {
Map parameters = new HashMap();
parameters.put("starttime", starttime);
parameters.put("all", all);
@@ -1604,7 +1615,7 @@ public void updateJob(String starttime, Boolean all, Integer bwlimit, String com
parameters.put("storage", storage);
parameters.put("tmpdir", tmpdir);
parameters.put("vmid", vmid);
- _client.executeAction("/cluster/backup/" + _id + "", HttpMethod.PUT, parameters);
+ _client.put("/cluster/backup/" + _id + "", parameters);
}
/**
@@ -1612,18 +1623,18 @@ public void updateJob(String starttime, Boolean all, Integer bwlimit, String com
*
* @param starttime Job Start time.
*/
- public void updateJob(String starttime) {
+ public void updateJob(String starttime) throws JSONException {
Map parameters = new HashMap();
parameters.put("starttime", starttime);
- _client.executeAction("/cluster/backup/" + _id + "", HttpMethod.PUT, parameters);
+ _client.put("/cluster/backup/" + _id + "", parameters);
}
}
/**
* List vzdump backup schedule.
*/
- public JSONObject index() {
- return _client.executeAction("/cluster/backup", HttpMethod.GET, null);
+ public JSONObject index() throws JSONException {
+ return _client.get("/cluster/backup", null);
}
/**
@@ -1664,7 +1675,7 @@ public JSONObject index() {
* @param tmpdir Store temporary files to specified directory.
* @param vmid The ID of the guest system you want to backup.
*/
- public void createJob(String starttime, Boolean all, Integer bwlimit, String compress, String dow, String dumpdir, Boolean enabled, String exclude, String exclude_path, Integer ionice, Integer lockwait, String mailnotification, String mailto, Integer maxfiles, String mode, String node, Integer pigz, Boolean quiet, Boolean remove, String script, Integer size, Boolean stdexcludes, Boolean stop, Integer stopwait, String storage, String tmpdir, String vmid) {
+ public void createJob(String starttime, Boolean all, Integer bwlimit, String compress, String dow, String dumpdir, Boolean enabled, String exclude, String exclude_path, Integer ionice, Integer lockwait, String mailnotification, String mailto, Integer maxfiles, String mode, String node, Integer pigz, Boolean quiet, Boolean remove, String script, Integer size, Boolean stdexcludes, Boolean stop, Integer stopwait, String storage, String tmpdir, String vmid) throws JSONException {
Map parameters = new HashMap();
parameters.put("starttime", starttime);
parameters.put("all", all);
@@ -1693,7 +1704,7 @@ public void createJob(String starttime, Boolean all, Integer bwlimit, String com
parameters.put("storage", storage);
parameters.put("tmpdir", tmpdir);
parameters.put("vmid", vmid);
- _client.executeAction("/cluster/backup", HttpMethod.POST, parameters);
+ _client.post("/cluster/backup", parameters);
}
/**
@@ -1701,10 +1712,10 @@ public void createJob(String starttime, Boolean all, Integer bwlimit, String com
*
* @param starttime Job Start time.
*/
- public void createJob(String starttime) {
+ public void createJob(String starttime) throws JSONException {
Map parameters = new HashMap();
parameters.put("starttime", starttime);
- _client.executeAction("/cluster/backup", HttpMethod.POST, parameters);
+ _client.post("/cluster/backup", parameters);
}
}
@@ -1787,10 +1798,10 @@ protected PVEMigrate(Client client, Object sid) {
*
* @param node The cluster node name.
*/
- public void migrate(String node) {
+ public void migrate(String node) throws JSONException {
Map parameters = new HashMap();
parameters.put("node", node);
- _client.executeAction("/cluster/ha/resources/" + _sid + "/migrate", HttpMethod.POST, parameters);
+ _client.post("/cluster/ha/resources/" + _sid + "/migrate", parameters);
}
}
@@ -1810,25 +1821,25 @@ protected PVERelocate(Client client, Object sid) {
*
* @param node The cluster node name.
*/
- public void relocate(String node) {
+ public void relocate(String node) throws JSONException {
Map parameters = new HashMap();
parameters.put("node", node);
- _client.executeAction("/cluster/ha/resources/" + _sid + "/relocate", HttpMethod.POST, parameters);
+ _client.post("/cluster/ha/resources/" + _sid + "/relocate", parameters);
}
}
/**
* Delete resource configuration.
*/
- public void delete() {
- _client.executeAction("/cluster/ha/resources/" + _sid + "", HttpMethod.DELETE, null);
+ public void delete() throws JSONException {
+ _client.delete("/cluster/ha/resources/" + _sid + "", null);
}
/**
* Read resource configuration.
*/
- public JSONObject read() {
- return _client.executeAction("/cluster/ha/resources/" + _sid + "", HttpMethod.GET, null);
+ public JSONObject read() throws JSONException {
+ return _client.get("/cluster/ha/resources/" + _sid + "", null);
}
/**
@@ -1847,7 +1858,7 @@ public JSONObject read() {
* @param state Requested resource state. Enum:
* started,stopped,enabled,disabled
*/
- public void update(String comment, String delete, String digest, String group, Integer max_relocate, Integer max_restart, String state) {
+ public void update(String comment, String delete, String digest, String group, Integer max_relocate, Integer max_restart, String state) throws JSONException {
Map parameters = new HashMap();
parameters.put("comment", comment);
parameters.put("delete", delete);
@@ -1856,14 +1867,14 @@ public void update(String comment, String delete, String digest, String group, I
parameters.put("max_relocate", max_relocate);
parameters.put("max_restart", max_restart);
parameters.put("state", state);
- _client.executeAction("/cluster/ha/resources/" + _sid + "", HttpMethod.PUT, parameters);
+ _client.put("/cluster/ha/resources/" + _sid + "", parameters);
}
/**
* Update resource configuration.
*/
- public void update() {
- _client.executeAction("/cluster/ha/resources/" + _sid + "", HttpMethod.PUT, null);
+ public void update() throws JSONException {
+ _client.put("/cluster/ha/resources/" + _sid + "", null);
}
}
@@ -1872,17 +1883,17 @@ public void update() {
*
* @param type Only list resources of specific type Enum: ct,vm
*/
- public JSONObject index(String type) {
+ public JSONObject index(String type) throws JSONException {
Map parameters = new HashMap();
parameters.put("type", type);
- return _client.executeAction("/cluster/ha/resources", HttpMethod.GET, parameters);
+ return _client.get("/cluster/ha/resources", parameters);
}
/**
* List HA resources.
*/
- public JSONObject index() {
- return _client.executeAction("/cluster/ha/resources", HttpMethod.GET, null);
+ public JSONObject index() throws JSONException {
+ return _client.get("/cluster/ha/resources", null);
}
/**
@@ -1903,7 +1914,7 @@ public JSONObject index() {
* started,stopped,enabled,disabled
* @param type Resource type. Enum: ct,vm
*/
- public void create(String sid, String comment, String group, Integer max_relocate, Integer max_restart, String state, String type) {
+ public void create(String sid, String comment, String group, Integer max_relocate, Integer max_restart, String state, String type) throws JSONException {
Map parameters = new HashMap();
parameters.put("sid", sid);
parameters.put("comment", comment);
@@ -1912,7 +1923,7 @@ public void create(String sid, String comment, String group, Integer max_relocat
parameters.put("max_restart", max_restart);
parameters.put("state", state);
parameters.put("type", type);
- _client.executeAction("/cluster/ha/resources", HttpMethod.POST, parameters);
+ _client.post("/cluster/ha/resources", parameters);
}
/**
@@ -1924,10 +1935,10 @@ public void create(String sid, String comment, String group, Integer max_relocat
* containers, you can simply use the VM or CT id as a shortcut
* (example: 100).
*/
- public void create(String sid) {
+ public void create(String sid) throws JSONException {
Map parameters = new HashMap();
parameters.put("sid", sid);
- _client.executeAction("/cluster/ha/resources", HttpMethod.POST, parameters);
+ _client.post("/cluster/ha/resources", parameters);
}
}
@@ -1953,15 +1964,15 @@ protected PVEItemGroup(Client client, Object group) {
/**
* Delete ha group configuration.
*/
- public void delete() {
- _client.executeAction("/cluster/ha/groups/" + _group + "", HttpMethod.DELETE, null);
+ public void delete() throws JSONException {
+ _client.delete("/cluster/ha/groups/" + _group + "", null);
}
/**
* Read ha group configuration.
*/
- public JSONObject read() {
- return _client.executeAction("/cluster/ha/groups/" + _group + "", HttpMethod.GET, null);
+ public JSONObject read() throws JSONException {
+ return _client.get("/cluster/ha/groups/" + _group + "", null);
}
/**
@@ -1981,7 +1992,7 @@ public JSONObject read() {
* @param restricted Resources bound to restricted groups
* may only run on nodes defined by the group.
*/
- public void update(String comment, String delete, String digest, String nodes, Boolean nofailback, Boolean restricted) {
+ public void update(String comment, String delete, String digest, String nodes, Boolean nofailback, Boolean restricted) throws JSONException {
Map parameters = new HashMap();
parameters.put("comment", comment);
parameters.put("delete", delete);
@@ -1989,22 +2000,22 @@ public void update(String comment, String delete, String digest, String nodes, B
parameters.put("nodes", nodes);
parameters.put("nofailback", nofailback);
parameters.put("restricted", restricted);
- _client.executeAction("/cluster/ha/groups/" + _group + "", HttpMethod.PUT, parameters);
+ _client.put("/cluster/ha/groups/" + _group + "", parameters);
}
/**
* Update ha group configuration.
*/
- public void update() {
- _client.executeAction("/cluster/ha/groups/" + _group + "", HttpMethod.PUT, null);
+ public void update() throws JSONException {
+ _client.put("/cluster/ha/groups/" + _group + "", null);
}
}
/**
* Get HA groups.
*/
- public JSONObject index() {
- return _client.executeAction("/cluster/ha/groups", HttpMethod.GET, null);
+ public JSONObject index() throws JSONException {
+ return _client.get("/cluster/ha/groups", null);
}
/**
@@ -2022,7 +2033,7 @@ public JSONObject index() {
* only run on nodes defined by the group.
* @param type Group type. Enum: group
*/
- public void create(String group, String nodes, String comment, Boolean nofailback, Boolean restricted, String type) {
+ public void create(String group, String nodes, String comment, Boolean nofailback, Boolean restricted, String type) throws JSONException {
Map parameters = new HashMap();
parameters.put("group", group);
parameters.put("nodes", nodes);
@@ -2030,7 +2041,7 @@ public void create(String group, String nodes, String comment, Boolean nofailbac
parameters.put("nofailback", nofailback);
parameters.put("restricted", restricted);
parameters.put("type", type);
- _client.executeAction("/cluster/ha/groups", HttpMethod.POST, parameters);
+ _client.post("/cluster/ha/groups", parameters);
}
/**
@@ -2040,11 +2051,11 @@ public void create(String group, String nodes, String comment, Boolean nofailbac
* @param nodes List of cluster node names with optional
* priority.
*/
- public void create(String group, String nodes) {
+ public void create(String group, String nodes) throws JSONException {
Map parameters = new HashMap();
parameters.put("group", group);
parameters.put("nodes", nodes);
- _client.executeAction("/cluster/ha/groups", HttpMethod.POST, parameters);
+ _client.post("/cluster/ha/groups", parameters);
}
}
@@ -2079,8 +2090,8 @@ protected PVECurrent(Client client) {
/**
* Get HA manger status.
*/
- public JSONObject status() {
- return _client.executeAction("/cluster/ha/status/current", HttpMethod.GET, null);
+ public JSONObject status() throws JSONException {
+ return _client.get("/cluster/ha/status/current", null);
}
}
@@ -2093,24 +2104,24 @@ protected PVEManagerStatus(Client client) {
/**
* Get full HA manger status, including LRM status.
*/
- public JSONObject managerStatus() {
- return _client.executeAction("/cluster/ha/status/manager_status", HttpMethod.GET, null);
+ public JSONObject managerStatus() throws JSONException {
+ return _client.get("/cluster/ha/status/manager_status", null);
}
}
/**
* Directory index.
*/
- public JSONObject index() {
- return _client.executeAction("/cluster/ha/status", HttpMethod.GET, null);
+ public JSONObject index() throws JSONException {
+ return _client.get("/cluster/ha/status", null);
}
}
/**
* Directory index.
*/
- public JSONObject index() {
- return _client.executeAction("/cluster/ha", HttpMethod.GET, null);
+ public JSONObject index() throws JSONException {
+ return _client.get("/cluster/ha", null);
}
}
@@ -2125,17 +2136,17 @@ protected PVELog(Client client) {
*
* @param max Maximum number of entries.
*/
- public JSONObject log(Integer max) {
+ public JSONObject log(Integer max) throws JSONException {
Map parameters = new HashMap();
parameters.put("max", max);
- return _client.executeAction("/cluster/log", HttpMethod.GET, parameters);
+ return _client.get("/cluster/log", parameters);
}
/**
* Read cluster log
*/
- public JSONObject log() {
- return _client.executeAction("/cluster/log", HttpMethod.GET, null);
+ public JSONObject log() throws JSONException {
+ return _client.get("/cluster/log", null);
}
}
@@ -2150,17 +2161,17 @@ protected PVEResources(Client client) {
*
* @param type Enum: vm,storage,node
*/
- public JSONObject resources(String type) {
+ public JSONObject resources(String type) throws JSONException {
Map parameters = new HashMap();
parameters.put("type", type);
- return _client.executeAction("/cluster/resources", HttpMethod.GET, parameters);
+ return _client.get("/cluster/resources", parameters);
}
/**
* Resources index (cluster wide).
*/
- public JSONObject resources() {
- return _client.executeAction("/cluster/resources", HttpMethod.GET, null);
+ public JSONObject resources() throws JSONException {
+ return _client.get("/cluster/resources", null);
}
}
@@ -2173,8 +2184,8 @@ protected PVETasks(Client client) {
/**
* List recent tasks (cluster wide).
*/
- public JSONObject tasks() {
- return _client.executeAction("/cluster/tasks", HttpMethod.GET, null);
+ public JSONObject tasks() throws JSONException {
+ return _client.get("/cluster/tasks", null);
}
}
@@ -2187,8 +2198,8 @@ protected PVEOptions(Client client) {
/**
* Get datacenter options.
*/
- public JSONObject getOptions() {
- return _client.executeAction("/cluster/options", HttpMethod.GET, null);
+ public JSONObject getOptions() throws JSONException {
+ return _client.get("/cluster/options", null);
}
/**
@@ -2220,7 +2231,7 @@ public JSONObject getOptions() {
* default. For secure private networks you can disable it to speed
* up migration. Deprecated, use the 'migration' property instead!
*/
- public void setOptions(String console, String delete, String email_from, String fencing, String http_proxy, String keyboard, String language, String mac_prefix, Integer max_workers, String migration, Boolean migration_unsecure) {
+ public void setOptions(String console, String delete, String email_from, String fencing, String http_proxy, String keyboard, String language, String mac_prefix, Integer max_workers, String migration, Boolean migration_unsecure) throws JSONException {
Map parameters = new HashMap();
parameters.put("console", console);
parameters.put("delete", delete);
@@ -2233,14 +2244,14 @@ public void setOptions(String console, String delete, String email_from, String
parameters.put("max_workers", max_workers);
parameters.put("migration", migration);
parameters.put("migration_unsecure", migration_unsecure);
- _client.executeAction("/cluster/options", HttpMethod.PUT, parameters);
+ _client.put("/cluster/options", parameters);
}
/**
* Set datacenter options.
*/
- public void setOptions() {
- _client.executeAction("/cluster/options", HttpMethod.PUT, null);
+ public void setOptions() throws JSONException {
+ _client.put("/cluster/options", null);
}
}
@@ -2253,8 +2264,8 @@ protected PVEStatus(Client client) {
/**
* Get cluster status informations.
*/
- public JSONObject getStatus() {
- return _client.executeAction("/cluster/status", HttpMethod.GET, null);
+ public JSONObject getStatus() throws JSONException {
+ return _client.get("/cluster/status", null);
}
}
@@ -2270,26 +2281,26 @@ protected PVENextid(Client client) {
*
* @param vmid The (unique) ID of the VM.
*/
- public JSONObject nextid(Integer vmid) {
+ public JSONObject nextid(Integer vmid) throws JSONException {
Map parameters = new HashMap();
parameters.put("vmid", vmid);
- return _client.executeAction("/cluster/nextid", HttpMethod.GET, parameters);
+ return _client.get("/cluster/nextid", parameters);
}
/**
* Get next free VMID. If you pass an VMID it will raise an error if
* the ID is already used.
*/
- public JSONObject nextid() {
- return _client.executeAction("/cluster/nextid", HttpMethod.GET, null);
+ public JSONObject nextid() throws JSONException {
+ return _client.get("/cluster/nextid", null);
}
}
/**
* Cluster index.
*/
- public JSONObject index() {
- return _client.executeAction("/cluster", HttpMethod.GET, null);
+ public JSONObject index() throws JSONException {
+ return _client.get("/cluster", null);
}
}
@@ -2839,24 +2850,24 @@ protected PVEItemPos(Client client, Object node, Object vmid, Object pos) {
* This can be used to prevent concurrent
* modifications.
*/
- public void deleteRule(String digest) {
+ public void deleteRule(String digest) throws JSONException {
Map parameters = new HashMap();
parameters.put("digest", digest);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules/" + _pos + "", HttpMethod.DELETE, parameters);
+ _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules/" + _pos + "", parameters);
}
/**
* Delete rule.
*/
- public void deleteRule() {
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules/" + _pos + "", HttpMethod.DELETE, null);
+ public void deleteRule() throws JSONException {
+ _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules/" + _pos + "", null);
}
/**
* Get single rule data.
*/
- public JSONObject getRule() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules/" + _pos + "", HttpMethod.GET, null);
+ public JSONObject getRule() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules/" + _pos + "", null);
}
/**
@@ -2916,7 +2927,7 @@ public JSONObject getRule() {
* ranges.
* @param type Rule type. Enum: in,out,group
*/
- public void updateRule(String action, String comment, String delete, String dest, String digest, String dport, Integer enable, String iface, String macro, Integer moveto, String proto, String source, String sport, String type) {
+ public void updateRule(String action, String comment, String delete, String dest, String digest, String dport, Integer enable, String iface, String macro, Integer moveto, String proto, String source, String sport, String type) throws JSONException {
Map parameters = new HashMap();
parameters.put("action", action);
parameters.put("comment", comment);
@@ -2932,22 +2943,22 @@ public void updateRule(String action, String comment, String delete, String dest
parameters.put("source", source);
parameters.put("sport", sport);
parameters.put("type", type);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules/" + _pos + "", HttpMethod.PUT, parameters);
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules/" + _pos + "", parameters);
}
/**
* Modify rule data.
*/
- public void updateRule() {
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules/" + _pos + "", HttpMethod.PUT, null);
+ public void updateRule() throws JSONException {
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules/" + _pos + "", null);
}
}
/**
* List rules.
*/
- public JSONObject getRules() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules", HttpMethod.GET, null);
+ public JSONObject getRules() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules", null);
}
/**
@@ -3001,7 +3012,7 @@ public JSONObject getRules() {
* example '80:85', and you can use comma separated
* list to match several ports or ranges.
*/
- public void createRule(String action, String type, String comment, String dest, String digest, String dport, Integer enable, String iface, String macro, Integer pos, String proto, String source, String sport) {
+ public void createRule(String action, String type, String comment, String dest, String digest, String dport, Integer enable, String iface, String macro, Integer pos, String proto, String source, String sport) throws JSONException {
Map parameters = new HashMap();
parameters.put("action", action);
parameters.put("type", type);
@@ -3016,7 +3027,7 @@ public void createRule(String action, String type, String comment, String dest,
parameters.put("proto", proto);
parameters.put("source", source);
parameters.put("sport", sport);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules", HttpMethod.POST, parameters);
+ _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules", parameters);
}
/**
@@ -3026,11 +3037,11 @@ public void createRule(String action, String type, String comment, String dest,
* 'REJECT') or security group name.
* @param type Rule type. Enum: in,out,group
*/
- public void createRule(String action, String type) {
+ public void createRule(String action, String type) throws JSONException {
Map parameters = new HashMap();
parameters.put("action", action);
parameters.put("type", type);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules", HttpMethod.POST, parameters);
+ _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/rules", parameters);
}
}
@@ -3070,24 +3081,24 @@ protected PVEItemName(Client client, Object node, Object vmid, Object name) {
* This can be used to prevent concurrent
* modifications.
*/
- public void removeAlias(String digest) {
+ public void removeAlias(String digest) throws JSONException {
Map parameters = new HashMap();
parameters.put("digest", digest);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases/" + _name + "", HttpMethod.DELETE, parameters);
+ _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases/" + _name + "", parameters);
}
/**
* Remove IP or Network alias.
*/
- public void removeAlias() {
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases/" + _name + "", HttpMethod.DELETE, null);
+ public void removeAlias() throws JSONException {
+ _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases/" + _name + "", null);
}
/**
* Read alias.
*/
- public JSONObject readAlias() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases/" + _name + "", HttpMethod.GET, null);
+ public JSONObject readAlias() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases/" + _name + "", null);
}
/**
@@ -3102,13 +3113,13 @@ public JSONObject readAlias() {
* modifications.
* @param rename Rename an existing alias.
*/
- public void updateAlias(String cidr, String comment, String digest, String rename) {
+ public void updateAlias(String cidr, String comment, String digest, String rename) throws JSONException {
Map parameters = new HashMap();
parameters.put("cidr", cidr);
parameters.put("comment", comment);
parameters.put("digest", digest);
parameters.put("rename", rename);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases/" + _name + "", HttpMethod.PUT, parameters);
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases/" + _name + "", parameters);
}
/**
@@ -3117,18 +3128,18 @@ public void updateAlias(String cidr, String comment, String digest, String renam
* @param cidr Network/IP specification in CIDR
* format.
*/
- public void updateAlias(String cidr) {
+ public void updateAlias(String cidr) throws JSONException {
Map parameters = new HashMap();
parameters.put("cidr", cidr);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases/" + _name + "", HttpMethod.PUT, parameters);
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases/" + _name + "", parameters);
}
}
/**
* List aliases
*/
- public JSONObject getAliases() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases", HttpMethod.GET, null);
+ public JSONObject getAliases() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases", null);
}
/**
@@ -3139,12 +3150,12 @@ public JSONObject getAliases() {
* @param name Alias name.
* @param comment
*/
- public void createAlias(String cidr, String name, String comment) {
+ public void createAlias(String cidr, String name, String comment) throws JSONException {
Map parameters = new HashMap();
parameters.put("cidr", cidr);
parameters.put("name", name);
parameters.put("comment", comment);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases", HttpMethod.POST, parameters);
+ _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases", parameters);
}
/**
@@ -3154,11 +3165,11 @@ public void createAlias(String cidr, String name, String comment) {
* format.
* @param name Alias name.
*/
- public void createAlias(String cidr, String name) {
+ public void createAlias(String cidr, String name) throws JSONException {
Map parameters = new HashMap();
parameters.put("cidr", cidr);
parameters.put("name", name);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases", HttpMethod.POST, parameters);
+ _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/aliases", parameters);
}
}
@@ -3217,24 +3228,24 @@ protected PVEItemCidr(Client client, Object node, Object vmid, Object name, Obje
* digest. This can be used to prevent
* concurrent modifications.
*/
- public void removeIp(String digest) {
+ public void removeIp(String digest) throws JSONException {
Map parameters = new HashMap();
parameters.put("digest", digest);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", HttpMethod.DELETE, parameters);
+ _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", parameters);
}
/**
* Remove IP or Network from IPSet.
*/
- public void removeIp() {
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", HttpMethod.DELETE, null);
+ public void removeIp() throws JSONException {
+ _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", null);
}
/**
* Read IP or Network settings from IPSet.
*/
- public JSONObject readIp() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", HttpMethod.GET, null);
+ public JSONObject readIp() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", null);
}
/**
@@ -3247,34 +3258,34 @@ public JSONObject readIp() {
* concurrent modifications.
* @param nomatch
*/
- public void updateIp(String comment, String digest, Boolean nomatch) {
+ public void updateIp(String comment, String digest, Boolean nomatch) throws JSONException {
Map parameters = new HashMap();
parameters.put("comment", comment);
parameters.put("digest", digest);
parameters.put("nomatch", nomatch);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", HttpMethod.PUT, parameters);
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", parameters);
}
/**
* Update IP or Network settings
*/
- public void updateIp() {
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", HttpMethod.PUT, null);
+ public void updateIp() throws JSONException {
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "/" + _cidr + "", null);
}
}
/**
* Delete IPSet
*/
- public void deleteIpset() {
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "", HttpMethod.DELETE, null);
+ public void deleteIpset() throws JSONException {
+ _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "", null);
}
/**
* List IPSet content
*/
- public JSONObject getIpset() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "", HttpMethod.GET, null);
+ public JSONObject getIpset() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "", null);
}
/**
@@ -3285,12 +3296,12 @@ public JSONObject getIpset() {
* @param comment
* @param nomatch
*/
- public void createIp(String cidr, String comment, Boolean nomatch) {
+ public void createIp(String cidr, String comment, Boolean nomatch) throws JSONException {
Map parameters = new HashMap();
parameters.put("cidr", cidr);
parameters.put("comment", comment);
parameters.put("nomatch", nomatch);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "", HttpMethod.POST, parameters);
+ _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "", parameters);
}
/**
@@ -3299,18 +3310,18 @@ public void createIp(String cidr, String comment, Boolean nomatch) {
* @param cidr Network/IP specification in CIDR
* format.
*/
- public void createIp(String cidr) {
+ public void createIp(String cidr) throws JSONException {
Map parameters = new HashMap();
parameters.put("cidr", cidr);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "", HttpMethod.POST, parameters);
+ _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset/" + _name + "", parameters);
}
}
/**
* List IPSets
*/
- public JSONObject ipsetIndex() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset", HttpMethod.GET, null);
+ public JSONObject ipsetIndex() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset", null);
}
/**
@@ -3326,13 +3337,13 @@ public JSONObject ipsetIndex() {
* set 'rename' to the same value as 'name' to
* update the 'comment' of an existing IPSet.
*/
- public void createIpset(String name, String comment, String digest, String rename) {
+ public void createIpset(String name, String comment, String digest, String rename) throws JSONException {
Map parameters = new HashMap();
parameters.put("name", name);
parameters.put("comment", comment);
parameters.put("digest", digest);
parameters.put("rename", rename);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset", HttpMethod.POST, parameters);
+ _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset", parameters);
}
/**
@@ -3340,10 +3351,10 @@ public void createIpset(String name, String comment, String digest, String renam
*
* @param name IP set name.
*/
- public void createIpset(String name) {
+ public void createIpset(String name) throws JSONException {
Map parameters = new HashMap();
parameters.put("name", name);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset", HttpMethod.POST, parameters);
+ _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/ipset", parameters);
}
}
@@ -3361,8 +3372,8 @@ protected PVEOptions(Client client, Object node, Object vmid) {
/**
* Get VM firewall options.
*/
- public JSONObject getOptions() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/options", HttpMethod.GET, null);
+ public JSONObject getOptions() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/options", null);
}
/**
@@ -3399,7 +3410,7 @@ public JSONObject getOptions() {
* ACCEPT,REJECT,DROP
* @param radv Allow sending Router Advertisement.
*/
- public void setOptions(String delete, Boolean dhcp, String digest, Boolean enable, Boolean ipfilter, String log_level_in, String log_level_out, Boolean macfilter, Boolean ndp, String policy_in, String policy_out, Boolean radv) {
+ public void setOptions(String delete, Boolean dhcp, String digest, Boolean enable, Boolean ipfilter, String log_level_in, String log_level_out, Boolean macfilter, Boolean ndp, String policy_in, String policy_out, Boolean radv) throws JSONException {
Map parameters = new HashMap();
parameters.put("delete", delete);
parameters.put("dhcp", dhcp);
@@ -3413,14 +3424,14 @@ public void setOptions(String delete, Boolean dhcp, String digest, Boolean enabl
parameters.put("policy_in", policy_in);
parameters.put("policy_out", policy_out);
parameters.put("radv", radv);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/options", HttpMethod.PUT, parameters);
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/options", parameters);
}
/**
* Set Firewall options.
*/
- public void setOptions() {
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/options", HttpMethod.PUT, null);
+ public void setOptions() throws JSONException {
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/options", null);
}
}
@@ -3441,18 +3452,18 @@ protected PVELog(Client client, Object node, Object vmid) {
* @param limit
* @param start
*/
- public JSONObject log(Integer limit, Integer start) {
+ public JSONObject log(Integer limit, Integer start) throws JSONException {
Map parameters = new HashMap();
parameters.put("limit", limit);
parameters.put("start", start);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/log", HttpMethod.GET, parameters);
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/log", parameters);
}
/**
* Read firewall log
*/
- public JSONObject log() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/log", HttpMethod.GET, null);
+ public JSONObject log() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/log", null);
}
}
@@ -3474,26 +3485,26 @@ protected PVERefs(Client client, Object node, Object vmid) {
* @param type Only list references of specified
* type. Enum: alias,ipset
*/
- public JSONObject refs(String type) {
+ public JSONObject refs(String type) throws JSONException {
Map parameters = new HashMap();
parameters.put("type", type);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/refs", HttpMethod.GET, parameters);
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/refs", parameters);
}
/**
* Lists possible IPSet/Alias reference which are
* allowed in source/dest properties.
*/
- public JSONObject refs() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/refs", HttpMethod.GET, null);
+ public JSONObject refs() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall/refs", null);
}
}
/**
* Directory index.
*/
- public JSONObject index() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/firewall", HttpMethod.GET, null);
+ public JSONObject index() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/firewall", null);
}
}
@@ -3518,12 +3529,12 @@ protected PVERrd(Client client, Object node, Object vmid) {
* @param cf The RRD consolidation function Enum:
* AVERAGE,MAX
*/
- public JSONObject rrd(String ds, String timeframe, String cf) {
+ public JSONObject rrd(String ds, String timeframe, String cf) throws JSONException {
Map parameters = new HashMap();
parameters.put("ds", ds);
parameters.put("timeframe", timeframe);
parameters.put("cf", cf);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/rrd", HttpMethod.GET, parameters);
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/rrd", parameters);
}
/**
@@ -3534,11 +3545,11 @@ public JSONObject rrd(String ds, String timeframe, String cf) {
* @param timeframe Specify the time frame you are
* interested in. Enum: hour,day,week,month,year
*/
- public JSONObject rrd(String ds, String timeframe) {
+ public JSONObject rrd(String ds, String timeframe) throws JSONException {
Map parameters = new HashMap();
parameters.put("ds", ds);
parameters.put("timeframe", timeframe);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/rrd", HttpMethod.GET, parameters);
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/rrd", parameters);
}
}
@@ -3561,11 +3572,11 @@ protected PVERrddata(Client client, Object node, Object vmid) {
* @param cf The RRD consolidation function Enum:
* AVERAGE,MAX
*/
- public JSONObject rrddata(String timeframe, String cf) {
+ public JSONObject rrddata(String timeframe, String cf) throws JSONException {
Map parameters = new HashMap();
parameters.put("timeframe", timeframe);
parameters.put("cf", cf);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/rrddata", HttpMethod.GET, parameters);
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/rrddata", parameters);
}
/**
@@ -3574,10 +3585,10 @@ public JSONObject rrddata(String timeframe, String cf) {
* @param timeframe Specify the time frame you are
* interested in. Enum: hour,day,week,month,year
*/
- public JSONObject rrddata(String timeframe) {
+ public JSONObject rrddata(String timeframe) throws JSONException {
Map parameters = new HashMap();
parameters.put("timeframe", timeframe);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/rrddata", HttpMethod.GET, parameters);
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/rrddata", parameters);
}
}
@@ -3600,10 +3611,10 @@ protected PVEConfig(Client client, Object node, Object vmid) {
* @param current Get current values (instead of pending
* values).
*/
- public JSONObject vmConfig(Boolean current) {
+ public JSONObject vmConfig(Boolean current) throws JSONException {
Map parameters = new HashMap();
parameters.put("current", current);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/config", HttpMethod.GET, parameters);
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/config", parameters);
}
/**
@@ -3611,8 +3622,8 @@ public JSONObject vmConfig(Boolean current) {
* not include pending configuration changes (see
* 'pending' API).
*/
- public JSONObject vmConfig() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/config", HttpMethod.GET, null);
+ public JSONObject vmConfig() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/config", null);
}
/**
@@ -3740,7 +3751,7 @@ public JSONObject vmConfig() {
* @param watchdog Create a virtual hardware watchdog
* device.
*/
- public JSONObject updateVmAsync(Boolean acpi, Boolean agent, String args, Boolean autostart, Integer background_delay, Integer balloon, String bios, String boot, String bootdisk, String cdrom, Integer cores, String cpu, Integer cpulimit, Integer cpuunits, String delete, String description, String digest, Boolean force, Boolean freeze, Map hostpciN, String hotplug, String hugepages, Map ideN, String keyboard, Boolean kvm, Boolean localtime, String lock_, String machine, Integer memory, Integer migrate_downtime, Integer migrate_speed, String name, Map netN, Boolean numa, Map numaN, Boolean onboot, String ostype, Map parallelN, Boolean protection, Boolean reboot, String revert, Map sataN, Map scsiN, String scsihw, Map serialN, Integer shares, Boolean skiplock, String smbios1, Integer smp, Integer sockets, String startdate, String startup, Boolean tablet, Boolean tdf, Boolean template, Map unusedN, Map usbN, Integer vcpus, String vga, Map virtioN, String watchdog) {
+ public JSONObject updateVmAsync(Boolean acpi, Boolean agent, String args, Boolean autostart, Integer background_delay, Integer balloon, String bios, String boot, String bootdisk, String cdrom, Integer cores, String cpu, Integer cpulimit, Integer cpuunits, String delete, String description, String digest, Boolean force, Boolean freeze, Map hostpciN, String hotplug, String hugepages, Map ideN, String keyboard, Boolean kvm, Boolean localtime, String lock_, String machine, Integer memory, Integer migrate_downtime, Integer migrate_speed, String name, Map netN, Boolean numa, Map numaN, Boolean onboot, String ostype, Map parallelN, Boolean protection, Boolean reboot, String revert, Map sataN, Map scsiN, String scsihw, Map serialN, Integer shares, Boolean skiplock, String smbios1, Integer smp, Integer sockets, String startdate, String startup, Boolean tablet, Boolean tdf, Boolean template, Map unusedN, Map usbN, Integer vcpus, String vga, Map virtioN, String watchdog) throws JSONException {
Map parameters = new HashMap();
parameters.put("acpi", acpi);
parameters.put("agent", agent);
@@ -3803,14 +3814,14 @@ public JSONObject updateVmAsync(Boolean acpi, Boolean agent, String args, Boolea
addIndexedParmeter(parameters, "unused", unusedN);
addIndexedParmeter(parameters, "usb", usbN);
addIndexedParmeter(parameters, "virtio", virtioN);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/config", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/config", parameters);
}
/**
* Set virtual machine options (asynchrounous API).
*/
- public JSONObject updateVmAsync() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/config", HttpMethod.POST, null);
+ public JSONObject updateVmAsync() throws JSONException {
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/config", null);
}
/**
@@ -3937,7 +3948,7 @@ public JSONObject updateVmAsync() {
* @param watchdog Create a virtual hardware watchdog
* device.
*/
- public void updateVm(Boolean acpi, Boolean agent, String args, Boolean autostart, Integer balloon, String bios, String boot, String bootdisk, String cdrom, Integer cores, String cpu, Integer cpulimit, Integer cpuunits, String delete, String description, String digest, Boolean force, Boolean freeze, Map hostpciN, String hotplug, String hugepages, Map ideN, String keyboard, Boolean kvm, Boolean localtime, String lock_, String machine, Integer memory, Integer migrate_downtime, Integer migrate_speed, String name, Map netN, Boolean numa, Map numaN, Boolean onboot, String ostype, Map parallelN, Boolean protection, Boolean reboot, String revert, Map sataN, Map scsiN, String scsihw, Map serialN, Integer shares, Boolean skiplock, String smbios1, Integer smp, Integer sockets, String startdate, String startup, Boolean tablet, Boolean tdf, Boolean template, Map unusedN, Map usbN, Integer vcpus, String vga, Map virtioN, String watchdog) {
+ public void updateVm(Boolean acpi, Boolean agent, String args, Boolean autostart, Integer balloon, String bios, String boot, String bootdisk, String cdrom, Integer cores, String cpu, Integer cpulimit, Integer cpuunits, String delete, String description, String digest, Boolean force, Boolean freeze, Map hostpciN, String hotplug, String hugepages, Map ideN, String keyboard, Boolean kvm, Boolean localtime, String lock_, String machine, Integer memory, Integer migrate_downtime, Integer migrate_speed, String name, Map netN, Boolean numa, Map numaN, Boolean onboot, String ostype, Map parallelN, Boolean protection, Boolean reboot, String revert, Map sataN, Map scsiN, String scsihw, Map serialN, Integer shares, Boolean skiplock, String smbios1, Integer smp, Integer sockets, String startdate, String startup, Boolean tablet, Boolean tdf, Boolean template, Map unusedN, Map usbN, Integer vcpus, String vga, Map virtioN, String watchdog) throws JSONException {
Map parameters = new HashMap();
parameters.put("acpi", acpi);
parameters.put("agent", agent);
@@ -3999,7 +4010,7 @@ public void updateVm(Boolean acpi, Boolean agent, String args, Boolean autostart
addIndexedParmeter(parameters, "unused", unusedN);
addIndexedParmeter(parameters, "usb", usbN);
addIndexedParmeter(parameters, "virtio", virtioN);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/config", HttpMethod.PUT, parameters);
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/config", parameters);
}
/**
@@ -4007,8 +4018,8 @@ public void updateVm(Boolean acpi, Boolean agent, String args, Boolean autostart
* should consider using the POST method instead for any
* actions involving hotplug or storage allocation.
*/
- public void updateVm() {
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/config", HttpMethod.PUT, null);
+ public void updateVm() throws JSONException {
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/config", null);
}
}
@@ -4027,8 +4038,8 @@ protected PVEPending(Client client, Object node, Object vmid) {
* Get virtual machine configuration, including pending
* changes.
*/
- public JSONObject vmPending() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/pending", HttpMethod.GET, null);
+ public JSONObject vmPending() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/pending", null);
}
}
@@ -4053,11 +4064,11 @@ protected PVEUnlink(Client client, Object node, Object vmid) {
* 'unused[n]', which contains the volume ID. Unlink of
* unused[n] always cause physical removal.
*/
- public void unlink(String idlist, Boolean force) {
+ public void unlink(String idlist, Boolean force) throws JSONException {
Map parameters = new HashMap();
parameters.put("idlist", idlist);
parameters.put("force", force);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/unlink", HttpMethod.PUT, parameters);
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/unlink", parameters);
}
/**
@@ -4065,10 +4076,10 @@ public void unlink(String idlist, Boolean force) {
*
* @param idlist A list of disk IDs you want to delete.
*/
- public void unlink(String idlist) {
+ public void unlink(String idlist) throws JSONException {
Map parameters = new HashMap();
parameters.put("idlist", idlist);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/unlink", HttpMethod.PUT, parameters);
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/unlink", parameters);
}
}
@@ -4089,17 +4100,17 @@ protected PVEVncproxy(Client client, Object node, Object vmid) {
* @param websocket starts websockify instead of
* vncproxy
*/
- public JSONObject vncproxy(Boolean websocket) {
+ public JSONObject vncproxy(Boolean websocket) throws JSONException {
Map parameters = new HashMap();
parameters.put("websocket", websocket);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/vncproxy", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/vncproxy", parameters);
}
/**
* Creates a TCP VNC proxy connections.
*/
- public JSONObject vncproxy() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/vncproxy", HttpMethod.POST, null);
+ public JSONObject vncproxy() throws JSONException {
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/vncproxy", null);
}
}
@@ -4122,11 +4133,11 @@ protected PVEVncwebsocket(Client client, Object node, Object vmid) {
* @param vncticket Ticket from previous call to
* vncproxy.
*/
- public JSONObject vncwebsocket(int port, String vncticket) {
+ public JSONObject vncwebsocket(int port, String vncticket) throws JSONException {
Map parameters = new HashMap();
parameters.put("port", port);
parameters.put("vncticket", vncticket);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/vncwebsocket", HttpMethod.GET, parameters);
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/vncwebsocket", parameters);
}
}
@@ -4153,17 +4164,17 @@ protected PVESpiceproxy(Client client, Object node, Object vmid) {
* API (This is window.location.hostname for the JS
* GUI).
*/
- public JSONObject spiceproxy(String proxy) {
+ public JSONObject spiceproxy(String proxy) throws JSONException {
Map parameters = new HashMap();
parameters.put("proxy", proxy);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/spiceproxy", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/spiceproxy", parameters);
}
/**
* Returns a SPICE configuration to connect to the VM.
*/
- public JSONObject spiceproxy() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/spiceproxy", HttpMethod.POST, null);
+ public JSONObject spiceproxy() throws JSONException {
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/spiceproxy", null);
}
}
@@ -4248,8 +4259,8 @@ protected PVECurrent(Client client, Object node, Object vmid) {
/**
* Get virtual machine status.
*/
- public JSONObject vmStatus() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/status/current", HttpMethod.GET, null);
+ public JSONObject vmStatus() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/status/current", null);
}
}
@@ -4284,7 +4295,7 @@ protected PVEStart(Client client, Object node, Object vmid) {
* migration. (Can be '1' to use the same storage id
* as on the source node.)
*/
- public JSONObject vmStart(String machine, String migratedfrom, String migration_network, String migration_type, Boolean skiplock, String stateuri, String targetstorage) {
+ public JSONObject vmStart(String machine, String migratedfrom, String migration_network, String migration_type, Boolean skiplock, String stateuri, String targetstorage) throws JSONException {
Map parameters = new HashMap();
parameters.put("machine", machine);
parameters.put("migratedfrom", migratedfrom);
@@ -4293,14 +4304,14 @@ public JSONObject vmStart(String machine, String migratedfrom, String migration_
parameters.put("skiplock", skiplock);
parameters.put("stateuri", stateuri);
parameters.put("targetstorage", targetstorage);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/status/start", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/status/start", parameters);
}
/**
* Start virtual machine.
*/
- public JSONObject vmStart() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/status/start", HttpMethod.POST, null);
+ public JSONObject vmStart() throws JSONException {
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/status/start", null);
}
}
@@ -4328,13 +4339,13 @@ protected PVEStop(Client client, Object node, Object vmid) {
* allowed to use this option.
* @param timeout Wait maximal timeout seconds.
*/
- public JSONObject vmStop(Boolean keepActive, String migratedfrom, Boolean skiplock, Integer timeout) {
+ public JSONObject vmStop(Boolean keepActive, String migratedfrom, Boolean skiplock, Integer timeout) throws JSONException {
Map parameters = new HashMap();
parameters.put("keepActive", keepActive);
parameters.put("migratedfrom", migratedfrom);
parameters.put("skiplock", skiplock);
parameters.put("timeout", timeout);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/status/stop", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/status/stop", parameters);
}
/**
@@ -4343,8 +4354,8 @@ public JSONObject vmStop(Boolean keepActive, String migratedfrom, Boolean skiplo
* plug of a running computer and may damage the VM
* data
*/
- public JSONObject vmStop() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/status/stop", HttpMethod.POST, null);
+ public JSONObject vmStop() throws JSONException {
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/status/stop", null);
}
}
@@ -4365,17 +4376,17 @@ protected PVEReset(Client client, Object node, Object vmid) {
* @param skiplock Ignore locks - only root is
* allowed to use this option.
*/
- public JSONObject vmReset(Boolean skiplock) {
+ public JSONObject vmReset(Boolean skiplock) throws JSONException {
Map parameters = new HashMap();
parameters.put("skiplock", skiplock);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/status/reset", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/status/reset", parameters);
}
/**
* Reset virtual machine.
*/
- public JSONObject vmReset() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/status/reset", HttpMethod.POST, null);
+ public JSONObject vmReset() throws JSONException {
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/status/reset", null);
}
}
@@ -4404,13 +4415,13 @@ protected PVEShutdown(Client client, Object node, Object vmid) {
* allowed to use this option.
* @param timeout Wait maximal timeout seconds.
*/
- public JSONObject vmShutdown(Boolean forceStop, Boolean keepActive, Boolean skiplock, Integer timeout) {
+ public JSONObject vmShutdown(Boolean forceStop, Boolean keepActive, Boolean skiplock, Integer timeout) throws JSONException {
Map parameters = new HashMap();
parameters.put("forceStop", forceStop);
parameters.put("keepActive", keepActive);
parameters.put("skiplock", skiplock);
parameters.put("timeout", timeout);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/status/shutdown", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/status/shutdown", parameters);
}
/**
@@ -4420,8 +4431,8 @@ public JSONObject vmShutdown(Boolean forceStop, Boolean keepActive, Boolean skip
* guest OS, which should then proceed to a clean
* shutdown.
*/
- public JSONObject vmShutdown() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/status/shutdown", HttpMethod.POST, null);
+ public JSONObject vmShutdown() throws JSONException {
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/status/shutdown", null);
}
}
@@ -4442,17 +4453,17 @@ protected PVESuspend(Client client, Object node, Object vmid) {
* @param skiplock Ignore locks - only root is
* allowed to use this option.
*/
- public JSONObject vmSuspend(Boolean skiplock) {
+ public JSONObject vmSuspend(Boolean skiplock) throws JSONException {
Map parameters = new HashMap();
parameters.put("skiplock", skiplock);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/status/suspend", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/status/suspend", parameters);
}
/**
* Suspend virtual machine.
*/
- public JSONObject vmSuspend() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/status/suspend", HttpMethod.POST, null);
+ public JSONObject vmSuspend() throws JSONException {
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/status/suspend", null);
}
}
@@ -4474,26 +4485,26 @@ protected PVEResume(Client client, Object node, Object vmid) {
* @param skiplock Ignore locks - only root is
* allowed to use this option.
*/
- public JSONObject vmResume(Boolean nocheck, Boolean skiplock) {
+ public JSONObject vmResume(Boolean nocheck, Boolean skiplock) throws JSONException {
Map parameters = new HashMap();
parameters.put("nocheck", nocheck);
parameters.put("skiplock", skiplock);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/status/resume", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/status/resume", parameters);
}
/**
* Resume virtual machine.
*/
- public JSONObject vmResume() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/status/resume", HttpMethod.POST, null);
+ public JSONObject vmResume() throws JSONException {
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/status/resume", null);
}
}
/**
* Directory index
*/
- public JSONObject vmcmdidx() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/status", HttpMethod.GET, null);
+ public JSONObject vmcmdidx() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/status", null);
}
}
@@ -4515,11 +4526,11 @@ protected PVESendkey(Client client, Object node, Object vmid) {
* @param skiplock Ignore locks - only root is allowed
* to use this option.
*/
- public void vmSendkey(String key, Boolean skiplock) {
+ public void vmSendkey(String key, Boolean skiplock) throws JSONException {
Map parameters = new HashMap();
parameters.put("key", key);
parameters.put("skiplock", skiplock);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/sendkey", HttpMethod.PUT, parameters);
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/sendkey", parameters);
}
/**
@@ -4527,10 +4538,10 @@ public void vmSendkey(String key, Boolean skiplock) {
*
* @param key The key (qemu monitor encoding).
*/
- public void vmSendkey(String key) {
+ public void vmSendkey(String key) throws JSONException {
Map parameters = new HashMap();
parameters.put("key", key);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/sendkey", HttpMethod.PUT, parameters);
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/sendkey", parameters);
}
}
@@ -4552,11 +4563,11 @@ protected PVEFeature(Client client, Object node, Object vmid) {
* snapshot,clone,copy
* @param snapname The name of the snapshot.
*/
- public JSONObject vmFeature(String feature, String snapname) {
+ public JSONObject vmFeature(String feature, String snapname) throws JSONException {
Map parameters = new HashMap();
parameters.put("feature", feature);
parameters.put("snapname", snapname);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/feature", HttpMethod.GET, parameters);
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/feature", parameters);
}
/**
@@ -4565,10 +4576,10 @@ public JSONObject vmFeature(String feature, String snapname) {
* @param feature Feature to check. Enum:
* snapshot,clone,copy
*/
- public JSONObject vmFeature(String feature) {
+ public JSONObject vmFeature(String feature) throws JSONException {
Map parameters = new HashMap();
parameters.put("feature", feature);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/feature", HttpMethod.GET, parameters);
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/feature", parameters);
}
}
@@ -4601,7 +4612,7 @@ protected PVEClone(Client client, Object node, Object vmid) {
* @param target Target node. Only allowed if the
* original VM is on shared storage.
*/
- public JSONObject cloneVm(int newid, String description, String format, Boolean full, String name, String pool, String snapname, String storage, String target) {
+ public JSONObject cloneVm(int newid, String description, String format, Boolean full, String name, String pool, String snapname, String storage, String target) throws JSONException {
Map parameters = new HashMap();
parameters.put("newid", newid);
parameters.put("description", description);
@@ -4612,7 +4623,7 @@ public JSONObject cloneVm(int newid, String description, String format, Boolean
parameters.put("snapname", snapname);
parameters.put("storage", storage);
parameters.put("target", target);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/clone", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/clone", parameters);
}
/**
@@ -4620,10 +4631,10 @@ public JSONObject cloneVm(int newid, String description, String format, Boolean
*
* @param newid VMID for the clone.
*/
- public JSONObject cloneVm(int newid) {
+ public JSONObject cloneVm(int newid) throws JSONException {
Map parameters = new HashMap();
parameters.put("newid", newid);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/clone", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/clone", parameters);
}
}
@@ -4652,14 +4663,14 @@ protected PVEMoveDisk(Client client, Object node, Object vmid) {
* can be used to prevent concurrent modifications.
* @param format Target Format. Enum: raw,qcow2,vmdk
*/
- public JSONObject moveVmDisk(String disk, String storage, Boolean delete, String digest, String format) {
+ public JSONObject moveVmDisk(String disk, String storage, Boolean delete, String digest, String format) throws JSONException {
Map parameters = new HashMap();
parameters.put("disk", disk);
parameters.put("storage", storage);
parameters.put("delete", delete);
parameters.put("digest", digest);
parameters.put("format", format);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/move_disk", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/move_disk", parameters);
}
/**
@@ -4669,11 +4680,11 @@ public JSONObject moveVmDisk(String disk, String storage, Boolean delete, String
* ide0,ide1,ide2,ide3,scsi0,scsi1,scsi2,scsi3,scsi4,scsi5,scsi6,scsi7,scsi8,scsi9,scsi10,scsi11,scsi12,scsi13,virtio0,virtio1,virtio2,virtio3,virtio4,virtio5,virtio6,virtio7,virtio8,virtio9,virtio10,virtio11,virtio12,virtio13,virtio14,virtio15,sata0,sata1,sata2,sata3,sata4,sata5,efidisk0
* @param storage Target storage.
*/
- public JSONObject moveVmDisk(String disk, String storage) {
+ public JSONObject moveVmDisk(String disk, String storage) throws JSONException {
Map parameters = new HashMap();
parameters.put("disk", disk);
parameters.put("storage", storage);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/move_disk", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/move_disk", parameters);
}
}
@@ -4706,7 +4717,7 @@ protected PVEMigrate(Client client, Object node, Object vmid) {
* @param with_local_disks Enable live storage migration
* for local disk
*/
- public JSONObject migrateVm(String target, Boolean force, String migration_network, String migration_type, Boolean online, String targetstorage, Boolean with_local_disks) {
+ public JSONObject migrateVm(String target, Boolean force, String migration_network, String migration_type, Boolean online, String targetstorage, Boolean with_local_disks) throws JSONException {
Map parameters = new HashMap();
parameters.put("target", target);
parameters.put("force", force);
@@ -4715,7 +4726,7 @@ public JSONObject migrateVm(String target, Boolean force, String migration_netwo
parameters.put("online", online);
parameters.put("targetstorage", targetstorage);
parameters.put("with-local-disks", with_local_disks);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/migrate", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/migrate", parameters);
}
/**
@@ -4724,10 +4735,10 @@ public JSONObject migrateVm(String target, Boolean force, String migration_netwo
*
* @param target Target node.
*/
- public JSONObject migrateVm(String target) {
+ public JSONObject migrateVm(String target) throws JSONException {
Map parameters = new HashMap();
parameters.put("target", target);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/migrate", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/migrate", parameters);
}
}
@@ -4747,10 +4758,10 @@ protected PVEMonitor(Client client, Object node, Object vmid) {
*
* @param command The monitor command.
*/
- public JSONObject monitor(String command) {
+ public JSONObject monitor(String command) throws JSONException {
Map parameters = new HashMap();
parameters.put("command", command);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/monitor", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/monitor", parameters);
}
}
@@ -4771,10 +4782,10 @@ protected PVEAgent(Client client, Object node, Object vmid) {
* @param command The QGA command. Enum:
* ping,get-time,info,fsfreeze-status,fsfreeze-freeze,fsfreeze-thaw,fstrim,network-get-interfaces,get-vcpus,get-fsinfo,get-memory-blocks,get-memory-block-info,suspend-hybrid,suspend-ram,suspend-disk,shutdown
*/
- public JSONObject agent(String command) {
+ public JSONObject agent(String command) throws JSONException {
Map parameters = new HashMap();
parameters.put("command", command);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/agent", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/agent", parameters);
}
}
@@ -4804,13 +4815,13 @@ protected PVEResize(Client client, Object node, Object vmid) {
* @param skiplock Ignore locks - only root is allowed
* to use this option.
*/
- public void resizeVm(String disk, String size, String digest, Boolean skiplock) {
+ public void resizeVm(String disk, String size, String digest, Boolean skiplock) throws JSONException {
Map parameters = new HashMap();
parameters.put("disk", disk);
parameters.put("size", size);
parameters.put("digest", digest);
parameters.put("skiplock", skiplock);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/resize", HttpMethod.PUT, parameters);
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/resize", parameters);
}
/**
@@ -4823,11 +4834,11 @@ public void resizeVm(String disk, String size, String digest, Boolean skiplock)
* it, the value is taken as an absolute one. Shrinking
* disk size is not supported.
*/
- public void resizeVm(String disk, String size) {
+ public void resizeVm(String disk, String size) throws JSONException {
Map parameters = new HashMap();
parameters.put("disk", disk);
parameters.put("size", size);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/resize", HttpMethod.PUT, parameters);
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/resize", parameters);
}
}
@@ -4891,8 +4902,8 @@ protected PVEConfig(Client client, Object node, Object vmid, Object snapname) {
/**
* Get snapshot configuration
*/
- public JSONObject getSnapshotConfig() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "/config", HttpMethod.GET, null);
+ public JSONObject getSnapshotConfig() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "/config", null);
}
/**
@@ -4901,17 +4912,17 @@ public JSONObject getSnapshotConfig() {
* @param description A textual description or
* comment.
*/
- public void updateSnapshotConfig(String description) {
+ public void updateSnapshotConfig(String description) throws JSONException {
Map parameters = new HashMap();
parameters.put("description", description);
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "/config", HttpMethod.PUT, parameters);
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "/config", parameters);
}
/**
* Update snapshot metadata.
*/
- public void updateSnapshotConfig() {
- _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "/config", HttpMethod.PUT, null);
+ public void updateSnapshotConfig() throws JSONException {
+ _client.put("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "/config", null);
}
}
@@ -4931,8 +4942,8 @@ protected PVERollback(Client client, Object node, Object vmid, Object snapname)
/**
* Rollback VM state to specified snapshot.
*/
- public JSONObject rollback() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "/rollback", HttpMethod.POST, null);
+ public JSONObject rollback() throws JSONException {
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "/rollback", null);
}
}
@@ -4942,32 +4953,32 @@ public JSONObject rollback() {
* @param force For removal from config file, even
* if removing disk snapshots fails.
*/
- public JSONObject delsnapshot(Boolean force) {
+ public JSONObject delsnapshot(Boolean force) throws JSONException {
Map parameters = new HashMap();
parameters.put("force", force);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "", HttpMethod.DELETE, parameters);
+ return _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "", parameters);
}
/**
* Delete a VM snapshot.
*/
- public JSONObject delsnapshot() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "", HttpMethod.DELETE, null);
+ public JSONObject delsnapshot() throws JSONException {
+ return _client.delete("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "", null);
}
/**
*
*/
- public JSONObject snapshotCmdIdx() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "", HttpMethod.GET, null);
+ public JSONObject snapshotCmdIdx() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot/" + _snapname + "", null);
}
}
/**
* List all snapshots.
*/
- public JSONObject snapshotList() {
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot", HttpMethod.GET, null);
+ public JSONObject snapshotList() throws JSONException {
+ return _client.get("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot", null);
}
/**
@@ -4977,12 +4988,12 @@ public JSONObject snapshotList() {
* @param description A textual description or comment.
* @param vmstate Save the vmstate
*/
- public JSONObject snapshot(String snapname, String description, Boolean vmstate) {
+ public JSONObject snapshot(String snapname, String description, Boolean vmstate) throws JSONException {
Map parameters = new HashMap();
parameters.put("snapname", snapname);
parameters.put("description", description);
parameters.put("vmstate", vmstate);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot", parameters);
}
/**
@@ -4990,10 +5001,10 @@ public JSONObject snapshot(String snapname, String description, Boolean vmstate)
*
* @param snapname The name of the snapshot.
*/
- public JSONObject snapshot(String snapname) {
+ public JSONObject snapshot(String snapname) throws JSONException {
Map parameters = new HashMap();
parameters.put("snapname", snapname);
- return _client.executeAction("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot", HttpMethod.POST, parameters);
+ return _client.post("/nodes/" + _node + "/qemu/" + _vmid + "/snapshot", parameters);
}
}
@@ -5015,17 +5026,17 @@ protected PVETemplate(Client client, Object node, Object vmid) {
* base image. Enum:
* ide0,ide1,ide2,ide3,scsi0,scsi1,scsi2,scsi3,scsi4,scsi5,scsi6,scsi7,scsi8,scsi9,scsi10,scsi11,scsi12,scsi13,virtio0,virtio1,virtio2,virtio3,virtio4,virtio5,virtio6,virtio7,virtio8,virtio9,virtio10,virtio11,virtio12,virtio13,virtio14,virtio15,sata0,sata1,sata2,sata3,sata4,sata5,efidisk0
*/
- public void template(String disk) {
+ public void template(String disk) throws JSONException {
Map