/
ServerConfigApi.java
50 lines (44 loc) · 1.69 KB
/
ServerConfigApi.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package org.hyperic.hq.hqapi1;
import org.hyperic.hq.hqapi1.types.ServerConfigsResponse;
import org.hyperic.hq.hqapi1.types.ServerConfig;
import org.hyperic.hq.hqapi1.types.ServerConfigRequest;
import org.hyperic.hq.hqapi1.types.StatusResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
/**
* The Hyperic HQ Server Configuration API.
*/
public class ServerConfigApi extends BaseApi {
ServerConfigApi(HQConnection conn) {
super(conn);
}
/**
* Get the HQ server configuration.
*
* @return On {@link org.hyperic.hq.hqapi1.types.ResponseStatus#SUCCESS},
* a List of {@link org.hyperic.hq.hqapi1.types.ServerConfig}s.
*
* @throws IOException If a network error occurs while making the request.
*/
public ServerConfigsResponse getConfig() throws IOException {
return doGet("serverconfig/getConfig.hqu", new HashMap<String, String[]>(),
ServerConfigsResponse.class);
}
/**
* Set the HQ server configuration. The List of ServerConfig's must include
* all configurations returned from #getConfig.
*
* @param configs An array of ServerConfig objects.
*
* @return {@link org.hyperic.hq.hqapi1.types.ResponseStatus#SUCCESS} if
* the server configuration was updated sucessfully.
*
* @throws IOException If a network error occurs while making the request.
*/
public StatusResponse setConfig(List<ServerConfig> configs) throws IOException {
ServerConfigRequest request = new ServerConfigRequest();
request.getServerConfig().addAll(configs);
return doPost("serverConfig/setConfig.hqu", request, StatusResponse.class);
}
}