getUrl获取文件访问链接接口:传入参数path和bucket,返回可以访问的链接(7天有效)。这里的path就是上传文件的返回值fileName。 @RequestMapping("minio") @RestController public class MinioController { @Resource private MinioClient minioClient; @PostMapping(value = "upload", consumes = MediaType.MULTIPART_FORM_...
Stringfilename,intseconds,StringpublicBaseUrl){GetPresignedObjectUrlArgsbuild=GetPresignedObjectUrlArgs.builder().method(Method.GET).bucket(bucket).object(filename).expiry(seconds).build();returnclient.getPresignedObjectUrl(build,publicBaseUrl);}}
Set policy to "public" for bucket with prefix on Amazon S3 cloud storage. $ mc policy set public s3/public-commons/images Set a custom prefix based bucket policy on Amazon S3 cloud storage using a JSON file. $ mc policy set-json /path/to/policy.json s3/public-commons/images Get bucket...
public class UploadResponse { private String minIoUrl; private String nginxUrl; public UploadResponse() { } public UploadResponse(String minIoUrl, String nginxUrl) { this.minIoUrl = minIoUrl; this.nginxUrl = nginxUrl; } public String getMinIoUrl() { return minIoUrl; } public void setMinIoU...
build(); } public void readCsvFromMinio(String bucketName, String objectName) throws MinioException, NoSuchAlgorithmException, InvalidKeyException, IOException, CsvValidationException { // Generate pre-signed URL for object download String url = minioClient.getPresignedObjectUrl( GetPresignedObjectUrlArgs....
Config.getUrl()) .credentials(minioConfig.getAccessKey(), minioConfig.getSecretKey()) .build(); // 检测 bucket 是否存在 bucketName = minioConfig.getBucketName(); bucketExists(bucketName); } } /** * 根据 bucketName 检测是否存在 不存在则创建 * * @param bucketName 名称 */ public void ...
1、引入Nuget包 Minio.AspNetCore 2、配置json文件 "Minio": {"Endpoint":"127.0.0.1:9000","Region":"127.0.0.1","AccessKey":"minioadmin","SecretKey":"minioadmin","BucketName":"omsfile","FileURL":"http://127.0.0.1:9000/file"} 3、添加服务 ...
4.2 使用预签名URL 预签名URL允许临时访问对象,无需暴露访问密钥: 代码语言:java 复制 importio.minio.GeneratePresignedUrlArgs;publicStringgeneratePresignedUrl(MinioClientminioClient,StringbucketName,StringobjectName)throwsException{returnminioClient.getPresignedObjectUrl(GeneratePresignedUrlArgs.builder().bucket(bucke...
public String getUrl() { return url; } public void setUrl(String url) { this.url =url; } public String getAccessKey() { return accessKey; } public void setAccessKey(String accessKey) { this.accessKey =accessKey; } public String getSecretKey() ...
* 获取文件的url * *@paramfileName *@return*/@SneakyThrowspublicStringgetUrl(String bucketName, String fileName){GetPresignedObjectUrlArgsbuild=GetPresignedObjectUrlArgs.builder().bucket(bucketName).object(fileName).method(Method.GET).build();returnminioClient.getPresignedObjectUrl(build); ...