2024年4月15日15:57:57
parent
d91801cbe6
commit
1f38db9ee4
|
|
@ -116,6 +116,7 @@ public class MinioUploadController {
|
||||||
public void init_bucket_list(){
|
public void init_bucket_list(){
|
||||||
backet_item_list.clear();
|
backet_item_list.clear();
|
||||||
//获取所有储存桶
|
//获取所有储存桶
|
||||||
|
MinioUtils.getDefault();
|
||||||
List<Bucket> buckets = MinioUtils.getAllBuckets();
|
List<Bucket> buckets = MinioUtils.getAllBuckets();
|
||||||
if (buckets.size()>0){
|
if (buckets.size()>0){
|
||||||
for (Bucket bucket : buckets) {
|
for (Bucket bucket : buckets) {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,52 @@
|
||||||
package com.zhangmeng.tools.utils;
|
package com.zhangmeng.tools.utils;
|
||||||
|
|
||||||
|
import io.minio.MinioClient;
|
||||||
|
import io.minio.errors.*;
|
||||||
|
import io.minio.messages.Bucket;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : 芊芊墨客
|
* @author : 芊芊墨客
|
||||||
* @version : 1.0
|
* @version : 1.0
|
||||||
* @date : 2023-04-27 17:49
|
* @date : 2023-04-27 17:49
|
||||||
*/
|
*/
|
||||||
public class Test {
|
public class Test {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String endpoint = "http://123.57.75.116:49002";
|
||||||
|
String accessKey = "admin";
|
||||||
|
String secretKey = "password";
|
||||||
|
MinioClient minioClient = MinioClient.builder().endpoint(endpoint.toString()).credentials(accessKey.toString(), secretKey.toString()).build();
|
||||||
|
System.out.println(minioClient);
|
||||||
|
try {
|
||||||
|
List<Bucket> allBuckets = minioClient.listBuckets();
|
||||||
|
for (Bucket bucket : allBuckets) {
|
||||||
|
System.out.println(bucket.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (ErrorResponseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InsufficientDataException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InternalException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InvalidKeyException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InvalidResponseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (ServerException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (XmlParserException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue