|
|
@@ -32,6 +32,10 @@ public class OssConsoleClient {
|
|
|
auth(accessKeyId, accessKeySecret);
|
|
|
}
|
|
|
|
|
|
+ public OssConsoleClient(String endpoint) {
|
|
|
+ this.endpoint = endpoint;
|
|
|
+ }
|
|
|
+
|
|
|
private void auth(String accessKeyId, String accessKeySecret) throws Exception {
|
|
|
MultiPartBodyPublisher publisher = new MultiPartBodyPublisher()
|
|
|
.addPart("accessKeyId", accessKeyId)
|
|
|
@@ -63,10 +67,9 @@ public class OssConsoleClient {
|
|
|
}
|
|
|
|
|
|
public void registerNode(String jsonPayload) throws Exception {
|
|
|
- String api = String.format("%s/api/oss/store/node", endpoint);
|
|
|
+ String api = String.format("%s/api/oss/store/node/register", endpoint);
|
|
|
HttpClient httpClient = HttpClient.newBuilder().build();
|
|
|
HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
|
|
|
- .header("authorization", "Bearer " + token)
|
|
|
.header("content-type", "application/json")
|
|
|
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
|
|
|
.build();
|
|
|
@@ -114,7 +117,6 @@ public class OssConsoleClient {
|
|
|
public List<ObjectChannel> getObjectChannels(String nodeAddr) throws Exception {
|
|
|
String api = String.format("%s/api/oss/channels?nodeAddr=%s", endpoint, nodeAddr);
|
|
|
HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
|
|
|
- .header("authorization", "Bearer " + token)
|
|
|
.version(HttpClient.Version.HTTP_1_1)
|
|
|
.GET()
|
|
|
.build();
|
|
|
@@ -139,7 +141,6 @@ public class OssConsoleClient {
|
|
|
public ObjectChannel getObjectChannel(String nodeAddr, int channelId) throws Exception {
|
|
|
String api = String.format("%s/api/oss/channel?nodeAddr=%s&channelId=%s", endpoint, nodeAddr, channelId);
|
|
|
HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
|
|
|
- .header("authorization", "Bearer " + token)
|
|
|
.version(HttpClient.Version.HTTP_1_1)
|
|
|
.GET()
|
|
|
.build();
|