From cadfbdcbc72346c2bff47ed57fadb9fdb059c7fe Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Tue, 4 Jul 2023 10:50:32 +0800 Subject: [PATCH 01/22] add admin info --- .../java/io/minio/admin/MinioAdminClient.java | 23 +- .../java/io/minio/admin/info/Buckets.java | 44 ++++ .../main/java/io/minio/admin/info/Disk.java | 207 ++++++++++++++++++ .../java/io/minio/admin/info/DiskMetrics.java | 45 ++++ .../io/minio/admin/info/ErasureBackend.java | 84 +++++++ .../io/minio/admin/info/ErasureSetInfo.java | 82 +++++++ .../java/io/minio/admin/info/GCStats.java | 69 ++++++ .../java/io/minio/admin/info/HealingDisk.java | 183 ++++++++++++++++ .../java/io/minio/admin/info/InfoMessage.java | 98 +++++++++ .../java/io/minio/admin/info/MemStats.java | 68 ++++++ .../java/io/minio/admin/info/Objects.java | 44 ++++ .../io/minio/admin/info/ServerProperties.java | 141 ++++++++++++ .../java/io/minio/admin/info/TimedAction.java | 52 +++++ .../main/java/io/minio/admin/info/Usage.java | 45 ++++ .../java/io/minio/admin/info/Versions.java | 45 ++++ functional/TestMinioAdminClient.java | 20 ++ 16 files changed, 1249 insertions(+), 1 deletion(-) create mode 100644 adminapi/src/main/java/io/minio/admin/info/Buckets.java create mode 100644 adminapi/src/main/java/io/minio/admin/info/Disk.java create mode 100644 adminapi/src/main/java/io/minio/admin/info/DiskMetrics.java create mode 100644 adminapi/src/main/java/io/minio/admin/info/ErasureBackend.java create mode 100644 adminapi/src/main/java/io/minio/admin/info/ErasureSetInfo.java create mode 100644 adminapi/src/main/java/io/minio/admin/info/GCStats.java create mode 100644 adminapi/src/main/java/io/minio/admin/info/HealingDisk.java create mode 100644 adminapi/src/main/java/io/minio/admin/info/InfoMessage.java create mode 100644 adminapi/src/main/java/io/minio/admin/info/MemStats.java create mode 100644 adminapi/src/main/java/io/minio/admin/info/Objects.java create mode 100644 adminapi/src/main/java/io/minio/admin/info/ServerProperties.java create mode 100644 adminapi/src/main/java/io/minio/admin/info/TimedAction.java create mode 100644 adminapi/src/main/java/io/minio/admin/info/Usage.java create mode 100644 adminapi/src/main/java/io/minio/admin/info/Versions.java diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index a2ab37789..c2f7ea281 100644 --- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java +++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java @@ -30,6 +30,7 @@ import io.minio.S3Escaper; import io.minio.Signer; import io.minio.Time; +import io.minio.admin.info.InfoMessage; import io.minio.admin.messages.DataUsageInfo; import io.minio.credentials.Credentials; import io.minio.credentials.Provider; @@ -79,7 +80,9 @@ private enum Command { DATA_USAGE_INFO("datausageinfo"), ADD_UPDATE_REMOVE_GROUP("update-group-members"), GROUP_INFO("group"), - LIST_GROUPS("groups"); + LIST_GROUPS("groups"), + + ADMIN_INFO("info"); private final String value; private Command(String value) { @@ -206,6 +209,24 @@ 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 IOException thrown to indicate I/O error on MinIO REST operation. + * @throws NoSuchAlgorithmException thrown to indicate missing of MD5 or SHA-256 digest library. + * @throws InvalidKeyException thrown to indicate missing of HMAC SHA-256 library. + */ + public InfoMessage getAdminInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException { + try (Response response = + execute( + Method.GET, Command.ADMIN_INFO, null, null)) { + byte[] jsonData = response.body().bytes(); + System.out.println(new String(jsonData)); + return OBJECT_MAPPER.readValue(jsonData, InfoMessage.class); + } + } + /** * Adds a user with the specified access and secret key. * diff --git a/adminapi/src/main/java/io/minio/admin/info/Buckets.java b/adminapi/src/main/java/io/minio/admin/info/Buckets.java new file mode 100644 index 000000000..b01710ffb --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/info/Buckets.java @@ -0,0 +1,44 @@ +/* + * 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; + +/** + * Buckets contains the number of buckets + * + * @see info-commands.go + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class Buckets { + + @JsonProperty("count") + private Integer count; + + @JsonProperty("error") + private String error; + + public Integer count() { + return count; + } + + 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 new file mode 100644 index 000000000..3ac55644f --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/info/Disk.java @@ -0,0 +1,207 @@ +/* + * 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/DiskMetrics.java b/adminapi/src/main/java/io/minio/admin/info/DiskMetrics.java new file mode 100644 index 000000000..0960e7ded --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/info/DiskMetrics.java @@ -0,0 +1,45 @@ +/* + * 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.JsonProperty; + +import java.util.Collections; +import java.util.Map; + +/** + * DiskMetrics has the information about XL Storage APIs + * + * @see info-commands.go + */ +public class DiskMetrics { + + @JsonProperty("lastMinute") + private Map lastMinute; + + @JsonProperty("apiCalls") + private Map apiCalls; + + public Map lastMinute() { + return Collections.unmodifiableMap(lastMinute); + } + + public Map apiCalls() { + return Collections.unmodifiableMap(apiCalls); + } +} diff --git a/adminapi/src/main/java/io/minio/admin/info/ErasureBackend.java b/adminapi/src/main/java/io/minio/admin/info/ErasureBackend.java new file mode 100644 index 000000000..c72942548 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/info/ErasureBackend.java @@ -0,0 +1,84 @@ +/* + * 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 new file mode 100644 index 000000000..f34d07f60 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/info/ErasureSetInfo.java @@ -0,0 +1,82 @@ +/* + * 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/GCStats.java b/adminapi/src/main/java/io/minio/admin/info/GCStats.java new file mode 100644 index 000000000..fe1c4230c --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/info/GCStats.java @@ -0,0 +1,69 @@ +/* + * 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; + +/** + * GCStats collect information about recent garbage collections. + * + * @see health.go + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class GCStats { + + @JsonProperty("last_gc") + private String lastGC; + + @JsonProperty("num_gc") + private Integer numGC; + + @JsonProperty("pause_total") + private Integer pauseTotal; + + @JsonProperty("pause") + private List pause; + + @JsonProperty("pause_end") + private List pauseEnd; + + public String lastGC() { + return lastGC; + } + + public Integer numGC() { + return numGC; + } + + public Integer pauseTotal() { + return pauseTotal; + } + + public List pause() { + return Collections.unmodifiableList(pause == null ? new LinkedList<>() : pause); + } + + public List pauseEnd() { + return Collections.unmodifiableList(pauseEnd == null ? new LinkedList<>() : pauseEnd); + } +} diff --git a/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java b/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java new file mode 100644 index 000000000..4f65c3367 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java @@ -0,0 +1,183 @@ +/* + * 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 new file mode 100644 index 000000000..5797a197e --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/info/InfoMessage.java @@ -0,0 +1,98 @@ +/* + * 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/MemStats.java b/adminapi/src/main/java/io/minio/admin/info/MemStats.java new file mode 100644 index 000000000..f1fa4df56 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/info/MemStats.java @@ -0,0 +1,68 @@ +/* + * 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; + + +/** + * MemStats is strip down version of runtime.MemStats containing memory stats of MinIO server. + * + * @see health.go + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class MemStats { + + @JsonProperty("Alloc") + private BigDecimal alloc; + + @JsonProperty("TotalAlloc") + private BigDecimal totalAlloc; + + @JsonProperty("Mallocs") + private BigDecimal mallocs; + + @JsonProperty("Frees") + private BigDecimal frees; + + @JsonProperty("HeapAlloc") + private BigDecimal heapAlloc; + + public BigDecimal alloc() { + return alloc; + } + + public BigDecimal totalAlloc() { + return totalAlloc; + } + + public BigDecimal mallocs() { + return mallocs; + } + + public BigDecimal frees() { + return frees; + } + + 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/info/Objects.java new file mode 100644 index 000000000..a5f852d85 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/info/Objects.java @@ -0,0 +1,44 @@ +/* + * 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; + +/** + * Objects contains the number of objects + * + * @see info-commands.go + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class Objects { + @JsonProperty("count") + private Integer count; + + @JsonProperty("error") + private String error; + + public Integer count() { + return count; + } + + public String error() { + return error; + } +} diff --git a/adminapi/src/main/java/io/minio/admin/info/ServerProperties.java b/adminapi/src/main/java/io/minio/admin/info/ServerProperties.java new file mode 100644 index 000000000..c0c724652 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/info/ServerProperties.java @@ -0,0 +1,141 @@ +/* + * 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); + } +} diff --git a/adminapi/src/main/java/io/minio/admin/info/TimedAction.java b/adminapi/src/main/java/io/minio/admin/info/TimedAction.java new file mode 100644 index 000000000..ca3d7a276 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/info/TimedAction.java @@ -0,0 +1,52 @@ +/* + * 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; + +/** + * TimedAction contains a number of actions and their accumulated duration in nanoseconds. + * + * @see metrics.go + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class TimedAction { + @JsonProperty("count") + private BigDecimal count; + + @JsonProperty("acc_time_ns") + private BigDecimal accTime; + + @JsonProperty("bytes") + private BigDecimal bytes; + + public BigDecimal count() { + return count; + } + + public BigDecimal accTime() { + return accTime; + } + + 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 new file mode 100644 index 000000000..75f8ca776 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/info/Usage.java @@ -0,0 +1,45 @@ +/* + * 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; + +/** + * Usage contains the total size used + * + * @see info-commands.go + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class Usage { + + @JsonProperty("size") + private Integer size; + + @JsonProperty("error") + private String error; + + public Integer size() { + return size; + } + + 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 new file mode 100644 index 000000000..649494bc3 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/info/Versions.java @@ -0,0 +1,45 @@ +/* + * 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; + +/** + * Versions contains the number of versions + * + * @see info-commands.go + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class Versions { + + @JsonProperty("count") + private Integer count; + + @JsonProperty("error") + private String error; + + public Integer count() { + return count; + } + + public String error() { + return error; + } +} diff --git a/functional/TestMinioAdminClient.java b/functional/TestMinioAdminClient.java index e7911dec6..292c4e580 100644 --- a/functional/TestMinioAdminClient.java +++ b/functional/TestMinioAdminClient.java @@ -17,7 +17,10 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import io.minio.admin.*; + import java.util.Map; + +import io.minio.admin.info.InfoMessage; import org.junit.Assert; @SuppressFBWarnings( @@ -156,6 +159,22 @@ public void deleteUser() throws Exception { } } + public void getAdminInfo()throws Exception{ + String methodName = "getAdminInfo()"; + if (!mintEnv) { + System.out.println(methodName); + } + + long startTime = System.currentTimeMillis(); + try { + InfoMessage infoMessage = adminClient.getAdminInfo(); + String mode = infoMessage.mode(); + Assert.assertTrue(mode != null); + } catch (Exception e) { + FunctionalTest.handleException(methodName, null, startTime, e); + } + } + public void runAdminTests() throws Exception { addUser(); addCannedPolicy(); @@ -165,5 +184,6 @@ public void runAdminTests() throws Exception { listCannedPolicies(); deleteUser(); removeCannedPolicy(); + getAdminInfo(); } } From 29bbb1df8309b2e893da4da03300806ef71cdfb6 Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Tue, 4 Jul 2023 11:07:53 +0800 Subject: [PATCH 02/22] Update TestMinioAdminClient.java --- functional/TestMinioAdminClient.java | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/functional/TestMinioAdminClient.java b/functional/TestMinioAdminClient.java index 292c4e580..a69905f3a 100644 --- a/functional/TestMinioAdminClient.java +++ b/functional/TestMinioAdminClient.java @@ -17,15 +17,12 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import io.minio.admin.*; - import java.util.Map; - -import io.minio.admin.info.InfoMessage; import org.junit.Assert; @SuppressFBWarnings( - value = "REC", - justification = "Allow catching super class Exception since it's tests") + value = "REC", + justification = "Allow catching super class Exception since it's tests") public class TestMinioAdminClient { private final MinioAdminClient adminClient; @@ -61,8 +58,8 @@ public void addCannedPolicy() throws Exception { long startTime = System.currentTimeMillis(); try { String policyJson = - "{'Version': '2012-10-17','Statement': [{'Action': ['s3:GetObject'],'Effect':" - + " 'Allow','Resource': ['arn:aws:s3:::my-bucketname/*'],'Sid': ''}]}"; + "{'Version': '2012-10-17','Statement': [{'Action': ['s3:GetObject'],'Effect':" + + " 'Allow','Resource': ['arn:aws:s3:::my-bucketname/*'],'Sid': ''}]}"; adminClient.addCannedPolicy(policyName, policyJson.replaceAll("'", "\"")); } catch (Exception e) { FunctionalTest.handleException(methodName, null, startTime, e); @@ -159,22 +156,6 @@ public void deleteUser() throws Exception { } } - public void getAdminInfo()throws Exception{ - String methodName = "getAdminInfo()"; - if (!mintEnv) { - System.out.println(methodName); - } - - long startTime = System.currentTimeMillis(); - try { - InfoMessage infoMessage = adminClient.getAdminInfo(); - String mode = infoMessage.mode(); - Assert.assertTrue(mode != null); - } catch (Exception e) { - FunctionalTest.handleException(methodName, null, startTime, e); - } - } - public void runAdminTests() throws Exception { addUser(); addCannedPolicy(); @@ -184,6 +165,5 @@ public void runAdminTests() throws Exception { listCannedPolicies(); deleteUser(); removeCannedPolicy(); - getAdminInfo(); } } From 0545a858e377caf65776bca9fecd73b6b1be87c4 Mon Sep 17 00:00:00 2001 From: dorman <37854724+dormanze@users.noreply.github.com> Date: Tue, 4 Jul 2023 11:11:16 +0800 Subject: [PATCH 03/22] Update TestMinioAdminClient.java --- functional/TestMinioAdminClient.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functional/TestMinioAdminClient.java b/functional/TestMinioAdminClient.java index a69905f3a..e7911dec6 100644 --- a/functional/TestMinioAdminClient.java +++ b/functional/TestMinioAdminClient.java @@ -21,8 +21,8 @@ import org.junit.Assert; @SuppressFBWarnings( - value = "REC", - justification = "Allow catching super class Exception since it's tests") + value = "REC", + justification = "Allow catching super class Exception since it's tests") public class TestMinioAdminClient { private final MinioAdminClient adminClient; @@ -58,8 +58,8 @@ public void addCannedPolicy() throws Exception { long startTime = System.currentTimeMillis(); try { String policyJson = - "{'Version': '2012-10-17','Statement': [{'Action': ['s3:GetObject'],'Effect':" - + " 'Allow','Resource': ['arn:aws:s3:::my-bucketname/*'],'Sid': ''}]}"; + "{'Version': '2012-10-17','Statement': [{'Action': ['s3:GetObject'],'Effect':" + + " 'Allow','Resource': ['arn:aws:s3:::my-bucketname/*'],'Sid': ''}]}"; adminClient.addCannedPolicy(policyName, policyJson.replaceAll("'", "\"")); } catch (Exception e) { FunctionalTest.handleException(methodName, null, startTime, e); From 173698470f8f39cef5de7e91e5a97b459ccd697a Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Tue, 4 Jul 2023 11:15:56 +0800 Subject: [PATCH 04/22] Update MinioAdminClient.java --- .../src/main/java/io/minio/admin/MinioAdminClient.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index c2f7ea281..2ea02c4f0 100644 --- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java +++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java @@ -81,7 +81,6 @@ private enum Command { ADD_UPDATE_REMOVE_GROUP("update-group-members"), GROUP_INFO("group"), LIST_GROUPS("groups"), - ADMIN_INFO("info"); private final String value; @@ -209,13 +208,14 @@ private Response execute( throw new RuntimeException("Request failed with response: " + response.body().string()); } + /** - * Obtains admin info for the Minio server + * Obtains admin info for the Minio server. * - * @return admin info for the Minio server - * @throws IOException thrown to indicate I/O error on MinIO REST operation. + * @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 = From 2041f29ee8632a435a46d7a694f968f3f3d781bf Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Tue, 4 Jul 2023 12:28:33 +0800 Subject: [PATCH 05/22] fix ci --- .../java/io/minio/admin/MinioAdminClient.java | 8 +- .../java/io/minio/admin/info/Buckets.java | 20 +- .../main/java/io/minio/admin/info/Disk.java | 251 +++++++++--------- .../java/io/minio/admin/info/DiskMetrics.java | 21 +- .../io/minio/admin/info/ErasureBackend.java | 72 ++--- .../io/minio/admin/info/ErasureSetInfo.java | 71 +++-- .../java/io/minio/admin/info/GCStats.java | 54 ++-- .../java/io/minio/admin/info/HealingDisk.java | 211 ++++++++------- .../java/io/minio/admin/info/InfoMessage.java | 91 ++++--- .../java/io/minio/admin/info/MemStats.java | 55 ++-- .../java/io/minio/admin/info/Objects.java | 23 +- .../io/minio/admin/info/ServerProperties.java | 154 ++++++----- .../java/io/minio/admin/info/TimedAction.java | 34 ++- .../main/java/io/minio/admin/info/Usage.java | 23 +- .../java/io/minio/admin/info/Versions.java | 23 +- 15 files changed, 546 insertions(+), 565 deletions(-) diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index 2ea02c4f0..0fcf9b749 100644 --- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java +++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java @@ -208,7 +208,6 @@ private Response execute( throw new RuntimeException("Request failed with response: " + response.body().string()); } - /** * Obtains admin info for the Minio server. * @@ -217,10 +216,9 @@ private Response execute( * @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)) { + public InfoMessage getAdminInfo() + throws IOException, NoSuchAlgorithmException, InvalidKeyException { + try (Response response = execute(Method.GET, Command.ADMIN_INFO, null, null)) { byte[] jsonData = response.body().bytes(); System.out.println(new String(jsonData)); return OBJECT_MAPPER.readValue(jsonData, InfoMessage.class); diff --git a/adminapi/src/main/java/io/minio/admin/info/Buckets.java b/adminapi/src/main/java/io/minio/admin/info/Buckets.java index b01710ffb..f812eaf50 100644 --- a/adminapi/src/main/java/io/minio/admin/info/Buckets.java +++ b/adminapi/src/main/java/io/minio/admin/info/Buckets.java @@ -28,17 +28,17 @@ @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/info/Disk.java b/adminapi/src/main/java/io/minio/admin/info/Disk.java index 3ac55644f..f77cefddc 100644 --- a/adminapi/src/main/java/io/minio/admin/info/Disk.java +++ b/adminapi/src/main/java/io/minio/admin/info/Disk.java @@ -19,7 +19,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; - import java.math.BigDecimal; /** @@ -30,178 +29,178 @@ */ @JsonIgnoreProperties(ignoreUnknown = true) public class Disk { - @JsonProperty("endpoint") - private String endpoint; + @JsonProperty("endpoint") + private String endpoint; - @JsonProperty("rootDisk") - private boolean rootDisk; + @JsonProperty("rootDisk") + private boolean rootDisk; - @JsonProperty("path") - private String path; + @JsonProperty("path") + private String path; - @JsonProperty("healing") - private boolean healing; + @JsonProperty("healing") + private boolean healing; - @JsonProperty("scanning") - private boolean scanning; + @JsonProperty("scanning") + private boolean scanning; - @JsonProperty("state") - private String state; + @JsonProperty("state") + private String state; - @JsonProperty("uuid") - private String uuid; + @JsonProperty("uuid") + private String uuid; - @JsonProperty("major") - private BigDecimal major; + @JsonProperty("major") + private BigDecimal major; - @JsonProperty("minor") - private BigDecimal minor; + @JsonProperty("minor") + private BigDecimal minor; - @JsonProperty("model") - private String model; + @JsonProperty("model") + private String model; - @JsonProperty("totalspace") - private BigDecimal totalspace; + @JsonProperty("totalspace") + private BigDecimal totalspace; - @JsonProperty("usedspace") - private BigDecimal usedspace; + @JsonProperty("usedspace") + private BigDecimal usedspace; - @JsonProperty("availspace") - private BigDecimal availspace; + @JsonProperty("availspace") + private BigDecimal availspace; - @JsonProperty("readthroughput") - private BigDecimal readthroughput; + @JsonProperty("readthroughput") + private BigDecimal readthroughput; - @JsonProperty("writethroughput") - private BigDecimal writethroughput; + @JsonProperty("writethroughput") + private BigDecimal writethroughput; - @JsonProperty("readlatency") - private BigDecimal readlatency; + @JsonProperty("readlatency") + private BigDecimal readlatency; - @JsonProperty("writelatency") - private BigDecimal writelatency; + @JsonProperty("writelatency") + private BigDecimal writelatency; - @JsonProperty("utilization") - private BigDecimal utilization; + @JsonProperty("utilization") + private BigDecimal utilization; - @JsonProperty("metrics") - private DiskMetrics metrics; + @JsonProperty("metrics") + private DiskMetrics metrics; - @JsonProperty("heal_info") - private HealingDisk healInfo; + @JsonProperty("heal_info") + private HealingDisk healInfo; - @JsonProperty("used_inodes") - private BigDecimal usedInodes; + @JsonProperty("used_inodes") + private BigDecimal usedInodes; - @JsonProperty("free_inodes") - private BigDecimal freeInodes; + @JsonProperty("free_inodes") + private BigDecimal freeInodes; - @JsonProperty("pool_index") - private Integer poolIndex; + @JsonProperty("pool_index") + private Integer poolIndex; - @JsonProperty("set_index") - private Integer setIndex; + @JsonProperty("set_index") + private Integer setIndex; - @JsonProperty("disk_index") - private Integer diskIndex; + @JsonProperty("disk_index") + private Integer diskIndex; - public String endpoint() { - return endpoint; - } + public String endpoint() { + return endpoint; + } - public boolean isRootDisk() { - return rootDisk; - } + public boolean isRootDisk() { + return rootDisk; + } - public String path() { - return path; - } + public String path() { + return path; + } - public boolean isHealing() { - return healing; - } + public boolean isHealing() { + return healing; + } - public boolean isScanning() { - return scanning; - } + public boolean isScanning() { + return scanning; + } - public String state() { - return state; - } + public String state() { + return state; + } - public String uuid() { - return uuid; - } + public String uuid() { + return uuid; + } - public BigDecimal major() { - return major; - } + public BigDecimal major() { + return major; + } - public BigDecimal minor() { - return minor; - } + public BigDecimal minor() { + return minor; + } - public String model() { - return model; - } + public String model() { + return model; + } - public BigDecimal totalspace() { - return totalspace; - } + public BigDecimal totalspace() { + return totalspace; + } - public BigDecimal usedspace() { - return usedspace; - } + public BigDecimal usedspace() { + return usedspace; + } - public BigDecimal availspace() { - return availspace; - } + public BigDecimal availspace() { + return availspace; + } - public BigDecimal readthroughput() { - return readthroughput; - } + public BigDecimal readthroughput() { + return readthroughput; + } - public BigDecimal writethroughput() { - return writethroughput; - } + public BigDecimal writethroughput() { + return writethroughput; + } - public BigDecimal readlatency() { - return readlatency; - } + public BigDecimal readlatency() { + return readlatency; + } - public BigDecimal writelatency() { - return writelatency; - } + public BigDecimal writelatency() { + return writelatency; + } - public BigDecimal utilization() { - return utilization; - } + public BigDecimal utilization() { + return utilization; + } - public DiskMetrics metrics() { - return metrics; - } + public DiskMetrics metrics() { + return metrics; + } - public HealingDisk healInfo() { - return healInfo; - } + public HealingDisk healInfo() { + return healInfo; + } - public BigDecimal usedInodes() { - return usedInodes; - } + public BigDecimal usedInodes() { + return usedInodes; + } - public BigDecimal freeInodes() { - return freeInodes; - } + public BigDecimal freeInodes() { + return freeInodes; + } - public Integer poolIndex() { - return poolIndex; - } + public Integer poolIndex() { + return poolIndex; + } - public Integer setIndex() { - return setIndex; - } + public Integer setIndex() { + return setIndex; + } - public Integer diskIndex() { - return diskIndex; - } + 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/info/DiskMetrics.java index 0960e7ded..3c7dbe464 100644 --- a/adminapi/src/main/java/io/minio/admin/info/DiskMetrics.java +++ b/adminapi/src/main/java/io/minio/admin/info/DiskMetrics.java @@ -17,7 +17,6 @@ package io.minio.admin.info; import com.fasterxml.jackson.annotation.JsonProperty; - import java.util.Collections; import java.util.Map; @@ -29,17 +28,17 @@ */ 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/info/ErasureBackend.java b/adminapi/src/main/java/io/minio/admin/info/ErasureBackend.java index c72942548..1fbd4c0ac 100644 --- a/adminapi/src/main/java/io/minio/admin/info/ErasureBackend.java +++ b/adminapi/src/main/java/io/minio/admin/info/ErasureBackend.java @@ -19,7 +19,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; - import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -33,52 +32,53 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class ErasureBackend { - @JsonProperty("backendType") - private String backendType; + @JsonProperty("backendType") + private String backendType; - @JsonProperty("onlineDisks") - private Integer onlineDisks; + @JsonProperty("onlineDisks") + private Integer onlineDisks; - @JsonProperty("offlineDisks") - private Integer offlineDisks; + @JsonProperty("offlineDisks") + private Integer offlineDisks; - @JsonProperty("standardSCParity") - private Integer standardSCParity; + @JsonProperty("standardSCParity") + private Integer standardSCParity; - @JsonProperty("rrSCParity") - private Integer rrSCParity; + @JsonProperty("rrSCParity") + private Integer rrSCParity; - @JsonProperty("totalSets") - private List totalSets; + @JsonProperty("totalSets") + private List totalSets; - @JsonProperty("totalDrivesPerSet") - private List totalDrivesPerSet; + @JsonProperty("totalDrivesPerSet") + private List totalDrivesPerSet; - public String backendType() { - return backendType; - } + public String backendType() { + return backendType; + } - public Integer onlineDisks() { - return onlineDisks; - } + public Integer onlineDisks() { + return onlineDisks; + } - public Integer offlineDisks() { - return offlineDisks; - } + public Integer offlineDisks() { + return offlineDisks; + } - public Integer standardSCParity() { - return standardSCParity; - } + public Integer standardSCParity() { + return standardSCParity; + } - public Integer rrSCParity() { - return rrSCParity; - } + public Integer rrSCParity() { + return rrSCParity; + } - public List totalSets() { - return Collections.unmodifiableList(totalSets == null ? new LinkedList<>() : totalSets); - } + public List totalSets() { + return Collections.unmodifiableList(totalSets == null ? new LinkedList<>() : totalSets); + } - public List totalDrivesPerSet() { - return Collections.unmodifiableList(totalDrivesPerSet == null ? new LinkedList<>() : totalDrivesPerSet); - } + 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 index f34d07f60..2b288291b 100644 --- a/adminapi/src/main/java/io/minio/admin/info/ErasureSetInfo.java +++ b/adminapi/src/main/java/io/minio/admin/info/ErasureSetInfo.java @@ -19,7 +19,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; - import java.math.BigDecimal; /** @@ -31,52 +30,52 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class ErasureSetInfo { - @JsonProperty("id") - private Integer id; + @JsonProperty("id") + private Integer id; - @JsonProperty("rawUsage") - private BigDecimal rawUsage; + @JsonProperty("rawUsage") + private BigDecimal rawUsage; - @JsonProperty("rawCapacity") - private BigDecimal rawCapacity; + @JsonProperty("rawCapacity") + private BigDecimal rawCapacity; - @JsonProperty("usage") - private BigDecimal usage; + @JsonProperty("usage") + private BigDecimal usage; - @JsonProperty("objectsCount") - private BigDecimal objectsCount; + @JsonProperty("objectsCount") + private BigDecimal objectsCount; - @JsonProperty("versionsCount") - private BigDecimal versionsCount; + @JsonProperty("versionsCount") + private BigDecimal versionsCount; - @JsonProperty("healDisks") - private Integer healDisks; + @JsonProperty("healDisks") + private Integer healDisks; - public Integer id() { - return id; - } + public Integer id() { + return id; + } - public BigDecimal rawUsage() { - return rawUsage; - } + public BigDecimal rawUsage() { + return rawUsage; + } - public BigDecimal rawCapacity() { - return rawCapacity; - } + public BigDecimal rawCapacity() { + return rawCapacity; + } - public BigDecimal usage() { - return usage; - } + public BigDecimal usage() { + return usage; + } - public BigDecimal objectsCount() { - return objectsCount; - } + public BigDecimal objectsCount() { + return objectsCount; + } - public BigDecimal versionsCount() { - return versionsCount; - } + public BigDecimal versionsCount() { + return versionsCount; + } - public Integer healDisks() { - return healDisks; - } + 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/info/GCStats.java index fe1c4230c..2f818e62d 100644 --- a/adminapi/src/main/java/io/minio/admin/info/GCStats.java +++ b/adminapi/src/main/java/io/minio/admin/info/GCStats.java @@ -18,7 +18,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; - import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -26,44 +25,43 @@ /** * 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/info/HealingDisk.java b/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java index 4f65c3367..32c7a9fa1 100644 --- a/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java +++ b/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java @@ -19,7 +19,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; - import java.math.BigDecimal; import java.util.Collections; import java.util.LinkedList; @@ -34,150 +33,150 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class HealingDisk { - @JsonProperty("id") - private String id; + @JsonProperty("id") + private String id; - @JsonProperty("heal_id") - private String healID; + @JsonProperty("heal_id") + private String healID; - @JsonProperty("pool_index") - private Integer poolIndex; + @JsonProperty("pool_index") + private Integer poolIndex; - @JsonProperty("set_index") - private Integer setIndex; + @JsonProperty("set_index") + private Integer setIndex; - @JsonProperty("disk_index") - private Integer diskIndex; + @JsonProperty("disk_index") + private Integer diskIndex; - @JsonProperty("endpoint") - private String endpoint; + @JsonProperty("endpoint") + private String endpoint; - @JsonProperty("path") - private String path; + @JsonProperty("path") + private String path; - @JsonProperty("started") - private String started; + @JsonProperty("started") + private String started; - @JsonProperty("last_update") - private String lastUpdate; + @JsonProperty("last_update") + private String lastUpdate; - @JsonProperty("objects_total_count") - private BigDecimal objectsTotalCount; + @JsonProperty("objects_total_count") + private BigDecimal objectsTotalCount; - @JsonProperty("objects_total_size") - private BigDecimal objectsTotalSize; + @JsonProperty("objects_total_size") + private BigDecimal objectsTotalSize; - @JsonProperty("items_healed") - private BigDecimal itemsHealed; + @JsonProperty("items_healed") + private BigDecimal itemsHealed; - @JsonProperty("items_failed") - private BigDecimal itemsFailed; + @JsonProperty("items_failed") + private BigDecimal itemsFailed; - @JsonProperty("bytes_done") - private BigDecimal bytesDone; + @JsonProperty("bytes_done") + private BigDecimal bytesDone; - @JsonProperty("bytes_failed") - private BigDecimal bytesFailed; + @JsonProperty("bytes_failed") + private BigDecimal bytesFailed; - @JsonProperty("objects_healed") - private BigDecimal objectsHealed; + @JsonProperty("objects_healed") + private BigDecimal objectsHealed; - @JsonProperty("objects_failed") - private BigDecimal objectsFailed; + @JsonProperty("objects_failed") + private BigDecimal objectsFailed; - @JsonProperty("current_bucket") - private String bucket; + @JsonProperty("current_bucket") + private String bucket; - @JsonProperty("current_object") - private String object; + @JsonProperty("current_object") + private String object; - @JsonProperty("queued_buckets") - private List queuedBuckets; + @JsonProperty("queued_buckets") + private List queuedBuckets; - @JsonProperty("healed_buckets") - private List HealedBuckets; + @JsonProperty("healed_buckets") + private List HealedBuckets; - public String id() { - return id; - } + public String id() { + return id; + } - public String healID() { - return healID; - } + public String healID() { + return healID; + } - public Integer poolIndex() { - return poolIndex; - } + public Integer poolIndex() { + return poolIndex; + } - public Integer setIndex() { - return setIndex; - } + public Integer setIndex() { + return setIndex; + } - public Integer diskIndex() { - return diskIndex; - } + public Integer diskIndex() { + return diskIndex; + } - public String endpoint() { - return endpoint; - } + public String endpoint() { + return endpoint; + } - public String path() { - return path; - } + public String path() { + return path; + } - public String started() { - return started; - } + public String started() { + return started; + } - public String lastUpdate() { - return lastUpdate; - } + public String lastUpdate() { + return lastUpdate; + } - public BigDecimal objectsTotalCount() { - return objectsTotalCount; - } + public BigDecimal objectsTotalCount() { + return objectsTotalCount; + } - public BigDecimal objectsTotalSize() { - return objectsTotalSize; - } + public BigDecimal objectsTotalSize() { + return objectsTotalSize; + } - public BigDecimal itemsHealed() { - return itemsHealed; - } + public BigDecimal itemsHealed() { + return itemsHealed; + } - public BigDecimal itemsFailed() { - return itemsFailed; - } + public BigDecimal itemsFailed() { + return itemsFailed; + } - public BigDecimal bytesDone() { - return bytesDone; - } + public BigDecimal bytesDone() { + return bytesDone; + } - public BigDecimal bytesFailed() { - return bytesFailed; - } + public BigDecimal bytesFailed() { + return bytesFailed; + } - public BigDecimal objectsHealed() { - return objectsHealed; - } + public BigDecimal objectsHealed() { + return objectsHealed; + } - public BigDecimal objectsFailed() { - return objectsFailed; - } + public BigDecimal objectsFailed() { + return objectsFailed; + } - public String bucket() { - return bucket; - } + public String bucket() { + return bucket; + } - public String object() { - return object; - } + public String object() { + return object; + } - public List queuedBuckets() { - return Collections.unmodifiableList(queuedBuckets == null ? new LinkedList<>() : queuedBuckets); - } + public List queuedBuckets() { + return Collections.unmodifiableList(queuedBuckets == null ? new LinkedList<>() : queuedBuckets); + } - public List healedBuckets() { - return Collections.unmodifiableList(HealedBuckets == null ? new LinkedList<>() : HealedBuckets); - } + 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 index 5797a197e..fcc6a3096 100644 --- a/adminapi/src/main/java/io/minio/admin/info/InfoMessage.java +++ b/adminapi/src/main/java/io/minio/admin/info/InfoMessage.java @@ -18,7 +18,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; - import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -33,66 +32,66 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class InfoMessage { - @JsonProperty("mode") - private String mode; + @JsonProperty("mode") + private String mode; - @JsonProperty("deploymentID") - private String deploymentID; + @JsonProperty("deploymentID") + private String deploymentID; - @JsonProperty("buckets") - private Buckets buckets; + @JsonProperty("buckets") + private Buckets buckets; - @JsonProperty("objects") - private Objects objects; + @JsonProperty("objects") + private Objects objects; - @JsonProperty("versions") - private Versions versions; + @JsonProperty("versions") + private Versions versions; - @JsonProperty("usage") - private Usage usage; + @JsonProperty("usage") + private Usage usage; - @JsonProperty("backend") - private ErasureBackend backend; + @JsonProperty("backend") + private ErasureBackend backend; - @JsonProperty("servers") - private List servers; + @JsonProperty("servers") + private List servers; - @JsonProperty("pools") - private Map> erasureSetInfo; + @JsonProperty("pools") + private Map> erasureSetInfo; - public String mode() { - return mode; - } + public String mode() { + return mode; + } - public String deploymentID() { - return deploymentID; - } + public String deploymentID() { + return deploymentID; + } - public Buckets buckets() { - return buckets; - } + public Buckets buckets() { + return buckets; + } - public Objects objects() { - return objects; - } + public Objects objects() { + return objects; + } - public Versions versions() { - return versions; - } + public Versions versions() { + return versions; + } - public Usage usage() { - return usage; - } + public Usage usage() { + return usage; + } - public ErasureBackend backend() { - return backend; - } + public ErasureBackend backend() { + return backend; + } - public List servers() { - return Collections.unmodifiableList(servers == null ? new LinkedList<>() : servers); - } + public List servers() { + return Collections.unmodifiableList(servers == null ? new LinkedList<>() : servers); + } - public Map> erasureSetInfo() { - return erasureSetInfo; - } + 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/info/MemStats.java index f1fa4df56..22c09e6ae 100644 --- a/adminapi/src/main/java/io/minio/admin/info/MemStats.java +++ b/adminapi/src/main/java/io/minio/admin/info/MemStats.java @@ -18,51 +18,48 @@ 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. * - * @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/info/Objects.java index a5f852d85..5c8ebc1f5 100644 --- a/adminapi/src/main/java/io/minio/admin/info/Objects.java +++ b/adminapi/src/main/java/io/minio/admin/info/Objects.java @@ -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/info/ServerProperties.java b/adminapi/src/main/java/io/minio/admin/info/ServerProperties.java index c0c724652..caa37613e 100644 --- a/adminapi/src/main/java/io/minio/admin/info/ServerProperties.java +++ b/adminapi/src/main/java/io/minio/admin/info/ServerProperties.java @@ -19,7 +19,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; - import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -28,114 +27,113 @@ /** * ServerProperties holds server information * - * @see info-commands.go + * @see info-commands.go */ @JsonIgnoreProperties(ignoreUnknown = true) public class ServerProperties { - @JsonProperty("state") - private String state; + @JsonProperty("state") + private String state; - @JsonProperty("endpoint") - private String endpoint; + @JsonProperty("endpoint") + private String endpoint; - @JsonProperty("scheme") - private String scheme; + @JsonProperty("scheme") + private String scheme; - @JsonProperty("uptime") - private Integer uptime; + @JsonProperty("uptime") + private Integer uptime; - @JsonProperty("version") - private String version; + @JsonProperty("version") + private String version; - @JsonProperty("commitID") - private String commitID; + @JsonProperty("commitID") + private String commitID; - @JsonProperty("network") - private Map network; + @JsonProperty("network") + private Map network; - @JsonProperty("drives") - private List disks; + @JsonProperty("drives") + private List disks; - @JsonProperty("poolNumber") - private Integer poolNumber; + @JsonProperty("poolNumber") + private Integer poolNumber; - @JsonProperty("mem_stats") - private MemStats memStats; + @JsonProperty("mem_stats") + private MemStats memStats; - @JsonProperty("go_max_procs") - private Integer goMaxProcs; + @JsonProperty("go_max_procs") + private Integer goMaxProcs; - @JsonProperty("num_cpu") - private Integer numCPU; + @JsonProperty("num_cpu") + private Integer numCPU; - @JsonProperty("runtime_version") - private String runtimeVersion; + @JsonProperty("runtime_version") + private String runtimeVersion; - @JsonProperty("gc_stats") - private GCStats gCStats; + @JsonProperty("gc_stats") + private GCStats gCStats; - @JsonProperty("minio_env_vars") - private Map minioEnvVars; + @JsonProperty("minio_env_vars") + private Map minioEnvVars; - public String state() { - return state; - } + public String state() { + return state; + } - public String endpoint() { - return endpoint; - } + public String endpoint() { + return endpoint; + } - public String scheme() { - return scheme; - } + public String scheme() { + return scheme; + } - public Integer uptime() { - return uptime; - } + public Integer uptime() { + return uptime; + } - public String version() { - return version; - } + public String version() { + return version; + } - public String commitID() { - return commitID; - } + public String commitID() { + return commitID; + } - public Map network() { - return Collections.unmodifiableMap(this.network); - } + public Map network() { + return Collections.unmodifiableMap(this.network); + } - public List disks() { - return Collections.unmodifiableList(disks == null ? new LinkedList<>() : disks); - } + public List disks() { + return Collections.unmodifiableList(disks == null ? new LinkedList<>() : disks); + } - public Integer poolNumber() { - return poolNumber; - } + public Integer poolNumber() { + return poolNumber; + } - public MemStats memStats() { - return memStats; - } + public MemStats memStats() { + return memStats; + } - public Integer goMaxProcs() { - return goMaxProcs; - } + public Integer goMaxProcs() { + return goMaxProcs; + } - public Integer numCPU() { - return numCPU; - } + public Integer numCPU() { + return numCPU; + } - public String runtimeVersion() { - return runtimeVersion; - } + public String runtimeVersion() { + return runtimeVersion; + } - public GCStats gCStats() { - return gCStats; - } + public GCStats gCStats() { + return gCStats; + } - public Map minioEnvVars() { - return Collections.unmodifiableMap(this.minioEnvVars); - } + 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/info/TimedAction.java index ca3d7a276..722e1bacc 100644 --- a/adminapi/src/main/java/io/minio/admin/info/TimedAction.java +++ b/adminapi/src/main/java/io/minio/admin/info/TimedAction.java @@ -18,35 +18,33 @@ 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. * - * @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 75f8ca776..a37e43d42 100644 --- a/adminapi/src/main/java/io/minio/admin/info/Usage.java +++ b/adminapi/src/main/java/io/minio/admin/info/Usage.java @@ -23,23 +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 649494bc3..687355566 100644 --- a/adminapi/src/main/java/io/minio/admin/info/Versions.java +++ b/adminapi/src/main/java/io/minio/admin/info/Versions.java @@ -23,23 +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 ce4578b69b3eac8bdfd86cbd65ee44eb23b5a547 Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Tue, 4 Jul 2023 12:37:17 +0800 Subject: [PATCH 06/22] fix ci --- adminapi/src/main/java/io/minio/admin/MinioAdminClient.java | 1 - adminapi/src/main/java/io/minio/admin/info/HealingDisk.java | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index 0fcf9b749..e1a5e22d4 100644 --- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java +++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java @@ -220,7 +220,6 @@ public InfoMessage getAdminInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException { try (Response response = execute(Method.GET, Command.ADMIN_INFO, null, null)) { byte[] jsonData = response.body().bytes(); - System.out.println(new String(jsonData)); return OBJECT_MAPPER.readValue(jsonData, InfoMessage.class); } } diff --git a/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java b/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java index 32c7a9fa1..0d7e3c664 100644 --- a/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java +++ b/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java @@ -94,7 +94,7 @@ public class HealingDisk { private List queuedBuckets; @JsonProperty("healed_buckets") - private List HealedBuckets; + private List healedBuckets; public String id() { return id; @@ -177,6 +177,6 @@ public List queuedBuckets() { } public List healedBuckets() { - return Collections.unmodifiableList(HealedBuckets == null ? new LinkedList<>() : HealedBuckets); + return Collections.unmodifiableList(healedBuckets == null ? new LinkedList<>() : healedBuckets); } } From 5bdb6e4e089def782a4442b64dfd5470bca2b80c Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Tue, 4 Jul 2023 14:17:40 +0800 Subject: [PATCH 07/22] fix ci --- .../java/io/minio/admin/info/Buckets.java | 25 +- .../main/java/io/minio/admin/info/Disk.java | 254 +++++++++--------- .../java/io/minio/admin/info/DiskMetrics.java | 26 +- .../io/minio/admin/info/ErasureBackend.java | 76 +++--- .../io/minio/admin/info/ErasureSetInfo.java | 75 +++--- .../java/io/minio/admin/info/GCStats.java | 56 ++-- .../java/io/minio/admin/info/HealingDisk.java | 215 +++++++-------- .../java/io/minio/admin/info/InfoMessage.java | 96 +++---- .../java/io/minio/admin/info/MemStats.java | 59 ++-- .../java/io/minio/admin/info/Objects.java | 23 +- .../io/minio/admin/info/ServerProperties.java | 155 +++++------ .../java/io/minio/admin/info/TimedAction.java | 38 +-- .../main/java/io/minio/admin/info/Usage.java | 24 +- .../java/io/minio/admin/info/Versions.java | 24 +- 14 files changed, 583 insertions(+), 563 deletions(-) diff --git a/adminapi/src/main/java/io/minio/admin/info/Buckets.java b/adminapi/src/main/java/io/minio/admin/info/Buckets.java index f812eaf50..d93366eaa 100644 --- a/adminapi/src/main/java/io/minio/admin/info/Buckets.java +++ b/adminapi/src/main/java/io/minio/admin/info/Buckets.java @@ -14,6 +14,7 @@ * 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; @@ -23,22 +24,22 @@ * Buckets contains the number of buckets * * @see info-commands.go + * href= + * "https://github.com/minio/madmin-go/blob/main/info-commands.go#L286">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/info/Disk.java b/adminapi/src/main/java/io/minio/admin/info/Disk.java index f77cefddc..0726b35d7 100644 --- a/adminapi/src/main/java/io/minio/admin/info/Disk.java +++ b/adminapi/src/main/java/io/minio/admin/info/Disk.java @@ -19,188 +19,190 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; + import java.math.BigDecimal; /** * Disk holds Disk information * * @see info-commands.go + * href= + * "https://github.com/minio/madmin-go/blob/main/info-commands.go#L404">info-commands.go */ @JsonIgnoreProperties(ignoreUnknown = true) public class Disk { - @JsonProperty("endpoint") - private String endpoint; + @JsonProperty("endpoint") + private String endpoint; - @JsonProperty("rootDisk") - private boolean rootDisk; + @JsonProperty("rootDisk") + private boolean rootDisk; - @JsonProperty("path") - private String path; + @JsonProperty("path") + private String path; - @JsonProperty("healing") - private boolean healing; + @JsonProperty("healing") + private boolean healing; - @JsonProperty("scanning") - private boolean scanning; + @JsonProperty("scanning") + private boolean scanning; - @JsonProperty("state") - private String state; + @JsonProperty("state") + private String state; - @JsonProperty("uuid") - private String uuid; + @JsonProperty("uuid") + private String uuid; - @JsonProperty("major") - private BigDecimal major; + @JsonProperty("major") + private BigDecimal major; - @JsonProperty("minor") - private BigDecimal minor; + @JsonProperty("minor") + private BigDecimal minor; - @JsonProperty("model") - private String model; + @JsonProperty("model") + private String model; - @JsonProperty("totalspace") - private BigDecimal totalspace; + @JsonProperty("totalspace") + private BigDecimal totalspace; - @JsonProperty("usedspace") - private BigDecimal usedspace; + @JsonProperty("usedspace") + private BigDecimal usedspace; - @JsonProperty("availspace") - private BigDecimal availspace; + @JsonProperty("availspace") + private BigDecimal availspace; - @JsonProperty("readthroughput") - private BigDecimal readthroughput; + @JsonProperty("readthroughput") + private BigDecimal readthroughput; - @JsonProperty("writethroughput") - private BigDecimal writethroughput; + @JsonProperty("writethroughput") + private BigDecimal writethroughput; - @JsonProperty("readlatency") - private BigDecimal readlatency; + @JsonProperty("readlatency") + private BigDecimal readlatency; - @JsonProperty("writelatency") - private BigDecimal writelatency; + @JsonProperty("writelatency") + private BigDecimal writelatency; - @JsonProperty("utilization") - private BigDecimal utilization; + @JsonProperty("utilization") + private BigDecimal utilization; - @JsonProperty("metrics") - private DiskMetrics metrics; + @JsonProperty("metrics") + private DiskMetrics metrics; - @JsonProperty("heal_info") - private HealingDisk healInfo; + @JsonProperty("heal_info") + private HealingDisk healInfo; - @JsonProperty("used_inodes") - private BigDecimal usedInodes; + @JsonProperty("used_inodes") + private BigDecimal usedInodes; - @JsonProperty("free_inodes") - private BigDecimal freeInodes; + @JsonProperty("free_inodes") + private BigDecimal freeInodes; - @JsonProperty("pool_index") - private Integer poolIndex; + @JsonProperty("pool_index") + private Integer poolIndex; - @JsonProperty("set_index") - private Integer setIndex; + @JsonProperty("set_index") + private Integer setIndex; - @JsonProperty("disk_index") - private Integer diskIndex; + @JsonProperty("disk_index") + private Integer diskIndex; - public String endpoint() { - return endpoint; - } + public String endpoint() { + return endpoint; + } - public boolean isRootDisk() { - return rootDisk; - } + public boolean isRootDisk() { + return rootDisk; + } - public String path() { - return path; - } + public String path() { + return path; + } - public boolean isHealing() { - return healing; - } + public boolean isHealing() { + return healing; + } - public boolean isScanning() { - return scanning; - } + public boolean isScanning() { + return scanning; + } - public String state() { - return state; - } + public String state() { + return state; + } - public String uuid() { - return uuid; - } + public String uuid() { + return uuid; + } - public BigDecimal major() { - return major; - } + public BigDecimal major() { + return major; + } - public BigDecimal minor() { - return minor; - } + public BigDecimal minor() { + return minor; + } - public String model() { - return model; - } + public String model() { + return model; + } - public BigDecimal totalspace() { - return totalspace; - } + public BigDecimal totalspace() { + return totalspace; + } - public BigDecimal usedspace() { - return usedspace; - } + public BigDecimal usedspace() { + return usedspace; + } - public BigDecimal availspace() { - return availspace; - } + public BigDecimal availspace() { + return availspace; + } - public BigDecimal readthroughput() { - return readthroughput; - } + public BigDecimal readthroughput() { + return readthroughput; + } - public BigDecimal writethroughput() { - return writethroughput; - } + public BigDecimal writethroughput() { + return writethroughput; + } - public BigDecimal readlatency() { - return readlatency; - } + public BigDecimal readlatency() { + return readlatency; + } - public BigDecimal writelatency() { - return writelatency; - } + public BigDecimal writelatency() { + return writelatency; + } - public BigDecimal utilization() { - return utilization; - } + public BigDecimal utilization() { + return utilization; + } - public DiskMetrics metrics() { - return metrics; - } + public DiskMetrics metrics() { + return metrics; + } - public HealingDisk healInfo() { - return healInfo; - } + public HealingDisk healInfo() { + return healInfo; + } - public BigDecimal usedInodes() { - return usedInodes; - } + public BigDecimal usedInodes() { + return usedInodes; + } - public BigDecimal freeInodes() { - return freeInodes; - } + public BigDecimal freeInodes() { + return freeInodes; + } - public Integer poolIndex() { - return poolIndex; - } + public Integer poolIndex() { + return poolIndex; + } - public Integer setIndex() { - return setIndex; - } + public Integer setIndex() { + return setIndex; + } - public Integer diskIndex() { - return diskIndex; - } + 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/info/DiskMetrics.java index 3c7dbe464..564c524b4 100644 --- a/adminapi/src/main/java/io/minio/admin/info/DiskMetrics.java +++ b/adminapi/src/main/java/io/minio/admin/info/DiskMetrics.java @@ -14,9 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package io.minio.admin.info; import com.fasterxml.jackson.annotation.JsonProperty; + import java.util.Collections; import java.util.Map; @@ -24,21 +26,21 @@ * DiskMetrics has the information about XL Storage APIs * * @see info-commands.go + * href= + * "https://github.com/minio/madmin-go/blob/main/info-commands.go#L395">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/info/ErasureBackend.java b/adminapi/src/main/java/io/minio/admin/info/ErasureBackend.java index 1fbd4c0ac..05b1577ef 100644 --- a/adminapi/src/main/java/io/minio/admin/info/ErasureBackend.java +++ b/adminapi/src/main/java/io/minio/admin/info/ErasureBackend.java @@ -19,6 +19,7 @@ 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,58 +28,57 @@ * ErasureBackend contains specific erasure storage information * * @see info-commands.go + * href= + * "https://github.com/minio/madmin-go/blob/main/info-commands.go#L359">info-commands.go */ @JsonIgnoreProperties(ignoreUnknown = true) public class ErasureBackend { + @JsonProperty("backendType") + private String backendType; - @JsonProperty("backendType") - private String backendType; - - @JsonProperty("onlineDisks") - private Integer onlineDisks; + @JsonProperty("onlineDisks") + private Integer onlineDisks; - @JsonProperty("offlineDisks") - private Integer offlineDisks; + @JsonProperty("offlineDisks") + private Integer offlineDisks; - @JsonProperty("standardSCParity") - private Integer standardSCParity; + @JsonProperty("standardSCParity") + private Integer standardSCParity; - @JsonProperty("rrSCParity") - private Integer rrSCParity; + @JsonProperty("rrSCParity") + private Integer rrSCParity; - @JsonProperty("totalSets") - private List totalSets; + @JsonProperty("totalSets") + private List totalSets; - @JsonProperty("totalDrivesPerSet") - private List totalDrivesPerSet; + @JsonProperty("totalDrivesPerSet") + private List totalDrivesPerSet; - public String backendType() { - return backendType; - } + public String backendType() { + return backendType; + } - public Integer onlineDisks() { - return onlineDisks; - } + public Integer onlineDisks() { + return onlineDisks; + } - public Integer offlineDisks() { - return offlineDisks; - } + public Integer offlineDisks() { + return offlineDisks; + } - public Integer standardSCParity() { - return standardSCParity; - } + public Integer standardSCParity() { + return standardSCParity; + } - public Integer rrSCParity() { - return rrSCParity; - } + public Integer rrSCParity() { + return rrSCParity; + } - public List totalSets() { - return Collections.unmodifiableList(totalSets == null ? new LinkedList<>() : totalSets); - } + public List totalSets() { + return Collections.unmodifiableList(totalSets == null ? new LinkedList<>() : totalSets); + } - public List totalDrivesPerSet() { - return Collections.unmodifiableList( - totalDrivesPerSet == null ? new LinkedList<>() : totalDrivesPerSet); - } + 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 index 2b288291b..ebb69aa22 100644 --- a/adminapi/src/main/java/io/minio/admin/info/ErasureSetInfo.java +++ b/adminapi/src/main/java/io/minio/admin/info/ErasureSetInfo.java @@ -19,63 +19,64 @@ 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 + * href= + * "https://github.com/minio/madmin-go/blob/main/info-commands.go#L227">info-commands.go */ @JsonIgnoreProperties(ignoreUnknown = true) public class ErasureSetInfo { + @JsonProperty("id") + private Integer id; - @JsonProperty("id") - private Integer id; - - @JsonProperty("rawUsage") - private BigDecimal rawUsage; + @JsonProperty("rawUsage") + private BigDecimal rawUsage; - @JsonProperty("rawCapacity") - private BigDecimal rawCapacity; + @JsonProperty("rawCapacity") + private BigDecimal rawCapacity; - @JsonProperty("usage") - private BigDecimal usage; + @JsonProperty("usage") + private BigDecimal usage; - @JsonProperty("objectsCount") - private BigDecimal objectsCount; + @JsonProperty("objectsCount") + private BigDecimal objectsCount; - @JsonProperty("versionsCount") - private BigDecimal versionsCount; + @JsonProperty("versionsCount") + private BigDecimal versionsCount; - @JsonProperty("healDisks") - private Integer healDisks; + @JsonProperty("healDisks") + private Integer healDisks; - public Integer id() { - return id; - } + public Integer id() { + return id; + } - public BigDecimal rawUsage() { - return rawUsage; - } + public BigDecimal rawUsage() { + return rawUsage; + } - public BigDecimal rawCapacity() { - return rawCapacity; - } + public BigDecimal rawCapacity() { + return rawCapacity; + } - public BigDecimal usage() { - return usage; - } + public BigDecimal usage() { + return usage; + } - public BigDecimal objectsCount() { - return objectsCount; - } + public BigDecimal objectsCount() { + return objectsCount; + } - public BigDecimal versionsCount() { - return versionsCount; - } + public BigDecimal versionsCount() { + return versionsCount; + } - public Integer healDisks() { - return healDisks; - } + 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/info/GCStats.java index 2f818e62d..3869b9fbe 100644 --- a/adminapi/src/main/java/io/minio/admin/info/GCStats.java +++ b/adminapi/src/main/java/io/minio/admin/info/GCStats.java @@ -14,10 +14,12 @@ * 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; @@ -25,43 +27,43 @@ /** * 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/info/HealingDisk.java b/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java index 0d7e3c664..6bcb439e2 100644 --- a/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java +++ b/adminapi/src/main/java/io/minio/admin/info/HealingDisk.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; + import java.math.BigDecimal; import java.util.Collections; import java.util.LinkedList; @@ -28,155 +29,155 @@ * HealingDisk contains information about * * @see heal-commands.go + * href= + * "https://github.com/minio/madmin-go/blob/main/heal-commands.go#L344">heal-commands.go */ @JsonIgnoreProperties(ignoreUnknown = true) public class HealingDisk { + @JsonProperty("id") + private String id; - @JsonProperty("id") - private String id; - - @JsonProperty("heal_id") - private String healID; + @JsonProperty("heal_id") + private String healID; - @JsonProperty("pool_index") - private Integer poolIndex; + @JsonProperty("pool_index") + private Integer poolIndex; - @JsonProperty("set_index") - private Integer setIndex; + @JsonProperty("set_index") + private Integer setIndex; - @JsonProperty("disk_index") - private Integer diskIndex; + @JsonProperty("disk_index") + private Integer diskIndex; - @JsonProperty("endpoint") - private String endpoint; + @JsonProperty("endpoint") + private String endpoint; - @JsonProperty("path") - private String path; + @JsonProperty("path") + private String path; - @JsonProperty("started") - private String started; + @JsonProperty("started") + private String started; - @JsonProperty("last_update") - private String lastUpdate; + @JsonProperty("last_update") + private String lastUpdate; - @JsonProperty("objects_total_count") - private BigDecimal objectsTotalCount; + @JsonProperty("objects_total_count") + private BigDecimal objectsTotalCount; - @JsonProperty("objects_total_size") - private BigDecimal objectsTotalSize; + @JsonProperty("objects_total_size") + private BigDecimal objectsTotalSize; - @JsonProperty("items_healed") - private BigDecimal itemsHealed; + @JsonProperty("items_healed") + private BigDecimal itemsHealed; - @JsonProperty("items_failed") - private BigDecimal itemsFailed; + @JsonProperty("items_failed") + private BigDecimal itemsFailed; - @JsonProperty("bytes_done") - private BigDecimal bytesDone; + @JsonProperty("bytes_done") + private BigDecimal bytesDone; - @JsonProperty("bytes_failed") - private BigDecimal bytesFailed; + @JsonProperty("bytes_failed") + private BigDecimal bytesFailed; - @JsonProperty("objects_healed") - private BigDecimal objectsHealed; + @JsonProperty("objects_healed") + private BigDecimal objectsHealed; - @JsonProperty("objects_failed") - private BigDecimal objectsFailed; + @JsonProperty("objects_failed") + private BigDecimal objectsFailed; - @JsonProperty("current_bucket") - private String bucket; + @JsonProperty("current_bucket") + private String bucket; - @JsonProperty("current_object") - private String object; + @JsonProperty("current_object") + private String object; - @JsonProperty("queued_buckets") - private List queuedBuckets; + @JsonProperty("queued_buckets") + private List queuedBuckets; - @JsonProperty("healed_buckets") - private List healedBuckets; + @JsonProperty("healed_buckets") + private List healedBuckets; - public String id() { - return id; - } + public String id() { + return id; + } - public String healID() { - return healID; - } + public String healID() { + return healID; + } - public Integer poolIndex() { - return poolIndex; - } + public Integer poolIndex() { + return poolIndex; + } - public Integer setIndex() { - return setIndex; - } + public Integer setIndex() { + return setIndex; + } - public Integer diskIndex() { - return diskIndex; - } + public Integer diskIndex() { + return diskIndex; + } - public String endpoint() { - return endpoint; - } + public String endpoint() { + return endpoint; + } - public String path() { - return path; - } + public String path() { + return path; + } - public String started() { - return started; - } + public String started() { + return started; + } - public String lastUpdate() { - return lastUpdate; - } + public String lastUpdate() { + return lastUpdate; + } - public BigDecimal objectsTotalCount() { - return objectsTotalCount; - } + public BigDecimal objectsTotalCount() { + return objectsTotalCount; + } - public BigDecimal objectsTotalSize() { - return objectsTotalSize; - } + public BigDecimal objectsTotalSize() { + return objectsTotalSize; + } - public BigDecimal itemsHealed() { - return itemsHealed; - } + public BigDecimal itemsHealed() { + return itemsHealed; + } - public BigDecimal itemsFailed() { - return itemsFailed; - } + public BigDecimal itemsFailed() { + return itemsFailed; + } - public BigDecimal bytesDone() { - return bytesDone; - } + public BigDecimal bytesDone() { + return bytesDone; + } - public BigDecimal bytesFailed() { - return bytesFailed; - } + public BigDecimal bytesFailed() { + return bytesFailed; + } - public BigDecimal objectsHealed() { - return objectsHealed; - } + public BigDecimal objectsHealed() { + return objectsHealed; + } - public BigDecimal objectsFailed() { - return objectsFailed; - } + public BigDecimal objectsFailed() { + return objectsFailed; + } - public String bucket() { - return bucket; - } + public String bucket() { + return bucket; + } - public String object() { - return object; - } + public String object() { + return object; + } - public List queuedBuckets() { - return Collections.unmodifiableList(queuedBuckets == null ? new LinkedList<>() : queuedBuckets); - } + public List queuedBuckets() { + return Collections.unmodifiableList(queuedBuckets == null ? new LinkedList<>() : queuedBuckets); + } - public List healedBuckets() { - return Collections.unmodifiableList(healedBuckets == null ? new LinkedList<>() : healedBuckets); - } + 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 index fcc6a3096..4e3a74fdf 100644 --- a/adminapi/src/main/java/io/minio/admin/info/InfoMessage.java +++ b/adminapi/src/main/java/io/minio/admin/info/InfoMessage.java @@ -14,10 +14,12 @@ * 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; @@ -27,71 +29,71 @@ * InfoMessage container to hold server admin related information. * * @see heal-commands.go + * href= + * "https://github.com/minio/madmin-go/blob/main/info-commands.go#L238">heal-commands.go */ @JsonIgnoreProperties(ignoreUnknown = true) public class InfoMessage { + @JsonProperty("mode") + private String mode; - @JsonProperty("mode") - private String mode; - - @JsonProperty("deploymentID") - private String deploymentID; + @JsonProperty("deploymentID") + private String deploymentID; - @JsonProperty("buckets") - private Buckets buckets; + @JsonProperty("buckets") + private Buckets buckets; - @JsonProperty("objects") - private Objects objects; + @JsonProperty("objects") + private Objects objects; - @JsonProperty("versions") - private Versions versions; + @JsonProperty("versions") + private Versions versions; - @JsonProperty("usage") - private Usage usage; + @JsonProperty("usage") + private Usage usage; - @JsonProperty("backend") - private ErasureBackend backend; + @JsonProperty("backend") + private ErasureBackend backend; - @JsonProperty("servers") - private List servers; + @JsonProperty("servers") + private List servers; - @JsonProperty("pools") - private Map> erasureSetInfo; + @JsonProperty("pools") + private Map> erasureSetInfo; - public String mode() { - return mode; - } + public String mode() { + return mode; + } - public String deploymentID() { - return deploymentID; - } + public String deploymentID() { + return deploymentID; + } - public Buckets buckets() { - return buckets; - } + public Buckets buckets() { + return buckets; + } - public Objects objects() { - return objects; - } + public Objects objects() { + return objects; + } - public Versions versions() { - return versions; - } + public Versions versions() { + return versions; + } - public Usage usage() { - return usage; - } + public Usage usage() { + return usage; + } - public ErasureBackend backend() { - return backend; - } + public ErasureBackend backend() { + return backend; + } - public List servers() { - return Collections.unmodifiableList(servers == null ? new LinkedList<>() : servers); - } + public List servers() { + return Collections.unmodifiableList(servers == null ? new LinkedList<>() : servers); + } - public Map> erasureSetInfo() { - return erasureSetInfo; - } + 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/info/MemStats.java index 22c09e6ae..61419c377 100644 --- a/adminapi/src/main/java/io/minio/admin/info/MemStats.java +++ b/adminapi/src/main/java/io/minio/admin/info/MemStats.java @@ -14,52 +14,55 @@ * 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; /** - * 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/info/Objects.java index 5c8ebc1f5..7b8a0427d 100644 --- a/adminapi/src/main/java/io/minio/admin/info/Objects.java +++ b/adminapi/src/main/java/io/minio/admin/info/Objects.java @@ -23,21 +23,22 @@ /** * 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/info/ServerProperties.java b/adminapi/src/main/java/io/minio/admin/info/ServerProperties.java index caa37613e..161ae45a3 100644 --- a/adminapi/src/main/java/io/minio/admin/info/ServerProperties.java +++ b/adminapi/src/main/java/io/minio/admin/info/ServerProperties.java @@ -19,6 +19,7 @@ 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,113 +28,113 @@ /** * ServerProperties holds server information * - * @see info-commands.go + * @see info-commands.go */ @JsonIgnoreProperties(ignoreUnknown = true) public class ServerProperties { + @JsonProperty("state") + private String state; - @JsonProperty("state") - private String state; - - @JsonProperty("endpoint") - private String endpoint; + @JsonProperty("endpoint") + private String endpoint; - @JsonProperty("scheme") - private String scheme; + @JsonProperty("scheme") + private String scheme; - @JsonProperty("uptime") - private Integer uptime; + @JsonProperty("uptime") + private Integer uptime; - @JsonProperty("version") - private String version; + @JsonProperty("version") + private String version; - @JsonProperty("commitID") - private String commitID; + @JsonProperty("commitID") + private String commitID; - @JsonProperty("network") - private Map network; + @JsonProperty("network") + private Map network; - @JsonProperty("drives") - private List disks; + @JsonProperty("drives") + private List disks; - @JsonProperty("poolNumber") - private Integer poolNumber; + @JsonProperty("poolNumber") + private Integer poolNumber; - @JsonProperty("mem_stats") - private MemStats memStats; + @JsonProperty("mem_stats") + private MemStats memStats; - @JsonProperty("go_max_procs") - private Integer goMaxProcs; + @JsonProperty("go_max_procs") + private Integer goMaxProcs; - @JsonProperty("num_cpu") - private Integer numCPU; + @JsonProperty("num_cpu") + private Integer numCPU; - @JsonProperty("runtime_version") - private String runtimeVersion; + @JsonProperty("runtime_version") + private String runtimeVersion; - @JsonProperty("gc_stats") - private GCStats gCStats; + @JsonProperty("gc_stats") + private GCStats gCStats; - @JsonProperty("minio_env_vars") - private Map minioEnvVars; + @JsonProperty("minio_env_vars") + private Map minioEnvVars; - public String state() { - return state; - } + public String state() { + return state; + } - public String endpoint() { - return endpoint; - } + public String endpoint() { + return endpoint; + } - public String scheme() { - return scheme; - } + public String scheme() { + return scheme; + } - public Integer uptime() { - return uptime; - } + public Integer uptime() { + return uptime; + } - public String version() { - return version; - } + public String version() { + return version; + } - public String commitID() { - return commitID; - } + public String commitID() { + return commitID; + } - public Map network() { - return Collections.unmodifiableMap(this.network); - } + public Map network() { + return Collections.unmodifiableMap(this.network); + } - public List disks() { - return Collections.unmodifiableList(disks == null ? new LinkedList<>() : disks); - } + public List disks() { + return Collections.unmodifiableList(disks == null ? new LinkedList<>() : disks); + } - public Integer poolNumber() { - return poolNumber; - } + public Integer poolNumber() { + return poolNumber; + } - public MemStats memStats() { - return memStats; - } + public MemStats memStats() { + return memStats; + } - public Integer goMaxProcs() { - return goMaxProcs; - } + public Integer goMaxProcs() { + return goMaxProcs; + } - public Integer numCPU() { - return numCPU; - } + public Integer numCPU() { + return numCPU; + } - public String runtimeVersion() { - return runtimeVersion; - } + public String runtimeVersion() { + return runtimeVersion; + } - public GCStats gCStats() { - return gCStats; - } + public GCStats gCStats() { + return gCStats; + } - public Map minioEnvVars() { - return Collections.unmodifiableMap(this.minioEnvVars); - } + 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/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.>readValue(response.body().bytes(), mapType) - .entrySet().stream() - .filter(entry -> "quota".equals(entry.getKey())) - .findFirst() - .map(entry -> Long.valueOf(entry.getValue().toString())) - .orElseThrow(() -> new IllegalArgumentException("found not quota")); + .entrySet().stream() + .filter(entry -> "quota".equals(entry.getKey())) + .findFirst() + .map(entry -> Long.valueOf(entry.getValue().toString())) + .orElseThrow(() -> new IllegalArgumentException("found not quota")); } } @@ -464,15 +456,14 @@ public long getBucketQuota(String bucketName) * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ public void clearBucketQuota(@Nonnull String bucketName) - throws IOException, NoSuchAlgorithmException, InvalidKeyException { + throws IOException, NoSuchAlgorithmException, InvalidKeyException { setBucketQuota(bucketName, 0, QuotaUnit.KB); } /** * Creates a policy. * - *
-   * Example:{@code
+   * 
Example:{@code
    * // Assume policyJson contains below JSON string;
    * // {
    * //     "Statement": [
@@ -487,8 +478,7 @@ public void clearBucketQuota(@Nonnull String bucketName)
    * // }
    * //
    * client.addCannedPolicy("my-policy-name", policyJson);
-   * }
-   * 
+ * }
* * @param name Policy name. * @param policy Policy as JSON string. @@ -497,7 +487,7 @@ public void clearBucketQuota(@Nonnull String bucketName) * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ public void addCannedPolicy(@Nonnull String name, @Nonnull String policy) - throws NoSuchAlgorithmException, InvalidKeyException, IOException { + throws NoSuchAlgorithmException, InvalidKeyException, IOException { if (name == null || name.isEmpty()) { throw new IllegalArgumentException("name must be provided"); } @@ -506,11 +496,11 @@ public void addCannedPolicy(@Nonnull String name, @Nonnull String policy) } try (Response response = - execute( - Method.PUT, - Command.ADD_CANNED_POLICY, - ImmutableMultimap.of("name", name), - policy.getBytes(StandardCharsets.UTF_8))) {} + execute( + Method.PUT, + Command.ADD_CANNED_POLICY, + ImmutableMultimap.of("name", name), + policy.getBytes(StandardCharsets.UTF_8))) {} } /** @@ -524,8 +514,8 @@ public void addCannedPolicy(@Nonnull String name, @Nonnull String policy) * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ public void setPolicy( - @Nonnull String userOrGroupName, boolean isGroup, @Nonnull String policyName) - throws NoSuchAlgorithmException, InvalidKeyException, IOException { + @Nonnull String userOrGroupName, boolean isGroup, @Nonnull String policyName) + throws NoSuchAlgorithmException, InvalidKeyException, IOException { if (userOrGroupName == null || userOrGroupName.isEmpty()) { throw new IllegalArgumentException("user/group name must be provided"); } @@ -534,17 +524,17 @@ public void setPolicy( } try (Response response = - execute( - Method.PUT, - Command.SET_USER_OR_GROUP_POLICY, - ImmutableMultimap.of( - "userOrGroup", - userOrGroupName, - "isGroup", - String.valueOf(isGroup), - "policyName", - policyName), - null)) {} + execute( + Method.PUT, + Command.SET_USER_OR_GROUP_POLICY, + ImmutableMultimap.of( + "userOrGroup", + userOrGroupName, + "isGroup", + String.valueOf(isGroup), + "policyName", + policyName), + null)) {} } /** @@ -556,16 +546,16 @@ public void setPolicy( * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ public Map listCannedPolicies() - throws NoSuchAlgorithmException, InvalidKeyException, IOException { + throws NoSuchAlgorithmException, InvalidKeyException, IOException { try (Response response = execute(Method.GET, Command.LIST_CANNED_POLICIES, null, null)) { MapType mapType = - OBJECT_MAPPER - .getTypeFactory() - .constructMapType(HashMap.class, String.class, JsonNode.class); + OBJECT_MAPPER + .getTypeFactory() + .constructMapType(HashMap.class, String.class, JsonNode.class); HashMap policies = new HashMap<>(); OBJECT_MAPPER - .>readValue(response.body().bytes(), mapType) - .forEach((key, value) -> policies.put(key, value.toString())); + .>readValue(response.body().bytes(), mapType) + .forEach((key, value) -> policies.put(key, value.toString())); return policies; } } @@ -579,17 +569,17 @@ public Map listCannedPolicies() * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ public void removeCannedPolicy(@Nonnull String name) - throws NoSuchAlgorithmException, InvalidKeyException, IOException { + throws NoSuchAlgorithmException, InvalidKeyException, IOException { if (name == null || name.isEmpty()) { throw new IllegalArgumentException("name must be provided"); } try (Response response = - execute( - Method.DELETE, - Command.REMOVE_CANNED_POLICY, - ImmutableMultimap.of("name", name), - null)) {} + execute( + Method.DELETE, + Command.REMOVE_CANNED_POLICY, + ImmutableMultimap.of("name", name), + null)) {} } /** @@ -601,7 +591,7 @@ public void removeCannedPolicy(@Nonnull String name) * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ public DataUsageInfo getDataUsageInfo() - throws IOException, NoSuchAlgorithmException, InvalidKeyException { + throws IOException, NoSuchAlgorithmException, InvalidKeyException { try (Response response = execute(Method.GET, Command.DATA_USAGE_INFO, null, null)) { return OBJECT_MAPPER.readValue(response.body().bytes(), DataUsageInfo.class); } @@ -611,12 +601,10 @@ 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. @@ -624,17 +612,15 @@ public DataUsageInfo getDataUsageInfo() */ public void setTimeout(long connectTimeout, long writeTimeout, long readTimeout) { this.httpClient = - HttpUtils.setTimeout(this.httpClient, connectTimeout, writeTimeout, readTimeout); + HttpUtils.setTimeout(this.httpClient, connectTimeout, writeTimeout, 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. @@ -652,11 +638,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(); + MinioProperties.INSTANCE.getDefaultUserAgent() + " " + name.trim() + "/" + version.trim(); } /** @@ -666,11 +650,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); + new PrintWriter(new OutputStreamWriter(traceStream, StandardCharsets.UTF_8), true); } /** @@ -750,8 +732,8 @@ public MinioAdminClient build() { HttpUtils.validateNotNull(provider, "credential provider"); if (httpClient == null) { httpClient = - HttpUtils.newDefaultHttpClient( - DEFAULT_CONNECTION_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT); + HttpUtils.newDefaultHttpClient( + DEFAULT_CONNECTION_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT); } return new MinioAdminClient(baseUrl, region, provider, httpClient); } From 4fe71cb50a64ebc227d7c0533b0dd8fe303473f5 Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Tue, 4 Jul 2023 15:02:24 +0800 Subject: [PATCH 11/22] Update MinioAdminClient.java --- .../java/io/minio/admin/MinioAdminClient.java | 250 +++++++++--------- 1 file changed, 125 insertions(+), 125 deletions(-) diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index a17ae4d8f..a2ab37789 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; @@ -122,19 +122,19 @@ private Credentials getCredentials() { } 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(); @@ -160,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) { @@ -176,11 +176,11 @@ private Response execute( 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*")); + 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()); } @@ -190,11 +190,11 @@ 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()); @@ -220,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"); @@ -234,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)))) {} } /** @@ -251,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); } @@ -270,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); } } @@ -292,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)) {} } /** @@ -316,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))) {} } /** @@ -342,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); } @@ -359,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); } } @@ -377,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))) {} } /** @@ -403,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))) {} } /** @@ -427,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.>readValue(response.body().bytes(), mapType) - .entrySet().stream() - .filter(entry -> "quota".equals(entry.getKey())) - .findFirst() - .map(entry -> Long.valueOf(entry.getValue().toString())) - .orElseThrow(() -> new IllegalArgumentException("found not quota")); + .entrySet().stream() + .filter(entry -> "quota".equals(entry.getKey())) + .findFirst() + .map(entry -> Long.valueOf(entry.getValue().toString())) + .orElseThrow(() -> new IllegalArgumentException("found not quota")); } } @@ -456,7 +456,7 @@ public long getBucketQuota(String bucketName) * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ public void clearBucketQuota(@Nonnull String bucketName) - throws IOException, NoSuchAlgorithmException, InvalidKeyException { + throws IOException, NoSuchAlgorithmException, InvalidKeyException { setBucketQuota(bucketName, 0, QuotaUnit.KB); } @@ -487,7 +487,7 @@ public void clearBucketQuota(@Nonnull String bucketName) * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ public void addCannedPolicy(@Nonnull String name, @Nonnull String policy) - throws NoSuchAlgorithmException, InvalidKeyException, IOException { + throws NoSuchAlgorithmException, InvalidKeyException, IOException { if (name == null || name.isEmpty()) { throw new IllegalArgumentException("name must be provided"); } @@ -496,11 +496,11 @@ public void addCannedPolicy(@Nonnull String name, @Nonnull String policy) } try (Response response = - execute( - Method.PUT, - Command.ADD_CANNED_POLICY, - ImmutableMultimap.of("name", name), - policy.getBytes(StandardCharsets.UTF_8))) {} + execute( + Method.PUT, + Command.ADD_CANNED_POLICY, + ImmutableMultimap.of("name", name), + policy.getBytes(StandardCharsets.UTF_8))) {} } /** @@ -514,8 +514,8 @@ public void addCannedPolicy(@Nonnull String name, @Nonnull String policy) * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ public void setPolicy( - @Nonnull String userOrGroupName, boolean isGroup, @Nonnull String policyName) - throws NoSuchAlgorithmException, InvalidKeyException, IOException { + @Nonnull String userOrGroupName, boolean isGroup, @Nonnull String policyName) + throws NoSuchAlgorithmException, InvalidKeyException, IOException { if (userOrGroupName == null || userOrGroupName.isEmpty()) { throw new IllegalArgumentException("user/group name must be provided"); } @@ -524,17 +524,17 @@ public void setPolicy( } try (Response response = - execute( - Method.PUT, - Command.SET_USER_OR_GROUP_POLICY, - ImmutableMultimap.of( - "userOrGroup", - userOrGroupName, - "isGroup", - String.valueOf(isGroup), - "policyName", - policyName), - null)) {} + execute( + Method.PUT, + Command.SET_USER_OR_GROUP_POLICY, + ImmutableMultimap.of( + "userOrGroup", + userOrGroupName, + "isGroup", + String.valueOf(isGroup), + "policyName", + policyName), + null)) {} } /** @@ -546,16 +546,16 @@ public void setPolicy( * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ public Map listCannedPolicies() - throws NoSuchAlgorithmException, InvalidKeyException, IOException { + throws NoSuchAlgorithmException, InvalidKeyException, IOException { try (Response response = execute(Method.GET, Command.LIST_CANNED_POLICIES, null, null)) { MapType mapType = - OBJECT_MAPPER - .getTypeFactory() - .constructMapType(HashMap.class, String.class, JsonNode.class); + OBJECT_MAPPER + .getTypeFactory() + .constructMapType(HashMap.class, String.class, JsonNode.class); HashMap policies = new HashMap<>(); OBJECT_MAPPER - .>readValue(response.body().bytes(), mapType) - .forEach((key, value) -> policies.put(key, value.toString())); + .>readValue(response.body().bytes(), mapType) + .forEach((key, value) -> policies.put(key, value.toString())); return policies; } } @@ -569,17 +569,17 @@ public Map listCannedPolicies() * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ public void removeCannedPolicy(@Nonnull String name) - throws NoSuchAlgorithmException, InvalidKeyException, IOException { + throws NoSuchAlgorithmException, InvalidKeyException, IOException { if (name == null || name.isEmpty()) { throw new IllegalArgumentException("name must be provided"); } try (Response response = - execute( - Method.DELETE, - Command.REMOVE_CANNED_POLICY, - ImmutableMultimap.of("name", name), - null)) {} + execute( + Method.DELETE, + Command.REMOVE_CANNED_POLICY, + ImmutableMultimap.of("name", name), + null)) {} } /** @@ -591,7 +591,7 @@ public void removeCannedPolicy(@Nonnull String name) * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ public DataUsageInfo getDataUsageInfo() - throws IOException, NoSuchAlgorithmException, InvalidKeyException { + throws IOException, NoSuchAlgorithmException, InvalidKeyException { try (Response response = execute(Method.GET, Command.DATA_USAGE_INFO, null, null)) { return OBJECT_MAPPER.readValue(response.body().bytes(), DataUsageInfo.class); } @@ -612,7 +612,7 @@ public DataUsageInfo getDataUsageInfo() */ public void setTimeout(long connectTimeout, long writeTimeout, long readTimeout) { this.httpClient = - HttpUtils.setTimeout(this.httpClient, connectTimeout, writeTimeout, readTimeout); + HttpUtils.setTimeout(this.httpClient, connectTimeout, writeTimeout, readTimeout); } /** @@ -640,7 +640,7 @@ public void ignoreCertCheck() throws KeyManagementException, NoSuchAlgorithmExce public void setAppInfo(String name, String version) { if (name == null || version == null) return; this.userAgent = - MinioProperties.INSTANCE.getDefaultUserAgent() + " " + name.trim() + "/" + version.trim(); + MinioProperties.INSTANCE.getDefaultUserAgent() + " " + name.trim() + "/" + version.trim(); } /** @@ -652,7 +652,7 @@ public void setAppInfo(String name, String version) { public void traceOn(OutputStream traceStream) { if (traceStream == null) throw new IllegalArgumentException("trace stream must be provided"); this.traceStream = - new PrintWriter(new OutputStreamWriter(traceStream, StandardCharsets.UTF_8), true); + new PrintWriter(new OutputStreamWriter(traceStream, StandardCharsets.UTF_8), true); } /** @@ -732,8 +732,8 @@ public MinioAdminClient build() { HttpUtils.validateNotNull(provider, "credential provider"); if (httpClient == null) { httpClient = - HttpUtils.newDefaultHttpClient( - DEFAULT_CONNECTION_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT); + HttpUtils.newDefaultHttpClient( + DEFAULT_CONNECTION_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT); } return new MinioAdminClient(baseUrl, region, provider, httpClient); } From d0a974135a3ad11d3de887bdedef1f0b128b2935 Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Tue, 4 Jul 2023 15:17:27 +0800 Subject: [PATCH 12/22] fix code check --- .../java/io/minio/admin/MinioAdminClient.java | 19 +- .../io/minio/admin/clusterinfo/Buckets.java | 44 ---- .../java/io/minio/admin/clusterinfo/Disk.java | 206 ------------------ .../minio/admin/clusterinfo/DiskMetrics.java | 44 ---- .../admin/clusterinfo/ErasureBackend.java | 83 ------- .../admin/clusterinfo/ErasureSetInfo.java | 80 ------- .../io/minio/admin/clusterinfo/GCStats.java | 67 ------ .../minio/admin/clusterinfo/HealingDisk.java | 181 --------------- .../minio/admin/clusterinfo/InfoMessage.java | 97 --------- .../io/minio/admin/clusterinfo/MemStats.java | 65 ------ .../io/minio/admin/clusterinfo/Objects.java | 43 ---- .../admin/clusterinfo/ServerProperties.java | 138 ------------ .../minio/admin/clusterinfo/TimedAction.java | 51 ----- .../io/minio/admin/clusterinfo/Usage.java | 43 ---- .../io/minio/admin/clusterinfo/Versions.java | 43 ---- 15 files changed, 18 insertions(+), 1186 deletions(-) delete mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/Buckets.java delete mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/Disk.java delete mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/DiskMetrics.java delete mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureBackend.java delete mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureSetInfo.java delete mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/GCStats.java delete mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/HealingDisk.java delete mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/InfoMessage.java delete mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/MemStats.java delete mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/Objects.java delete mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/ServerProperties.java delete mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/TimedAction.java delete mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/Usage.java delete mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/Versions.java diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index a2ab37789..603c1503e 100644 --- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java +++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java @@ -79,7 +79,8 @@ private enum Command { DATA_USAGE_INFO("datausageinfo"), ADD_UPDATE_REMOVE_GROUP("update-group-members"), GROUP_INFO("group"), - LIST_GROUPS("groups"); + LIST_GROUPS("groups"), + ADMIN_INFO("info"); private final String value; private Command(String value) { @@ -597,6 +598,22 @@ public DataUsageInfo getDataUsageInfo() } } + /** + * 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 byte[] getAdminInfo() + throws IOException, NoSuchAlgorithmException, InvalidKeyException { + try (Response response = execute(Method.GET, Command.ADMIN_INFO, null, null)) { + byte[] jsonData = response.body().bytes(); + return jsonData; + } + } + /** * 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. diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/Buckets.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/Buckets.java deleted file mode 100644 index 9a2e03c08..000000000 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/Buckets.java +++ /dev/null @@ -1,44 +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.clusterinfo; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Buckets contains the number of buckets - * - * @see info-commands.go - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class Buckets { - @JsonProperty("count") - private Integer count; - - @JsonProperty("error") - private String error; - - public Integer count() { - return count; - } - - 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 deleted file mode 100644 index 16b711f0c..000000000 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/Disk.java +++ /dev/null @@ -1,206 +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.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/clusterinfo/DiskMetrics.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/DiskMetrics.java deleted file mode 100644 index 7cf1e5d22..000000000 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/DiskMetrics.java +++ /dev/null @@ -1,44 +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.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 - */ -public class DiskMetrics { - @JsonProperty("lastMinute") - private Map lastMinute; - - @JsonProperty("apiCalls") - private Map apiCalls; - - public Map lastMinute() { - return Collections.unmodifiableMap(lastMinute); - } - - 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 deleted file mode 100644 index b179153ab..000000000 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureBackend.java +++ /dev/null @@ -1,83 +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.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 deleted file mode 100644 index 946dd52fb..000000000 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureSetInfo.java +++ /dev/null @@ -1,80 +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.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/clusterinfo/GCStats.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/GCStats.java deleted file mode 100644 index 36463fc7e..000000000 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/GCStats.java +++ /dev/null @@ -1,67 +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.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; - -/** - * GCStats collect information about recent garbage collections. - * - * @see health.go - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class GCStats { - @JsonProperty("last_gc") - private String lastGC; - - @JsonProperty("num_gc") - private Integer numGC; - - @JsonProperty("pause_total") - private Integer pauseTotal; - - @JsonProperty("pause") - private List pause; - - @JsonProperty("pause_end") - private List pauseEnd; - - public String lastGC() { - return lastGC; - } - - public Integer numGC() { - return numGC; - } - - public Integer pauseTotal() { - return pauseTotal; - } - - public List pause() { - return Collections.unmodifiableList(pause == null ? new LinkedList<>() : pause); - } - - 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 deleted file mode 100644 index 1e55b320d..000000000 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/HealingDisk.java +++ /dev/null @@ -1,181 +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.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 deleted file mode 100644 index dc83a8773..000000000 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/InfoMessage.java +++ /dev/null @@ -1,97 +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.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/clusterinfo/MemStats.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/MemStats.java deleted file mode 100644 index 879f0ca49..000000000 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/MemStats.java +++ /dev/null @@ -1,65 +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.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. - * - * @see health.go - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class MemStats { - @JsonProperty("Alloc") - private BigDecimal alloc; - - @JsonProperty("TotalAlloc") - private BigDecimal totalAlloc; - - @JsonProperty("Mallocs") - private BigDecimal mallocs; - - @JsonProperty("Frees") - private BigDecimal frees; - - @JsonProperty("HeapAlloc") - private BigDecimal heapAlloc; - - public BigDecimal alloc() { - return alloc; - } - - public BigDecimal totalAlloc() { - return totalAlloc; - } - - public BigDecimal mallocs() { - return mallocs; - } - - public BigDecimal frees() { - return frees; - } - - public BigDecimal heapAlloc() { - return heapAlloc; - } -} diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/Objects.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/Objects.java deleted file mode 100644 index 1c08d29e5..000000000 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/Objects.java +++ /dev/null @@ -1,43 +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.clusterinfo; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Objects contains the number of objects - * - * @see info-commands.go - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class Objects { - @JsonProperty("count") - private Integer count; - - @JsonProperty("error") - private String error; - - public Integer count() { - return count; - } - - 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 deleted file mode 100644 index a02908639..000000000 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/ServerProperties.java +++ /dev/null @@ -1,138 +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.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/clusterinfo/TimedAction.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/TimedAction.java deleted file mode 100644 index 5f9108834..000000000 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/TimedAction.java +++ /dev/null @@ -1,51 +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.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. - * - * @see metrics.go - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class TimedAction { - @JsonProperty("count") - private BigDecimal count; - - @JsonProperty("acc_time_ns") - private BigDecimal accTime; - - @JsonProperty("bytes") - private BigDecimal bytes; - - public BigDecimal count() { - return count; - } - - public BigDecimal accTime() { - return accTime; - } - - public BigDecimal bytes() { - return bytes; - } -} diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/Usage.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/Usage.java deleted file mode 100644 index ac02be28a..000000000 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/Usage.java +++ /dev/null @@ -1,43 +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.clusterinfo; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Usage contains the total size used - * - * @see info-commands.go - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class Usage { - @JsonProperty("size") - private Integer size; - - @JsonProperty("error") - private String error; - - public Integer size() { - return size; - } - - public String error() { - return error; - } -} diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/Versions.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/Versions.java deleted file mode 100644 index 646b5e9b2..000000000 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/Versions.java +++ /dev/null @@ -1,43 +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.clusterinfo; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Versions contains the number of versions - * - * @see info-commands.go - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class Versions { - @JsonProperty("count") - private Integer count; - - @JsonProperty("error") - private String error; - - public Integer count() { - return count; - } - - public String error() { - return error; - } -} From 865beb7653a0d16c9773d6d900764092bff40771 Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Tue, 4 Jul 2023 15:27:29 +0800 Subject: [PATCH 13/22] Update MinioAdminClient.java --- adminapi/src/main/java/io/minio/admin/MinioAdminClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index 603c1503e..cc50212bb 100644 --- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java +++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java @@ -606,11 +606,11 @@ public DataUsageInfo getDataUsageInfo() * @throws InvalidKeyException thrown to indicate missing of HMAC SHA-256 library. * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ - public byte[] getAdminInfo() + public String getAdminInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException { try (Response response = execute(Method.GET, Command.ADMIN_INFO, null, null)) { byte[] jsonData = response.body().bytes(); - return jsonData; + return new String(jsonData); } } From ad4ecb751f5f14c7a48261431d0a1bb59544b284 Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Tue, 4 Jul 2023 15:32:09 +0800 Subject: [PATCH 14/22] Update MinioAdminClient.java --- adminapi/src/main/java/io/minio/admin/MinioAdminClient.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index cc50212bb..740244af0 100644 --- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java +++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java @@ -606,8 +606,7 @@ public DataUsageInfo getDataUsageInfo() * @throws InvalidKeyException thrown to indicate missing of HMAC SHA-256 library. * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ - public String getAdminInfo() - throws IOException, NoSuchAlgorithmException, InvalidKeyException { + public String getAdminInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException { try (Response response = execute(Method.GET, Command.ADMIN_INFO, null, null)) { byte[] jsonData = response.body().bytes(); return new String(jsonData); From ed3744bda6418887936f60038399a1f7ace37788 Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Tue, 4 Jul 2023 15:34:57 +0800 Subject: [PATCH 15/22] Update MinioAdminClient.java --- adminapi/src/main/java/io/minio/admin/MinioAdminClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index 740244af0..a2e45aa17 100644 --- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java +++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java @@ -606,10 +606,10 @@ public DataUsageInfo getDataUsageInfo() * @throws InvalidKeyException thrown to indicate missing of HMAC SHA-256 library. * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ - public String getAdminInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException { + public DataUsageInfo getAdminInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException { try (Response response = execute(Method.GET, Command.ADMIN_INFO, null, null)) { byte[] jsonData = response.body().bytes(); - return new String(jsonData); + return OBJECT_MAPPER.readValue(response.body().bytes(), DataUsageInfo.class); } } From 07517874bb29ccfb94b6fdbcf7c4556d25c3a120 Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Tue, 4 Jul 2023 15:35:48 +0800 Subject: [PATCH 16/22] Update MinioAdminClient.java --- adminapi/src/main/java/io/minio/admin/MinioAdminClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index a2e45aa17..a93f4a82d 100644 --- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java +++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java @@ -609,7 +609,7 @@ public DataUsageInfo getDataUsageInfo() public DataUsageInfo 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(response.body().bytes(), DataUsageInfo.class); + return OBJECT_MAPPER.readValue(jsonData, DataUsageInfo.class); } } From c8ad938e80e09f78d9d7c30c7a99bdc7e59c1153 Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Tue, 4 Jul 2023 15:50:09 +0800 Subject: [PATCH 17/22] fix ci --- .../java/io/minio/admin/MinioAdminClient.java | 7 +- .../io/minio/admin/clusterinfo/Buckets.java | 44 ++++ .../java/io/minio/admin/clusterinfo/Disk.java | 206 ++++++++++++++++++ .../minio/admin/clusterinfo/DiskMetrics.java | 44 ++++ .../admin/clusterinfo/ErasureBackend.java | 83 +++++++ .../admin/clusterinfo/ErasureSetInfo.java | 80 +++++++ .../io/minio/admin/clusterinfo/GCStats.java | 67 ++++++ .../minio/admin/clusterinfo/HealingDisk.java | 181 +++++++++++++++ .../minio/admin/clusterinfo/InfoMessage.java | 97 +++++++++ .../io/minio/admin/clusterinfo/MemStats.java | 65 ++++++ .../minio/admin/clusterinfo/MinioObjects.java | 44 ++++ .../admin/clusterinfo/ServerProperties.java | 139 ++++++++++++ .../minio/admin/clusterinfo/TimedAction.java | 51 +++++ .../io/minio/admin/clusterinfo/Usage.java | 44 ++++ .../io/minio/admin/clusterinfo/Versions.java | 44 ++++ 15 files changed, 1193 insertions(+), 3 deletions(-) create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/Buckets.java create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/Disk.java create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/DiskMetrics.java 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 create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/GCStats.java 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 create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/MemStats.java create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/MinioObjects.java create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/ServerProperties.java create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/TimedAction.java create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/Usage.java create mode 100644 adminapi/src/main/java/io/minio/admin/clusterinfo/Versions.java diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index a93f4a82d..7b3d21ab3 100644 --- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java +++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java @@ -30,6 +30,7 @@ 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; @@ -606,10 +607,10 @@ public DataUsageInfo getDataUsageInfo() * @throws InvalidKeyException thrown to indicate missing of HMAC SHA-256 library. * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ - public DataUsageInfo getAdminInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException { + 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, DataUsageInfo.class); + return OBJECT_MAPPER.readValue(response.body().bytes(), InfoMessage.class); } } diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/Buckets.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/Buckets.java new file mode 100644 index 000000000..9a2e03c08 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/Buckets.java @@ -0,0 +1,44 @@ +/* + * 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; + +/** + * Buckets contains the number of buckets + * + * @see info-commands.go + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class Buckets { + @JsonProperty("count") + private Integer count; + + @JsonProperty("error") + private String error; + + public Integer count() { + return count; + } + + 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/clusterinfo/DiskMetrics.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/DiskMetrics.java new file mode 100644 index 000000000..7cf1e5d22 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/DiskMetrics.java @@ -0,0 +1,44 @@ +/* + * 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.JsonProperty; +import java.util.Collections; +import java.util.Map; + +/** + * DiskMetrics has the information about XL Storage APIs + * + * @see info-commands.go + */ +public class DiskMetrics { + @JsonProperty("lastMinute") + private Map lastMinute; + + @JsonProperty("apiCalls") + private Map apiCalls; + + public Map lastMinute() { + return Collections.unmodifiableMap(lastMinute); + } + + 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/clusterinfo/GCStats.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/GCStats.java new file mode 100644 index 000000000..36463fc7e --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/GCStats.java @@ -0,0 +1,67 @@ +/* + * 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; + +/** + * GCStats collect information about recent garbage collections. + * + * @see health.go + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class GCStats { + @JsonProperty("last_gc") + private String lastGC; + + @JsonProperty("num_gc") + private Integer numGC; + + @JsonProperty("pause_total") + private Integer pauseTotal; + + @JsonProperty("pause") + private List pause; + + @JsonProperty("pause_end") + private List pauseEnd; + + public String lastGC() { + return lastGC; + } + + public Integer numGC() { + return numGC; + } + + public Integer pauseTotal() { + return pauseTotal; + } + + public List pause() { + return Collections.unmodifiableList(pause == null ? new LinkedList<>() : pause); + } + + 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..77ea66811 --- /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 MinioObjects minioObjects; + + @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 MinioObjects minioObjects() { + return minioObjects; + } + + 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/clusterinfo/MemStats.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/MemStats.java new file mode 100644 index 000000000..879f0ca49 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/MemStats.java @@ -0,0 +1,65 @@ +/* + * 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; + +/** + * MemStats is strip down version of runtime.MemStats containing memory stats of MinIO server. + * + * @see health.go + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class MemStats { + @JsonProperty("Alloc") + private BigDecimal alloc; + + @JsonProperty("TotalAlloc") + private BigDecimal totalAlloc; + + @JsonProperty("Mallocs") + private BigDecimal mallocs; + + @JsonProperty("Frees") + private BigDecimal frees; + + @JsonProperty("HeapAlloc") + private BigDecimal heapAlloc; + + public BigDecimal alloc() { + return alloc; + } + + public BigDecimal totalAlloc() { + return totalAlloc; + } + + public BigDecimal mallocs() { + return mallocs; + } + + public BigDecimal frees() { + return frees; + } + + public BigDecimal heapAlloc() { + return heapAlloc; + } +} diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/MinioObjects.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/MinioObjects.java new file mode 100644 index 000000000..f9b739cf7 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/MinioObjects.java @@ -0,0 +1,44 @@ +/* + * 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; + +/** + * Objects contains the number of objects + * + * @see info-commands.go + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class MinioObjects { + @JsonProperty("count") + private Integer count; + + @JsonProperty("error") + private String error; + + public Integer count() { + return count; + } + + 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..10a8e9172 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/ServerProperties.java @@ -0,0 +1,139 @@ +/* + * 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/clusterinfo/TimedAction.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/TimedAction.java new file mode 100644 index 000000000..c076dde11 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/TimedAction.java @@ -0,0 +1,51 @@ +/* + * 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; + +/** + * TimedAction contains a number of actions and their accumulated duration in nanoseconds. + * + * @see metrics.go + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class TimedAction { + @JsonProperty("count") + private BigDecimal count; + + @JsonProperty("acc_time_ns") + private BigDecimal accTime; + + @JsonProperty("bytes") + private BigDecimal bytes; + + public BigDecimal count() { + return count; + } + + public BigDecimal accTime() { + return accTime; + } + + public BigDecimal bytes() { + return bytes; + } +} diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/Usage.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/Usage.java new file mode 100644 index 000000000..4aab967c7 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/Usage.java @@ -0,0 +1,44 @@ +/* + * 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; + +/** + * Usage contains the total size used + * + * @see info-commands.go + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class Usage { + @JsonProperty("size") + private Integer size; + + @JsonProperty("error") + private String error; + + public Integer size() { + return size; + } + + public String error() { + return error; + } +} diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/Versions.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/Versions.java new file mode 100644 index 000000000..e43cb52c1 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/Versions.java @@ -0,0 +1,44 @@ +/* + * 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; + +/** + * Versions contains the number of versions + * + * @see info-commands.go + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class Versions { + @JsonProperty("count") + private Integer count; + + @JsonProperty("error") + private String error; + + public Integer count() { + return count; + } + + public String error() { + return error; + } +} From 14f4590c23f3dcd7c40200544df3759933b6ff6b Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Wed, 5 Jul 2023 09:33:46 +0800 Subject: [PATCH 18/22] resolve conversation --- .../java/io/minio/admin/MinioAdminClient.java | 10 ++++---- .../{ErasureBackend.java => Backend.java} | 2 +- .../{MinioObjects.java => Objects.java} | 2 +- .../InfoMessage.java | 25 ++++++++++++------- 4 files changed, 23 insertions(+), 16 deletions(-) rename adminapi/src/main/java/io/minio/admin/clusterinfo/{ErasureBackend.java => Backend.java} (98%) rename adminapi/src/main/java/io/minio/admin/clusterinfo/{MinioObjects.java => Objects.java} (97%) rename adminapi/src/main/java/io/minio/admin/{clusterinfo => messages}/InfoMessage.java (76%) diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index 7b3d21ab3..9d7112319 100644 --- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java +++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java @@ -30,8 +30,8 @@ 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.admin.messages.InfoMessage; import io.minio.credentials.Credentials; import io.minio.credentials.Provider; import io.minio.credentials.StaticProvider; @@ -81,7 +81,7 @@ private enum Command { ADD_UPDATE_REMOVE_GROUP("update-group-members"), GROUP_INFO("group"), LIST_GROUPS("groups"), - ADMIN_INFO("info"); + INFO("info"); private final String value; private Command(String value) { @@ -607,10 +607,10 @@ public DataUsageInfo getDataUsageInfo() * @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() + public InfoMessage getServerInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException { - try (Response response = execute(Method.GET, Command.ADMIN_INFO, null, null)) { - return OBJECT_MAPPER.readValue(response.body().bytes(), InfoMessage.class); + try (Response response = execute(Method.GET, Command.INFO, null, null)) { + return OBJECT_MAPPER.readValue(response.body().charStream(), InfoMessage.class); } } diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureBackend.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/Backend.java similarity index 98% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureBackend.java rename to adminapi/src/main/java/io/minio/admin/clusterinfo/Backend.java index b179153ab..f3bbe5e62 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureBackend.java +++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/Backend.java @@ -30,7 +30,7 @@ * "https://github.com/minio/madmin-go/blob/main/info-commands.go#L359">info-commands.go */ @JsonIgnoreProperties(ignoreUnknown = true) -public class ErasureBackend { +public class Backend { @JsonProperty("backendType") private String backendType; diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/MinioObjects.java b/adminapi/src/main/java/io/minio/admin/clusterinfo/Objects.java similarity index 97% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/MinioObjects.java rename to adminapi/src/main/java/io/minio/admin/clusterinfo/Objects.java index f9b739cf7..7bee33ed2 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/MinioObjects.java +++ b/adminapi/src/main/java/io/minio/admin/clusterinfo/Objects.java @@ -27,7 +27,7 @@ * "https://github.com/minio/madmin-go/blob/main/info-commands.go#L292">info-commands.go */ @JsonIgnoreProperties(ignoreUnknown = true) -public class MinioObjects { +public class Objects { @JsonProperty("count") private Integer count; diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/InfoMessage.java b/adminapi/src/main/java/io/minio/admin/messages/InfoMessage.java similarity index 76% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/InfoMessage.java rename to adminapi/src/main/java/io/minio/admin/messages/InfoMessage.java index 77ea66811..787abc84c 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/InfoMessage.java +++ b/adminapi/src/main/java/io/minio/admin/messages/InfoMessage.java @@ -15,10 +15,17 @@ * limitations under the License. */ -package io.minio.admin.clusterinfo; +package io.minio.admin.messages; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import io.minio.admin.clusterinfo.Backend; +import io.minio.admin.clusterinfo.Buckets; +import io.minio.admin.clusterinfo.ErasureSetInfo; +import io.minio.admin.clusterinfo.Objects; +import io.minio.admin.clusterinfo.ServerProperties; +import io.minio.admin.clusterinfo.Usage; +import io.minio.admin.clusterinfo.Versions; import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -42,7 +49,7 @@ public class InfoMessage { private Buckets buckets; @JsonProperty("objects") - private MinioObjects minioObjects; + private Objects objects; @JsonProperty("versions") private Versions versions; @@ -51,13 +58,13 @@ public class InfoMessage { private Usage usage; @JsonProperty("backend") - private ErasureBackend backend; + private Backend backend; @JsonProperty("servers") private List servers; @JsonProperty("pools") - private Map> erasureSetInfo; + private Map> pools; public String mode() { return mode; @@ -71,8 +78,8 @@ public Buckets buckets() { return buckets; } - public MinioObjects minioObjects() { - return minioObjects; + public Objects objects() { + return objects; } public Versions versions() { @@ -83,7 +90,7 @@ public Usage usage() { return usage; } - public ErasureBackend backend() { + public Backend backend() { return backend; } @@ -91,7 +98,7 @@ public List servers() { return Collections.unmodifiableList(servers == null ? new LinkedList<>() : servers); } - public Map> erasureSetInfo() { - return erasureSetInfo; + public Map> pools() { + return pools; } } From d9a6a8804dbfeb3d121a625cce381ff5e5d8bd46 Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Thu, 6 Jul 2023 09:15:00 +0800 Subject: [PATCH 19/22] resolve conversation --- .../src/main/java/io/minio/admin/MinioAdminClient.java | 6 +++--- .../minio/admin/{clusterinfo => messages}/Backend.java | 2 +- .../minio/admin/{clusterinfo => messages}/Buckets.java | 2 +- .../io/minio/admin/{clusterinfo => messages}/Disk.java | 2 +- .../admin/{clusterinfo => messages}/DiskMetrics.java | 2 +- .../{clusterinfo => messages}/ErasureSetInfo.java | 2 +- .../minio/admin/{clusterinfo => messages}/GCStats.java | 2 +- .../admin/{clusterinfo => messages}/HealingDisk.java | 2 +- .../admin/{clusterinfo => messages}/MemStats.java | 2 +- .../admin/messages/{InfoMessage.java => Message.java} | 10 ++-------- .../minio/admin/{clusterinfo => messages}/Objects.java | 2 +- .../{clusterinfo => messages}/ServerProperties.java | 2 +- .../admin/{clusterinfo => messages}/TimedAction.java | 2 +- .../minio/admin/{clusterinfo => messages}/Usage.java | 2 +- .../admin/{clusterinfo => messages}/Versions.java | 2 +- 15 files changed, 18 insertions(+), 24 deletions(-) rename adminapi/src/main/java/io/minio/admin/{clusterinfo => messages}/Backend.java (98%) rename adminapi/src/main/java/io/minio/admin/{clusterinfo => messages}/Buckets.java (97%) rename adminapi/src/main/java/io/minio/admin/{clusterinfo => messages}/Disk.java (99%) rename adminapi/src/main/java/io/minio/admin/{clusterinfo => messages}/DiskMetrics.java (97%) rename adminapi/src/main/java/io/minio/admin/{clusterinfo => messages}/ErasureSetInfo.java (98%) rename adminapi/src/main/java/io/minio/admin/{clusterinfo => messages}/GCStats.java (98%) rename adminapi/src/main/java/io/minio/admin/{clusterinfo => messages}/HealingDisk.java (99%) rename adminapi/src/main/java/io/minio/admin/{clusterinfo => messages}/MemStats.java (97%) rename adminapi/src/main/java/io/minio/admin/messages/{InfoMessage.java => Message.java} (86%) rename adminapi/src/main/java/io/minio/admin/{clusterinfo => messages}/Objects.java (97%) rename adminapi/src/main/java/io/minio/admin/{clusterinfo => messages}/ServerProperties.java (98%) rename adminapi/src/main/java/io/minio/admin/{clusterinfo => messages}/TimedAction.java (97%) rename adminapi/src/main/java/io/minio/admin/{clusterinfo => messages}/Usage.java (97%) rename adminapi/src/main/java/io/minio/admin/{clusterinfo => messages}/Versions.java (97%) diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index 9d7112319..5117d8985 100644 --- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java +++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java @@ -31,7 +31,7 @@ import io.minio.Signer; import io.minio.Time; import io.minio.admin.messages.DataUsageInfo; -import io.minio.admin.messages.InfoMessage; +import io.minio.admin.messages.Message; import io.minio.credentials.Credentials; import io.minio.credentials.Provider; import io.minio.credentials.StaticProvider; @@ -607,10 +607,10 @@ public DataUsageInfo getDataUsageInfo() * @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 getServerInfo() + public Message getServerInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException { try (Response response = execute(Method.GET, Command.INFO, null, null)) { - return OBJECT_MAPPER.readValue(response.body().charStream(), InfoMessage.class); + return OBJECT_MAPPER.readValue(response.body().charStream(), Message.class); } } diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/Backend.java b/adminapi/src/main/java/io/minio/admin/messages/Backend.java similarity index 98% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/Backend.java rename to adminapi/src/main/java/io/minio/admin/messages/Backend.java index f3bbe5e62..9524ceae2 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/Backend.java +++ b/adminapi/src/main/java/io/minio/admin/messages/Backend.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.clusterinfo; +package io.minio.admin.messages; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/Buckets.java b/adminapi/src/main/java/io/minio/admin/messages/Buckets.java similarity index 97% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/Buckets.java rename to adminapi/src/main/java/io/minio/admin/messages/Buckets.java index 9a2e03c08..777498671 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/Buckets.java +++ b/adminapi/src/main/java/io/minio/admin/messages/Buckets.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.clusterinfo; +package io.minio.admin.messages; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/Disk.java b/adminapi/src/main/java/io/minio/admin/messages/Disk.java similarity index 99% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/Disk.java rename to adminapi/src/main/java/io/minio/admin/messages/Disk.java index 16b711f0c..05c08645b 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/Disk.java +++ b/adminapi/src/main/java/io/minio/admin/messages/Disk.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.clusterinfo; +package io.minio.admin.messages; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/DiskMetrics.java b/adminapi/src/main/java/io/minio/admin/messages/DiskMetrics.java similarity index 97% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/DiskMetrics.java rename to adminapi/src/main/java/io/minio/admin/messages/DiskMetrics.java index 7cf1e5d22..dfa0e94e6 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/DiskMetrics.java +++ b/adminapi/src/main/java/io/minio/admin/messages/DiskMetrics.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.clusterinfo; +package io.minio.admin.messages; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Collections; diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureSetInfo.java b/adminapi/src/main/java/io/minio/admin/messages/ErasureSetInfo.java similarity index 98% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureSetInfo.java rename to adminapi/src/main/java/io/minio/admin/messages/ErasureSetInfo.java index 946dd52fb..28d20ac9c 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/ErasureSetInfo.java +++ b/adminapi/src/main/java/io/minio/admin/messages/ErasureSetInfo.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.clusterinfo; +package io.minio.admin.messages; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/GCStats.java b/adminapi/src/main/java/io/minio/admin/messages/GCStats.java similarity index 98% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/GCStats.java rename to adminapi/src/main/java/io/minio/admin/messages/GCStats.java index 36463fc7e..2e6a4fd61 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/GCStats.java +++ b/adminapi/src/main/java/io/minio/admin/messages/GCStats.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.clusterinfo; +package io.minio.admin.messages; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/HealingDisk.java b/adminapi/src/main/java/io/minio/admin/messages/HealingDisk.java similarity index 99% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/HealingDisk.java rename to adminapi/src/main/java/io/minio/admin/messages/HealingDisk.java index 1e55b320d..ef28683e4 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/HealingDisk.java +++ b/adminapi/src/main/java/io/minio/admin/messages/HealingDisk.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.clusterinfo; +package io.minio.admin.messages; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/MemStats.java b/adminapi/src/main/java/io/minio/admin/messages/MemStats.java similarity index 97% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/MemStats.java rename to adminapi/src/main/java/io/minio/admin/messages/MemStats.java index 879f0ca49..795e93d24 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/MemStats.java +++ b/adminapi/src/main/java/io/minio/admin/messages/MemStats.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.clusterinfo; +package io.minio.admin.messages; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/messages/InfoMessage.java b/adminapi/src/main/java/io/minio/admin/messages/Message.java similarity index 86% rename from adminapi/src/main/java/io/minio/admin/messages/InfoMessage.java rename to adminapi/src/main/java/io/minio/admin/messages/Message.java index 787abc84c..6a643ed6d 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/InfoMessage.java +++ b/adminapi/src/main/java/io/minio/admin/messages/Message.java @@ -19,13 +19,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; -import io.minio.admin.clusterinfo.Backend; -import io.minio.admin.clusterinfo.Buckets; -import io.minio.admin.clusterinfo.ErasureSetInfo; -import io.minio.admin.clusterinfo.Objects; -import io.minio.admin.clusterinfo.ServerProperties; -import io.minio.admin.clusterinfo.Usage; -import io.minio.admin.clusterinfo.Versions; + import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -38,7 +32,7 @@ * "https://github.com/minio/madmin-go/blob/main/info-commands.go#L238">heal-commands.go */ @JsonIgnoreProperties(ignoreUnknown = true) -public class InfoMessage { +public class Message { @JsonProperty("mode") private String mode; diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/Objects.java b/adminapi/src/main/java/io/minio/admin/messages/Objects.java similarity index 97% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/Objects.java rename to adminapi/src/main/java/io/minio/admin/messages/Objects.java index 7bee33ed2..0ae8a6b70 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/Objects.java +++ b/adminapi/src/main/java/io/minio/admin/messages/Objects.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.clusterinfo; +package io.minio.admin.messages; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/ServerProperties.java b/adminapi/src/main/java/io/minio/admin/messages/ServerProperties.java similarity index 98% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/ServerProperties.java rename to adminapi/src/main/java/io/minio/admin/messages/ServerProperties.java index 10a8e9172..9ba9a1eb0 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/ServerProperties.java +++ b/adminapi/src/main/java/io/minio/admin/messages/ServerProperties.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.clusterinfo; +package io.minio.admin.messages; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/TimedAction.java b/adminapi/src/main/java/io/minio/admin/messages/TimedAction.java similarity index 97% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/TimedAction.java rename to adminapi/src/main/java/io/minio/admin/messages/TimedAction.java index c076dde11..2a1bf1789 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/TimedAction.java +++ b/adminapi/src/main/java/io/minio/admin/messages/TimedAction.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.clusterinfo; +package io.minio.admin.messages; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/Usage.java b/adminapi/src/main/java/io/minio/admin/messages/Usage.java similarity index 97% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/Usage.java rename to adminapi/src/main/java/io/minio/admin/messages/Usage.java index 4aab967c7..23e42880a 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/Usage.java +++ b/adminapi/src/main/java/io/minio/admin/messages/Usage.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.clusterinfo; +package io.minio.admin.messages; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/clusterinfo/Versions.java b/adminapi/src/main/java/io/minio/admin/messages/Versions.java similarity index 97% rename from adminapi/src/main/java/io/minio/admin/clusterinfo/Versions.java rename to adminapi/src/main/java/io/minio/admin/messages/Versions.java index e43cb52c1..d2de645c2 100644 --- a/adminapi/src/main/java/io/minio/admin/clusterinfo/Versions.java +++ b/adminapi/src/main/java/io/minio/admin/messages/Versions.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.clusterinfo; +package io.minio.admin.messages; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; From ef13f166b26a668f8e7922f33360faca88ca35ed Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Thu, 6 Jul 2023 09:33:08 +0800 Subject: [PATCH 20/22] resolve conversation --- .../java/io/minio/admin/MinioAdminClient.java | 2 +- .../admin/messages/{ => info}/Backend.java | 2 +- .../admin/messages/{ => info}/Buckets.java | 2 +- .../minio/admin/messages/{ => info}/Disk.java | 2 +- .../messages/{ => info}/DiskMetrics.java | 2 +- .../messages/{ => info}/ErasureSetInfo.java | 2 +- .../admin/messages/{ => info}/GCStats.java | 2 +- .../messages/{ => info}/HealingDisk.java | 2 +- .../admin/messages/{ => info}/MemStats.java | 2 +- .../admin/messages/{ => info}/Message.java | 2 +- .../admin/messages/{ => info}/Objects.java | 2 +- .../messages/{ => info}/ServerProperties.java | 2 +- .../messages/{ => info}/TimedAction.java | 2 +- .../admin/messages/{ => info}/Usage.java | 2 +- .../admin/messages/{ => info}/Versions.java | 2 +- .../admin/messages/info/MessageTest.java | 52 ++++ .../src/test/resources/messages/message.json | 286 ++++++++++++++++++ 17 files changed, 353 insertions(+), 15 deletions(-) rename adminapi/src/main/java/io/minio/admin/messages/{ => info}/Backend.java (98%) rename adminapi/src/main/java/io/minio/admin/messages/{ => info}/Buckets.java (96%) rename adminapi/src/main/java/io/minio/admin/messages/{ => info}/Disk.java (99%) rename adminapi/src/main/java/io/minio/admin/messages/{ => info}/DiskMetrics.java (97%) rename adminapi/src/main/java/io/minio/admin/messages/{ => info}/ErasureSetInfo.java (98%) rename adminapi/src/main/java/io/minio/admin/messages/{ => info}/GCStats.java (97%) rename adminapi/src/main/java/io/minio/admin/messages/{ => info}/HealingDisk.java (99%) rename adminapi/src/main/java/io/minio/admin/messages/{ => info}/MemStats.java (97%) rename adminapi/src/main/java/io/minio/admin/messages/{ => info}/Message.java (98%) rename adminapi/src/main/java/io/minio/admin/messages/{ => info}/Objects.java (96%) rename adminapi/src/main/java/io/minio/admin/messages/{ => info}/ServerProperties.java (98%) rename adminapi/src/main/java/io/minio/admin/messages/{ => info}/TimedAction.java (97%) rename adminapi/src/main/java/io/minio/admin/messages/{ => info}/Usage.java (96%) rename adminapi/src/main/java/io/minio/admin/messages/{ => info}/Versions.java (96%) create mode 100644 adminapi/src/test/java/io/minio/admin/messages/info/MessageTest.java create mode 100644 adminapi/src/test/resources/messages/message.json diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index 5117d8985..33b15af33 100644 --- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java +++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java @@ -31,7 +31,7 @@ import io.minio.Signer; import io.minio.Time; import io.minio.admin.messages.DataUsageInfo; -import io.minio.admin.messages.Message; +import io.minio.admin.messages.info.Message; import io.minio.credentials.Credentials; import io.minio.credentials.Provider; import io.minio.credentials.StaticProvider; diff --git a/adminapi/src/main/java/io/minio/admin/messages/Backend.java b/adminapi/src/main/java/io/minio/admin/messages/info/Backend.java similarity index 98% rename from adminapi/src/main/java/io/minio/admin/messages/Backend.java rename to adminapi/src/main/java/io/minio/admin/messages/info/Backend.java index 9524ceae2..ae9f08319 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/Backend.java +++ b/adminapi/src/main/java/io/minio/admin/messages/info/Backend.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.messages; +package io.minio.admin.messages.info; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/messages/Buckets.java b/adminapi/src/main/java/io/minio/admin/messages/info/Buckets.java similarity index 96% rename from adminapi/src/main/java/io/minio/admin/messages/Buckets.java rename to adminapi/src/main/java/io/minio/admin/messages/info/Buckets.java index 777498671..54b16037c 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/Buckets.java +++ b/adminapi/src/main/java/io/minio/admin/messages/info/Buckets.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.messages; +package io.minio.admin.messages.info; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/messages/Disk.java b/adminapi/src/main/java/io/minio/admin/messages/info/Disk.java similarity index 99% rename from adminapi/src/main/java/io/minio/admin/messages/Disk.java rename to adminapi/src/main/java/io/minio/admin/messages/info/Disk.java index 05c08645b..d6f2c39ed 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/Disk.java +++ b/adminapi/src/main/java/io/minio/admin/messages/info/Disk.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.messages; +package io.minio.admin.messages.info; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/messages/DiskMetrics.java b/adminapi/src/main/java/io/minio/admin/messages/info/DiskMetrics.java similarity index 97% rename from adminapi/src/main/java/io/minio/admin/messages/DiskMetrics.java rename to adminapi/src/main/java/io/minio/admin/messages/info/DiskMetrics.java index dfa0e94e6..bdcd2de75 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/DiskMetrics.java +++ b/adminapi/src/main/java/io/minio/admin/messages/info/DiskMetrics.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.messages; +package io.minio.admin.messages.info; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Collections; diff --git a/adminapi/src/main/java/io/minio/admin/messages/ErasureSetInfo.java b/adminapi/src/main/java/io/minio/admin/messages/info/ErasureSetInfo.java similarity index 98% rename from adminapi/src/main/java/io/minio/admin/messages/ErasureSetInfo.java rename to adminapi/src/main/java/io/minio/admin/messages/info/ErasureSetInfo.java index 28d20ac9c..5b8102eec 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/ErasureSetInfo.java +++ b/adminapi/src/main/java/io/minio/admin/messages/info/ErasureSetInfo.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.messages; +package io.minio.admin.messages.info; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/messages/GCStats.java b/adminapi/src/main/java/io/minio/admin/messages/info/GCStats.java similarity index 97% rename from adminapi/src/main/java/io/minio/admin/messages/GCStats.java rename to adminapi/src/main/java/io/minio/admin/messages/info/GCStats.java index 2e6a4fd61..d2d9d9cd8 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/GCStats.java +++ b/adminapi/src/main/java/io/minio/admin/messages/info/GCStats.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.messages; +package io.minio.admin.messages.info; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/messages/HealingDisk.java b/adminapi/src/main/java/io/minio/admin/messages/info/HealingDisk.java similarity index 99% rename from adminapi/src/main/java/io/minio/admin/messages/HealingDisk.java rename to adminapi/src/main/java/io/minio/admin/messages/info/HealingDisk.java index ef28683e4..e87eb42a7 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/HealingDisk.java +++ b/adminapi/src/main/java/io/minio/admin/messages/info/HealingDisk.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.messages; +package io.minio.admin.messages.info; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/messages/MemStats.java b/adminapi/src/main/java/io/minio/admin/messages/info/MemStats.java similarity index 97% rename from adminapi/src/main/java/io/minio/admin/messages/MemStats.java rename to adminapi/src/main/java/io/minio/admin/messages/info/MemStats.java index 795e93d24..1f692e9d1 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/MemStats.java +++ b/adminapi/src/main/java/io/minio/admin/messages/info/MemStats.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.messages; +package io.minio.admin.messages.info; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/messages/Message.java b/adminapi/src/main/java/io/minio/admin/messages/info/Message.java similarity index 98% rename from adminapi/src/main/java/io/minio/admin/messages/Message.java rename to adminapi/src/main/java/io/minio/admin/messages/info/Message.java index 6a643ed6d..9db058015 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/Message.java +++ b/adminapi/src/main/java/io/minio/admin/messages/info/Message.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.messages; +package io.minio.admin.messages.info; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/messages/Objects.java b/adminapi/src/main/java/io/minio/admin/messages/info/Objects.java similarity index 96% rename from adminapi/src/main/java/io/minio/admin/messages/Objects.java rename to adminapi/src/main/java/io/minio/admin/messages/info/Objects.java index 0ae8a6b70..0e072260b 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/Objects.java +++ b/adminapi/src/main/java/io/minio/admin/messages/info/Objects.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.messages; +package io.minio.admin.messages.info; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/messages/ServerProperties.java b/adminapi/src/main/java/io/minio/admin/messages/info/ServerProperties.java similarity index 98% rename from adminapi/src/main/java/io/minio/admin/messages/ServerProperties.java rename to adminapi/src/main/java/io/minio/admin/messages/info/ServerProperties.java index 9ba9a1eb0..0b33dc282 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/ServerProperties.java +++ b/adminapi/src/main/java/io/minio/admin/messages/info/ServerProperties.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.messages; +package io.minio.admin.messages.info; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/messages/TimedAction.java b/adminapi/src/main/java/io/minio/admin/messages/info/TimedAction.java similarity index 97% rename from adminapi/src/main/java/io/minio/admin/messages/TimedAction.java rename to adminapi/src/main/java/io/minio/admin/messages/info/TimedAction.java index 2a1bf1789..f1cde4185 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/TimedAction.java +++ b/adminapi/src/main/java/io/minio/admin/messages/info/TimedAction.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.messages; +package io.minio.admin.messages.info; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/messages/Usage.java b/adminapi/src/main/java/io/minio/admin/messages/info/Usage.java similarity index 96% rename from adminapi/src/main/java/io/minio/admin/messages/Usage.java rename to adminapi/src/main/java/io/minio/admin/messages/info/Usage.java index 23e42880a..fa24ede7b 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/Usage.java +++ b/adminapi/src/main/java/io/minio/admin/messages/info/Usage.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.messages; +package io.minio.admin.messages.info; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/main/java/io/minio/admin/messages/Versions.java b/adminapi/src/main/java/io/minio/admin/messages/info/Versions.java similarity index 96% rename from adminapi/src/main/java/io/minio/admin/messages/Versions.java rename to adminapi/src/main/java/io/minio/admin/messages/info/Versions.java index d2de645c2..67efc6fc2 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/Versions.java +++ b/adminapi/src/main/java/io/minio/admin/messages/info/Versions.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package io.minio.admin.messages; +package io.minio.admin.messages.info; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/adminapi/src/test/java/io/minio/admin/messages/info/MessageTest.java b/adminapi/src/test/java/io/minio/admin/messages/info/MessageTest.java new file mode 100644 index 000000000..46968474c --- /dev/null +++ b/adminapi/src/test/java/io/minio/admin/messages/info/MessageTest.java @@ -0,0 +1,52 @@ +/* + * 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.messages.info; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import io.minio.admin.messages.DataUsageInfo; +import org.junit.Assert; +import org.junit.Test; + +import java.io.File; +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.ZoneOffset; + +public class MessageTest { + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + static { + OBJECT_MAPPER.registerModule(new JavaTimeModule()); + } + + @Test + public void deserializeTest() throws IOException { + + Message message = + OBJECT_MAPPER.readValue( + new File( + getClass().getClassLoader().getResource("messages/message.json").getFile()), + Message.class); + Assert.assertNotNull(message.mode()); + Assert.assertNotNull(message.deploymentID()); + + Assert.assertEquals(3, message.buckets().count().intValue()); + Assert.assertEquals(3, message.servers().size()); + } +} diff --git a/adminapi/src/test/resources/messages/message.json b/adminapi/src/test/resources/messages/message.json new file mode 100644 index 000000000..3eec415e0 --- /dev/null +++ b/adminapi/src/test/resources/messages/message.json @@ -0,0 +1,286 @@ +{ + "mode":"online", + "deploymentID":"0a59fb49-3ed1-4048-bbe4-c4100fceb07e", + "buckets":{ + "count":3, + "error":null + }, + "objects":{ + "count":211642, + "error":null + }, + "versions":null, + "usage":{ + "size":423284000, + "error":null + }, + "backend":{ + "backendType":"Erasure", + "onlineDisks":6, + "offlineDisks":null, + "standardSCParity":3, + "rrSCParity":2, + "totalSets":null, + "totalDrivesPerSet":null + }, + "servers":[ + { + "state":"online", + "endpoint":"minio-1.minio-headless.kube-system.svc.cluster.local:8989", + "scheme":null, + "uptime":15, + "version":"2021-03-17T02-33-02Z", + "commitID":"e197800f9055489415b53cf137e31e194aaf7ba0", + "network":{ + "minio-0.minio-headless.kube-system.svc.cluster.local:8989":"online", + "minio-1.minio-headless.kube-system.svc.cluster.local:8989":"online", + "minio-2.minio-headless.kube-system.svc.cluster.local:8989":"online" + }, + "drives":[ + { + "endpoint":"https://minio-1.minio-headless.kube-system.svc.cluster.local:8989/export1", + "rootDisk":true, + "path":"/export1", + "healing":true, + "scanning":false, + "state":"ok", + "uuid":"66be42e4-1474-4f75-8c89-5cd916cc72b2", + "major":null, + "minor":null, + "model":null, + "totalspace":53660876800, + "usedspace":413777920, + "availspace":53247098880, + "readthroughput":null, + "writethroughput":null, + "readlatency":null, + "writelatency":null, + "utilization":null, + "metrics":null, + "heal_info":{ + "id":"66be42e4-1474-4f75-8c89-5cd916cc72b2", + "heal_id":null, + "pool_index":0, + "set_index":0, + "disk_index":1, + "endpoint":"https://minio-1.minio-headless.kube-system.svc.cluster.local:8989/export1", + "path":"/export1", + "started":"2023-07-03T09:33:52.326206307Z", + "last_update":"2023-07-03T09:34:02.610125624Z", + "objects_total_count":null, + "objects_total_size":null, + "items_healed":null, + "items_failed":null, + "bytes_done":7646100, + "bytes_failed":0, + "objects_healed":12, + "objects_failed":0, + "current_bucket":".minio.sys/buckets", + "current_object":"zekaifeng2/.usage-cache.bin", + "queued_buckets":[ + "zekaifeng2", + "zekaifeng1", + "zekaifeng" + ], + "healed_buckets":[ + ".minio.sys/config", + ".minio.sys/buckets" + ] + }, + "used_inodes":null, + "free_inodes":null, + "pool_index":0, + "set_index":0, + "disk_index":1 + }, + { + "endpoint":"https://minio-1.minio-headless.kube-system.svc.cluster.local:8989/export2", + "rootDisk":true, + "path":"/export2", + "healing":false, + "scanning":false, + "state":"ok", + "uuid":"3de15615-789d-4ce2-9e6b-7a4a1d999630", + "major":null, + "minor":null, + "model":null, + "totalspace":53660876800, + "usedspace":5646413824, + "availspace":48014462976, + "readthroughput":null, + "writethroughput":null, + "readlatency":null, + "writelatency":null, + "utilization":null, + "metrics":null, + "heal_info":null, + "used_inodes":null, + "free_inodes":null, + "pool_index":0, + "set_index":0, + "disk_index":4 + } + ], + "poolNumber":1, + "mem_stats":null, + "go_max_procs":null, + "num_cpu":null, + "runtime_version":null, + "gc_stats":null, + "minio_env_vars":null + }, + { + "state":"online", + "endpoint":"minio-2.minio-headless.kube-system.svc.cluster.local:8989", + "scheme":null, + "uptime":2149013, + "version":"2021-03-17T02-33-02Z", + "commitID":"e197800f9055489415b53cf137e31e194aaf7ba0", + "network":{ + "minio-0.minio-headless.kube-system.svc.cluster.local:8989":"online", + "minio-1.minio-headless.kube-system.svc.cluster.local:8989":"online", + "minio-2.minio-headless.kube-system.svc.cluster.local:8989":"online" + }, + "drives":[ + { + "endpoint":"https://minio-2.minio-headless.kube-system.svc.cluster.local:8989/export2", + "rootDisk":true, + "path":"/export2", + "healing":false, + "scanning":false, + "state":"ok", + "uuid":"e964ca9a-5d1c-4c96-b64d-dbef6ee2f2d9", + "major":null, + "minor":null, + "model":null, + "totalspace":53660876800, + "usedspace":5647269888, + "availspace":48013606912, + "readthroughput":null, + "writethroughput":null, + "readlatency":null, + "writelatency":null, + "utilization":null, + "metrics":null, + "heal_info":null, + "used_inodes":null, + "free_inodes":null, + "pool_index":0, + "set_index":0, + "disk_index":5 + }, + { + "endpoint":"https://minio-2.minio-headless.kube-system.svc.cluster.local:8989/export1", + "rootDisk":true, + "path":"/export1", + "healing":false, + "scanning":false, + "state":"ok", + "uuid":"c5b3ea80-2688-47c1-aa8a-6136aea815d8", + "major":null, + "minor":null, + "model":null, + "totalspace":64393052160, + "usedspace":5722112000, + "availspace":58670940160, + "readthroughput":null, + "writethroughput":null, + "readlatency":null, + "writelatency":null, + "utilization":null, + "metrics":null, + "heal_info":null, + "used_inodes":null, + "free_inodes":null, + "pool_index":0, + "set_index":0, + "disk_index":2 + } + ], + "poolNumber":1, + "mem_stats":null, + "go_max_procs":null, + "num_cpu":null, + "runtime_version":null, + "gc_stats":null, + "minio_env_vars":null + }, + { + "state":"online", + "endpoint":"minio-0.minio-headless.kube-system.svc.cluster.local:8989", + "scheme":null, + "uptime":2149015, + "version":"2021-03-17T02-33-02Z", + "commitID":"e197800f9055489415b53cf137e31e194aaf7ba0", + "network":{ + "minio-0.minio-headless.kube-system.svc.cluster.local:8989":"online", + "minio-1.minio-headless.kube-system.svc.cluster.local:8989":"online", + "minio-2.minio-headless.kube-system.svc.cluster.local:8989":"online" + }, + "drives":[ + { + "endpoint":"https://minio-0.minio-headless.kube-system.svc.cluster.local:8989/export2", + "rootDisk":true, + "path":"/export2", + "healing":false, + "scanning":false, + "state":"ok", + "uuid":"b673dbfa-b5cb-4c41-a5e1-178c759df69e", + "major":null, + "minor":null, + "model":null, + "totalspace":53660876800, + "usedspace":5647257600, + "availspace":48013619200, + "readthroughput":null, + "writethroughput":null, + "readlatency":null, + "writelatency":null, + "utilization":null, + "metrics":null, + "heal_info":null, + "used_inodes":null, + "free_inodes":null, + "pool_index":0, + "set_index":0, + "disk_index":3 + }, + { + "endpoint":"https://minio-0.minio-headless.kube-system.svc.cluster.local:8989/export1", + "rootDisk":true, + "path":"/export1", + "healing":false, + "scanning":false, + "state":"ok", + "uuid":"20b3ca09-329b-466c-83c3-f6bc0c92869c", + "major":null, + "minor":null, + "model":null, + "totalspace":85857402880, + "usedspace":5871828992, + "availspace":79985573888, + "readthroughput":null, + "writethroughput":null, + "readlatency":null, + "writelatency":null, + "utilization":null, + "metrics":null, + "heal_info":null, + "used_inodes":null, + "free_inodes":null, + "pool_index":0, + "set_index":0, + "disk_index":0 + } + ], + "poolNumber":1, + "mem_stats":null, + "go_max_procs":null, + "num_cpu":null, + "runtime_version":null, + "gc_stats":null, + "minio_env_vars":null + } + ], + "pools":null +} From 9b5d339cafd3ea465a213be87fb6faf7a8b29142 Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Thu, 6 Jul 2023 09:41:27 +0800 Subject: [PATCH 21/22] fix ci --- .../main/java/io/minio/admin/MinioAdminClient.java | 3 +-- .../java/io/minio/admin/messages/info/Message.java | 1 - .../io/minio/admin/messages/info/MessageTest.java | 11 +++-------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index 33b15af33..c48b2b2f9 100644 --- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java +++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java @@ -607,8 +607,7 @@ public DataUsageInfo getDataUsageInfo() * @throws InvalidKeyException thrown to indicate missing of HMAC SHA-256 library. * @throws IOException thrown to indicate I/O error on MinIO REST operation. */ - public Message getServerInfo() - throws IOException, NoSuchAlgorithmException, InvalidKeyException { + public Message getServerInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException { try (Response response = execute(Method.GET, Command.INFO, null, null)) { return OBJECT_MAPPER.readValue(response.body().charStream(), Message.class); } diff --git a/adminapi/src/main/java/io/minio/admin/messages/info/Message.java b/adminapi/src/main/java/io/minio/admin/messages/info/Message.java index 9db058015..1515ddfc6 100644 --- a/adminapi/src/main/java/io/minio/admin/messages/info/Message.java +++ b/adminapi/src/main/java/io/minio/admin/messages/info/Message.java @@ -19,7 +19,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; - import java.util.Collections; import java.util.LinkedList; import java.util.List; diff --git a/adminapi/src/test/java/io/minio/admin/messages/info/MessageTest.java b/adminapi/src/test/java/io/minio/admin/messages/info/MessageTest.java index 46968474c..5ce5604d9 100644 --- a/adminapi/src/test/java/io/minio/admin/messages/info/MessageTest.java +++ b/adminapi/src/test/java/io/minio/admin/messages/info/MessageTest.java @@ -19,14 +19,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import io.minio.admin.messages.DataUsageInfo; -import org.junit.Assert; -import org.junit.Test; - import java.io.File; import java.io.IOException; -import java.time.LocalDateTime; -import java.time.ZoneOffset; +import org.junit.Assert; +import org.junit.Test; public class MessageTest { private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); @@ -40,8 +36,7 @@ public void deserializeTest() throws IOException { Message message = OBJECT_MAPPER.readValue( - new File( - getClass().getClassLoader().getResource("messages/message.json").getFile()), + new File(getClass().getClassLoader().getResource("messages/message.json").getFile()), Message.class); Assert.assertNotNull(message.mode()); Assert.assertNotNull(message.deploymentID()); From 891242e464982ca973c128f1d70e2c88f8f573b0 Mon Sep 17 00:00:00 2001 From: dormanze <37854724+dormanze@users.noreply.github.com> Date: Thu, 6 Jul 2023 12:25:28 +0800 Subject: [PATCH 22/22] Remove test file --- .../admin/messages/info/MessageTest.java | 47 --- .../src/test/resources/messages/message.json | 286 ------------------ 2 files changed, 333 deletions(-) delete mode 100644 adminapi/src/test/java/io/minio/admin/messages/info/MessageTest.java delete mode 100644 adminapi/src/test/resources/messages/message.json diff --git a/adminapi/src/test/java/io/minio/admin/messages/info/MessageTest.java b/adminapi/src/test/java/io/minio/admin/messages/info/MessageTest.java deleted file mode 100644 index 5ce5604d9..000000000 --- a/adminapi/src/test/java/io/minio/admin/messages/info/MessageTest.java +++ /dev/null @@ -1,47 +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.messages.info; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import java.io.File; -import java.io.IOException; -import org.junit.Assert; -import org.junit.Test; - -public class MessageTest { - private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); - - static { - OBJECT_MAPPER.registerModule(new JavaTimeModule()); - } - - @Test - public void deserializeTest() throws IOException { - - Message message = - OBJECT_MAPPER.readValue( - new File(getClass().getClassLoader().getResource("messages/message.json").getFile()), - Message.class); - Assert.assertNotNull(message.mode()); - Assert.assertNotNull(message.deploymentID()); - - Assert.assertEquals(3, message.buckets().count().intValue()); - Assert.assertEquals(3, message.servers().size()); - } -} diff --git a/adminapi/src/test/resources/messages/message.json b/adminapi/src/test/resources/messages/message.json deleted file mode 100644 index 3eec415e0..000000000 --- a/adminapi/src/test/resources/messages/message.json +++ /dev/null @@ -1,286 +0,0 @@ -{ - "mode":"online", - "deploymentID":"0a59fb49-3ed1-4048-bbe4-c4100fceb07e", - "buckets":{ - "count":3, - "error":null - }, - "objects":{ - "count":211642, - "error":null - }, - "versions":null, - "usage":{ - "size":423284000, - "error":null - }, - "backend":{ - "backendType":"Erasure", - "onlineDisks":6, - "offlineDisks":null, - "standardSCParity":3, - "rrSCParity":2, - "totalSets":null, - "totalDrivesPerSet":null - }, - "servers":[ - { - "state":"online", - "endpoint":"minio-1.minio-headless.kube-system.svc.cluster.local:8989", - "scheme":null, - "uptime":15, - "version":"2021-03-17T02-33-02Z", - "commitID":"e197800f9055489415b53cf137e31e194aaf7ba0", - "network":{ - "minio-0.minio-headless.kube-system.svc.cluster.local:8989":"online", - "minio-1.minio-headless.kube-system.svc.cluster.local:8989":"online", - "minio-2.minio-headless.kube-system.svc.cluster.local:8989":"online" - }, - "drives":[ - { - "endpoint":"https://minio-1.minio-headless.kube-system.svc.cluster.local:8989/export1", - "rootDisk":true, - "path":"/export1", - "healing":true, - "scanning":false, - "state":"ok", - "uuid":"66be42e4-1474-4f75-8c89-5cd916cc72b2", - "major":null, - "minor":null, - "model":null, - "totalspace":53660876800, - "usedspace":413777920, - "availspace":53247098880, - "readthroughput":null, - "writethroughput":null, - "readlatency":null, - "writelatency":null, - "utilization":null, - "metrics":null, - "heal_info":{ - "id":"66be42e4-1474-4f75-8c89-5cd916cc72b2", - "heal_id":null, - "pool_index":0, - "set_index":0, - "disk_index":1, - "endpoint":"https://minio-1.minio-headless.kube-system.svc.cluster.local:8989/export1", - "path":"/export1", - "started":"2023-07-03T09:33:52.326206307Z", - "last_update":"2023-07-03T09:34:02.610125624Z", - "objects_total_count":null, - "objects_total_size":null, - "items_healed":null, - "items_failed":null, - "bytes_done":7646100, - "bytes_failed":0, - "objects_healed":12, - "objects_failed":0, - "current_bucket":".minio.sys/buckets", - "current_object":"zekaifeng2/.usage-cache.bin", - "queued_buckets":[ - "zekaifeng2", - "zekaifeng1", - "zekaifeng" - ], - "healed_buckets":[ - ".minio.sys/config", - ".minio.sys/buckets" - ] - }, - "used_inodes":null, - "free_inodes":null, - "pool_index":0, - "set_index":0, - "disk_index":1 - }, - { - "endpoint":"https://minio-1.minio-headless.kube-system.svc.cluster.local:8989/export2", - "rootDisk":true, - "path":"/export2", - "healing":false, - "scanning":false, - "state":"ok", - "uuid":"3de15615-789d-4ce2-9e6b-7a4a1d999630", - "major":null, - "minor":null, - "model":null, - "totalspace":53660876800, - "usedspace":5646413824, - "availspace":48014462976, - "readthroughput":null, - "writethroughput":null, - "readlatency":null, - "writelatency":null, - "utilization":null, - "metrics":null, - "heal_info":null, - "used_inodes":null, - "free_inodes":null, - "pool_index":0, - "set_index":0, - "disk_index":4 - } - ], - "poolNumber":1, - "mem_stats":null, - "go_max_procs":null, - "num_cpu":null, - "runtime_version":null, - "gc_stats":null, - "minio_env_vars":null - }, - { - "state":"online", - "endpoint":"minio-2.minio-headless.kube-system.svc.cluster.local:8989", - "scheme":null, - "uptime":2149013, - "version":"2021-03-17T02-33-02Z", - "commitID":"e197800f9055489415b53cf137e31e194aaf7ba0", - "network":{ - "minio-0.minio-headless.kube-system.svc.cluster.local:8989":"online", - "minio-1.minio-headless.kube-system.svc.cluster.local:8989":"online", - "minio-2.minio-headless.kube-system.svc.cluster.local:8989":"online" - }, - "drives":[ - { - "endpoint":"https://minio-2.minio-headless.kube-system.svc.cluster.local:8989/export2", - "rootDisk":true, - "path":"/export2", - "healing":false, - "scanning":false, - "state":"ok", - "uuid":"e964ca9a-5d1c-4c96-b64d-dbef6ee2f2d9", - "major":null, - "minor":null, - "model":null, - "totalspace":53660876800, - "usedspace":5647269888, - "availspace":48013606912, - "readthroughput":null, - "writethroughput":null, - "readlatency":null, - "writelatency":null, - "utilization":null, - "metrics":null, - "heal_info":null, - "used_inodes":null, - "free_inodes":null, - "pool_index":0, - "set_index":0, - "disk_index":5 - }, - { - "endpoint":"https://minio-2.minio-headless.kube-system.svc.cluster.local:8989/export1", - "rootDisk":true, - "path":"/export1", - "healing":false, - "scanning":false, - "state":"ok", - "uuid":"c5b3ea80-2688-47c1-aa8a-6136aea815d8", - "major":null, - "minor":null, - "model":null, - "totalspace":64393052160, - "usedspace":5722112000, - "availspace":58670940160, - "readthroughput":null, - "writethroughput":null, - "readlatency":null, - "writelatency":null, - "utilization":null, - "metrics":null, - "heal_info":null, - "used_inodes":null, - "free_inodes":null, - "pool_index":0, - "set_index":0, - "disk_index":2 - } - ], - "poolNumber":1, - "mem_stats":null, - "go_max_procs":null, - "num_cpu":null, - "runtime_version":null, - "gc_stats":null, - "minio_env_vars":null - }, - { - "state":"online", - "endpoint":"minio-0.minio-headless.kube-system.svc.cluster.local:8989", - "scheme":null, - "uptime":2149015, - "version":"2021-03-17T02-33-02Z", - "commitID":"e197800f9055489415b53cf137e31e194aaf7ba0", - "network":{ - "minio-0.minio-headless.kube-system.svc.cluster.local:8989":"online", - "minio-1.minio-headless.kube-system.svc.cluster.local:8989":"online", - "minio-2.minio-headless.kube-system.svc.cluster.local:8989":"online" - }, - "drives":[ - { - "endpoint":"https://minio-0.minio-headless.kube-system.svc.cluster.local:8989/export2", - "rootDisk":true, - "path":"/export2", - "healing":false, - "scanning":false, - "state":"ok", - "uuid":"b673dbfa-b5cb-4c41-a5e1-178c759df69e", - "major":null, - "minor":null, - "model":null, - "totalspace":53660876800, - "usedspace":5647257600, - "availspace":48013619200, - "readthroughput":null, - "writethroughput":null, - "readlatency":null, - "writelatency":null, - "utilization":null, - "metrics":null, - "heal_info":null, - "used_inodes":null, - "free_inodes":null, - "pool_index":0, - "set_index":0, - "disk_index":3 - }, - { - "endpoint":"https://minio-0.minio-headless.kube-system.svc.cluster.local:8989/export1", - "rootDisk":true, - "path":"/export1", - "healing":false, - "scanning":false, - "state":"ok", - "uuid":"20b3ca09-329b-466c-83c3-f6bc0c92869c", - "major":null, - "minor":null, - "model":null, - "totalspace":85857402880, - "usedspace":5871828992, - "availspace":79985573888, - "readthroughput":null, - "writethroughput":null, - "readlatency":null, - "writelatency":null, - "utilization":null, - "metrics":null, - "heal_info":null, - "used_inodes":null, - "free_inodes":null, - "pool_index":0, - "set_index":0, - "disk_index":0 - } - ], - "poolNumber":1, - "mem_stats":null, - "go_max_procs":null, - "num_cpu":null, - "runtime_version":null, - "gc_stats":null, - "minio_env_vars":null - } - ], - "pools":null -}