com.i2soft.resource.v20190805.Cluster Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of i2up-java-sdk Show documentation
Show all versions of i2up-java-sdk Show documentation
Information2 United Data Management Platform SDK for Java
package com.i2soft.resource.v20190805;
import com.i2soft.http.I2Rs;
import com.i2soft.http.I2softException;
import com.i2soft.http.Response;
import com.i2soft.common.Auth;
import com.i2soft.util.StringMap;
import java.util.Map;
public final class Cluster {
/**
* Auth 对象
*/
private final Auth auth;
/**
* 构建一个新对象
*
* @param auth Auth对象
*/
public Cluster(Auth auth) {
this.auth = auth;
}
/**
* 集群认证
*
* @param args: 参数详见 API 手册
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map authCls(StringMap args) throws I2softException {
args.fieldsRsa(new String[]{"os_pwd"});
String url = String.format("%s/cls/auth", auth.cc_url);
Response r = auth.client.post(url, args);
return r.jsonToMap();
}
/**
* 集群节点验证
*
* @param args: 参数详见 API 手册
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map verifyClsNode(StringMap args) throws I2softException {
String url = String.format("%s/cls/node_verify", auth.cc_url);
Response r = auth.client.post(url, args);
return r.jsonToMap();
}
/**
* 新建集群
*
* @param args: 参数详见 API 手册
* @return code, message
* @throws I2softException:
*/
public I2Rs.I2SmpRs createCls(StringMap args) throws I2softException {
String url = String.format("%s/cls", auth.cc_url);
Response r = auth.client.post(url, args);
return r.jsonToObject(I2Rs.I2SmpRs.class);
}
/**
* 获取单个集群
*
* @param uuid: uuid
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map describeCls(String uuid) throws I2softException {
String url = String.format("%s/cls/%s", auth.cc_url, uuid);
Response r = auth.client.get(url);
return r.jsonToMap();
}
/**
* 修改集群
*
* @param uuid: uuid
* @param args: 参数详见 API 手册
* @return code, message
* @throws I2softException:
*/
public I2Rs.I2SmpRs modifyCls(String uuid, StringMap args) throws I2softException {
String url = String.format("%s/cls/%s", auth.cc_url, uuid);
Response r = auth.client.put(url, args);
return r.jsonToObject(I2Rs.I2SmpRs.class);
}
/**
* 集群详情
*
* @param args: 参数详见 API 手册
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map listCls(StringMap args) throws I2softException {
String url = String.format("%s/cls", auth.cc_url);
Response r = auth.client.get(url, args);
return r.jsonToMap();
}
/**
* 2 集群状态
*
* @param args: 参数详见 API 手册
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map listClsStatus(StringMap args) throws I2softException {
String url = String.format("%s/cls/status", auth.cc_url);
Response r = auth.client.get(url, args);
return r.jsonToMap();
}
/**
* 3 删除集群
*
* @param args: 参数详见 API 手册
* @return code, message
* @throws I2softException:
*/
public I2Rs.I2SmpRs deleteCls(StringMap args) throws I2softException {
String url = String.format("%s/cls", auth.cc_url);
Response r = auth.client.delete(url, args);
return r.jsonToObject(I2Rs.I2SmpRs.class);
}
/**
* 集群 - 操作:获取详情
*
* @param uuid: uuid
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map clsDetail(String uuid) throws I2softException {
String url = String.format("%s/cls/operate", auth.cc_url);
StringMap newArgs = new StringMap().putNotEmpty("node_uuid", uuid).put("operate", "detail");
Response r = auth.client.post(url, newArgs);
return r.jsonToMap();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy