
com.zabbix4j.screen.Screen Maven / Gradle / Ivy
package com.zabbix4j.screen;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.zabbix4j.ZabbixApiException;
import com.zabbix4j.ZabbixApiMethod;
/**
* @author Suguru Yajima
*/
public class Screen extends ZabbixApiMethod {
public Screen(String apiUrl, String auth) {
super(apiUrl, auth);
}
public ScreenCreateResponse create(ScreenCreateRequest request) throws ZabbixApiException {
ScreenCreateResponse 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, ScreenCreateResponse.class);
} catch (ZabbixApiException e) {
throw new ZabbixApiException(e);
}
return response;
}
public ScreenDeleteResponse delete(ScreenDeleteRequest request) throws ZabbixApiException {
ScreenDeleteResponse 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, ScreenDeleteResponse.class);
} catch (ZabbixApiException e) {
throw new ZabbixApiException(e);
}
return response;
}
public ScreenUpdateResponse update(ScreenUpdateRequest request) throws ZabbixApiException {
ScreenUpdateResponse 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, ScreenUpdateResponse.class);
} catch (ZabbixApiException e) {
throw new ZabbixApiException(e);
}
return response;
}
public ScreenGetResponse get(ScreenGetRequest request) throws ZabbixApiException {
ScreenGetResponse 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, ScreenGetResponse.class);
} catch (ZabbixApiException e) {
throw new ZabbixApiException(e);
}
return response;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy