Browse Source

open

master
pioneer 2 years ago
commit
197b2e9700
  1. 6
      README.md
  2. BIN
      doc/SIM卡流量采集使用文档.docx
  3. BIN
      lib/finekit-10.0-20200828.jar
  4. BIN
      lib/huaweicloud-sdk-core-3.0.78.jar
  5. BIN
      lib/huaweicloud-sdk-gsl-3.0.78.jar
  6. BIN
      lib/jackson-annotations-2.11.1.jar
  7. BIN
      lib/jackson-core-2.11.1.jar
  8. BIN
      lib/jackson-databind-2.11.1.jar
  9. BIN
      lib/jackson-datatype-jdk8-2.11.1.jar
  10. BIN
      lib/jackson-datatype-jsr310-2.11.1.jar
  11. BIN
      lib/okhttp-3.14.2.jar
  12. BIN
      lib/okio-1.17.2.jar
  13. BIN
      lib/slf4j-api-1.7.32.jar
  14. 23
      plugin.xml
  15. 192
      src/main/java/com/fr/plugin/DBUtils.java
  16. 130
      src/main/java/com/fr/plugin/GetSIMDataFun.java
  17. 240
      src/main/java/com/fr/plugin/HttpUtil.java
  18. 155
      src/main/java/com/fr/plugin/MyGslClient.java
  19. 701
      src/main/java/com/fr/plugin/MyGslMeta.java
  20. 156
      src/main/java/com/fr/plugin/models/MyListSimCardsResponse.java
  21. 1042
      src/main/java/com/fr/plugin/models/MySimDeviceVO.java

6
README.md

@ -0,0 +1,6 @@
# open-JSD-9710
JSD-9710 接口取数\
免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\
仅作为开发者学习参考使用!禁止用于任何商业用途!\
为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系【pioneer】处理。

BIN
doc/SIM卡流量采集使用文档.docx

Binary file not shown.

BIN
lib/finekit-10.0-20200828.jar

Binary file not shown.

BIN
lib/huaweicloud-sdk-core-3.0.78.jar

Binary file not shown.

BIN
lib/huaweicloud-sdk-gsl-3.0.78.jar

Binary file not shown.

BIN
lib/jackson-annotations-2.11.1.jar

Binary file not shown.

BIN
lib/jackson-core-2.11.1.jar

Binary file not shown.

BIN
lib/jackson-databind-2.11.1.jar

Binary file not shown.

BIN
lib/jackson-datatype-jdk8-2.11.1.jar

Binary file not shown.

BIN
lib/jackson-datatype-jsr310-2.11.1.jar

Binary file not shown.

BIN
lib/okhttp-3.14.2.jar

Binary file not shown.

BIN
lib/okio-1.17.2.jar

Binary file not shown.

BIN
lib/slf4j-api-1.7.32.jar

Binary file not shown.

23
plugin.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin>
<id>com.fr.plugin.sim.data</id>
<name><![CDATA[采集SIM卡数据到数据库插件]]></name>
<active>yes</active>
<version>1.0.1</version>
<env-version>10.0</env-version>
<jartime>2020-07-31</jartime>
<vendor>fr.open</vendor>
<description><![CDATA[]]></description>
<change-notes><![CDATA[
]]></change-notes>
<lifecycle-monitor class="com.fr.plugin.SIMLifeCycleMonitor"/>
<prefer-packages>
<prefer-package>com.huaweicloud.sdk.*</prefer-package>
<prefer-package>okhttp3.*</prefer-package>
<prefer-package>okio.*</prefer-package>
</prefer-packages>
<extra-core>
<!--定义函数的类名,函数名,描述-->
<FunctionDefineProvider class="com.fr.plugin.GetSIMDataFun" name="getSIMData" description="采集SIM卡数据到数据库函数需要2个参数,第一个为华为云的AK值,第二个为华为云的SK值"/>
</extra-core>
<function-recorder class="com.fr.plugin.GetSIMDataFun"/>
</plugin>

192
src/main/java/com/fr/plugin/DBUtils.java

@ -0,0 +1,192 @@
package com.fr.plugin;
import com.fanruan.api.data.ConnectionKit;
import com.fr.log.FineLoggerFactory;
import com.fr.log.FineLoggerProvider;
import java.math.BigDecimal;
import java.sql.*;
import java.util.*;
public class DBUtils {
String db_name = "";
private static FineLoggerProvider logger = FineLoggerFactory.getLogger();
public DBUtils() {
this.db_name = "FRDW";
}
public com.fr.data.impl.Connection getDbConnect() {
return ConnectionKit.getConnection(db_name);
}
public List<Map<String, Object>> select(String sql, Object... params) {
logger.info("query data by sql:" + sql + Arrays.toString(params));
try {
com.fr.data.impl.Connection dbConnect = getDbConnect();
Connection con = dbConnect.createConnection();
PreparedStatement preparedStatement = con.prepareStatement(sql);
setParams(preparedStatement, params);
ResultSet rs = preparedStatement.executeQuery(sql);
// 获得记录的详细信息,然后获得总列数
ResultSetMetaData resMetaData = rs.getMetaData();
int colNum = resMetaData.getColumnCount();
// 用对象保存数据
String name = "";
String value = "";
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
while (rs.next()) {
Map<String, Object> cells = new HashMap<String, Object>();
for (int i = 0; i < colNum; i++) {
name = resMetaData.getColumnLabel(i);
if (cells.get(name) != null) {
name = resMetaData.getColumnLabel(i);
}
if (rs.getObject(i) != null && resMetaData.getColumnTypeName(i).equals("DATETIME") || resMetaData.getColumnTypeName(i).equals("TIMESTAMP")) {
value = rs.getObject(i).toString();
cells.put(name, value.substring(0, value.length() - 2));
} else {
cells.put(name, rs.getString(i));
}
}
list.add(cells);
}
// 释放数据库资源
rs.close();
preparedStatement.close();
con.close();
return list;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public int exec(String sql, String date) throws Exception {
logger.info("query data by sql:{} 时间:{}", sql, date);
Connection con = null;
CallableStatement call = null;
try {
com.fr.data.impl.Connection dbConnect = getDbConnect();
con = dbConnect.createConnection();
call = con.prepareCall(sql);
call.registerOutParameter(1, Types.INTEGER);
call.execute();
Integer ret = call.getInt(1);
return ret;
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
if (call != null) {
call.close();
}
if (con != null) {
con.close();
}
}
}
public Map<String, Object> findOneRow(String sql, Object... params) {
List<Map<String, Object>> select = select(sql, params);
if (select != null) {
if (!select.isEmpty()) {
return select.get(0);
}
}
return null;
}
public boolean checkExist(String sql, Object... params) throws Exception {
Connection connection = getDbConnect().createConnection();
PreparedStatement pstmt = connection.prepareStatement(sql);
setParams(pstmt, params);
try {
ResultSet resultSet = pstmt.executeQuery();
if (resultSet.next()) {
return resultSet.getInt(1) > 0;
}
} catch (Exception e) {
e.printStackTrace();
} finally {
connection.close();
}
return false;
}
private void setParams(PreparedStatement pstmt, Object... params) throws SQLException {
if (params.length > 0) {
int length = params.length;
for (int i = 1; i <= length; i++) {
pstmt.setObject(i, params[i - 1]);
}
}
}
public int exSqlUpdate(String sql, Object... params) throws Exception {
logger.info("update data by sql:" + sql + " params " + Arrays.toString(params));
PreparedStatement pstmt = null;
Connection connection = null;
try {
com.fr.data.impl.Connection dbConnect = getDbConnect();
connection = dbConnect.createConnection();
pstmt = connection.prepareStatement(sql);
setParams(pstmt, params);
int i = pstmt.executeUpdate();
return i;
} catch (Exception e) {
FineLoggerFactory.getLogger().error("执行更新SQL报错: sql:{}", e, sql);
} finally {
if (pstmt != null) {
pstmt.close();
}
if (connection != null) {
connection.close();
}
}
return 0;
}
/**
* 取查询结果集字段
*
* @param sql
* @param params
* @return
* @throws Exception
*/
public List<Map<String, String>> exQuery(String sql, Object... params) throws Exception {
logger.info("query data by sql:" + sql + " params " + Arrays.toString(params));
com.fr.data.impl.Connection dbConnect = getDbConnect();
Connection connection = dbConnect.createConnection();
PreparedStatement pstmt = connection.prepareStatement(sql);
setParams(pstmt, params);
ResultSet resultSet = pstmt.executeQuery();
ResultSetMetaData resMetaData = resultSet.getMetaData();
int columnCount = resMetaData.getColumnCount();
List<Map<String, String>> arrs = new ArrayList<Map<String, String>>();
while (resultSet.next()) {
String name;
String value;
Map<String, String> one = new HashMap<String, String>();
for (int i = 1; i <= columnCount; i++) {
name = resMetaData.getColumnLabel(i);
if (one.get(name) != null) {
name = resMetaData.getColumnLabel(i);
}
if (resultSet.getObject(i) != null && resMetaData.getColumnTypeName(i).equals("DATETIME") || resMetaData.getColumnTypeName(i).equals("TIMESTAMP")) {
value = resultSet.getObject(i).toString();
one.put(name, value.substring(0, value.length() - 2));
} else {
one.put(name, resultSet.getString(i));
}
}
arrs.add(one);
}
pstmt.close();
connection.close();
return arrs;
}
}

130
src/main/java/com/fr/plugin/GetSIMDataFun.java

@ -0,0 +1,130 @@
package com.fr.plugin;
import com.fanruan.api.log.LogKit;
import com.fr.plugin.models.MyListSimCardsResponse;
import com.fr.plugin.models.MySimDeviceVO;
import com.fr.plugin.transform.ExecuteFunctionRecord;
import com.fr.plugin.transform.FunctionRecorder;
import com.fr.script.AbstractFunction;
import com.fr.stable.exception.FormulaException;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.http.HttpConfig;
import com.huaweicloud.sdk.gsl.v3.model.ListSimCardsRequest;
import com.huaweicloud.sdk.gsl.v3.region.GslRegion;
import java.util.Date;
import java.util.UUID;
@FunctionRecorder
public class GetSIMDataFun extends AbstractFunction {
/**
* 接口地址
* https://xxxx/api-ocgsl/gsl_07_0008.html
* 表名fine_plugin_siminfo
* 数据链接名FRDW
*
* @param objects
* @return
* @throws FormulaException
*/
@Override
@ExecuteFunctionRecord
public Object run(Object[] objects) throws FormulaException {
if (objects.length<2) {
return "调用参数顺序应该为getSIMData('ak','sk') 当前参数个数不足";
}
HttpConfig config = HttpConfig.getDefaultHttpConfig();
String ak = objects[0].toString();
String sk = objects[1].toString();
config.withIgnoreSSLVerification(true);
BasicCredentials auth = new BasicCredentials()
.withAk(ak)
.withSk(sk);
MyGslClient ecsClient = MyGslClient.newBuilder()
.withHttpConfig(config)
.withRegion(GslRegion.CN_NORTH_4)
.withCredential(auth)
.build();
Integer count;
Long offset = 1L;
Integer sum = 0;
DBUtils dbUtils = new DBUtils();
do {
MyListSimCardsResponse cardsResponse = getSIMS(ecsClient, offset);
count = cardsResponse.getSimCards().size();
if(count==0){
break;
}
try {
for (MySimDeviceVO simCard : cardsResponse.getSimCards()) {
insert2DB(simCard, dbUtils);
}
} catch (Exception e) {
LogKit.error("SIM卡保存异常:", e);
}
sum += count;
offset++;
} while (count > 0);
LogKit.info("一共同步了:{} 条记录", sum);
return "success";
}
private void insert2DB(MySimDeviceVO vo, DBUtils dbUtils) throws Exception {
Object[] params = new Object[]{
UUID.randomUUID().toString(),
vo.getSimCardId(),
vo.getAccountId(),
vo.getCid(),
vo.getSimPoolId(),
vo.getImei(),
vo.getSimStatus(),
vo.getDeviceStatus(),
vo.getDeviceModel(),
vo.getActDate(),
vo.getDeviceStatusDate(),
vo.getNodeId(),
vo.getIccid(),
vo.getNetworkType(),
vo.getDbm(),
vo.getSignalLevel(),
vo.getSimType(),
vo.getTagNames(),
vo.getOrderId(),
vo.getExpireTime(),
vo.getPricePlanName(),
vo.getFlowLeft(),
vo.getFlowUsed(),
vo.getOperatorStatus(),
vo.getMsisdn(),
vo.getImsi(),
vo.getRealNamed(),
vo.getCutNetFlag(),
vo.getExceedCutNetFlag(),
vo.getExceedCutNetQuota(),
vo.getImeiBindRemainTimes(),
vo.getSpeedValue(),
new Date()
};
String sql = "INSERT INTO `fine_plugin_siminfo`(`s_id`, `sim_card_id`, `account_id`, `cid`, `sim_pool_id`, `imei`, `sim_status`, `device_status`, `device_model`, `act_date`, `device_status_date`, `node_id`, `iccid`, `network_type`, `dbm`, `signal_level`, `sim_type`, `tag_names`, `order_id`, `expire_time`, `price_plan_name`, `flow_left`, `flow_used`, `operator_status`, `msisdn`, `imsi`, `real_named`, `cut_net_flag`, `exceed_cut_net_flag`, `exceed_cut_net_quota`, `imei_bind_remain_times`, `speed_value`, `update_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
dbUtils.exSqlUpdate(sql, params);
}
//展示的当前页
private MyListSimCardsResponse getSIMS(MyGslClient MyGslClient, Long offset) {
//显示的数据数量 最大500
Long limit = 500L;
//SIM卡状态-11-未激活
Integer simStatus = 20;
MyListSimCardsResponse response = MyGslClient.listSimCards(
new ListSimCardsRequest().withLimit(limit).withOffset(offset) );
LogKit.info("请求响应:{} ", response.toString());
return response;
}
}

240
src/main/java/com/fr/plugin/HttpUtil.java

@ -0,0 +1,240 @@
package com.fr.plugin;
import com.fr.log.FineLoggerFactory;
import com.fr.third.org.apache.commons.collections4.MapUtils;
import com.fr.third.org.apache.commons.lang3.StringUtils;
import com.fr.third.org.apache.http.HttpEntity;
import com.fr.third.org.apache.http.HttpResponse;
import com.fr.third.org.apache.http.HttpStatus;
import com.fr.third.org.apache.http.NameValuePair;
import com.fr.third.org.apache.http.client.HttpClient;
import com.fr.third.org.apache.http.client.entity.UrlEncodedFormEntity;
import com.fr.third.org.apache.http.client.methods.HttpGet;
import com.fr.third.org.apache.http.client.methods.HttpPost;
import com.fr.third.org.apache.http.client.utils.URLEncodedUtils;
import com.fr.third.org.apache.http.config.Registry;
import com.fr.third.org.apache.http.config.RegistryBuilder;
import com.fr.third.org.apache.http.conn.socket.ConnectionSocketFactory;
import com.fr.third.org.apache.http.conn.socket.PlainConnectionSocketFactory;
import com.fr.third.org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import com.fr.third.org.apache.http.entity.StringEntity;
import com.fr.third.org.apache.http.impl.client.CloseableHttpClient;
import com.fr.third.org.apache.http.impl.client.HttpClients;
import com.fr.third.org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import com.fr.third.org.apache.http.message.BasicNameValuePair;
import com.fr.third.org.apache.http.util.EntityUtils;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.security.Principal;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class HttpUtil {
private static CloseableHttpClient wrapClient() {
try {
SSLContext ctx = SSLContext.getInstance("TLS");
X509TrustManager tm = new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) {
}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType)
throws CertificateException {
if ((chain == null) || (chain.length == 0)) {
throw new IllegalArgumentException("null or zero-length certificate chain");
}
if ((authType == null) || (authType.length() == 0)) {
throw new IllegalArgumentException("null or zero-length authentication type");
}
boolean br = false;
Principal principal;
for (X509Certificate x509Certificate : chain) {
principal = x509Certificate.getSubjectX500Principal();
if (principal != null) {
br = true;
break;
}
}
if (!(br)) {
throw new CertificateException("服务端证书验证失败!");
}
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
};
ctx.init(null, new TrustManager[]{tm}, new SecureRandom());
SSLConnectionSocketFactory ssf = new SSLConnectionSocketFactory(ctx, SSLConnectionSocketFactory.getDefaultHostnameVerifier());
Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", PlainConnectionSocketFactory.getSocketFactory()).register("https", ssf).build();
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(registry);
return HttpClients.custom().setConnectionManager(cm).build();
} catch (Exception ex) {
FineLoggerFactory.getLogger().error("httpclient初始化失败", ex);
return null;
}
}
public static String postEntity(String url, HttpEntity entity, Map<String, String> headers) {
HttpClient httpClient = createHttpClient(url);
HttpPost requestBase = new HttpPost(url);
requestBase.setEntity(entity);
try {
if (MapUtils.isNotEmpty(headers)) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
requestBase.setHeader(entry.getKey(), entry.getValue());
}
}
HttpResponse response = httpClient.execute(requestBase);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
return EntityUtils.toString(response.getEntity(), "UTF-8");
}
} catch (IOException e) {
FineLoggerFactory.getLogger().error("http接口调用异常:url is::" + url, e);
}
return "";
}
public static String get(String url, Map<String, String> headers) {
CloseableHttpClient httpClient = createHttpClient(url);
try {
HttpGet httpGet = new HttpGet(url);
httpGet.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0");
HttpResponse response;
if (MapUtils.isNotEmpty(headers)) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
httpGet.setHeader(entry.getKey(), entry.getValue());
}
}
response = httpClient.execute(httpGet);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
return EntityUtils.toString(response.getEntity(), "UTF-8");
}
} catch (IOException e) {
FineLoggerFactory.getLogger().error("http接口调用异常:url is::" + url, e);
}
return "";
}
public static String get(String url, Map<String, String> params, Map<String, String> headers) {
StringBuilder sb = new StringBuilder(url);
if (!url.contains("?")) {
sb.append("?");
} else {
sb.append("&");
}
List<NameValuePair> nvps = new ArrayList<>();
if (params != null) {
for (Map.Entry<String, String> entry : params.entrySet()) {
nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
}
String uri = sb.append(URLEncodedUtils.format(nvps, "UTF-8")).toString();
return get(uri, headers);
}
public static String getNoHeader(String url, Map<String, String> params) {
return get(url, params, null);
}
public static String post(String url, Map<String, String> params) {
return post(url, params, null);
}
public static String post(String url, Map<String, String> params, Map<String, String> headers) {
CloseableHttpClient httpClient = createHttpClient(url);
List<NameValuePair> nvps = new ArrayList<>();
if (params != null) {
for (Map.Entry<String, String> entry : params.entrySet()) {
nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
}
final HttpPost post = new HttpPost(url);
try {
if (MapUtils.isNotEmpty(headers)) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
post.setHeader(entry.getKey(), entry.getValue());
}
}
post.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));
HttpResponse response = httpClient.execute(post);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
return EntityUtils.toString(response.getEntity());
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
httpClient.close();
} catch (IOException e) {
FineLoggerFactory.getLogger().error("http接口调用异常:url is::" + url, e);
}
}
return "";
}
public static String post(String url, String postEntity) {
CloseableHttpClient httpClient = createHttpClient(url);
HttpPost post = new HttpPost(url);
try {
post.setEntity(new StringEntity(postEntity));
HttpResponse response = httpClient.execute(post);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
return EntityUtils.toString(response.getEntity());
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
httpClient.close();
} catch (IOException e) {
FineLoggerFactory.getLogger().error("http接口调用异常:url is::" + url, e);
}
}
return "";
}
private static CloseableHttpClient createHttpClient(String url) {
CloseableHttpClient httpClient;
if (url.startsWith("https")) {
httpClient = wrapClient();
} else {
httpClient = HttpClients.createDefault();
}
return httpClient;
}
public static boolean inContainURL(HttpServletRequest request, String url) {
boolean result = false;
if (url != null && !"".equals(url.trim())) {
String[] urlArr = url.split(";");
StringBuffer reqUrl = new StringBuffer(request.getRequestURL());
for (int i = 0; i < urlArr.length; ++i) {
if (reqUrl.indexOf(urlArr[i]) > 1) {
result = true;
break;
}
}
}
String op = request.getParameter("op");
if (StringUtils.isNotBlank(op)) {
result=true;
}
return result;
}
}

155
src/main/java/com/fr/plugin/MyGslClient.java

@ -0,0 +1,155 @@
package com.fr.plugin;
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
import com.fr.plugin.models.MyListSimCardsResponse;
import com.huaweicloud.sdk.core.ClientBuilder;
import com.huaweicloud.sdk.core.HcClient;
import com.huaweicloud.sdk.core.http.HttpRequestDef;
import com.huaweicloud.sdk.core.invoker.SyncInvoker;
import com.huaweicloud.sdk.gsl.v3.*;
import com.huaweicloud.sdk.gsl.v3.model.*;
public class MyGslClient {
protected HcClient hcClient;
public MyGslClient(HcClient hcClient) {
this.hcClient = hcClient;
}
public static ClientBuilder<MyGslClient> newBuilder() {
return new ClientBuilder<MyGslClient>(MyGslClient::new);
}
public ListProPricePlansResponse listProPricePlans(ListProPricePlansRequest request) {
return (ListProPricePlansResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.listProPricePlans);
}
public SyncInvoker<ListProPricePlansRequest, ListProPricePlansResponse> listProPricePlansInvoker(ListProPricePlansRequest request) {
return new SyncInvoker(request, MyGslMeta.listProPricePlans, this.hcClient);
}
public DeleteRealNameResponse deleteRealName(DeleteRealNameRequest request) {
return (DeleteRealNameResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.deleteRealName);
}
public SyncInvoker<DeleteRealNameRequest, DeleteRealNameResponse> deleteRealNameInvoker(DeleteRealNameRequest request) {
return new SyncInvoker(request, MyGslMeta.deleteRealName, this.hcClient);
}
public EnableSimCardResponse enableSimCard(EnableSimCardRequest request) {
return (EnableSimCardResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.enableSimCard);
}
public SyncInvoker<EnableSimCardRequest, EnableSimCardResponse> enableSimCardInvoker(EnableSimCardRequest request) {
return new SyncInvoker(request, MyGslMeta.enableSimCard, this.hcClient);
}
public MyListSimCardsResponse listSimCards(ListSimCardsRequest request) {
return (MyListSimCardsResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.listSimCards);
}
public SyncInvoker<ListSimCardsRequest, MyListSimCardsResponse> listSimCardsInvoker(ListSimCardsRequest request) {
return new SyncInvoker(request, MyGslMeta.listSimCards, this.hcClient);
}
public RegisterImeiResponse registerImei(RegisterImeiRequest request) {
return (RegisterImeiResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.registerImei);
}
public SyncInvoker<RegisterImeiRequest, RegisterImeiResponse> registerImeiInvoker(RegisterImeiRequest request) {
return new SyncInvoker(request, MyGslMeta.registerImei, this.hcClient);
}
public ResetSimCardResponse resetSimCard(ResetSimCardRequest request) {
return (ResetSimCardResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.resetSimCard);
}
public SyncInvoker<ResetSimCardRequest, ResetSimCardResponse> resetSimCardInvoker(ResetSimCardRequest request) {
return new SyncInvoker(request, MyGslMeta.resetSimCard, this.hcClient);
}
public SetExceedCutNetResponse setExceedCutNet(SetExceedCutNetRequest request) {
return (SetExceedCutNetResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.setExceedCutNet);
}
public SyncInvoker<SetExceedCutNetRequest, SetExceedCutNetResponse> setExceedCutNetInvoker(SetExceedCutNetRequest request) {
return new SyncInvoker(request, MyGslMeta.setExceedCutNet, this.hcClient);
}
public SetSpeedValueResponse setSpeedValue(SetSpeedValueRequest request) {
return (SetSpeedValueResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.setSpeedValue);
}
public SyncInvoker<SetSpeedValueRequest, SetSpeedValueResponse> setSpeedValueInvoker(SetSpeedValueRequest request) {
return new SyncInvoker(request, MyGslMeta.setSpeedValue, this.hcClient);
}
public ShowRealNamedResponse showRealNamed(ShowRealNamedRequest request) {
return (ShowRealNamedResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.showRealNamed);
}
public SyncInvoker<ShowRealNamedRequest, ShowRealNamedResponse> showRealNamedInvoker(ShowRealNamedRequest request) {
return new SyncInvoker(request, MyGslMeta.showRealNamed, this.hcClient);
}
public ShowSimCardResponse showSimCard(ShowSimCardRequest request) {
return (ShowSimCardResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.showSimCard);
}
public SyncInvoker<ShowSimCardRequest, ShowSimCardResponse> showSimCardInvoker(ShowSimCardRequest request) {
return new SyncInvoker(request, MyGslMeta.showSimCard, this.hcClient);
}
public StartStopNetResponse startStopNet(StartStopNetRequest request) {
return (StartStopNetResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.startStopNet);
}
public SyncInvoker<StartStopNetRequest, StartStopNetResponse> startStopNetInvoker(StartStopNetRequest request) {
return new SyncInvoker(request, MyGslMeta.startStopNet, this.hcClient);
}
public StopSimCardResponse stopSimCard(StopSimCardRequest request) {
return (StopSimCardResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.stopSimCard);
}
public SyncInvoker<StopSimCardRequest, StopSimCardResponse> stopSimCardInvoker(StopSimCardRequest request) {
return new SyncInvoker(request, MyGslMeta.stopSimCard, this.hcClient);
}
public ListSimPoolMembersResponse listSimPoolMembers(ListSimPoolMembersRequest request) {
return (ListSimPoolMembersResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.listSimPoolMembers);
}
public SyncInvoker<ListSimPoolMembersRequest, ListSimPoolMembersResponse> listSimPoolMembersInvoker(ListSimPoolMembersRequest request) {
return new SyncInvoker(request, MyGslMeta.listSimPoolMembers, this.hcClient);
}
public ListSimPoolsResponse listSimPools(ListSimPoolsRequest request) {
return (ListSimPoolsResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.listSimPools);
}
public SyncInvoker<ListSimPoolsRequest, ListSimPoolsResponse> listSimPoolsInvoker(ListSimPoolsRequest request) {
return new SyncInvoker(request, MyGslMeta.listSimPools, this.hcClient);
}
public ListFlowBySimCardsResponse listFlowBySimCards(ListFlowBySimCardsRequest request) {
return (ListFlowBySimCardsResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.listFlowBySimCards);
}
public SyncInvoker<ListFlowBySimCardsRequest, ListFlowBySimCardsResponse> listFlowBySimCardsInvoker(ListFlowBySimCardsRequest request) {
return new SyncInvoker(request, MyGslMeta.listFlowBySimCards, this.hcClient);
}
public ListSimPricePlansResponse listSimPricePlans(ListSimPricePlansRequest request) {
return (ListSimPricePlansResponse)this.hcClient.syncInvokeHttp(request, MyGslMeta.listSimPricePlans);
}
public SyncInvoker<ListSimPricePlansRequest, ListSimPricePlansResponse> listSimPricePlansInvoker(ListSimPricePlansRequest request) {
return new SyncInvoker(request, MyGslMeta.listSimPricePlans, this.hcClient);
}
}

701
src/main/java/com/fr/plugin/MyGslMeta.java

@ -0,0 +1,701 @@
package com.fr.plugin;
import com.fr.plugin.models.MyListSimCardsResponse;
import com.huaweicloud.sdk.core.TypeCasts;
import com.huaweicloud.sdk.core.http.FieldExistence;
import com.huaweicloud.sdk.core.http.HttpMethod;
import com.huaweicloud.sdk.core.http.HttpRequestDef;
import com.huaweicloud.sdk.core.http.LocationType;
import com.huaweicloud.sdk.gsl.v3.model.*;
import java.util.List;
@SuppressWarnings("unchecked")
public class MyGslMeta {
public static final HttpRequestDef<ListProPricePlansRequest, ListProPricePlansResponse> listProPricePlans =
genForlistProPricePlans();
private static HttpRequestDef<ListProPricePlansRequest, ListProPricePlansResponse> genForlistProPricePlans() {
// basic
HttpRequestDef.Builder<ListProPricePlansRequest, ListProPricePlansResponse> builder =
HttpRequestDef.builder(HttpMethod.GET, ListProPricePlansRequest.class, ListProPricePlansResponse.class)
.withName("ListProPricePlans")
.withUri("/v1/price-plans")
.withContentType("application/json");
// requests
builder.<Long>withRequestField("limit",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListProPricePlansRequest::getLimit, (req, v) -> {
req.setLimit(v);
}));
builder.<Long>withRequestField("offset",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListProPricePlansRequest::getOffset, (req, v) -> {
req.setOffset(v);
}));
builder.<String>withRequestField("main_search_key",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(String.class),
f -> f.withMarshaller(ListProPricePlansRequest::getMainSearchKey, (req, v) -> {
req.setMainSearchKey(v);
}));
builder.<Long>withRequestField("flow_total",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListProPricePlansRequest::getFlowTotal, (req, v) -> {
req.setFlowTotal(v);
}));
builder.<Long>withRequestField("network_type",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListProPricePlansRequest::getNetworkType, (req, v) -> {
req.setNetworkType(v);
}));
builder.<Long>withRequestField("location_type",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListProPricePlansRequest::getLocationType, (req, v) -> {
req.setLocationType(v);
}));
builder.<Integer>withRequestField("carrier_type",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Integer.class),
f -> f.withMarshaller(ListProPricePlansRequest::getCarrierType, (req, v) -> {
req.setCarrierType(v);
}));
builder.<Long>withRequestField("country_type",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListProPricePlansRequest::getCountryType, (req, v) -> {
req.setCountryType(v);
}));
// response
return builder.build();
}
public static final HttpRequestDef<DeleteRealNameRequest, DeleteRealNameResponse> deleteRealName =
genFordeleteRealName();
private static HttpRequestDef<DeleteRealNameRequest, DeleteRealNameResponse> genFordeleteRealName() {
// basic
HttpRequestDef.Builder<DeleteRealNameRequest, DeleteRealNameResponse> builder =
HttpRequestDef.builder(HttpMethod.POST, DeleteRealNameRequest.class, DeleteRealNameResponse.class)
.withName("DeleteRealName")
.withUri("/v1/sim-cards/{sim_card_id}/clear-real-name")
.withContentType("application/json");
// requests
builder.<Long>withRequestField("sim_card_id",
LocationType.Path,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(DeleteRealNameRequest::getSimCardId, (req, v) -> {
req.setSimCardId(v);
}));
// response
return builder.build();
}
public static final HttpRequestDef<EnableSimCardRequest, EnableSimCardResponse> enableSimCard =
genForenableSimCard();
private static HttpRequestDef<EnableSimCardRequest, EnableSimCardResponse> genForenableSimCard() {
// basic
HttpRequestDef.Builder<EnableSimCardRequest, EnableSimCardResponse> builder =
HttpRequestDef.builder(HttpMethod.POST, EnableSimCardRequest.class, EnableSimCardResponse.class)
.withName("EnableSimCard")
.withUri("/v1/sim-cards/{sim_card_id}/enable")
.withContentType("application/json");
// requests
builder.<Long>withRequestField("sim_card_id",
LocationType.Path,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(EnableSimCardRequest::getSimCardId, (req, v) -> {
req.setSimCardId(v);
}));
// response
return builder.build();
}
public static final HttpRequestDef<ListSimCardsRequest, MyListSimCardsResponse> listSimCards = genForlistSimCards();
private static HttpRequestDef<ListSimCardsRequest, MyListSimCardsResponse> genForlistSimCards() {
// basic
HttpRequestDef.Builder<ListSimCardsRequest, MyListSimCardsResponse> builder =
HttpRequestDef.builder(HttpMethod.GET, ListSimCardsRequest.class, MyListSimCardsResponse.class)
.withName("ListSimCards")
.withUri("/v1/sim-cards")
.withContentType("application/json");
// requests
builder.<Integer>withRequestField("main_search_type",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Integer.class),
f -> f.withMarshaller(ListSimCardsRequest::getMainSearchType, (req, v) -> {
req.setMainSearchType(v);
}));
builder.<String>withRequestField("main_search_key",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(String.class),
f -> f.withMarshaller(ListSimCardsRequest::getMainSearchKey, (req, v) -> {
req.setMainSearchKey(v);
}));
builder.<Long>withRequestField("limit",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListSimCardsRequest::getLimit, (req, v) -> {
req.setLimit(v);
}));
builder.<Long>withRequestField("offset",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListSimCardsRequest::getOffset, (req, v) -> {
req.setOffset(v);
}));
builder.<Integer>withRequestField("sim_status",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Integer.class),
f -> f.withMarshaller(ListSimCardsRequest::getSimStatus, (req, v) -> {
req.setSimStatus(v);
}));
builder.<Integer>withRequestField("device_status",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Integer.class),
f -> f.withMarshaller(ListSimCardsRequest::getDeviceStatus, (req, v) -> {
req.setDeviceStatus(v);
}));
builder.<Integer>withRequestField("sim_type",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Integer.class),
f -> f.withMarshaller(ListSimCardsRequest::getSimType, (req, v) -> {
req.setSimType(v);
}));
builder.<ListSimCardsRequest.OrderEnum>withRequestField("order",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(ListSimCardsRequest.OrderEnum.class),
f -> f.withMarshaller(ListSimCardsRequest::getOrder, (req, v) -> {
req.setOrder(v);
}));
builder.<ListSimCardsRequest.SortEnum>withRequestField("sort",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(ListSimCardsRequest.SortEnum.class),
f -> f.withMarshaller(ListSimCardsRequest::getSort, (req, v) -> {
req.setSort(v);
}));
builder.<String>withRequestField("msisdn",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(String.class),
f -> f.withMarshaller(ListSimCardsRequest::getMsisdn, (req, v) -> {
req.setMsisdn(v);
}));
builder.<String>withRequestField("customer_attribute1",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(String.class),
f -> f.withMarshaller(ListSimCardsRequest::getCustomerAttribute1, (req, v) -> {
req.setCustomerAttribute1(v);
}));
builder.<String>withRequestField("customer_attribute2",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(String.class),
f -> f.withMarshaller(ListSimCardsRequest::getCustomerAttribute2, (req, v) -> {
req.setCustomerAttribute2(v);
}));
builder.<String>withRequestField("customer_attribute3",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(String.class),
f -> f.withMarshaller(ListSimCardsRequest::getCustomerAttribute3, (req, v) -> {
req.setCustomerAttribute3(v);
}));
builder.<String>withRequestField("customer_attribute4",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(String.class),
f -> f.withMarshaller(ListSimCardsRequest::getCustomerAttribute4, (req, v) -> {
req.setCustomerAttribute4(v);
}));
builder.<String>withRequestField("customer_attribute5",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(String.class),
f -> f.withMarshaller(ListSimCardsRequest::getCustomerAttribute5, (req, v) -> {
req.setCustomerAttribute5(v);
}));
builder.<String>withRequestField("customer_attribute6",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(String.class),
f -> f.withMarshaller(ListSimCardsRequest::getCustomerAttribute6, (req, v) -> {
req.setCustomerAttribute6(v);
}));
builder.<Boolean>withRequestField("real_named",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Boolean.class),
f -> f.withMarshaller(ListSimCardsRequest::getRealNamed, (req, v) -> {
req.setRealNamed(v);
}));
// response
return builder.build();
}
public static final HttpRequestDef<RegisterImeiRequest, RegisterImeiResponse> registerImei = genForregisterImei();
private static HttpRequestDef<RegisterImeiRequest, RegisterImeiResponse> genForregisterImei() {
// basic
HttpRequestDef.Builder<RegisterImeiRequest, RegisterImeiResponse> builder =
HttpRequestDef.builder(HttpMethod.POST, RegisterImeiRequest.class, RegisterImeiResponse.class)
.withName("RegisterImei")
.withUri("/v1/sim-cards/{sim_card_id}/bind-device")
.withContentType("application/json");
// requests
builder.<Long>withRequestField("sim_card_id",
LocationType.Path,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(RegisterImeiRequest::getSimCardId, (req, v) -> {
req.setSimCardId(v);
}));
builder.<RegisterImeiReq>withRequestField("body",
LocationType.Body,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(RegisterImeiReq.class),
f -> f.withMarshaller(RegisterImeiRequest::getBody, (req, v) -> {
req.setBody(v);
}));
// response
return builder.build();
}
public static final HttpRequestDef<ResetSimCardRequest, ResetSimCardResponse> resetSimCard = genForresetSimCard();
private static HttpRequestDef<ResetSimCardRequest, ResetSimCardResponse> genForresetSimCard() {
// basic
HttpRequestDef.Builder<ResetSimCardRequest, ResetSimCardResponse> builder =
HttpRequestDef.builder(HttpMethod.POST, ResetSimCardRequest.class, ResetSimCardResponse.class)
.withName("ResetSimCard")
.withUri("/v1/sim-cards/{sim_card_id}/reset")
.withContentType("application/json");
// requests
builder.<Long>withRequestField("sim_card_id",
LocationType.Path,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ResetSimCardRequest::getSimCardId, (req, v) -> {
req.setSimCardId(v);
}));
builder.<DownUpTimeForSimCardReq>withRequestField("body",
LocationType.Body,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(DownUpTimeForSimCardReq.class),
f -> f.withMarshaller(ResetSimCardRequest::getBody, (req, v) -> {
req.setBody(v);
}));
// response
return builder.build();
}
public static final HttpRequestDef<SetExceedCutNetRequest, SetExceedCutNetResponse> setExceedCutNet =
genForsetExceedCutNet();
private static HttpRequestDef<SetExceedCutNetRequest, SetExceedCutNetResponse> genForsetExceedCutNet() {
// basic
HttpRequestDef.Builder<SetExceedCutNetRequest, SetExceedCutNetResponse> builder =
HttpRequestDef.builder(HttpMethod.POST, SetExceedCutNetRequest.class, SetExceedCutNetResponse.class)
.withName("SetExceedCutNet")
.withUri("/v1/sim-cards/{sim_card_id}/exceed-cut-net")
.withContentType("application/json");
// requests
builder.<Long>withRequestField("sim_card_id",
LocationType.Path,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(SetExceedCutNetRequest::getSimCardId, (req, v) -> {
req.setSimCardId(v);
}));
builder.<ExceedCutNetReq>withRequestField("body",
LocationType.Body,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(ExceedCutNetReq.class),
f -> f.withMarshaller(SetExceedCutNetRequest::getBody, (req, v) -> {
req.setBody(v);
}));
// response
return builder.build();
}
public static final HttpRequestDef<SetSpeedValueRequest, SetSpeedValueResponse> setSpeedValue =
genForsetSpeedValue();
private static HttpRequestDef<SetSpeedValueRequest, SetSpeedValueResponse> genForsetSpeedValue() {
// basic
HttpRequestDef.Builder<SetSpeedValueRequest, SetSpeedValueResponse> builder =
HttpRequestDef.builder(HttpMethod.POST, SetSpeedValueRequest.class, SetSpeedValueResponse.class)
.withName("SetSpeedValue")
.withUri("/v1/sim-cards/{sim_card_id}/speed-limit")
.withContentType("application/json");
// requests
builder.<Long>withRequestField("sim_card_id",
LocationType.Path,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(SetSpeedValueRequest::getSimCardId, (req, v) -> {
req.setSimCardId(v);
}));
builder.<SetSpeedValueReq>withRequestField("body",
LocationType.Body,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(SetSpeedValueReq.class),
f -> f.withMarshaller(SetSpeedValueRequest::getBody, (req, v) -> {
req.setBody(v);
}));
// response
return builder.build();
}
public static final HttpRequestDef<ShowRealNamedRequest, ShowRealNamedResponse> showRealNamed =
genForshowRealNamed();
private static HttpRequestDef<ShowRealNamedRequest, ShowRealNamedResponse> genForshowRealNamed() {
// basic
HttpRequestDef.Builder<ShowRealNamedRequest, ShowRealNamedResponse> builder =
HttpRequestDef.builder(HttpMethod.GET, ShowRealNamedRequest.class, ShowRealNamedResponse.class)
.withName("ShowRealNamed")
.withUri("/v1/sim-cards/{sim_card_id}/real-named")
.withContentType("application/json");
// requests
builder.<Long>withRequestField("sim_card_id",
LocationType.Path,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ShowRealNamedRequest::getSimCardId, (req, v) -> {
req.setSimCardId(v);
}));
// response
return builder.build();
}
public static final HttpRequestDef<ShowSimCardRequest, ShowSimCardResponse> showSimCard = genForshowSimCard();
private static HttpRequestDef<ShowSimCardRequest, ShowSimCardResponse> genForshowSimCard() {
// basic
HttpRequestDef.Builder<ShowSimCardRequest, ShowSimCardResponse> builder =
HttpRequestDef.builder(HttpMethod.GET, ShowSimCardRequest.class, ShowSimCardResponse.class)
.withName("ShowSimCard")
.withUri("/v1/sim-cards/{sim_card_id}")
.withContentType("application/json");
// requests
builder.<Long>withRequestField("sim_card_id",
LocationType.Path,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ShowSimCardRequest::getSimCardId, (req, v) -> {
req.setSimCardId(v);
}));
// response
return builder.build();
}
public static final HttpRequestDef<StartStopNetRequest, StartStopNetResponse> startStopNet = genForstartStopNet();
private static HttpRequestDef<StartStopNetRequest, StartStopNetResponse> genForstartStopNet() {
// basic
HttpRequestDef.Builder<StartStopNetRequest, StartStopNetResponse> builder =
HttpRequestDef.builder(HttpMethod.POST, StartStopNetRequest.class, StartStopNetResponse.class)
.withName("StartStopNet")
.withUri("/v1/sim-cards/{sim_card_id}/cut-net")
.withContentType("application/json");
// requests
builder.<Long>withRequestField("sim_card_id",
LocationType.Path,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(StartStopNetRequest::getSimCardId, (req, v) -> {
req.setSimCardId(v);
}));
builder.<CutNetReq>withRequestField("body",
LocationType.Body,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(CutNetReq.class),
f -> f.withMarshaller(StartStopNetRequest::getBody, (req, v) -> {
req.setBody(v);
}));
// response
return builder.build();
}
public static final HttpRequestDef<StopSimCardRequest, StopSimCardResponse> stopSimCard = genForstopSimCard();
private static HttpRequestDef<StopSimCardRequest, StopSimCardResponse> genForstopSimCard() {
// basic
HttpRequestDef.Builder<StopSimCardRequest, StopSimCardResponse> builder =
HttpRequestDef.builder(HttpMethod.POST, StopSimCardRequest.class, StopSimCardResponse.class)
.withName("StopSimCard")
.withUri("/v1/sim-cards/{sim_card_id}/stop")
.withContentType("application/json");
// requests
builder.<Long>withRequestField("sim_card_id",
LocationType.Path,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(StopSimCardRequest::getSimCardId, (req, v) -> {
req.setSimCardId(v);
}));
builder.<DownUpTimeForSimCardReq>withRequestField("body",
LocationType.Body,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(DownUpTimeForSimCardReq.class),
f -> f.withMarshaller(StopSimCardRequest::getBody, (req, v) -> {
req.setBody(v);
}));
// response
return builder.build();
}
public static final HttpRequestDef<ListSimPoolMembersRequest, ListSimPoolMembersResponse> listSimPoolMembers =
genForlistSimPoolMembers();
private static HttpRequestDef<ListSimPoolMembersRequest, ListSimPoolMembersResponse> genForlistSimPoolMembers() {
// basic
HttpRequestDef.Builder<ListSimPoolMembersRequest, ListSimPoolMembersResponse> builder =
HttpRequestDef.builder(HttpMethod.GET, ListSimPoolMembersRequest.class, ListSimPoolMembersResponse.class)
.withName("ListSimPoolMembers")
.withUri("/v1/sim-pools/{sim_pool_id}/members")
.withContentType("application/json");
// requests
builder.<Long>withRequestField("sim_pool_id",
LocationType.Path,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListSimPoolMembersRequest::getSimPoolId, (req, v) -> {
req.setSimPoolId(v);
}));
builder.<String>withRequestField("cid",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(String.class),
f -> f.withMarshaller(ListSimPoolMembersRequest::getCid, (req, v) -> {
req.setCid(v);
}));
builder.<Long>withRequestField("limit",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListSimPoolMembersRequest::getLimit, (req, v) -> {
req.setLimit(v);
}));
builder.<Long>withRequestField("offset",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListSimPoolMembersRequest::getOffset, (req, v) -> {
req.setOffset(v);
}));
builder.<String>withRequestField("billing_cycle",
LocationType.Query,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(String.class),
f -> f.withMarshaller(ListSimPoolMembersRequest::getBillingCycle, (req, v) -> {
req.setBillingCycle(v);
}));
// response
return builder.build();
}
public static final HttpRequestDef<ListSimPoolsRequest, ListSimPoolsResponse> listSimPools = genForlistSimPools();
private static HttpRequestDef<ListSimPoolsRequest, ListSimPoolsResponse> genForlistSimPools() {
// basic
HttpRequestDef.Builder<ListSimPoolsRequest, ListSimPoolsResponse> builder =
HttpRequestDef.builder(HttpMethod.GET, ListSimPoolsRequest.class, ListSimPoolsResponse.class)
.withName("ListSimPools")
.withUri("/v1/sim-pools")
.withContentType("application/json");
// requests
builder.<String>withRequestField("pool_name",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(String.class),
f -> f.withMarshaller(ListSimPoolsRequest::getPoolName, (req, v) -> {
req.setPoolName(v);
}));
builder.<Long>withRequestField("limit",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListSimPoolsRequest::getLimit, (req, v) -> {
req.setLimit(v);
}));
builder.<Long>withRequestField("offset",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListSimPoolsRequest::getOffset, (req, v) -> {
req.setOffset(v);
}));
builder.<String>withRequestField("billing_cycle",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(String.class),
f -> f.withMarshaller(ListSimPoolsRequest::getBillingCycle, (req, v) -> {
req.setBillingCycle(v);
}));
// response
return builder.build();
}
public static final HttpRequestDef<ListFlowBySimCardsRequest, ListFlowBySimCardsResponse> listFlowBySimCards =
genForlistFlowBySimCards();
private static HttpRequestDef<ListFlowBySimCardsRequest, ListFlowBySimCardsResponse> genForlistFlowBySimCards() {
// basic
HttpRequestDef.Builder<ListFlowBySimCardsRequest, ListFlowBySimCardsResponse> builder =
HttpRequestDef.builder(HttpMethod.POST, ListFlowBySimCardsRequest.class, ListFlowBySimCardsResponse.class)
.withName("ListFlowBySimCards")
.withUri("/v1/sim-price-plans/usage/batch-query")
.withContentType("application/json");
// requests
builder.<ListFlowBySimCardsReq>withRequestField("body",
LocationType.Body,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(ListFlowBySimCardsReq.class),
f -> f.withMarshaller(ListFlowBySimCardsRequest::getBody, (req, v) -> {
req.setBody(v);
}));
// response
builder.<List<SimCardsFlowVO>>withResponseField("body",
LocationType.Body,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(List.class),
f -> f.withMarshaller(ListFlowBySimCardsResponse::getBody, (response, data) -> {
response.setBody(data);
}).withInnerContainerType(SimCardsFlowVO.class));
return builder.build();
}
public static final HttpRequestDef<ListSimPricePlansRequest, ListSimPricePlansResponse> listSimPricePlans =
genForlistSimPricePlans();
private static HttpRequestDef<ListSimPricePlansRequest, ListSimPricePlansResponse> genForlistSimPricePlans() {
// basic
HttpRequestDef.Builder<ListSimPricePlansRequest, ListSimPricePlansResponse> builder =
HttpRequestDef.builder(HttpMethod.GET, ListSimPricePlansRequest.class, ListSimPricePlansResponse.class)
.withName("ListSimPricePlans")
.withUri("/v1/sim-price-plans")
.withContentType("application/json");
// requests
builder.<Long>withRequestField("sim_card_id",
LocationType.Query,
FieldExistence.NON_NULL_NON_EMPTY,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListSimPricePlansRequest::getSimCardId, (req, v) -> {
req.setSimCardId(v);
}));
builder.<Boolean>withRequestField("real_time",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Boolean.class),
f -> f.withMarshaller(ListSimPricePlansRequest::getRealTime, (req, v) -> {
req.setRealTime(v);
}));
builder.<Long>withRequestField("limit",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListSimPricePlansRequest::getLimit, (req, v) -> {
req.setLimit(v);
}));
builder.<Long>withRequestField("offset",
LocationType.Query,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(Long.class),
f -> f.withMarshaller(ListSimPricePlansRequest::getOffset, (req, v) -> {
req.setOffset(v);
}));
// response
builder.<List<SimPricePlanVO>>withResponseField("body",
LocationType.Body,
FieldExistence.NULL_IGNORE,
TypeCasts.uncheckedConversion(List.class),
f -> f.withMarshaller(ListSimPricePlansResponse::getBody, (response, data) -> {
response.setBody(data);
}).withInnerContainerType(SimPricePlanVO.class));
return builder.build();
}
}

156
src/main/java/com/fr/plugin/models/MyListSimCardsResponse.java

@ -0,0 +1,156 @@
package com.fr.plugin.models;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.huaweicloud.sdk.core.SdkResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
/** Response Object */
public class MyListSimCardsResponse extends SdkResponse {
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "limit")
private Long limit;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "offset")
private Long offset;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "count")
private Long count;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "sim_cards")
private List<MySimDeviceVO> simCards = null;
public MyListSimCardsResponse withLimit(Long limit) {
this.limit = limit;
return this;
}
/** 每页记录数
*
* @return limit */
public Long getLimit() {
return limit;
}
public void setLimit(Long limit) {
this.limit = limit;
}
public MyListSimCardsResponse withOffset(Long offset) {
this.offset = offset;
return this;
}
/** 页码
*
* @return offset */
public Long getOffset() {
return offset;
}
public void setOffset(Long offset) {
this.offset = offset;
}
public MyListSimCardsResponse withCount(Long count) {
this.count = count;
return this;
}
/** 总数
*
* @return count */
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public MyListSimCardsResponse withSimCards(List<MySimDeviceVO> simCards) {
this.simCards = simCards;
return this;
}
public MyListSimCardsResponse addSimCardsItem(MySimDeviceVO simCardsItem) {
if (this.simCards == null) {
this.simCards = new ArrayList<>();
}
this.simCards.add(simCardsItem);
return this;
}
public MyListSimCardsResponse withSimCards(Consumer<List<MySimDeviceVO>> simCardsSetter) {
if (this.simCards == null) {
this.simCards = new ArrayList<>();
}
simCardsSetter.accept(this.simCards);
return this;
}
/** sim卡数据集合
*
* @return simCards */
public List<MySimDeviceVO> getSimCards() {
return simCards;
}
public void setSimCards(List<MySimDeviceVO> simCards) {
this.simCards = simCards;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MyListSimCardsResponse MyListSimCardsResponse = (MyListSimCardsResponse) o;
return Objects.equals(this.limit, MyListSimCardsResponse.limit)
&& Objects.equals(this.offset, MyListSimCardsResponse.offset)
&& Objects.equals(this.count, MyListSimCardsResponse.count)
&& Objects.equals(this.simCards, MyListSimCardsResponse.simCards);
}
@Override
public int hashCode() {
return Objects.hash(limit, offset, count, simCards);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class MyListSimCardsResponse {\n");
sb.append(" limit: ").append(toIndentedString(limit)).append("\n");
sb.append(" offset: ").append(toIndentedString(offset)).append("\n");
sb.append(" count: ").append(toIndentedString(count)).append("\n");
sb.append(" simCards: ").append(toIndentedString(simCards)).append("\n");
sb.append("}");
return sb.toString();
}
/** Convert the given object to string with each line indented by 4 spaces (except the first line). */
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

1042
src/main/java/com/fr/plugin/models/MySimDeviceVO.java

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save