minioEnvVars() {
+ return Collections.unmodifiableMap(this.minioEnvVars);
+ }
}
diff --git a/adminapi/src/main/java/io/minio/admin/info/TimedAction.java b/adminapi/src/main/java/io/minio/admin/info/TimedAction.java
index 722e1bacc..6fd5b800b 100644
--- a/adminapi/src/main/java/io/minio/admin/info/TimedAction.java
+++ b/adminapi/src/main/java/io/minio/admin/info/TimedAction.java
@@ -14,37 +14,41 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package io.minio.admin.info;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
+
import java.math.BigDecimal;
/**
- * TimedAction contains a number of actions and their accumulated duration in nanoseconds.
+ * TimedAction contains a number of actions and their accumulated duration in
+ * nanoseconds.
*
- * @see metrics.go
+ * @see metrics.go
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class TimedAction {
- @JsonProperty("count")
- private BigDecimal count;
+ @JsonProperty("count")
+ private BigDecimal count;
- @JsonProperty("acc_time_ns")
- private BigDecimal accTime;
+ @JsonProperty("acc_time_ns")
+ private BigDecimal accTime;
- @JsonProperty("bytes")
- private BigDecimal bytes;
+ @JsonProperty("bytes")
+ private BigDecimal bytes;
- public BigDecimal count() {
- return count;
- }
+ public BigDecimal count() {
+ return count;
+ }
- public BigDecimal accTime() {
- return accTime;
- }
+ public BigDecimal accTime() {
+ return accTime;
+ }
- public BigDecimal bytes() {
- return bytes;
- }
+ public BigDecimal bytes() {
+ return bytes;
+ }
}
diff --git a/adminapi/src/main/java/io/minio/admin/info/Usage.java b/adminapi/src/main/java/io/minio/admin/info/Usage.java
index a37e43d42..03adbed7a 100644
--- a/adminapi/src/main/java/io/minio/admin/info/Usage.java
+++ b/adminapi/src/main/java/io/minio/admin/info/Usage.java
@@ -23,22 +23,22 @@
/**
* Usage contains the total size used
*
- * @see info-commands.go
+ * @see info-commands.go
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class Usage {
+ @JsonProperty("size")
+ private Integer size;
- @JsonProperty("size")
- private Integer size;
+ @JsonProperty("error")
+ private String error;
- @JsonProperty("error")
- private String error;
+ public Integer size() {
+ return size;
+ }
- public Integer size() {
- return size;
- }
-
- public String error() {
- return error;
- }
+ public String error() {
+ return error;
+ }
}
diff --git a/adminapi/src/main/java/io/minio/admin/info/Versions.java b/adminapi/src/main/java/io/minio/admin/info/Versions.java
index 687355566..3f0b1ae3f 100644
--- a/adminapi/src/main/java/io/minio/admin/info/Versions.java
+++ b/adminapi/src/main/java/io/minio/admin/info/Versions.java
@@ -23,22 +23,22 @@
/**
* Versions contains the number of versions
*
- * @see info-commands.go
+ * @see info-commands.go
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class Versions {
+ @JsonProperty("count")
+ private Integer count;
- @JsonProperty("count")
- private Integer count;
+ @JsonProperty("error")
+ private String error;
- @JsonProperty("error")
- private String error;
+ public Integer count() {
+ return count;
+ }
- public Integer count() {
- return count;
- }
-
- public String error() {
- return error;
- }
+ public String error() {
+ return error;
+ }
}
From 28bb4e8d99000693cfd346a361189ed620dcc975 Mon Sep 17 00:00:00 2001
From: dormanze <37854724+dormanze@users.noreply.github.com>
Date: Tue, 4 Jul 2023 14:41:58 +0800
Subject: [PATCH 08/22] fix ci
---
.../java/io/minio/admin/MinioAdminClient.java | 44 ++--
.../admin/{info => clusterinfo}/Buckets.java | 27 ++-
.../java/io/minio/admin/clusterinfo/Disk.java | 206 +++++++++++++++++
.../{info => clusterinfo}/DiskMetrics.java | 28 ++-
.../admin/clusterinfo/ErasureBackend.java | 83 +++++++
.../admin/clusterinfo/ErasureSetInfo.java | 80 +++++++
.../admin/{info => clusterinfo}/GCStats.java | 56 +++--
.../minio/admin/clusterinfo/HealingDisk.java | 181 +++++++++++++++
.../minio/admin/clusterinfo/InfoMessage.java | 97 ++++++++
.../admin/{info => clusterinfo}/MemStats.java | 59 +++--
.../admin/{info => clusterinfo}/Objects.java | 25 +--
.../admin/clusterinfo/ServerProperties.java | 138 ++++++++++++
.../{info => clusterinfo}/TimedAction.java | 39 ++--
.../admin/{info => clusterinfo}/Usage.java | 25 +--
.../admin/{info => clusterinfo}/Versions.java | 25 +--
.../main/java/io/minio/admin/info/Disk.java | 208 ------------------
.../io/minio/admin/info/ErasureBackend.java | 84 -------
.../io/minio/admin/info/ErasureSetInfo.java | 82 -------
.../java/io/minio/admin/info/HealingDisk.java | 183 ---------------
.../java/io/minio/admin/info/InfoMessage.java | 99 ---------
.../io/minio/admin/info/ServerProperties.java | 140 ------------
21 files changed, 951 insertions(+), 958 deletions(-)
rename adminapi/src/main/java/io/minio/admin/{info => clusterinfo}/Buckets.java (70%)
create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/Disk.java
rename adminapi/src/main/java/io/minio/admin/{info => clusterinfo}/DiskMetrics.java (62%)
create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureBackend.java
create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureSetInfo.java
rename adminapi/src/main/java/io/minio/admin/{info => clusterinfo}/GCStats.java (53%)
create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/HealingDisk.java
create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/InfoMessage.java
rename adminapi/src/main/java/io/minio/admin/{info => clusterinfo}/MemStats.java (54%)
rename adminapi/src/main/java/io/minio/admin/{info => clusterinfo}/Objects.java (71%)
create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/ServerProperties.java
rename adminapi/src/main/java/io/minio/admin/{info => clusterinfo}/TimedAction.java (64%)
rename adminapi/src/main/java/io/minio/admin/{info => clusterinfo}/Usage.java (71%)
rename adminapi/src/main/java/io/minio/admin/{info => clusterinfo}/Versions.java (71%)
delete mode 100644 adminapi/src/main/java/io/minio/admin/info/Disk.java
delete mode 100644 adminapi/src/main/java/io/minio/admin/info/ErasureBackend.java
delete mode 100644 adminapi/src/main/java/io/minio/admin/info/ErasureSetInfo.java
delete mode 100644 adminapi/src/main/java/io/minio/admin/info/HealingDisk.java
delete mode 100644 adminapi/src/main/java/io/minio/admin/info/InfoMessage.java
delete mode 100644 adminapi/src/main/java/io/minio/admin/info/ServerProperties.java
diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java
index e1a5e22d4..fbf2ac59d 100644
--- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java
+++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java
@@ -30,7 +30,7 @@
import io.minio.S3Escaper;
import io.minio.Signer;
import io.minio.Time;
-import io.minio.admin.info.InfoMessage;
+import io.minio.admin.clusterinfo.InfoMessage;
import io.minio.admin.messages.DataUsageInfo;
import io.minio.credentials.Credentials;
import io.minio.credentials.Provider;
@@ -119,7 +119,9 @@ private MinioAdminClient(
private Credentials getCredentials() {
Credentials creds = provider.fetch();
- if (creds == null) throw new RuntimeException("Credential provider returns null credential");
+ if (creds == null) {
+ throw new RuntimeException("Credential provider returns null credential");
+ }
return creds;
}
@@ -175,7 +177,9 @@ private Response execute(
traceBuilder.append("---------START-HTTP---------\n");
String encodedPath = request.url().encodedPath();
String encodedQuery = request.url().encodedQuery();
- if (encodedQuery != null) encodedPath += "?" + encodedQuery;
+ if (encodedQuery != null) {
+ encodedPath += "?" + encodedQuery;
+ }
traceBuilder.append(request.method()).append(" ").append(encodedPath).append(" HTTP/1.1\n");
traceBuilder.append(
request
@@ -183,7 +187,9 @@ private Response execute(
.toString()
.replaceAll("Signature=([0-9a-f]+)", "Signature=*REDACTED*")
.replaceAll("Credential=([^/]+)", "Credential=*REDACTED*"));
- if (body != null) traceBuilder.append("\n").append(new String(body, StandardCharsets.UTF_8));
+ if (body != null) {
+ traceBuilder.append("\n").append(new String(body, StandardCharsets.UTF_8));
+ }
traceStream.println(traceBuilder.toString());
}
@@ -203,7 +209,9 @@ private Response execute(
traceStream.println("----------END-HTTP----------");
}
- if (response.isSuccessful()) return response;
+ if (response.isSuccessful()) {
+ return response;
+ }
throw new RuntimeException("Request failed with response: " + response.body().string());
}
@@ -481,7 +489,8 @@ public void clearBucketQuota(@Nonnull String bucketName)
/**
* Creates a policy.
*
- * Example:{@code
+ *
+ * Example:{@code
* // Assume policyJson contains below JSON string;
* // {
* // "Statement": [
@@ -496,7 +505,8 @@ public void clearBucketQuota(@Nonnull String bucketName)
* // }
* //
* client.addCannedPolicy("my-policy-name", policyJson);
- * }
+ * }
+ *
*
* @param name Policy name.
* @param policy Policy as JSON string.
@@ -619,10 +629,12 @@ public DataUsageInfo getDataUsageInfo()
* Sets HTTP connect, write and read timeouts. A value of 0 means no timeout, otherwise values
* must be between 1 and Integer.MAX_VALUE when converted to milliseconds.
*
- * Example:{@code
+ *
+ * Example:{@code
* minioClient.setTimeout(TimeUnit.SECONDS.toMillis(10), TimeUnit.SECONDS.toMillis(10),
* TimeUnit.SECONDS.toMillis(30));
- * }
+ * }
+ *
*
* @param connectTimeout HTTP connect timeout in milliseconds.
* @param writeTimeout HTTP write timeout in milliseconds.
@@ -636,9 +648,11 @@ public void setTimeout(long connectTimeout, long writeTimeout, long readTimeout)
/**
* Ignores check on server certificate for HTTPS connection.
*
- * Example:{@code
+ *
+ * Example:{@code
* client.ignoreCertCheck();
- * }
+ * }
+ *
*
* @throws KeyManagementException thrown to indicate key management error.
* @throws NoSuchAlgorithmException thrown to indicate missing of SSL library.
@@ -656,7 +670,9 @@ public void ignoreCertCheck() throws KeyManagementException, NoSuchAlgorithmExce
* @param version Your application version.
*/
public void setAppInfo(String name, String version) {
- if (name == null || version == null) return;
+ if (name == null || version == null) {
+ return;
+ }
this.userAgent =
MinioProperties.INSTANCE.getDefaultUserAgent() + " " + name.trim() + "/" + version.trim();
}
@@ -668,7 +684,9 @@ public void setAppInfo(String name, String version) {
* @see #traceOff
*/
public void traceOn(OutputStream traceStream) {
- if (traceStream == null) throw new IllegalArgumentException("trace stream must be provided");
+ if (traceStream == null) {
+ throw new IllegalArgumentException("trace stream must be provided");
+ }
this.traceStream =
new PrintWriter(new OutputStreamWriter(traceStream, StandardCharsets.UTF_8), true);
}
diff --git a/adminapi/src/main/java/io/minio/admin/info/Buckets.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/Buckets.java
similarity index 70%
rename from adminapi/src/main/java/io/minio/admin/info/Buckets.java
rename to adminapi/src/main/java/io/minio/admin/clusterinfo/Buckets.java
index d93366eaa..9a2e03c08 100644
--- a/adminapi/src/main/java/io/minio/admin/info/Buckets.java
+++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/Buckets.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package io.minio.admin.info;
+package io.minio.admin.clusterinfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -23,23 +23,22 @@
/**
* Buckets contains the number of buckets
*
- * @see info-commands.go
+ * @see info-commands.go
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class Buckets {
- @JsonProperty("count")
- private Integer count;
+ @JsonProperty("count")
+ private Integer count;
- @JsonProperty("error")
- private String error;
+ @JsonProperty("error")
+ private String error;
- public Integer count() {
- return count;
- }
+ public Integer count() {
+ return count;
+ }
- public String error() {
- return error;
- }
+ public String error() {
+ return error;
+ }
}
diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/Disk.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/Disk.java
new file mode 100644
index 000000000..16b711f0c
--- /dev/null
+++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/Disk.java
@@ -0,0 +1,206 @@
+/*
+ * MinIO Java SDK for Amazon S3 Compatible Cloud Storage,
+ * (C) 2022 MinIO, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.minio.admin.clusterinfo;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.math.BigDecimal;
+
+/**
+ * Disk holds Disk information
+ *
+ * @see info-commands.go
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Disk {
+ @JsonProperty("endpoint")
+ private String endpoint;
+
+ @JsonProperty("rootDisk")
+ private boolean rootDisk;
+
+ @JsonProperty("path")
+ private String path;
+
+ @JsonProperty("healing")
+ private boolean healing;
+
+ @JsonProperty("scanning")
+ private boolean scanning;
+
+ @JsonProperty("state")
+ private String state;
+
+ @JsonProperty("uuid")
+ private String uuid;
+
+ @JsonProperty("major")
+ private BigDecimal major;
+
+ @JsonProperty("minor")
+ private BigDecimal minor;
+
+ @JsonProperty("model")
+ private String model;
+
+ @JsonProperty("totalspace")
+ private BigDecimal totalspace;
+
+ @JsonProperty("usedspace")
+ private BigDecimal usedspace;
+
+ @JsonProperty("availspace")
+ private BigDecimal availspace;
+
+ @JsonProperty("readthroughput")
+ private BigDecimal readthroughput;
+
+ @JsonProperty("writethroughput")
+ private BigDecimal writethroughput;
+
+ @JsonProperty("readlatency")
+ private BigDecimal readlatency;
+
+ @JsonProperty("writelatency")
+ private BigDecimal writelatency;
+
+ @JsonProperty("utilization")
+ private BigDecimal utilization;
+
+ @JsonProperty("metrics")
+ private DiskMetrics metrics;
+
+ @JsonProperty("heal_info")
+ private HealingDisk healInfo;
+
+ @JsonProperty("used_inodes")
+ private BigDecimal usedInodes;
+
+ @JsonProperty("free_inodes")
+ private BigDecimal freeInodes;
+
+ @JsonProperty("pool_index")
+ private Integer poolIndex;
+
+ @JsonProperty("set_index")
+ private Integer setIndex;
+
+ @JsonProperty("disk_index")
+ private Integer diskIndex;
+
+ public String endpoint() {
+ return endpoint;
+ }
+
+ public boolean isRootDisk() {
+ return rootDisk;
+ }
+
+ public String path() {
+ return path;
+ }
+
+ public boolean isHealing() {
+ return healing;
+ }
+
+ public boolean isScanning() {
+ return scanning;
+ }
+
+ public String state() {
+ return state;
+ }
+
+ public String uuid() {
+ return uuid;
+ }
+
+ public BigDecimal major() {
+ return major;
+ }
+
+ public BigDecimal minor() {
+ return minor;
+ }
+
+ public String model() {
+ return model;
+ }
+
+ public BigDecimal totalspace() {
+ return totalspace;
+ }
+
+ public BigDecimal usedspace() {
+ return usedspace;
+ }
+
+ public BigDecimal availspace() {
+ return availspace;
+ }
+
+ public BigDecimal readthroughput() {
+ return readthroughput;
+ }
+
+ public BigDecimal writethroughput() {
+ return writethroughput;
+ }
+
+ public BigDecimal readlatency() {
+ return readlatency;
+ }
+
+ public BigDecimal writelatency() {
+ return writelatency;
+ }
+
+ public BigDecimal utilization() {
+ return utilization;
+ }
+
+ public DiskMetrics metrics() {
+ return metrics;
+ }
+
+ public HealingDisk healInfo() {
+ return healInfo;
+ }
+
+ public BigDecimal usedInodes() {
+ return usedInodes;
+ }
+
+ public BigDecimal freeInodes() {
+ return freeInodes;
+ }
+
+ public Integer poolIndex() {
+ return poolIndex;
+ }
+
+ public Integer setIndex() {
+ return setIndex;
+ }
+
+ public Integer diskIndex() {
+ return diskIndex;
+ }
+}
diff --git a/adminapi/src/main/java/io/minio/admin/info/DiskMetrics.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/DiskMetrics.java
similarity index 62%
rename from adminapi/src/main/java/io/minio/admin/info/DiskMetrics.java
rename to adminapi/src/main/java/io/minio/admin/clusterinfo/DiskMetrics.java
index 564c524b4..7cf1e5d22 100644
--- a/adminapi/src/main/java/io/minio/admin/info/DiskMetrics.java
+++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/DiskMetrics.java
@@ -15,32 +15,30 @@
* limitations under the License.
*/
-package io.minio.admin.info;
+package io.minio.admin.clusterinfo;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.util.Collections;
import java.util.Map;
/**
* DiskMetrics has the information about XL Storage APIs
*
- * @see info-commands.go
+ * @see info-commands.go
*/
public class DiskMetrics {
- @JsonProperty("lastMinute")
- private Map lastMinute;
+ @JsonProperty("lastMinute")
+ private Map lastMinute;
- @JsonProperty("apiCalls")
- private Map apiCalls;
+ @JsonProperty("apiCalls")
+ private Map apiCalls;
- public Map lastMinute() {
- return Collections.unmodifiableMap(lastMinute);
- }
+ public Map lastMinute() {
+ return Collections.unmodifiableMap(lastMinute);
+ }
- public Map apiCalls() {
- return Collections.unmodifiableMap(apiCalls);
- }
+ public Map apiCalls() {
+ return Collections.unmodifiableMap(apiCalls);
+ }
}
diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureBackend.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureBackend.java
new file mode 100644
index 000000000..b179153ab
--- /dev/null
+++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureBackend.java
@@ -0,0 +1,83 @@
+/*
+ * MinIO Java SDK for Amazon S3 Compatible Cloud Storage,
+ * (C) 2022 MinIO, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.minio.admin.clusterinfo;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * ErasureBackend contains specific erasure storage information
+ *
+ * @see info-commands.go
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ErasureBackend {
+ @JsonProperty("backendType")
+ private String backendType;
+
+ @JsonProperty("onlineDisks")
+ private Integer onlineDisks;
+
+ @JsonProperty("offlineDisks")
+ private Integer offlineDisks;
+
+ @JsonProperty("standardSCParity")
+ private Integer standardSCParity;
+
+ @JsonProperty("rrSCParity")
+ private Integer rrSCParity;
+
+ @JsonProperty("totalSets")
+ private List totalSets;
+
+ @JsonProperty("totalDrivesPerSet")
+ private List totalDrivesPerSet;
+
+ public String backendType() {
+ return backendType;
+ }
+
+ public Integer onlineDisks() {
+ return onlineDisks;
+ }
+
+ public Integer offlineDisks() {
+ return offlineDisks;
+ }
+
+ public Integer standardSCParity() {
+ return standardSCParity;
+ }
+
+ public Integer rrSCParity() {
+ return rrSCParity;
+ }
+
+ public List totalSets() {
+ return Collections.unmodifiableList(totalSets == null ? new LinkedList<>() : totalSets);
+ }
+
+ public List totalDrivesPerSet() {
+ return Collections.unmodifiableList(
+ totalDrivesPerSet == null ? new LinkedList<>() : totalDrivesPerSet);
+ }
+}
diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureSetInfo.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureSetInfo.java
new file mode 100644
index 000000000..946dd52fb
--- /dev/null
+++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureSetInfo.java
@@ -0,0 +1,80 @@
+/*
+ * MinIO Java SDK for Amazon S3 Compatible Cloud Storage,
+ * (C) 2022 MinIO, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.minio.admin.clusterinfo;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.math.BigDecimal;
+
+/**
+ * ErasureSetInfo provides information per erasure set
+ *
+ * @see info-commands.go
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ErasureSetInfo {
+ @JsonProperty("id")
+ private Integer id;
+
+ @JsonProperty("rawUsage")
+ private BigDecimal rawUsage;
+
+ @JsonProperty("rawCapacity")
+ private BigDecimal rawCapacity;
+
+ @JsonProperty("usage")
+ private BigDecimal usage;
+
+ @JsonProperty("objectsCount")
+ private BigDecimal objectsCount;
+
+ @JsonProperty("versionsCount")
+ private BigDecimal versionsCount;
+
+ @JsonProperty("healDisks")
+ private Integer healDisks;
+
+ public Integer id() {
+ return id;
+ }
+
+ public BigDecimal rawUsage() {
+ return rawUsage;
+ }
+
+ public BigDecimal rawCapacity() {
+ return rawCapacity;
+ }
+
+ public BigDecimal usage() {
+ return usage;
+ }
+
+ public BigDecimal objectsCount() {
+ return objectsCount;
+ }
+
+ public BigDecimal versionsCount() {
+ return versionsCount;
+ }
+
+ public Integer healDisks() {
+ return healDisks;
+ }
+}
diff --git a/adminapi/src/main/java/io/minio/admin/info/GCStats.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/GCStats.java
similarity index 53%
rename from adminapi/src/main/java/io/minio/admin/info/GCStats.java
rename to adminapi/src/main/java/io/minio/admin/clusterinfo/GCStats.java
index 3869b9fbe..36463fc7e 100644
--- a/adminapi/src/main/java/io/minio/admin/info/GCStats.java
+++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/GCStats.java
@@ -15,11 +15,10 @@
* limitations under the License.
*/
-package io.minio.admin.info;
+package io.minio.admin.clusterinfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -27,43 +26,42 @@
/**
* GCStats collect information about recent garbage collections.
*
- * @see health.go
+ * @see health.go
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class GCStats {
- @JsonProperty("last_gc")
- private String lastGC;
+ @JsonProperty("last_gc")
+ private String lastGC;
- @JsonProperty("num_gc")
- private Integer numGC;
+ @JsonProperty("num_gc")
+ private Integer numGC;
- @JsonProperty("pause_total")
- private Integer pauseTotal;
+ @JsonProperty("pause_total")
+ private Integer pauseTotal;
- @JsonProperty("pause")
- private List pause;
+ @JsonProperty("pause")
+ private List pause;
- @JsonProperty("pause_end")
- private List pauseEnd;
+ @JsonProperty("pause_end")
+ private List pauseEnd;
- public String lastGC() {
- return lastGC;
- }
+ public String lastGC() {
+ return lastGC;
+ }
- public Integer numGC() {
- return numGC;
- }
+ public Integer numGC() {
+ return numGC;
+ }
- public Integer pauseTotal() {
- return pauseTotal;
- }
+ public Integer pauseTotal() {
+ return pauseTotal;
+ }
- public List pause() {
- return Collections.unmodifiableList(pause == null ? new LinkedList<>() : pause);
- }
+ public List pause() {
+ return Collections.unmodifiableList(pause == null ? new LinkedList<>() : pause);
+ }
- public List pauseEnd() {
- return Collections.unmodifiableList(pauseEnd == null ? new LinkedList<>() : pauseEnd);
- }
+ public List pauseEnd() {
+ return Collections.unmodifiableList(pauseEnd == null ? new LinkedList<>() : pauseEnd);
+ }
}
diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/HealingDisk.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/HealingDisk.java
new file mode 100644
index 000000000..1e55b320d
--- /dev/null
+++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/HealingDisk.java
@@ -0,0 +1,181 @@
+/*
+ * MinIO Java SDK for Amazon S3 Compatible Cloud Storage,
+ * (C) 2022 MinIO, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.minio.admin.clusterinfo;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.math.BigDecimal;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * HealingDisk contains information about
+ *
+ * @see heal-commands.go
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class HealingDisk {
+ @JsonProperty("id")
+ private String id;
+
+ @JsonProperty("heal_id")
+ private String healID;
+
+ @JsonProperty("pool_index")
+ private Integer poolIndex;
+
+ @JsonProperty("set_index")
+ private Integer setIndex;
+
+ @JsonProperty("disk_index")
+ private Integer diskIndex;
+
+ @JsonProperty("endpoint")
+ private String endpoint;
+
+ @JsonProperty("path")
+ private String path;
+
+ @JsonProperty("started")
+ private String started;
+
+ @JsonProperty("last_update")
+ private String lastUpdate;
+
+ @JsonProperty("objects_total_count")
+ private BigDecimal objectsTotalCount;
+
+ @JsonProperty("objects_total_size")
+ private BigDecimal objectsTotalSize;
+
+ @JsonProperty("items_healed")
+ private BigDecimal itemsHealed;
+
+ @JsonProperty("items_failed")
+ private BigDecimal itemsFailed;
+
+ @JsonProperty("bytes_done")
+ private BigDecimal bytesDone;
+
+ @JsonProperty("bytes_failed")
+ private BigDecimal bytesFailed;
+
+ @JsonProperty("objects_healed")
+ private BigDecimal objectsHealed;
+
+ @JsonProperty("objects_failed")
+ private BigDecimal objectsFailed;
+
+ @JsonProperty("current_bucket")
+ private String bucket;
+
+ @JsonProperty("current_object")
+ private String object;
+
+ @JsonProperty("queued_buckets")
+ private List queuedBuckets;
+
+ @JsonProperty("healed_buckets")
+ private List healedBuckets;
+
+ public String id() {
+ return id;
+ }
+
+ public String healID() {
+ return healID;
+ }
+
+ public Integer poolIndex() {
+ return poolIndex;
+ }
+
+ public Integer setIndex() {
+ return setIndex;
+ }
+
+ public Integer diskIndex() {
+ return diskIndex;
+ }
+
+ public String endpoint() {
+ return endpoint;
+ }
+
+ public String path() {
+ return path;
+ }
+
+ public String started() {
+ return started;
+ }
+
+ public String lastUpdate() {
+ return lastUpdate;
+ }
+
+ public BigDecimal objectsTotalCount() {
+ return objectsTotalCount;
+ }
+
+ public BigDecimal objectsTotalSize() {
+ return objectsTotalSize;
+ }
+
+ public BigDecimal itemsHealed() {
+ return itemsHealed;
+ }
+
+ public BigDecimal itemsFailed() {
+ return itemsFailed;
+ }
+
+ public BigDecimal bytesDone() {
+ return bytesDone;
+ }
+
+ public BigDecimal bytesFailed() {
+ return bytesFailed;
+ }
+
+ public BigDecimal objectsHealed() {
+ return objectsHealed;
+ }
+
+ public BigDecimal objectsFailed() {
+ return objectsFailed;
+ }
+
+ public String bucket() {
+ return bucket;
+ }
+
+ public String object() {
+ return object;
+ }
+
+ public List queuedBuckets() {
+ return Collections.unmodifiableList(queuedBuckets == null ? new LinkedList<>() : queuedBuckets);
+ }
+
+ public List healedBuckets() {
+ return Collections.unmodifiableList(healedBuckets == null ? new LinkedList<>() : healedBuckets);
+ }
+}
diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/InfoMessage.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/InfoMessage.java
new file mode 100644
index 000000000..dc83a8773
--- /dev/null
+++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/InfoMessage.java
@@ -0,0 +1,97 @@
+/*
+ * MinIO Java SDK for Amazon S3 Compatible Cloud Storage,
+ * (C) 2022 MinIO, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.minio.admin.clusterinfo;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * InfoMessage container to hold server admin related information.
+ *
+ * @see heal-commands.go
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class InfoMessage {
+ @JsonProperty("mode")
+ private String mode;
+
+ @JsonProperty("deploymentID")
+ private String deploymentID;
+
+ @JsonProperty("buckets")
+ private Buckets buckets;
+
+ @JsonProperty("objects")
+ private Objects objects;
+
+ @JsonProperty("versions")
+ private Versions versions;
+
+ @JsonProperty("usage")
+ private Usage usage;
+
+ @JsonProperty("backend")
+ private ErasureBackend backend;
+
+ @JsonProperty("servers")
+ private List servers;
+
+ @JsonProperty("pools")
+ private Map> erasureSetInfo;
+
+ public String mode() {
+ return mode;
+ }
+
+ public String deploymentID() {
+ return deploymentID;
+ }
+
+ public Buckets buckets() {
+ return buckets;
+ }
+
+ public Objects objects() {
+ return objects;
+ }
+
+ public Versions versions() {
+ return versions;
+ }
+
+ public Usage usage() {
+ return usage;
+ }
+
+ public ErasureBackend backend() {
+ return backend;
+ }
+
+ public List servers() {
+ return Collections.unmodifiableList(servers == null ? new LinkedList<>() : servers);
+ }
+
+ public Map> erasureSetInfo() {
+ return erasureSetInfo;
+ }
+}
diff --git a/adminapi/src/main/java/io/minio/admin/info/MemStats.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/MemStats.java
similarity index 54%
rename from adminapi/src/main/java/io/minio/admin/info/MemStats.java
rename to adminapi/src/main/java/io/minio/admin/clusterinfo/MemStats.java
index 61419c377..879f0ca49 100644
--- a/adminapi/src/main/java/io/minio/admin/info/MemStats.java
+++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/MemStats.java
@@ -15,54 +15,51 @@
* limitations under the License.
*/
-package io.minio.admin.info;
+package io.minio.admin.clusterinfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.math.BigDecimal;
/**
- * MemStats is strip down version of runtime.MemStats containing memory stats of
- * MinIO server.
+ * MemStats is strip down version of runtime.MemStats containing memory stats of MinIO server.
*
- * @see health.go
+ * @see health.go
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class MemStats {
- @JsonProperty("Alloc")
- private BigDecimal alloc;
+ @JsonProperty("Alloc")
+ private BigDecimal alloc;
- @JsonProperty("TotalAlloc")
- private BigDecimal totalAlloc;
+ @JsonProperty("TotalAlloc")
+ private BigDecimal totalAlloc;
- @JsonProperty("Mallocs")
- private BigDecimal mallocs;
+ @JsonProperty("Mallocs")
+ private BigDecimal mallocs;
- @JsonProperty("Frees")
- private BigDecimal frees;
+ @JsonProperty("Frees")
+ private BigDecimal frees;
- @JsonProperty("HeapAlloc")
- private BigDecimal heapAlloc;
+ @JsonProperty("HeapAlloc")
+ private BigDecimal heapAlloc;
- public BigDecimal alloc() {
- return alloc;
- }
+ public BigDecimal alloc() {
+ return alloc;
+ }
- public BigDecimal totalAlloc() {
- return totalAlloc;
- }
+ public BigDecimal totalAlloc() {
+ return totalAlloc;
+ }
- public BigDecimal mallocs() {
- return mallocs;
- }
+ public BigDecimal mallocs() {
+ return mallocs;
+ }
- public BigDecimal frees() {
- return frees;
- }
+ public BigDecimal frees() {
+ return frees;
+ }
- public BigDecimal heapAlloc() {
- return heapAlloc;
- }
+ public BigDecimal heapAlloc() {
+ return heapAlloc;
+ }
}
diff --git a/adminapi/src/main/java/io/minio/admin/info/Objects.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/Objects.java
similarity index 71%
rename from adminapi/src/main/java/io/minio/admin/info/Objects.java
rename to adminapi/src/main/java/io/minio/admin/clusterinfo/Objects.java
index 7b8a0427d..1c08d29e5 100644
--- a/adminapi/src/main/java/io/minio/admin/info/Objects.java
+++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/Objects.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package io.minio.admin.info;
+package io.minio.admin.clusterinfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -23,22 +23,21 @@
/**
* Objects contains the number of objects
*
- * @see info-commands.go
+ * @see info-commands.go
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class Objects {
- @JsonProperty("count")
- private Integer count;
+ @JsonProperty("count")
+ private Integer count;
- @JsonProperty("error")
- private String error;
+ @JsonProperty("error")
+ private String error;
- public Integer count() {
- return count;
- }
+ public Integer count() {
+ return count;
+ }
- public String error() {
- return error;
- }
+ public String error() {
+ return error;
+ }
}
diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/ServerProperties.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/ServerProperties.java
new file mode 100644
index 000000000..a02908639
--- /dev/null
+++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/ServerProperties.java
@@ -0,0 +1,138 @@
+/*
+ * MinIO Java SDK for Amazon S3 Compatible Cloud Storage,
+ * (C) 2022 MinIO, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.minio.admin.clusterinfo;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * ServerProperties holds server information
+ *
+ * @see info-commands.go
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ServerProperties {
+ @JsonProperty("state")
+ private String state;
+
+ @JsonProperty("endpoint")
+ private String endpoint;
+
+ @JsonProperty("scheme")
+ private String scheme;
+
+ @JsonProperty("uptime")
+ private Integer uptime;
+
+ @JsonProperty("version")
+ private String version;
+
+ @JsonProperty("commitID")
+ private String commitID;
+
+ @JsonProperty("network")
+ private Map network;
+
+ @JsonProperty("drives")
+ private List disks;
+
+ @JsonProperty("poolNumber")
+ private Integer poolNumber;
+
+ @JsonProperty("mem_stats")
+ private MemStats memStats;
+
+ @JsonProperty("go_max_procs")
+ private Integer goMaxProcs;
+
+ @JsonProperty("num_cpu")
+ private Integer numCPU;
+
+ @JsonProperty("runtime_version")
+ private String runtimeVersion;
+
+ @JsonProperty("gc_stats")
+ private GCStats gCStats;
+
+ @JsonProperty("minio_env_vars")
+ private Map minioEnvVars;
+
+ public String state() {
+ return state;
+ }
+
+ public String endpoint() {
+ return endpoint;
+ }
+
+ public String scheme() {
+ return scheme;
+ }
+
+ public Integer uptime() {
+ return uptime;
+ }
+
+ public String version() {
+ return version;
+ }
+
+ public String commitID() {
+ return commitID;
+ }
+
+ public Map network() {
+ return Collections.unmodifiableMap(this.network);
+ }
+
+ public List disks() {
+ return Collections.unmodifiableList(disks == null ? new LinkedList<>() : disks);
+ }
+
+ public Integer poolNumber() {
+ return poolNumber;
+ }
+
+ public MemStats memStats() {
+ return memStats;
+ }
+
+ public Integer goMaxProcs() {
+ return goMaxProcs;
+ }
+
+ public Integer numCPU() {
+ return numCPU;
+ }
+
+ public String runtimeVersion() {
+ return runtimeVersion;
+ }
+
+ public GCStats gCStats() {
+ return gCStats;
+ }
+
+ public Map minioEnvVars() {
+ return Collections.unmodifiableMap(this.minioEnvVars);
+ }
+}
diff --git a/adminapi/src/main/java/io/minio/admin/info/TimedAction.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/TimedAction.java
similarity index 64%
rename from adminapi/src/main/java/io/minio/admin/info/TimedAction.java
rename to adminapi/src/main/java/io/minio/admin/clusterinfo/TimedAction.java
index 6fd5b800b..5f9108834 100644
--- a/adminapi/src/main/java/io/minio/admin/info/TimedAction.java
+++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/TimedAction.java
@@ -15,40 +15,37 @@
* limitations under the License.
*/
-package io.minio.admin.info;
+package io.minio.admin.clusterinfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.math.BigDecimal;
/**
- * TimedAction contains a number of actions and their accumulated duration in
- * nanoseconds.
+ * TimedAction contains a number of actions and their accumulated duration in nanoseconds.
*
- * @see metrics.go
+ * @see metrics.go
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class TimedAction {
- @JsonProperty("count")
- private BigDecimal count;
+ @JsonProperty("count")
+ private BigDecimal count;
- @JsonProperty("acc_time_ns")
- private BigDecimal accTime;
+ @JsonProperty("acc_time_ns")
+ private BigDecimal accTime;
- @JsonProperty("bytes")
- private BigDecimal bytes;
+ @JsonProperty("bytes")
+ private BigDecimal bytes;
- public BigDecimal count() {
- return count;
- }
+ public BigDecimal count() {
+ return count;
+ }
- public BigDecimal accTime() {
- return accTime;
- }
+ public BigDecimal accTime() {
+ return accTime;
+ }
- public BigDecimal bytes() {
- return bytes;
- }
+ public BigDecimal bytes() {
+ return bytes;
+ }
}
diff --git a/adminapi/src/main/java/io/minio/admin/info/Usage.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/Usage.java
similarity index 71%
rename from adminapi/src/main/java/io/minio/admin/info/Usage.java
rename to adminapi/src/main/java/io/minio/admin/clusterinfo/Usage.java
index 03adbed7a..ac02be28a 100644
--- a/adminapi/src/main/java/io/minio/admin/info/Usage.java
+++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/Usage.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package io.minio.admin.info;
+package io.minio.admin.clusterinfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -23,22 +23,21 @@
/**
* Usage contains the total size used
*
- * @see info-commands.go
+ * @see info-commands.go
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class Usage {
- @JsonProperty("size")
- private Integer size;
+ @JsonProperty("size")
+ private Integer size;
- @JsonProperty("error")
- private String error;
+ @JsonProperty("error")
+ private String error;
- public Integer size() {
- return size;
- }
+ public Integer size() {
+ return size;
+ }
- public String error() {
- return error;
- }
+ public String error() {
+ return error;
+ }
}
diff --git a/adminapi/src/main/java/io/minio/admin/info/Versions.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/Versions.java
similarity index 71%
rename from adminapi/src/main/java/io/minio/admin/info/Versions.java
rename to adminapi/src/main/java/io/minio/admin/clusterinfo/Versions.java
index 3f0b1ae3f..646b5e9b2 100644
--- a/adminapi/src/main/java/io/minio/admin/info/Versions.java
+++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/Versions.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package io.minio.admin.info;
+package io.minio.admin.clusterinfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -23,22 +23,21 @@
/**
* Versions contains the number of versions
*
- * @see info-commands.go
+ * @see info-commands.go
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class Versions {
- @JsonProperty("count")
- private Integer count;
+ @JsonProperty("count")
+ private Integer count;
- @JsonProperty("error")
- private String error;
+ @JsonProperty("error")
+ private String error;
- public Integer count() {
- return count;
- }
+ public Integer count() {
+ return count;
+ }
- public String error() {
- return error;
- }
+ public String error() {
+ return error;
+ }
}
diff --git a/adminapi/src/main/java/io/minio/admin/info/Disk.java b/adminapi/src/main/java/io/minio/admin/info/Disk.java
deleted file mode 100644
index 0726b35d7..000000000
--- a/adminapi/src/main/java/io/minio/admin/info/Disk.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * MinIO Java SDK for Amazon S3 Compatible Cloud Storage,
- * (C) 2022 MinIO, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.minio.admin.info;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.math.BigDecimal;
-
-/**
- * Disk holds Disk information
- *
- * @see info-commands.go
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class Disk {
- @JsonProperty("endpoint")
- private String endpoint;
-
- @JsonProperty("rootDisk")
- private boolean rootDisk;
-
- @JsonProperty("path")
- private String path;
-
- @JsonProperty("healing")
- private boolean healing;
-
- @JsonProperty("scanning")
- private boolean scanning;
-
- @JsonProperty("state")
- private String state;
-
- @JsonProperty("uuid")
- private String uuid;
-
- @JsonProperty("major")
- private BigDecimal major;
-
- @JsonProperty("minor")
- private BigDecimal minor;
-
- @JsonProperty("model")
- private String model;
-
- @JsonProperty("totalspace")
- private BigDecimal totalspace;
-
- @JsonProperty("usedspace")
- private BigDecimal usedspace;
-
- @JsonProperty("availspace")
- private BigDecimal availspace;
-
- @JsonProperty("readthroughput")
- private BigDecimal readthroughput;
-
- @JsonProperty("writethroughput")
- private BigDecimal writethroughput;
-
- @JsonProperty("readlatency")
- private BigDecimal readlatency;
-
- @JsonProperty("writelatency")
- private BigDecimal writelatency;
-
- @JsonProperty("utilization")
- private BigDecimal utilization;
-
- @JsonProperty("metrics")
- private DiskMetrics metrics;
-
- @JsonProperty("heal_info")
- private HealingDisk healInfo;
-
- @JsonProperty("used_inodes")
- private BigDecimal usedInodes;
-
- @JsonProperty("free_inodes")
- private BigDecimal freeInodes;
-
- @JsonProperty("pool_index")
- private Integer poolIndex;
-
- @JsonProperty("set_index")
- private Integer setIndex;
-
- @JsonProperty("disk_index")
- private Integer diskIndex;
-
- public String endpoint() {
- return endpoint;
- }
-
- public boolean isRootDisk() {
- return rootDisk;
- }
-
- public String path() {
- return path;
- }
-
- public boolean isHealing() {
- return healing;
- }
-
- public boolean isScanning() {
- return scanning;
- }
-
- public String state() {
- return state;
- }
-
- public String uuid() {
- return uuid;
- }
-
- public BigDecimal major() {
- return major;
- }
-
- public BigDecimal minor() {
- return minor;
- }
-
- public String model() {
- return model;
- }
-
- public BigDecimal totalspace() {
- return totalspace;
- }
-
- public BigDecimal usedspace() {
- return usedspace;
- }
-
- public BigDecimal availspace() {
- return availspace;
- }
-
- public BigDecimal readthroughput() {
- return readthroughput;
- }
-
- public BigDecimal writethroughput() {
- return writethroughput;
- }
-
- public BigDecimal readlatency() {
- return readlatency;
- }
-
- public BigDecimal writelatency() {
- return writelatency;
- }
-
- public BigDecimal utilization() {
- return utilization;
- }
-
- public DiskMetrics metrics() {
- return metrics;
- }
-
- public HealingDisk healInfo() {
- return healInfo;
- }
-
- public BigDecimal usedInodes() {
- return usedInodes;
- }
-
- public BigDecimal freeInodes() {
- return freeInodes;
- }
-
- public Integer poolIndex() {
- return poolIndex;
- }
-
- public Integer setIndex() {
- return setIndex;
- }
-
- public Integer diskIndex() {
- return diskIndex;
- }
-}
diff --git a/adminapi/src/main/java/io/minio/admin/info/ErasureBackend.java b/adminapi/src/main/java/io/minio/admin/info/ErasureBackend.java
deleted file mode 100644
index 05b1577ef..000000000
--- a/adminapi/src/main/java/io/minio/admin/info/ErasureBackend.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * MinIO Java SDK for Amazon S3 Compatible Cloud Storage,
- * (C) 2022 MinIO, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.minio.admin.info;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * ErasureBackend contains specific erasure storage information
- *
- * @see info-commands.go
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class ErasureBackend {
- @JsonProperty("backendType")
- private String backendType;
-
- @JsonProperty("onlineDisks")
- private Integer onlineDisks;
-
- @JsonProperty("offlineDisks")
- private Integer offlineDisks;
-
- @JsonProperty("standardSCParity")
- private Integer standardSCParity;
-
- @JsonProperty("rrSCParity")
- private Integer rrSCParity;
-
- @JsonProperty("totalSets")
- private List totalSets;
-
- @JsonProperty("totalDrivesPerSet")
- private List totalDrivesPerSet;
-
- public String backendType() {
- return backendType;
- }
-
- public Integer onlineDisks() {
- return onlineDisks;
- }
-
- public Integer offlineDisks() {
- return offlineDisks;
- }
-
- public Integer standardSCParity() {
- return standardSCParity;
- }
-
- public Integer rrSCParity() {
- return rrSCParity;
- }
-
- public List totalSets() {
- return Collections.unmodifiableList(totalSets == null ? new LinkedList<>() : totalSets);
- }
-
- public List totalDrivesPerSet() {
- return Collections.unmodifiableList(totalDrivesPerSet == null ? new LinkedList<>() : totalDrivesPerSet);
- }
-}
diff --git a/adminapi/src/main/java/io/minio/admin/info/ErasureSetInfo.java b/adminapi/src/main/java/io/minio/admin/info/ErasureSetInfo.java
deleted file mode 100644
index ebb69aa22..000000000
--- a/adminapi/src/main/java/io/minio/admin/info/ErasureSetInfo.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * MinIO Java SDK for Amazon S3 Compatible Cloud Storage,
- * (C) 2022 MinIO, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.minio.admin.info;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.math.BigDecimal;
-
-/**
- * ErasureSetInfo provides information per erasure set
- *
- * @see info-commands.go
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class ErasureSetInfo {
- @JsonProperty("id")
- private Integer id;
-
- @JsonProperty("rawUsage")
- private BigDecimal rawUsage;
-
- @JsonProperty("rawCapacity")
- private BigDecimal rawCapacity;
-
- @JsonProperty("usage")
- private BigDecimal usage;
-
- @JsonProperty("objectsCount")
- private BigDecimal objectsCount;
-
- @JsonProperty("versionsCount")
- private BigDecimal versionsCount;
-
- @JsonProperty("healDisks")
- private Integer healDisks;
-
- public Integer id() {
- return id;
- }
-
- public BigDecimal rawUsage() {
- return rawUsage;
- }
-
- public BigDecimal rawCapacity() {
- return rawCapacity;
- }
-
- public BigDecimal usage() {
- return usage;
- }
-
- public BigDecimal objectsCount() {
- return objectsCount;
- }
-
- public BigDecimal versionsCount() {
- return versionsCount;
- }
-
- public Integer healDisks() {
- return healDisks;
- }
-}
diff --git a/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java b/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java
deleted file mode 100644
index 6bcb439e2..000000000
--- a/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * MinIO Java SDK for Amazon S3 Compatible Cloud Storage,
- * (C) 2022 MinIO, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.minio.admin.info;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.math.BigDecimal;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * HealingDisk contains information about
- *
- * @see heal-commands.go
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class HealingDisk {
- @JsonProperty("id")
- private String id;
-
- @JsonProperty("heal_id")
- private String healID;
-
- @JsonProperty("pool_index")
- private Integer poolIndex;
-
- @JsonProperty("set_index")
- private Integer setIndex;
-
- @JsonProperty("disk_index")
- private Integer diskIndex;
-
- @JsonProperty("endpoint")
- private String endpoint;
-
- @JsonProperty("path")
- private String path;
-
- @JsonProperty("started")
- private String started;
-
- @JsonProperty("last_update")
- private String lastUpdate;
-
- @JsonProperty("objects_total_count")
- private BigDecimal objectsTotalCount;
-
- @JsonProperty("objects_total_size")
- private BigDecimal objectsTotalSize;
-
- @JsonProperty("items_healed")
- private BigDecimal itemsHealed;
-
- @JsonProperty("items_failed")
- private BigDecimal itemsFailed;
-
- @JsonProperty("bytes_done")
- private BigDecimal bytesDone;
-
- @JsonProperty("bytes_failed")
- private BigDecimal bytesFailed;
-
- @JsonProperty("objects_healed")
- private BigDecimal objectsHealed;
-
- @JsonProperty("objects_failed")
- private BigDecimal objectsFailed;
-
- @JsonProperty("current_bucket")
- private String bucket;
-
- @JsonProperty("current_object")
- private String object;
-
- @JsonProperty("queued_buckets")
- private List queuedBuckets;
-
- @JsonProperty("healed_buckets")
- private List healedBuckets;
-
- public String id() {
- return id;
- }
-
- public String healID() {
- return healID;
- }
-
- public Integer poolIndex() {
- return poolIndex;
- }
-
- public Integer setIndex() {
- return setIndex;
- }
-
- public Integer diskIndex() {
- return diskIndex;
- }
-
- public String endpoint() {
- return endpoint;
- }
-
- public String path() {
- return path;
- }
-
- public String started() {
- return started;
- }
-
- public String lastUpdate() {
- return lastUpdate;
- }
-
- public BigDecimal objectsTotalCount() {
- return objectsTotalCount;
- }
-
- public BigDecimal objectsTotalSize() {
- return objectsTotalSize;
- }
-
- public BigDecimal itemsHealed() {
- return itemsHealed;
- }
-
- public BigDecimal itemsFailed() {
- return itemsFailed;
- }
-
- public BigDecimal bytesDone() {
- return bytesDone;
- }
-
- public BigDecimal bytesFailed() {
- return bytesFailed;
- }
-
- public BigDecimal objectsHealed() {
- return objectsHealed;
- }
-
- public BigDecimal objectsFailed() {
- return objectsFailed;
- }
-
- public String bucket() {
- return bucket;
- }
-
- public String object() {
- return object;
- }
-
- public List queuedBuckets() {
- return Collections.unmodifiableList(queuedBuckets == null ? new LinkedList<>() : queuedBuckets);
- }
-
- public List healedBuckets() {
- return Collections.unmodifiableList(healedBuckets == null ? new LinkedList<>() : healedBuckets);
- }
-}
diff --git a/adminapi/src/main/java/io/minio/admin/info/InfoMessage.java b/adminapi/src/main/java/io/minio/admin/info/InfoMessage.java
deleted file mode 100644
index 4e3a74fdf..000000000
--- a/adminapi/src/main/java/io/minio/admin/info/InfoMessage.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * MinIO Java SDK for Amazon S3 Compatible Cloud Storage,
- * (C) 2022 MinIO, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.minio.admin.info;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * InfoMessage container to hold server admin related information.
- *
- * @see heal-commands.go
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class InfoMessage {
- @JsonProperty("mode")
- private String mode;
-
- @JsonProperty("deploymentID")
- private String deploymentID;
-
- @JsonProperty("buckets")
- private Buckets buckets;
-
- @JsonProperty("objects")
- private Objects objects;
-
- @JsonProperty("versions")
- private Versions versions;
-
- @JsonProperty("usage")
- private Usage usage;
-
- @JsonProperty("backend")
- private ErasureBackend backend;
-
- @JsonProperty("servers")
- private List servers;
-
- @JsonProperty("pools")
- private Map> erasureSetInfo;
-
- public String mode() {
- return mode;
- }
-
- public String deploymentID() {
- return deploymentID;
- }
-
- public Buckets buckets() {
- return buckets;
- }
-
- public Objects objects() {
- return objects;
- }
-
- public Versions versions() {
- return versions;
- }
-
- public Usage usage() {
- return usage;
- }
-
- public ErasureBackend backend() {
- return backend;
- }
-
- public List servers() {
- return Collections.unmodifiableList(servers == null ? new LinkedList<>() : servers);
- }
-
- public Map> erasureSetInfo() {
- return erasureSetInfo;
- }
-}
diff --git a/adminapi/src/main/java/io/minio/admin/info/ServerProperties.java b/adminapi/src/main/java/io/minio/admin/info/ServerProperties.java
deleted file mode 100644
index 161ae45a3..000000000
--- a/adminapi/src/main/java/io/minio/admin/info/ServerProperties.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * MinIO Java SDK for Amazon S3 Compatible Cloud Storage,
- * (C) 2022 MinIO, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.minio.admin.info;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * ServerProperties holds server information
- *
- * @see info-commands.go
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class ServerProperties {
- @JsonProperty("state")
- private String state;
-
- @JsonProperty("endpoint")
- private String endpoint;
-
- @JsonProperty("scheme")
- private String scheme;
-
- @JsonProperty("uptime")
- private Integer uptime;
-
- @JsonProperty("version")
- private String version;
-
- @JsonProperty("commitID")
- private String commitID;
-
- @JsonProperty("network")
- private Map network;
-
- @JsonProperty("drives")
- private List disks;
-
- @JsonProperty("poolNumber")
- private Integer poolNumber;
-
- @JsonProperty("mem_stats")
- private MemStats memStats;
-
- @JsonProperty("go_max_procs")
- private Integer goMaxProcs;
-
- @JsonProperty("num_cpu")
- private Integer numCPU;
-
- @JsonProperty("runtime_version")
- private String runtimeVersion;
-
- @JsonProperty("gc_stats")
- private GCStats gCStats;
-
- @JsonProperty("minio_env_vars")
- private Map minioEnvVars;
-
- public String state() {
- return state;
- }
-
- public String endpoint() {
- return endpoint;
- }
-
- public String scheme() {
- return scheme;
- }
-
- public Integer uptime() {
- return uptime;
- }
-
- public String version() {
- return version;
- }
-
- public String commitID() {
- return commitID;
- }
-
- public Map network() {
- return Collections.unmodifiableMap(this.network);
- }
-
- public List disks() {
- return Collections.unmodifiableList(disks == null ? new LinkedList<>() : disks);
- }
-
- public Integer poolNumber() {
- return poolNumber;
- }
-
- public MemStats memStats() {
- return memStats;
- }
-
- public Integer goMaxProcs() {
- return goMaxProcs;
- }
-
- public Integer numCPU() {
- return numCPU;
- }
-
- public String runtimeVersion() {
- return runtimeVersion;
- }
-
- public GCStats gCStats() {
- return gCStats;
- }
-
- public Map minioEnvVars() {
- return Collections.unmodifiableMap(this.minioEnvVars);
- }
-}
From 9861a393ef202e7fa91f6920e1c3915d02fe9471 Mon Sep 17 00:00:00 2001
From: dormanze <37854724+dormanze@users.noreply.github.com>
Date: Tue, 4 Jul 2023 14:56:30 +0800
Subject: [PATCH 09/22] check coding
---
.../java/io/minio/admin/MinioAdminClient.java | 20 +------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java
index fbf2ac59d..5e7a70187 100644
--- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java
+++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java
@@ -30,7 +30,6 @@
import io.minio.S3Escaper;
import io.minio.Signer;
import io.minio.Time;
-import io.minio.admin.clusterinfo.InfoMessage;
import io.minio.admin.messages.DataUsageInfo;
import io.minio.credentials.Credentials;
import io.minio.credentials.Provider;
@@ -80,8 +79,7 @@ private enum Command {
DATA_USAGE_INFO("datausageinfo"),
ADD_UPDATE_REMOVE_GROUP("update-group-members"),
GROUP_INFO("group"),
- LIST_GROUPS("groups"),
- ADMIN_INFO("info");
+ LIST_GROUPS("groups");
private final String value;
private Command(String value) {
@@ -216,22 +214,6 @@ private Response execute(
throw new RuntimeException("Request failed with response: " + response.body().string());
}
- /**
- * Obtains admin info for the Minio server.
- *
- * @return admin info for the Minio server.
- * @throws NoSuchAlgorithmException thrown to indicate missing of MD5 or SHA-256 digest library.
- * @throws InvalidKeyException thrown to indicate missing of HMAC SHA-256 library.
- * @throws IOException thrown to indicate I/O error on MinIO REST operation.
- */
- public InfoMessage getAdminInfo()
- throws IOException, NoSuchAlgorithmException, InvalidKeyException {
- try (Response response = execute(Method.GET, Command.ADMIN_INFO, null, null)) {
- byte[] jsonData = response.body().bytes();
- return OBJECT_MAPPER.readValue(jsonData, InfoMessage.class);
- }
- }
-
/**
* Adds a user with the specified access and secret key.
*
From f4fa64550770918185e38e5a8b4236ed0bb696bd Mon Sep 17 00:00:00 2001
From: dormanze <37854724+dormanze@users.noreply.github.com>
Date: Tue, 4 Jul 2023 14:58:39 +0800
Subject: [PATCH 10/22] Update MinioAdminClient.java
---
.../java/io/minio/admin/MinioAdminClient.java | 292 ++++++++----------
1 file changed, 137 insertions(+), 155 deletions(-)
diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java
index 5e7a70187..a17ae4d8f 100644
--- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java
+++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java
@@ -108,7 +108,7 @@ public String toString() {
private OkHttpClient httpClient;
private MinioAdminClient(
- HttpUrl baseUrl, String region, Provider provider, OkHttpClient httpClient) {
+ HttpUrl baseUrl, String region, Provider provider, OkHttpClient httpClient) {
this.baseUrl = baseUrl;
this.region = region;
this.provider = provider;
@@ -117,26 +117,24 @@ private MinioAdminClient(
private Credentials getCredentials() {
Credentials creds = provider.fetch();
- if (creds == null) {
- throw new RuntimeException("Credential provider returns null credential");
- }
+ if (creds == null) throw new RuntimeException("Credential provider returns null credential");
return creds;
}
private Response execute(
- Method method, Command command, Multimap queryParamMap, byte[] body)
- throws InvalidKeyException, IOException, NoSuchAlgorithmException {
+ Method method, Command command, Multimap queryParamMap, byte[] body)
+ throws InvalidKeyException, IOException, NoSuchAlgorithmException {
Credentials creds = getCredentials();
HttpUrl.Builder urlBuilder =
- this.baseUrl
- .newBuilder()
- .host(this.baseUrl.host())
- .addEncodedPathSegments(S3Escaper.encodePath("minio/admin/v3/" + command.toString()));
+ this.baseUrl
+ .newBuilder()
+ .host(this.baseUrl.host())
+ .addEncodedPathSegments(S3Escaper.encodePath("minio/admin/v3/" + command.toString()));
if (queryParamMap != null) {
for (Map.Entry entry : queryParamMap.entries()) {
urlBuilder.addEncodedQueryParameter(
- S3Escaper.encode(entry.getKey()), S3Escaper.encode(entry.getValue()));
+ S3Escaper.encode(entry.getKey()), S3Escaper.encode(entry.getValue()));
}
}
HttpUrl url = urlBuilder.build();
@@ -162,12 +160,12 @@ private Response execute(
Request request = requestBuilder.build();
request =
- Signer.signV4S3(
- request,
- region,
- creds.accessKey(),
- creds.secretKey(),
- request.header("x-amz-content-sha256"));
+ Signer.signV4S3(
+ request,
+ region,
+ creds.accessKey(),
+ creds.secretKey(),
+ request.header("x-amz-content-sha256"));
PrintWriter traceStream = this.traceStream;
if (traceStream != null) {
@@ -175,19 +173,15 @@ private Response execute(
traceBuilder.append("---------START-HTTP---------\n");
String encodedPath = request.url().encodedPath();
String encodedQuery = request.url().encodedQuery();
- if (encodedQuery != null) {
- encodedPath += "?" + encodedQuery;
- }
+ if (encodedQuery != null) encodedPath += "?" + encodedQuery;
traceBuilder.append(request.method()).append(" ").append(encodedPath).append(" HTTP/1.1\n");
traceBuilder.append(
- request
- .headers()
- .toString()
- .replaceAll("Signature=([0-9a-f]+)", "Signature=*REDACTED*")
- .replaceAll("Credential=([^/]+)", "Credential=*REDACTED*"));
- if (body != null) {
- traceBuilder.append("\n").append(new String(body, StandardCharsets.UTF_8));
- }
+ request
+ .headers()
+ .toString()
+ .replaceAll("Signature=([0-9a-f]+)", "Signature=*REDACTED*")
+ .replaceAll("Credential=([^/]+)", "Credential=*REDACTED*"));
+ if (body != null) traceBuilder.append("\n").append(new String(body, StandardCharsets.UTF_8));
traceStream.println(traceBuilder.toString());
}
@@ -196,20 +190,18 @@ private Response execute(
if (traceStream != null) {
String trace =
- response.protocol().toString().toUpperCase(Locale.US)
- + " "
- + response.code()
- + "\n"
- + response.headers();
+ response.protocol().toString().toUpperCase(Locale.US)
+ + " "
+ + response.code()
+ + "\n"
+ + response.headers();
traceStream.println(trace);
ResponseBody responseBody = response.peekBody(1024 * 1024);
traceStream.println(responseBody.string());
traceStream.println("----------END-HTTP----------");
}
- if (response.isSuccessful()) {
- return response;
- }
+ if (response.isSuccessful()) return response;
throw new RuntimeException("Request failed with response: " + response.body().string());
}
@@ -228,12 +220,12 @@ private Response execute(
* @throws InvalidCipherTextException thrown to indicate data cannot be encrypted/decrypted.
*/
public void addUser(
- @Nonnull String accessKey,
- @Nonnull UserInfo.Status status,
- @Nullable String secretKey,
- @Nullable String policyName,
- @Nullable List memberOf)
- throws NoSuchAlgorithmException, InvalidKeyException, IOException,
+ @Nonnull String accessKey,
+ @Nonnull UserInfo.Status status,
+ @Nullable String secretKey,
+ @Nullable String policyName,
+ @Nullable List memberOf)
+ throws NoSuchAlgorithmException, InvalidKeyException, IOException,
InvalidCipherTextException {
if (accessKey == null || accessKey.isEmpty()) {
throw new IllegalArgumentException("access key must be provided");
@@ -242,11 +234,11 @@ public void addUser(
Credentials creds = getCredentials();
try (Response response =
- execute(
- Method.PUT,
- Command.ADD_USER,
- ImmutableMultimap.of("accessKey", accessKey),
- Crypto.encrypt(creds.secretKey(), OBJECT_MAPPER.writeValueAsBytes(userInfo)))) {}
+ execute(
+ Method.PUT,
+ Command.ADD_USER,
+ ImmutableMultimap.of("accessKey", accessKey),
+ Crypto.encrypt(creds.secretKey(), OBJECT_MAPPER.writeValueAsBytes(userInfo)))) {}
}
/**
@@ -259,10 +251,10 @@ public void addUser(
* @throws IOException thrown to indicate I/O error on MinIO REST operation.
*/
public UserInfo getUserInfo(String accessKey)
- throws NoSuchAlgorithmException, InvalidKeyException, IOException {
+ throws NoSuchAlgorithmException, InvalidKeyException, IOException {
try (Response response =
- execute(
- Method.GET, Command.USER_INFO, ImmutableMultimap.of("accessKey", accessKey), null)) {
+ execute(
+ Method.GET, Command.USER_INFO, ImmutableMultimap.of("accessKey", accessKey), null)) {
byte[] jsonData = response.body().bytes();
return OBJECT_MAPPER.readValue(jsonData, UserInfo.class);
}
@@ -278,15 +270,15 @@ public UserInfo getUserInfo(String accessKey)
* @throws InvalidCipherTextException thrown to indicate data cannot be encrypted/decrypted.
*/
public Map listUsers()
- throws NoSuchAlgorithmException, InvalidKeyException, IOException,
+ throws NoSuchAlgorithmException, InvalidKeyException, IOException,
InvalidCipherTextException {
try (Response response = execute(Method.GET, Command.LIST_USERS, null, null)) {
Credentials creds = getCredentials();
byte[] jsonData = Crypto.decrypt(creds.secretKey(), response.body().bytes());
MapType mapType =
- OBJECT_MAPPER
- .getTypeFactory()
- .constructMapType(HashMap.class, String.class, UserInfo.class);
+ OBJECT_MAPPER
+ .getTypeFactory()
+ .constructMapType(HashMap.class, String.class, UserInfo.class);
return OBJECT_MAPPER.readValue(jsonData, mapType);
}
}
@@ -300,17 +292,17 @@ public Map listUsers()
* @throws IOException thrown to indicate I/O error on MinIO REST operation.
*/
public void deleteUser(@Nonnull String accessKey)
- throws NoSuchAlgorithmException, InvalidKeyException, IOException {
+ throws NoSuchAlgorithmException, InvalidKeyException, IOException {
if (accessKey == null || accessKey.isEmpty()) {
throw new IllegalArgumentException("access key must be provided");
}
try (Response response =
- execute(
- Method.DELETE,
- Command.REMOVE_USER,
- ImmutableMultimap.of("accessKey", accessKey),
- null)) {}
+ execute(
+ Method.DELETE,
+ Command.REMOVE_USER,
+ ImmutableMultimap.of("accessKey", accessKey),
+ null)) {}
}
/**
@@ -324,20 +316,20 @@ public void deleteUser(@Nonnull String accessKey)
* @throws IOException thrown to indicate I/O error on MinIO REST operation.
*/
public void addUpdateGroup(
- @Nonnull String group, @Nullable Status groupStatus, @Nullable List members)
- throws NoSuchAlgorithmException, InvalidKeyException, IOException {
+ @Nonnull String group, @Nullable Status groupStatus, @Nullable List members)
+ throws NoSuchAlgorithmException, InvalidKeyException, IOException {
if (group == null || group.isEmpty()) {
throw new IllegalArgumentException("group must be provided");
}
GroupAddUpdateRemoveInfo groupAddUpdateRemoveInfo =
- new GroupAddUpdateRemoveInfo(group, groupStatus, members, false);
+ new GroupAddUpdateRemoveInfo(group, groupStatus, members, false);
try (Response response =
- execute(
- Method.PUT,
- Command.ADD_UPDATE_REMOVE_GROUP,
- null,
- OBJECT_MAPPER.writeValueAsBytes(groupAddUpdateRemoveInfo))) {}
+ execute(
+ Method.PUT,
+ Command.ADD_UPDATE_REMOVE_GROUP,
+ null,
+ OBJECT_MAPPER.writeValueAsBytes(groupAddUpdateRemoveInfo))) {}
}
/**
@@ -350,9 +342,9 @@ public void addUpdateGroup(
* @throws IOException thrown to indicate I/O error on MinIO REST operation.
*/
public GroupInfo getGroupInfo(String group)
- throws NoSuchAlgorithmException, InvalidKeyException, IOException {
+ throws NoSuchAlgorithmException, InvalidKeyException, IOException {
try (Response response =
- execute(Method.GET, Command.GROUP_INFO, ImmutableMultimap.of("group", group), null)) {
+ execute(Method.GET, Command.GROUP_INFO, ImmutableMultimap.of("group", group), null)) {
byte[] jsonData = response.body().bytes();
return OBJECT_MAPPER.readValue(jsonData, GroupInfo.class);
}
@@ -367,11 +359,11 @@ public GroupInfo getGroupInfo(String group)
* @throws IOException thrown to indicate I/O error on MinIO REST operation.
*/
public List listGroups()
- throws NoSuchAlgorithmException, InvalidKeyException, IOException {
+ throws NoSuchAlgorithmException, InvalidKeyException, IOException {
try (Response response = execute(Method.GET, Command.LIST_GROUPS, null, null)) {
byte[] jsonData = response.body().bytes();
CollectionType mapType =
- OBJECT_MAPPER.getTypeFactory().constructCollectionType(ArrayList.class, String.class);
+ OBJECT_MAPPER.getTypeFactory().constructCollectionType(ArrayList.class, String.class);
return OBJECT_MAPPER.readValue(jsonData, mapType);
}
}
@@ -385,19 +377,19 @@ public List listGroups()
* @throws IOException thrown to indicate I/O error on MinIO REST operation.
*/
public void removeGroup(@Nonnull String group)
- throws NoSuchAlgorithmException, InvalidKeyException, IOException {
+ throws NoSuchAlgorithmException, InvalidKeyException, IOException {
if (group == null || group.isEmpty()) {
throw new IllegalArgumentException("group must be provided");
}
GroupAddUpdateRemoveInfo groupAddUpdateRemoveInfo =
- new GroupAddUpdateRemoveInfo(group, null, null, true);
+ new GroupAddUpdateRemoveInfo(group, null, null, true);
try (Response response =
- execute(
- Method.PUT,
- Command.ADD_UPDATE_REMOVE_GROUP,
- null,
- OBJECT_MAPPER.writeValueAsBytes(groupAddUpdateRemoveInfo))) {}
+ execute(
+ Method.PUT,
+ Command.ADD_UPDATE_REMOVE_GROUP,
+ null,
+ OBJECT_MAPPER.writeValueAsBytes(groupAddUpdateRemoveInfo))) {}
}
/**
@@ -411,18 +403,18 @@ public void removeGroup(@Nonnull String group)
* @throws IOException thrown to indicate I/O error on MinIO REST operation.
*/
public void setBucketQuota(@Nonnull String bucketName, long size, @Nonnull QuotaUnit unit)
- throws IOException, NoSuchAlgorithmException, InvalidKeyException {
+ throws IOException, NoSuchAlgorithmException, InvalidKeyException {
Map quotaEntity = new HashMap<>();
if (size > 0) {
quotaEntity.put("quotatype", "hard");
}
quotaEntity.put("quota", unit.toBytes(size));
try (Response response =
- execute(
- Method.PUT,
- Command.SET_BUCKET_QUOTA,
- ImmutableMultimap.of("bucket", bucketName),
- OBJECT_MAPPER.writeValueAsBytes(quotaEntity))) {}
+ execute(
+ Method.PUT,
+ Command.SET_BUCKET_QUOTA,
+ ImmutableMultimap.of("bucket", bucketName),
+ OBJECT_MAPPER.writeValueAsBytes(quotaEntity))) {}
}
/**
@@ -435,23 +427,23 @@ public void setBucketQuota(@Nonnull String bucketName, long size, @Nonnull Quota
* @throws InvalidKeyException
*/
public long getBucketQuota(String bucketName)
- throws IOException, NoSuchAlgorithmException, InvalidKeyException {
+ throws IOException, NoSuchAlgorithmException, InvalidKeyException {
try (Response response =
- execute(
- Method.GET,
- Command.GET_BUCKET_QUOTA,
- ImmutableMultimap.of("bucket", bucketName),
- null)) {
+ execute(
+ Method.GET,
+ Command.GET_BUCKET_QUOTA,
+ ImmutableMultimap.of("bucket", bucketName),
+ null)) {
MapType mapType =
- OBJECT_MAPPER
- .getTypeFactory()
- .constructMapType(HashMap.class, String.class, JsonNode.class);
+ OBJECT_MAPPER
+ .getTypeFactory()
+ .constructMapType(HashMap.class, String.class, JsonNode.class);
return OBJECT_MAPPER.