User
user.addmedia: 向用戶添加媒體
user.create: 創(chuàng)建新用戶
user.delete: 刪除用戶
user.deletemedia: 從用戶中刪除媒體
user.get: 檢索用戶
user.isreadable: 檢查用戶是否是可讀的
user.iswritable: 檢查用戶是否是可寫的
user.login: 用戶登錄
user.logout: 用戶登出
user.update: 更新用戶
user.updatemedia: 更新用戶媒體
user.updateprofile: 更新當前登錄的用戶
UserTest
package cn.com.yeexun.testzabbix.zabbix4j.example.user;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import org.junit.Test;
import com.zabbix4j.ZabbixApiException;
import com.zabbix4j.user.User;
import com.zabbix4j.user.UserLoginRequest;
import com.zabbix4j.user.UserLoginResponse;
/**
* Created by Suguru Yajima on 2014/04/26.
*/
public class UserTest {
public UserTest() {
}
@Test
public void testLogin1() {
User user = new User("http://192.168.200.10/zabbix/api_jsonrpc.php");
UserLoginRequest request = new UserLoginRequest();
request.getParams().setUser("admin");
request.getParams().setPassword("zabbix");
try {
UserLoginResponse response = user.login(request);
assertNotNull(response);
assertNotNull(response.getResult());
} catch (ZabbixApiException e) {
fail();
}
}
}