
com.zabbix4j.map.Map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Zabbix4j Show documentation
Show all versions of Zabbix4j Show documentation
Zabbix API library for the Java language.
The newest version!
package com.zabbix4j.map;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.zabbix4j.ZabbixApiException;
import com.zabbix4j.ZabbixApiMethod;
/**
* @author Suguru Yajima
*/
public class Map extends ZabbixApiMethod {
public Map(String apiUrl, String auth) {
super(apiUrl, auth);
}
public MapCreateResponse create(MapCreateRequest request) throws ZabbixApiException {
MapCreateResponse response = null;
request.setAuth(auth);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String requestJson = gson.toJson(request);
try {
String responseJson = sendRequest(requestJson);
response = gson.fromJson(responseJson, MapCreateResponse.class);
} catch (ZabbixApiException e) {
throw new ZabbixApiException(e);
}
return response;
}
public MapDeleteResponse delete(MapDeleteRequest request) throws ZabbixApiException {
MapDeleteResponse response = null;
request.setAuth(auth);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String requestJson = gson.toJson(request);
try {
String responseJson = sendRequest(requestJson);
response = gson.fromJson(responseJson, MapDeleteResponse.class);
} catch (ZabbixApiException e) {
throw new ZabbixApiException(e);
}
return response;
}
public MapUpdateResponse update(MapUpdateRequest request) throws ZabbixApiException {
MapUpdateResponse response = null;
request.setAuth(auth);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String requestJson = gson.toJson(request);
try {
String responseJson = sendRequest(requestJson);
response = gson.fromJson(responseJson, MapUpdateResponse.class);
} catch (ZabbixApiException e) {
throw new ZabbixApiException(e);
}
return response;
}
public MapGetResponse get(MapGetRequest request) throws ZabbixApiException {
MapGetResponse response = null;
request.setAuth(auth);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String requestJson = gson.toJson(request);
try {
String responseJson = sendRequest(requestJson);
response = gson.fromJson(responseJson, MapGetResponse.class);
} catch (ZabbixApiException e) {
throw new ZabbixApiException(e);
}
return response;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy