diff --git a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java index a2ab37789..c48b2b2f9 100644 --- a/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java +++ b/adminapi/src/main/java/io/minio/admin/MinioAdminClient.java @@ -31,6 +31,7 @@ import io.minio.Signer; import io.minio.Time; import io.minio.admin.messages.DataUsageInfo; +import io.minio.admin.messages.info.Message; import io.minio.credentials.Credentials; import io.minio.credentials.Provider; import io.minio.credentials.StaticProvider; @@ -79,7 +80,8 @@ private enum Command { DATA_USAGE_INFO("datausageinfo"), ADD_UPDATE_REMOVE_GROUP("update-group-members"), GROUP_INFO("group"), - LIST_GROUPS("groups"); + LIST_GROUPS("groups"), + INFO("info"); private final String value; private Command(String value) { @@ -597,6 +599,20 @@ 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 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); + } + } + /** * 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/messages/info/Backend.java b/adminapi/src/main/java/io/minio/admin/messages/info/Backend.java new file mode 100644 index 000000000..ae9f08319 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/messages/info/Backend.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.messages.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 Backend { + @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/messages/info/Buckets.java b/adminapi/src/main/java/io/minio/admin/messages/info/Buckets.java new file mode 100644 index 000000000..54b16037c --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/messages/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.messages.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/messages/info/Disk.java b/adminapi/src/main/java/io/minio/admin/messages/info/Disk.java new file mode 100644 index 000000000..d6f2c39ed --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/messages/info/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.messages.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/messages/info/DiskMetrics.java b/adminapi/src/main/java/io/minio/admin/messages/info/DiskMetrics.java new file mode 100644 index 000000000..bdcd2de75 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/messages/info/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.messages.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/messages/info/ErasureSetInfo.java b/adminapi/src/main/java/io/minio/admin/messages/info/ErasureSetInfo.java new file mode 100644 index 000000000..5b8102eec --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/messages/info/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.messages.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/messages/info/GCStats.java b/adminapi/src/main/java/io/minio/admin/messages/info/GCStats.java new file mode 100644 index 000000000..d2d9d9cd8 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/messages/info/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.messages.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/messages/info/HealingDisk.java b/adminapi/src/main/java/io/minio/admin/messages/info/HealingDisk.java new file mode 100644 index 000000000..e87eb42a7 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/messages/info/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.messages.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/messages/info/MemStats.java b/adminapi/src/main/java/io/minio/admin/messages/info/MemStats.java new file mode 100644 index 000000000..1f692e9d1 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/messages/info/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.messages.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/messages/info/Message.java b/adminapi/src/main/java/io/minio/admin/messages/info/Message.java new file mode 100644 index 000000000..1515ddfc6 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/messages/info/Message.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.messages.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 Message { + @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 Backend backend; + + @JsonProperty("servers") + private List servers; + + @JsonProperty("pools") + private Map> pools; + + 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 Backend backend() { + return backend; + } + + public List servers() { + return Collections.unmodifiableList(servers == null ? new LinkedList<>() : servers); + } + + public Map> pools() { + return pools; + } +} diff --git a/adminapi/src/main/java/io/minio/admin/messages/info/Objects.java b/adminapi/src/main/java/io/minio/admin/messages/info/Objects.java new file mode 100644 index 000000000..0e072260b --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/messages/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.messages.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/messages/info/ServerProperties.java b/adminapi/src/main/java/io/minio/admin/messages/info/ServerProperties.java new file mode 100644 index 000000000..0b33dc282 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/messages/info/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.messages.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/messages/info/TimedAction.java b/adminapi/src/main/java/io/minio/admin/messages/info/TimedAction.java new file mode 100644 index 000000000..f1cde4185 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/messages/info/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.messages.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/messages/info/Usage.java b/adminapi/src/main/java/io/minio/admin/messages/info/Usage.java new file mode 100644 index 000000000..fa24ede7b --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/messages/info/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.messages.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/messages/info/Versions.java b/adminapi/src/main/java/io/minio/admin/messages/info/Versions.java new file mode 100644 index 000000000..67efc6fc2 --- /dev/null +++ b/adminapi/src/main/java/io/minio/admin/messages/info/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.messages.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; + } +}