天翼云适配域名

develop
tanshaolong 2024-09-05 16:20:47 +08:00
parent 75284574bd
commit 112b07d716
3 changed files with 6 additions and 12 deletions

View File

@ -43,6 +43,7 @@ public class TianyiProvider {
private String regionId = "cn-jssz1"; private String regionId = "cn-jssz1";
public static final Integer SUCCESS_STATUS_CODE = 800; public static final Integer SUCCESS_STATUS_CODE = 800;
public String PROTOCOL = "http://70.10.130.186:12315"; public String PROTOCOL = "http://70.10.130.186:12315";
public String apiDomain = "";
public Integer PAGE_SIZE = 50; public Integer PAGE_SIZE = 50;
private final HttpClient client = new HttpClient(60 * 1000, PostDataFormat.RAW); private final HttpClient client = new HttpClient(60 * 1000, PostDataFormat.RAW);
protected ResultBuilder resultBuilder = new CommonResultBuilder(); protected ResultBuilder resultBuilder = new CommonResultBuilder();
@ -62,6 +63,7 @@ public class TianyiProvider {
if (StringUtils.hasText(butler.getUrl())) { if (StringUtils.hasText(butler.getUrl())) {
this.PROTOCOL = butler.getUrl(); this.PROTOCOL = butler.getUrl();
} }
this.apiDomain = "http://ct-global.ctapi.ctyun.local:31167";
} }
public boolean accessable() { public boolean accessable() {
@ -81,7 +83,7 @@ public class TianyiProvider {
} }
public String buildUrl(String apiUrl) { public String buildUrl(String apiUrl) {
return PROTOCOL + apiUrl; return this.apiDomain + apiUrl;
} }
public Result doGet(String url, Map<String, Object> headers) { public Result doGet(String url, Map<String, Object> headers) {
@ -100,16 +102,6 @@ public class TianyiProvider {
return httpClient.get(header, params, uri); return httpClient.get(header, params, uri);
} }
public Result doGet2(String url, Map<String, Object> headers, Map<String, Object> params) {
HttpClient httpClient = new HttpClient(60 * 1000, PostDataFormat.RAW);
httpClient.setDataFormat(null);
String uri = "http://ccse-global.ctapi.ctyun.local:31167" + url;
Map<String, Object> header = buildHeader(HttpRequestMethod.GET, url, headers, params);
printCurl(HttpRequestMethod.GET, uri, header, params);
return httpClient.get(header, params, uri);
}
public Result doGetWithBody(String url, Map<String, Object> headers, Map<String, Object> params) { public Result doGetWithBody(String url, Map<String, Object> headers, Map<String, Object> params) {
try { try {
//创建httpclient对象 //创建httpclient对象

View File

@ -32,6 +32,7 @@ public class TianYiContainerClusterProvider extends TianyiProvider {
public TianYiContainerClusterProvider(Butler butler) { public TianYiContainerClusterProvider(Butler butler) {
super(butler); super(butler);
this.butler = butler; this.butler = butler;
this.apiDomain = "http://ccse-global.ctapi.ctyun.local:31167";
} }
@ -48,7 +49,7 @@ public class TianYiContainerClusterProvider extends TianyiProvider {
while (true) { while (true) {
body.put("pageNow", pageNow); body.put("pageNow", pageNow);
Result result = doGet2(url, header, body); Result result = doGet(url, header, body);
JSONObject returnObj = checkResult(result, "查询容器集群列表"); JSONObject returnObj = checkResult(result, "查询容器集群列表");
log.info("checkedResult:{}", JSON.toJSONString(returnObj)); log.info("checkedResult:{}", JSON.toJSONString(returnObj));
records.addAll(JSONObject.parseObject(returnObj.getString("records"), List.class)); records.addAll(JSONObject.parseObject(returnObj.getString("records"), List.class));

View File

@ -33,6 +33,7 @@ public class TianYiContainerNodeProvider extends TianyiProvider {
public TianYiContainerNodeProvider(Butler butler) { public TianYiContainerNodeProvider(Butler butler) {
super(butler); super(butler);
this.butler = butler; this.butler = butler;
this.apiDomain = "http://ccse-global.ctapi.ctyun.local:31167";
} }
public GeneralResult listNodes(String clusterName) { public GeneralResult listNodes(String clusterName) {