com.i2soft.resource.v20190805.Node 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
The newest version!
package com.i2soft.resource.v20190805;
import com.i2soft.common.Auth;
import com.i2soft.http.I2Req;
import com.i2soft.http.I2Rs;
import com.i2soft.http.I2softException;
import com.i2soft.http.Response;
import com.i2soft.util.Rsa;
import com.i2soft.util.StringMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public final class Node {
/**
* Auth 对象
*/
private final Auth auth;
private String module_url;
/**
* 构建一个新对象
*
* @param auth Auth对象
*/
public Node(Auth auth) {
this.auth = auth;
this.module_url = auth.cc_url + "/node";
}
/**
* 获取节点容量
*
* @param args: 参数详见 API 手册
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map checkCapacity(StringMap args) throws I2softException {
String url = String.format("%s/check_capacity", module_url);
Response r = auth.client.get(url, args);
return r.jsonToMap();
}
/**
* 获取节点卷组列表
*
* @param args: 参数详见 API 手册
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map listVg(StringMap args) throws I2softException {
String url = String.format("%s/vg", module_url);
Response r = auth.client.get(url, args);
return r.jsonToMap();
}
/**
* 节点认证
*
* @param args: 参数详见 API 手册
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map authNode(StringMap args) throws I2softException {
args.fieldsRsa(new String[]{"os_pwd"});
String url = String.format("%s/auth", module_url);
Response r = auth.client.post(url, args);
return r.jsonToMap();
}
/**
* 检查节点在线
*
* @param args: 参数详见 API 手册
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map checkNodeOnline(StringMap args) throws I2softException {
String url = String.format("%s/hello", module_url);
Response r = auth.client.get(url, args);
return r.jsonToMap();
}
/**
* 新建节点
*
* @return code, message
*/
public Map createNode(StringMap args) throws I2softException {
Response r = auth.client.post(module_url, args);
return r.jsonToMap();
}
/**
* 新建节点(批量)
*
* @return code, message
*/
public Map createBatchNode(StringMap args) throws I2softException {
final Rsa rsa = new Rsa();
if (args.get("base_info_list").getClass().equals(ArrayList.class)) {
for (Map base_info : (List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy