com.i2soft.active.v20240819.ScriptMask 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.active.v20240819;
import com.i2soft.http.I2Req;
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 ScriptMask {
/**
* Auth 对象
*/
private final Auth auth;
/**
* 构建一个新对象
*
* @param auth Auth对象
*/
public ScriptMask(Auth auth) {
this.auth = auth;
}
/**
* 增加脚本
*
* @param args: 参数详见 API 手册
* @return code, message
* @throws I2softException:
*/
public I2Rs.I2SmpRs createScript(StringMap args) throws I2softException {
String url = String.format("%s/mask/script", auth.cc_url);
Response r = auth.client.post(url, args);
return r.jsonToObject(I2Rs.I2SmpRs.class);
}
/**
* 修改脚本
*
* @param uuid: uuid
* @param args: 参数详见 API 手册
* @return code, message
* @throws I2softException:
*/
public I2Rs.I2SmpRs modifyScript(String uuid, StringMap args) throws I2softException {
String url = String.format("%s/mask/script/%s", auth.cc_url, uuid);
Response r = auth.client.put(url, args);
return r.jsonToObject(I2Rs.I2SmpRs.class);
}
/**
* 删除脚本
*
* @param args: 参数详见 API 手册
* @return code, message
* @throws I2softException:
*/
public I2Rs.I2SmpRs deleteScript(StringMap args) throws I2softException {
String url = String.format("%s/mask/script", auth.cc_url);
Response r = auth.client.delete(url, args);
return r.jsonToObject(I2Rs.I2SmpRs.class);
}
/**
* 获取脚本列表
*
* @param args: 参数详见 API 手册
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map listScript(StringMap args) throws I2softException {
String url = String.format("%s/mask/script", auth.cc_url);
Response r = auth.client.get(url, args);
return r.jsonToMap();
}
/**
* 下载脚本
*
* @param args: 参数详见 API 手册
* @return 二进制文件
* @throws I2softException:
*/
public byte[] downloadScript(StringMap args) throws I2softException {
String url = String.format("%s/mask/script/download", auth.cc_url);
Response r = auth.client.get(url, args);
return r.body();
}
/**
* 获取脚本详细信息
*
* @param id: id
* @param args: 参数详见 API 手册
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map descriptScript(Integer id, StringMap args) throws I2softException {
String url = String.format("%s/mask/script/%s", auth.cc_url, id);
Response r = auth.client.get(url, args);
return r.jsonToMap();
}
/**
* 增加规则
*
* @param args: 参数详见 API 手册
* @return code, message
* @throws I2softException:
*/
public I2Rs.I2SmpRs createRule(StringMap args) throws I2softException {
String url = String.format("%s/mask/script_rule", auth.cc_url);
Response r = auth.client.post(url, args);
return r.jsonToObject(I2Rs.I2SmpRs.class);
}
/**
* 增加规则副本
*
* @param args: 参数详见 API 手册
* @return code, message
* @throws I2softException:
*/
public I2Rs.I2SmpRs modifyScriptRule(StringMap args) throws I2softException {
String url = String.format("%s/mask/script_rule", auth.cc_url);
Response r = auth.client.put(url, args);
return r.jsonToObject(I2Rs.I2SmpRs.class);
}
/**
* 删除规则
*
* @param args: 参数详见 API 手册
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map deleteRule(StringMap args) throws I2softException {
String url = String.format("%s/mask/script_rule", auth.cc_url);
Response r = auth.client.delete(url, args);
return r.jsonToMap();
}
/**
* 获取规则列表
*
* @param args: 参数详见 API 手册
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map listRules(StringMap args) throws I2softException {
String url = String.format("%s/mask/script_rule", auth.cc_url);
Response r = auth.client.get(url, args);
return r.jsonToMap();
}
/**
* 获取规则详细信息
*
* @param id: id
* @param args: 参数详见 API 手册
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map descriptRule(Integer id, StringMap args) throws I2softException {
String url = String.format("%s/mask/script_rule/%s", auth.cc_url, id);
Response r = auth.client.get(url, args);
return r.jsonToMap();
}
/**
* 获取脚本执行结果
*
* @param uuid: uuid
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map getScriptRuleResultDetail(String uuid) throws I2softException {
String url = String.format("%s/mask/script_rule/status_detail/%s", auth.cc_url, uuid);
Response r = auth.client.get(url, new StringMap());
return r.jsonToMap();
}
/**
* 获取规则状态
*
* @param args: 参数详见 API 手册
* @return 参数详见 API 手册
* @throws I2softException:
*/
public Map listRuleStatus(StringMap args) throws I2softException {
String url = String.format("%s/mask/script_rule/status", auth.cc_url);
Response r = auth.client.get(url, args);
return r.jsonToMap();
}
/**
* 启/停规则
*
* @param args: 参数详见 API 手册
* @return code, message
* @throws I2softException:
*/
public I2Rs.I2SmpRs startRule(StringMap args) throws I2softException {
String url = String.format("%s/mask/script_rule/operate", auth.cc_url);
Response r = auth.client.post(url, args);
return r.jsonToObject(I2Rs.I2SmpRs.class);
}
/**
* 启/停规则
*
* @param args: 参数详见 API 手册
* @return code, message
* @throws I2softException:
*/
public I2Rs.I2SmpRs stopRule(StringMap args) throws I2softException {
String url = String.format("%s/mask/script_rule/operate", auth.cc_url);
Response r = auth.client.post(url, args);
return r.jsonToObject(I2Rs.I2SmpRs.class);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy