|
|
@@ -117,30 +117,6 @@ public class OssConsoleClient {
|
|
|
return webResult.getData();
|
|
|
}
|
|
|
|
|
|
- public ObjectChannel getObjectChannel(int createBy, String nodeAddr, int channelId) throws Exception {
|
|
|
- String api = String.format("%s/api/oss/store/channel?createBy=%s&nodeAddr=%s&channelId=%s", endpoint, createBy, nodeAddr, channelId);
|
|
|
- HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
|
|
|
- .version(HttpClient.Version.HTTP_1_1)
|
|
|
- .GET()
|
|
|
- .build();
|
|
|
- HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
|
|
- int statusCode = httpResponse.statusCode();
|
|
|
- String body = httpResponse.body();
|
|
|
- if (statusCode != 200) {
|
|
|
- String errMsg = String.format("%s -> %s", statusCode, body);
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
-
|
|
|
- Type type = new TypeToken<WebResult<ObjectChannel>>(){}.getType();
|
|
|
- WebResult<ObjectChannel> webResult = JsonConverter.jsonToObject(body, type);
|
|
|
- if (webResult.getCode() != 0) {
|
|
|
- String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
-
|
|
|
- return webResult.getData();
|
|
|
- }
|
|
|
-
|
|
|
public StoreProperties getStoreProperties(String nodeAddr) throws Exception {
|
|
|
String api = String.format("%s/api/oss/store/properties?nodeAddr=%s", endpoint, nodeAddr);
|
|
|
HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
|
|
|
@@ -193,31 +169,6 @@ public class OssConsoleClient {
|
|
|
return webResult.getData();
|
|
|
}
|
|
|
|
|
|
- public ObjectChannel getObjectChannel(int channelId) throws Exception {
|
|
|
- String api = String.format("%s/api/oss/server/channel?channelId=%s", endpoint, channelId);
|
|
|
- HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
|
|
|
- .header("authorization", "Bearer " + token)
|
|
|
- .version(HttpClient.Version.HTTP_1_1)
|
|
|
- .GET()
|
|
|
- .build();
|
|
|
- HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
|
|
|
- int statusCode = httpResponse.statusCode();
|
|
|
- String body = httpResponse.body();
|
|
|
- if (statusCode != 200) {
|
|
|
- String errMsg = String.format("%s -> %s", statusCode, body);
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
-
|
|
|
- Type type = new TypeToken<WebResult<ObjectChannel>>(){}.getType();
|
|
|
- WebResult<ObjectChannel> webResult = JsonConverter.jsonToObject(body, type);
|
|
|
- if (webResult.getCode() != 0) {
|
|
|
- String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
|
|
|
- throw new Exception(errMsg);
|
|
|
- }
|
|
|
-
|
|
|
- return webResult.getData();
|
|
|
- }
|
|
|
-
|
|
|
public ObjectInfo getObjectInfo(String objectId) throws Exception {
|
|
|
String api = String.format("%s/api/oss/object/info?objectId=%s", endpoint, objectId);
|
|
|
HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
|