Java Code Examples for io.minio.MinioClient#removeObject()

The following examples show how to use io.minio.MinioClient#removeObject() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MinIOFileManage.java    From sk-admin with Apache License 2.0 5 votes vote down vote up
@Override
public void deleteFile(String key) {

    OssSetting os = getOssSetting();
    try {
        MinioClient minioClient = new MinioClient(os.getHttp() + os.getEndpoint(), os.getAccessKey(), os.getSecretKey());
        checkBucket(os, minioClient);
        minioClient.removeObject(os.getBucket(), key);
    } catch (Exception e) {
        throw new SkException("删除文件出错,请检查MinIO配置");
    }
}
 
Example 2
Source File: MinioController.java    From mall-learning with Apache License 2.0 5 votes vote down vote up
@ApiOperation("文件删除")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("objectName") String objectName) {
    try {
        MinioClient minioClient = new MinioClient(ENDPOINT, ACCESS_KEY, SECRET_KEY);
        minioClient.removeObject(BUCKET_NAME, objectName);
        return CommonResult.success(null);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return CommonResult.failed();
}
 
Example 3
Source File: MinioController.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@ApiOperation("文件删除")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("objectName") String objectName) {
    try {
        MinioClient minioClient = new MinioClient(ENDPOINT, ACCESS_KEY, SECRET_KEY);
        minioClient.removeObject(BUCKET_NAME, objectName);
        return CommonResult.success(null);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return CommonResult.failed();
}
 
Example 4
Source File: MinioController.java    From mall with Apache License 2.0 5 votes vote down vote up
@ApiOperation("文件删除")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("objectName") String objectName) {
    try {
        MinioClient minioClient = new MinioClient(ENDPOINT, ACCESS_KEY, SECRET_KEY);
        minioClient.removeObject(BUCKET_NAME, objectName);
        return CommonResult.success(null);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return CommonResult.failed();
}
 
Example 5
Source File: AdminStorageAction.java    From fess with Apache License 2.0 5 votes vote down vote up
public static void deleteObject(final String objectName) {
    try {
        final FessConfig fessConfig = ComponentUtil.getFessConfig();
        final MinioClient minioClient = createClient(fessConfig);
        minioClient.removeObject(fessConfig.getStorageBucket(), objectName);
    } catch (final Exception e) {
        throw new StorageException("Failed to delete " + objectName, e);
    }
}