public class MinioAsyncClient extends S3Base
If access/secret keys are provided, all S3 operation requests are signed using AWS Signature Version 4; else they are performed anonymously.
Examples on using this library are available here.
Use MinioAsyncClient.builder()
to create S3 client.
// Create client with anonymous access.
MinioAsyncClient minioAsyncClient =
MinioAsyncClient.builder().endpoint("https://play.min.io").build();
// Create client with credentials.
MinioAsyncClient minioAsyncClient =
MinioAsyncClient.builder()
.endpoint("https://play.min.io")
.credentials("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG")
.build();
Modifier and Type | Class and Description |
---|---|
static class |
MinioAsyncClient.Builder
Argument builder of
MinioClient . |
S3Base.NotificationResultRecords
awsDomainSuffix, awsDualstack, awsS3Prefix, baseUrl, closeHttpClient, DEFAULT_CONNECTION_TIMEOUT, httpClient, MAX_BUCKET_POLICY_SIZE, NO_SUCH_BUCKET, NO_SUCH_BUCKET_MESSAGE, NO_SUCH_BUCKET_POLICY, NO_SUCH_OBJECT_LOCK_CONFIGURATION, provider, region, regionCache, SERVER_SIDE_ENCRYPTION_CONFIGURATION_NOT_FOUND_ERROR, US_EAST_1, useVirtualStyle
Modifier | Constructor and Description |
---|---|
protected |
MinioAsyncClient(MinioAsyncClient client) |
abortMultipartUpload, abortMultipartUploadAsync, buildUrl, calculatePartCount, calculatePartCountAsync, checkArgs, close, completeMultipartUpload, completeMultipartUploadAsync, createMultipartUpload, createMultipartUploadAsync, createRequest, deleteObjects, deleteObjectsAsync, disableAccelerateEndpoint, disableDualStackEndpoint, disableVirtualStyleEndpoint, enableAccelerateEndpoint, enableDualStackEndpoint, enableVirtualStyleEndpoint, execute, execute, executeAsync, executeAsync, executeDelete, executeDeleteAsync, executeGet, executeGetAsync, executeHead, executeHeadAsync, executePost, executePostAsync, executePut, executePutAsync, getRegion, getRegionAsync, httpHeaders, ignoreCertCheck, listMultipartUploads, listMultipartUploadsAsync, listObjectsV1, listObjectsV1, listObjectsV1Async, listObjectsV2, listObjectsV2, listObjectsV2Async, listObjectVersions, listObjectVersions, listObjectVersionsAsync, listParts, listPartsAsync, merge, newMultimap, newMultimap, newMultimap, newPartReader, putObject, putObject, putObjectAsync, putObjectAsync, setAppInfo, setAwsS3Prefix, setTimeout, statObjectAsync, throwEncapsulatedException, traceOff, traceOn, uploadPart, uploadPartAsync, uploadPartAsync, uploadPartCopy, uploadPartCopyAsync
protected MinioAsyncClient(MinioAsyncClient client)
public CompletableFuture<StatObjectResponse> statObject(StatObjectArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
// Get information of an object.
CompletableFuture<StatObjectResponse> future =
minioAsyncClient.statObject(
StatObjectArgs.builder().bucket("my-bucketname").object("my-objectname").build());
// Get information of SSE-C encrypted object.
CompletableFuture<StatObjectResponse> future =
minioAsyncClient.statObject(
StatObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.ssec(ssec)
.build());
// Get information of a versioned object.
CompletableFuture<StatObjectResponse> future =
minioAsyncClient.statObject(
StatObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.versionId("version-id")
.build());
// Get information of a SSE-C encrypted versioned object.
CompletableFuture<StatObjectResponse> future =
minioAsyncClient.statObject(
StatObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.versionId("version-id")
.ssec(ssec)
.build());
args
- StatObjectArgs
object.CompletableFuture
<StatObjectResponse
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.StatObjectResponse
public CompletableFuture<GetObjectResponse> getObject(GetObjectArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<GetObjectResponse> future = minioAsyncClient.getObject(
GetObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.offset(offset)
.length(len)
.ssec(ssec)
.build()
args
- Object of GetObjectArgs
CompletableFuture
<GetObjectResponse
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.GetObjectResponse
public CompletableFuture<Void> downloadObject(DownloadObjectArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Void> future = minioAsyncClient.downloadObject(
DownloadObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.ssec(ssec)
.filename("my-filename")
.build());
args
- Object of DownloadObjectArgs
CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<ObjectWriteResponse> copyObject(CopyObjectArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
// Create object "my-objectname" in bucket "my-bucketname" by copying from object
// "my-objectname" in bucket "my-source-bucketname".
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.copyObject(
CopyObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.source(
CopySource.builder()
.bucket("my-source-bucketname")
.object("my-objectname")
.build())
.build());
// Create object "my-objectname" in bucket "my-bucketname" by copying from object
// "my-source-objectname" in bucket "my-source-bucketname".
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.copyObject(
CopyObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.source(
CopySource.builder()
.bucket("my-source-bucketname")
.object("my-source-objectname")
.build())
.build());
// Create object "my-objectname" in bucket "my-bucketname" with SSE-KMS server-side
// encryption by copying from object "my-objectname" in bucket "my-source-bucketname".
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.copyObject(
CopyObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.source(
CopySource.builder()
.bucket("my-source-bucketname")
.object("my-objectname")
.build())
.sse(sseKms) // Replace with actual key.
.build());
// Create object "my-objectname" in bucket "my-bucketname" with SSE-S3 server-side
// encryption by copying from object "my-objectname" in bucket "my-source-bucketname".
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.copyObject(
CopyObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.source(
CopySource.builder()
.bucket("my-source-bucketname")
.object("my-objectname")
.build())
.sse(sseS3) // Replace with actual key.
.build());
// Create object "my-objectname" in bucket "my-bucketname" with SSE-C server-side encryption
// by copying from object "my-objectname" in bucket "my-source-bucketname".
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.copyObject(
CopyObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.source(
CopySource.builder()
.bucket("my-source-bucketname")
.object("my-objectname")
.build())
.sse(ssec) // Replace with actual key.
.build());
// Create object "my-objectname" in bucket "my-bucketname" by copying from SSE-C encrypted
// object "my-source-objectname" in bucket "my-source-bucketname".
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.copyObject(
CopyObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.source(
CopySource.builder()
.bucket("my-source-bucketname")
.object("my-source-objectname")
.ssec(ssec) // Replace with actual key.
.build())
.build());
// Create object "my-objectname" in bucket "my-bucketname" with custom headers conditionally
// by copying from object "my-objectname" in bucket "my-source-bucketname".
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.copyObject(
CopyObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.source(
CopySource.builder()
.bucket("my-source-bucketname")
.object("my-objectname")
.matchETag(etag) // Replace with actual etag.
.build())
.headers(headers) // Replace with actual headers.
.build());
args
- CopyObjectArgs
object.CompletableFuture
<ObjectWriteResponse
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<ObjectWriteResponse> composeObject(ComposeObjectArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
List<ComposeSource> sourceObjectList = new ArrayList<ComposeSource>();
sourceObjectList.add(
ComposeSource.builder().bucket("my-job-bucket").object("my-objectname-part-one").build());
sourceObjectList.add(
ComposeSource.builder().bucket("my-job-bucket").object("my-objectname-part-two").build());
sourceObjectList.add(
ComposeSource.builder().bucket("my-job-bucket").object("my-objectname-part-three").build());
// Create my-bucketname/my-objectname by combining source object list.
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.composeObject(
ComposeObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.sources(sourceObjectList)
.build());
// Create my-bucketname/my-objectname with user metadata by combining source object
// list.
Map<String, String> userMetadata = new HashMap<>();
userMetadata.put("My-Project", "Project One");
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.composeObject(
ComposeObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.sources(sourceObjectList)
.userMetadata(userMetadata)
.build());
// Create my-bucketname/my-objectname with user metadata and server-side encryption
// by combining source object list.
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.composeObject(
ComposeObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.sources(sourceObjectList)
.userMetadata(userMetadata)
.ssec(sse)
.build());
args
- ComposeObjectArgs
object.CompletableFuture
<ObjectWriteResponse
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public String getPresignedObjectUrl(GetPresignedObjectUrlArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException, ServerException
Example:
// Get presigned URL string to delete 'my-objectname' in 'my-bucketname' and its life time
// is one day.
String url =
minioAsyncClient.getPresignedObjectUrl(
GetPresignedObjectUrlArgs.builder()
.method(Method.DELETE)
.bucket("my-bucketname")
.object("my-objectname")
.expiry(24 * 60 * 60)
.build());
System.out.println(url);
// Get presigned URL string to upload 'my-objectname' in 'my-bucketname'
// with response-content-type as application/json and life time as one day.
Map<String, String> reqParams = new HashMap<String, String>();
reqParams.put("response-content-type", "application/json");
String url =
minioAsyncClient.getPresignedObjectUrl(
GetPresignedObjectUrlArgs.builder()
.method(Method.PUT)
.bucket("my-bucketname")
.object("my-objectname")
.expiry(1, TimeUnit.DAYS)
.extraQueryParams(reqParams)
.build());
System.out.println(url);
// Get presigned URL string to download 'my-objectname' in 'my-bucketname' and its life time
// is 2 hours.
String url =
minioAsyncClient.getPresignedObjectUrl(
GetPresignedObjectUrlArgs.builder()
.method(Method.GET)
.bucket("my-bucketname")
.object("my-objectname")
.expiry(2, TimeUnit.HOURS)
.build());
System.out.println(url);
args
- GetPresignedObjectUrlArgs
object.ErrorResponseException
- thrown to indicate S3 service returned an error response.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.InvalidResponseException
- thrown to indicate S3 service returned invalid or no error
response.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.ServerException
public Map<String,String> getPresignedPostFormData(PostPolicy policy) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
PostPolicy
of an object to upload its data using POST method.
Example:
// Create new post policy for 'my-bucketname' with 7 days expiry from now.
PostPolicy policy = new PostPolicy("my-bucketname", ZonedDateTime.now().plusDays(7));
// Add condition that 'key' (object name) equals to 'my-objectname'.
policy.addEqualsCondition("key", "my-objectname");
// Add condition that 'Content-Type' starts with 'image/'.
policy.addStartsWithCondition("Content-Type", "image/");
// Add condition that 'content-length-range' is between 64kiB to 10MiB.
policy.addContentLengthRangeCondition(64 * 1024, 10 * 1024 * 1024);
Map<String, String> formData = minioAsyncClient.getPresignedPostFormData(policy);
// Upload an image using POST object with form-data.
MultipartBody.Builder multipartBuilder = new MultipartBody.Builder();
multipartBuilder.setType(MultipartBody.FORM);
for (Map.Entry<String, String> entry : formData.entrySet()) {
multipartBuilder.addFormDataPart(entry.getKey(), entry.getValue());
}
multipartBuilder.addFormDataPart("key", "my-objectname");
multipartBuilder.addFormDataPart("Content-Type", "image/png");
// "file" must be added at last.
multipartBuilder.addFormDataPart(
"file", "my-objectname", RequestBody.create(new File("Pictures/avatar.png"), null));
Request request =
new Request.Builder()
.url("https://play.min.io/my-bucketname")
.post(multipartBuilder.build())
.build();
OkHttpClient httpClient = new OkHttpClient().newBuilder().build();
Response response = httpClient.newCall(request).execute();
if (response.isSuccessful()) {
System.out.println("Pictures/avatar.png is uploaded successfully using POST object");
} else {
System.out.println("Failed to upload Pictures/avatar.png");
}
policy
- Post policy of an object.Map<String, String>
- Contains form-data to upload an object using POST method.ErrorResponseException
- thrown to indicate S3 service returned an error response.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.InvalidResponseException
- thrown to indicate S3 service returned invalid or no error
response.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.ServerException
PostPolicy
public CompletableFuture<Void> removeObject(RemoveObjectArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
// Remove object.
CompletableFuture<Void> future = minioAsyncClient.removeObject(
RemoveObjectArgs.builder().bucket("my-bucketname").object("my-objectname").build());
// Remove versioned object.
CompletableFuture<Void> future = minioAsyncClient.removeObject(
RemoveObjectArgs.builder()
.bucket("my-bucketname")
.object("my-versioned-objectname")
.versionId("my-versionid")
.build());
// Remove versioned object bypassing Governance mode.
CompletableFuture<Void> future = minioAsyncClient.removeObject(
RemoveObjectArgs.builder()
.bucket("my-bucketname")
.object("my-versioned-objectname")
.versionId("my-versionid")
.bypassRetentionMode(true)
.build());
args
- RemoveObjectArgs
object.CompletableFuture
<Void
> object.ErrorResponseException
- thrown to indicate S3 service returned an error response.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.InvalidResponseException
- thrown to indicate S3 service returned invalid or no error
response.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public Iterable<Result<DeleteError>> removeObjects(RemoveObjectsArgs args)
Example:
List<DeleteObject> objects = new LinkedList<>();
objects.add(new DeleteObject("my-objectname1"));
objects.add(new DeleteObject("my-objectname2"));
objects.add(new DeleteObject("my-objectname3"));
Iterable<Result<DeleteError>> results =
minioAsyncClient.removeObjects(
RemoveObjectsArgs.builder().bucket("my-bucketname").objects(objects).build());
for (Result<DeleteError> result : results) {
DeleteError error = errorResult.get();
System.out.println(
"Error in deleting object " + error.objectName() + "; " + error.message());
}
args
- RemoveObjectsArgs
object.Iterable<Result<DeleteError>>
- Lazy iterator contains object removal status.public CompletableFuture<Void> restoreObject(RestoreObjectArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
// Restore object.
CompletableFuture<Void> future = minioAsyncClient.restoreObject(
RestoreObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.request(new RestoreRequest(null, null, null, null, null, null))
.build());
// Restore versioned object.
CompletableFuture<Void> future = minioAsyncClient.restoreObject(
RestoreObjectArgs.builder()
.bucket("my-bucketname")
.object("my-versioned-objectname")
.versionId("my-versionid")
.request(new RestoreRequest(null, null, null, null, null, null))
.build());
args
- RestoreObjectArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public Iterable<Result<Item>> listObjects(ListObjectsArgs args)
useVersion1
as true
.
Example:
// Lists objects information.
Iterable<Result<Item>> results = minioAsyncClient.listObjects(
ListObjectsArgs.builder().bucket("my-bucketname").build());
// Lists objects information recursively.
Iterable<Result<Item>> results = minioAsyncClient.listObjects(
ListObjectsArgs.builder().bucket("my-bucketname").recursive(true).build());
// Lists maximum 100 objects information whose names starts with 'E' and after
// 'ExampleGuide.pdf'.
Iterable<Result<Item>> results = minioAsyncClient.listObjects(
ListObjectsArgs.builder()
.bucket("my-bucketname")
.startAfter("ExampleGuide.pdf")
.prefix("E")
.maxKeys(100)
.build());
// Lists maximum 100 objects information with version whose names starts with 'E' and after
// 'ExampleGuide.pdf'.
Iterable<Result<Item>> results = minioAsyncClient.listObjects(
ListObjectsArgs.builder()
.bucket("my-bucketname")
.startAfter("ExampleGuide.pdf")
.prefix("E")
.maxKeys(100)
.includeVersions(true)
.build());
args
- Instance of ListObjectsArgs
built using the builderIterable<Result<Item>>
- Lazy iterator contains object information.XmlParserException
- upon parsing response xmlpublic CompletableFuture<List<Bucket>> listBuckets() throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<List<Bucket>> future = minioAsyncClient.listBuckets();
CompletableFuture
<List
<Bucket
>> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<List<Bucket>> listBuckets(ListBucketsArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<List<Bucket>> future =
minioAsyncClient.listBuckets(ListBucketsArgs.builder().extraHeaders(headers).build());
CompletableFuture
<List
<Bucket
>> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Boolean> bucketExists(BucketExistsArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Boolean> future =
minioAsyncClient.bucketExists(BucketExistsArgs.builder().bucket("my-bucketname").build());
args
- BucketExistsArgs
object.CompletableFuture
<Boolean
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> makeBucket(MakeBucketArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
// Create bucket with default region.
CompletableFuture<Void> future = minioAsyncClient.makeBucket(
MakeBucketArgs.builder()
.bucket("my-bucketname")
.build());
// Create bucket with specific region.
CompletableFuture<Void> future = minioAsyncClient.makeBucket(
MakeBucketArgs.builder()
.bucket("my-bucketname")
.region("us-west-1")
.build());
// Create object-lock enabled bucket with specific region.
CompletableFuture<Void> future = minioAsyncClient.makeBucket(
MakeBucketArgs.builder()
.bucket("my-bucketname")
.region("us-west-1")
.objectLock(true)
.build());
args
- Object with bucket name, region and lock functionalityCompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> setBucketVersioning(SetBucketVersioningArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Void> future = minioAsyncClient.setBucketVersioning(
SetBucketVersioningArgs.builder().bucket("my-bucketname").config(config).build());
args
- SetBucketVersioningArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<VersioningConfiguration> getBucketVersioning(GetBucketVersioningArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<VersioningConfiguration> future =
minioAsyncClient.getBucketVersioning(
GetBucketVersioningArgs.builder().bucket("my-bucketname").build());
args
- GetBucketVersioningArgs
object.CompletableFuture
<VersioningConfiguration
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> setObjectLockConfiguration(SetObjectLockConfigurationArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
ObjectLockConfiguration config = new ObjectLockConfiguration(
RetentionMode.COMPLIANCE, new RetentionDurationDays(100));
CompletableFuture<Void> future = minioAsyncClient.setObjectLockConfiguration(
SetObjectLockConfigurationArgs.builder().bucket("my-bucketname").config(config).build());
args
- SetObjectLockConfigurationArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> deleteObjectLockConfiguration(DeleteObjectLockConfigurationArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Void> future = minioAsyncClient.deleteObjectLockConfiguration(
DeleteObjectLockConfigurationArgs.builder().bucket("my-bucketname").build());
args
- DeleteObjectLockConfigurationArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<ObjectLockConfiguration> getObjectLockConfiguration(GetObjectLockConfigurationArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<ObjectLockConfiguration> future =
minioAsyncClient.getObjectLockConfiguration(
GetObjectLockConfigurationArgs.builder().bucket("my-bucketname").build());
args
- GetObjectLockConfigurationArgs
object.CompletableFuture
<ObjectLockConfiguration
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> setObjectRetention(SetObjectRetentionArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
Retention retention = new Retention(
RetentionMode.COMPLIANCE, ZonedDateTime.now().plusYears(1));
CompletableFuture<Void> future = minioAsyncClient.setObjectRetention(
SetObjectRetentionArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.config(config)
.bypassGovernanceMode(true)
.build());
args
- SetObjectRetentionArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Retention> getObjectRetention(GetObjectRetentionArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Retention> future =
minioAsyncClient.getObjectRetention(GetObjectRetentionArgs.builder()
.bucket(bucketName)
.object(objectName)
.versionId(versionId)
.build());
args
- GetObjectRetentionArgs
object.CompletableFuture
<Retention
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> enableObjectLegalHold(EnableObjectLegalHoldArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Void> future = minioAsyncClient.enableObjectLegalHold(
EnableObjectLegalHoldArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.versionId("object-versionId")
.build());
args
- EnableObjectLegalHoldArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> disableObjectLegalHold(DisableObjectLegalHoldArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Void> future = minioAsyncClient.disableObjectLegalHold(
DisableObjectLegalHoldArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.versionId("object-versionId")
.build());
args
- DisableObjectLegalHoldArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Boolean> isObjectLegalHoldEnabled(IsObjectLegalHoldEnabledArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Boolean> future =
s3Client.isObjectLegalHoldEnabled(
IsObjectLegalHoldEnabledArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.versionId("object-versionId")
.build());
args
- IsObjectLegalHoldEnabledArgs
object.CompletableFuture
<Boolean
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> removeBucket(RemoveBucketArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Void> future =
minioAsyncClient.removeBucket(RemoveBucketArgs.builder().bucket("my-bucketname").build());
args
- RemoveBucketArgs
bucket.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<ObjectWriteResponse> putObject(PutObjectArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
// Upload known sized input stream.
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.putObject(
PutObjectArgs.builder().bucket("my-bucketname").object("my-objectname").stream(
inputStream, size, -1)
.contentType("video/mp4")
.build());
// Upload unknown sized input stream.
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.putObject(
PutObjectArgs.builder().bucket("my-bucketname").object("my-objectname").stream(
inputStream, -1, 10485760)
.contentType("video/mp4")
.build());
// Create object ends with '/' (also called as folder or directory).
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.putObject(
PutObjectArgs.builder().bucket("my-bucketname").object("path/to/").stream(
new ByteArrayInputStream(new byte[] {}), 0, -1)
.build());
// Upload input stream with headers and user metadata.
Map<String, String> headers = new HashMap<>();
headers.put("X-Amz-Storage-Class", "REDUCED_REDUNDANCY");
Map<String, String> userMetadata = new HashMap<>();
userMetadata.put("My-Project", "Project One");
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.putObject(
PutObjectArgs.builder().bucket("my-bucketname").object("my-objectname").stream(
inputStream, size, -1)
.headers(headers)
.userMetadata(userMetadata)
.build());
// Upload input stream with server-side encryption.
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.putObject(
PutObjectArgs.builder().bucket("my-bucketname").object("my-objectname").stream(
inputStream, size, -1)
.sse(sse)
.build());
args
- PutObjectArgs
object.CompletableFuture
<ObjectWriteResponse
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<ObjectWriteResponse> uploadObject(UploadObjectArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
// Upload an JSON file.
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.uploadObject(
UploadObjectArgs.builder()
.bucket("my-bucketname").object("my-objectname").filename("person.json").build());
// Upload a video file.
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.uploadObject(
UploadObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.filename("my-video.avi")
.contentType("video/mp4")
.build());
args
- UploadObjectArgs
object.CompletableFuture
<ObjectWriteResponse
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<String> getBucketPolicy(GetBucketPolicyArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<String> future =
minioAsyncClient.getBucketPolicy(
GetBucketPolicyArgs.builder().bucket("my-bucketname").build());
args
- GetBucketPolicyArgs
object.CompletableFuture
<String
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> setBucketPolicy(SetBucketPolicyArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
// Assume policyJson contains below JSON string;
// {
// "Statement": [
// {
// "Action": [
// "s3:GetBucketLocation",
// "s3:ListBucket"
// ],
// "Effect": "Allow",
// "Principal": "*",
// "Resource": "arn:aws:s3:::my-bucketname"
// },
// {
// "Action": "s3:GetObject",
// "Effect": "Allow",
// "Principal": "*",
// "Resource": "arn:aws:s3:::my-bucketname/myobject*"
// }
// ],
// "Version": "2012-10-17"
// }
//
CompletableFuture<Void> future = minioAsyncClient.setBucketPolicy(
SetBucketPolicyArgs.builder().bucket("my-bucketname").config(policyJson).build());
args
- SetBucketPolicyArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> deleteBucketPolicy(DeleteBucketPolicyArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Void> future =
minioAsyncClient.deleteBucketPolicy(
DeleteBucketPolicyArgs.builder().bucket("my-bucketname"));
args
- DeleteBucketPolicyArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> setBucketLifecycle(SetBucketLifecycleArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
List<LifecycleRule> rules = new LinkedList<>();
rules.add(
new LifecycleRule(
Status.ENABLED,
null,
new Expiration((ZonedDateTime) null, 365, null),
new RuleFilter("logs/"),
"rule2",
null,
null,
null));
LifecycleConfiguration config = new LifecycleConfiguration(rules);
CompletableFuture<Void> future = minioAsyncClient.setBucketLifecycle(
SetBucketLifecycleArgs.builder().bucket("my-bucketname").config(config).build());
args
- SetBucketLifecycleArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> deleteBucketLifecycle(DeleteBucketLifecycleArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Void> future = deleteBucketLifecycle(
DeleteBucketLifecycleArgs.builder().bucket("my-bucketname").build());
args
- DeleteBucketLifecycleArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<LifecycleConfiguration> getBucketLifecycle(GetBucketLifecycleArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<LifecycleConfiguration> future =
minioAsyncClient.getBucketLifecycle(
GetBucketLifecycleArgs.builder().bucket("my-bucketname").build());
args
- GetBucketLifecycleArgs
object.LifecycleConfiguration
object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<NotificationConfiguration> getBucketNotification(GetBucketNotificationArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<NotificationConfiguration> future =
minioAsyncClient.getBucketNotification(
GetBucketNotificationArgs.builder().bucket("my-bucketname").build());
args
- GetBucketNotificationArgs
object.CompletableFuture
<NotificationConfiguration
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> setBucketNotification(SetBucketNotificationArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
List<EventType> eventList = new LinkedList<>();
eventList.add(EventType.OBJECT_CREATED_PUT);
eventList.add(EventType.OBJECT_CREATED_COPY);
QueueConfiguration queueConfiguration = new QueueConfiguration();
queueConfiguration.setQueue("arn:minio:sqs::1:webhook");
queueConfiguration.setEvents(eventList);
queueConfiguration.setPrefixRule("images");
queueConfiguration.setSuffixRule("pg");
List<QueueConfiguration> queueConfigurationList = new LinkedList<>();
queueConfigurationList.add(queueConfiguration);
NotificationConfiguration config = new NotificationConfiguration();
config.setQueueConfigurationList(queueConfigurationList);
CompletableFuture<Void> future = minioAsyncClient.setBucketNotification(
SetBucketNotificationArgs.builder().bucket("my-bucketname").config(config).build());
args
- SetBucketNotificationArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> deleteBucketNotification(DeleteBucketNotificationArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Void> future = minioAsyncClient.deleteBucketNotification(
DeleteBucketNotificationArgs.builder().bucket("my-bucketname").build());
args
- DeleteBucketNotificationArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<ReplicationConfiguration> getBucketReplication(GetBucketReplicationArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<ReplicationConfiguration> future =
minioAsyncClient.getBucketReplication(
GetBucketReplicationArgs.builder().bucket("my-bucketname").build());
args
- GetBucketReplicationArgs
object.CompletableFuture
<ReplicationConfiguration
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> setBucketReplication(SetBucketReplicationArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
Map<String, String> tags = new HashMap<>();
tags.put("key1", "value1");
tags.put("key2", "value2");
ReplicationRule rule =
new ReplicationRule(
new DeleteMarkerReplication(Status.DISABLED),
new ReplicationDestination(
null, null, "REPLACE-WITH-ACTUAL-DESTINATION-BUCKET-ARN", null, null, null, null),
null,
new RuleFilter(new AndOperator("TaxDocs", tags)),
"rule1",
null,
1,
null,
Status.ENABLED);
List<ReplicationRule> rules = new LinkedList<>();
rules.add(rule);
ReplicationConfiguration config =
new ReplicationConfiguration("REPLACE-WITH-ACTUAL-ROLE", rules);
CompletableFuture<Void> future = minioAsyncClient.setBucketReplication(
SetBucketReplicationArgs.builder().bucket("my-bucketname").config(config).build());
args
- SetBucketReplicationArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> deleteBucketReplication(DeleteBucketReplicationArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Void> future = minioAsyncClient.deleteBucketReplication(
DeleteBucketReplicationArgs.builder().bucket("my-bucketname"));
args
- DeleteBucketReplicationArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CloseableIterator<Result<NotificationRecords>> listenBucketNotification(ListenBucketNotificationArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
String[] events = {"s3:ObjectCreated:*", "s3:ObjectAccessed:*"};
try (CloseableIterator<Result<NotificationRecords>> ci =
minioAsyncClient.listenBucketNotification(
ListenBucketNotificationArgs.builder()
.bucket("bucketName")
.prefix("")
.suffix("")
.events(events)
.build())) {
while (ci.hasNext()) {
NotificationRecords records = ci.next().get();
for (Event event : records.events()) {
System.out.println("Event " + event.eventType() + " occurred at "
+ event.eventTime() + " for " + event.bucketName() + "/"
+ event.objectName());
}
}
}
args
- ListenBucketNotificationArgs
object.CloseableIterator<Result<NotificationRecords>>
- Lazy closable iterator
contains event records.ErrorResponseException
- thrown to indicate S3 service returned an error response.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.InvalidResponseException
- thrown to indicate S3 service returned invalid or no error
response.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.ServerException
public SelectResponseStream selectObjectContent(SelectObjectContentArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
String sqlExpression = "select * from S3Object";
InputSerialization is =
new InputSerialization(null, false, null, null, FileHeaderInfo.USE, null, null,
null);
OutputSerialization os =
new OutputSerialization(null, null, null, QuoteFields.ASNEEDED, null);
SelectResponseStream stream =
minioAsyncClient.selectObjectContent(
SelectObjectContentArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.sqlExpression(sqlExpression)
.inputSerialization(is)
.outputSerialization(os)
.requestProgress(true)
.build());
byte[] buf = new byte[512];
int bytesRead = stream.read(buf, 0, buf.length);
System.out.println(new String(buf, 0, bytesRead, StandardCharsets.UTF_8));
Stats stats = stream.stats();
System.out.println("bytes scanned: " + stats.bytesScanned());
System.out.println("bytes processed: " + stats.bytesProcessed());
System.out.println("bytes returned: " + stats.bytesReturned());
stream.close();
args
- instance of SelectObjectContentArgs
SelectResponseStream
- Contains filtered records and progress.ErrorResponseException
- thrown to indicate S3 service returned an error response.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.InvalidResponseException
- thrown to indicate S3 service returned invalid or no error
response.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.ServerException
public CompletableFuture<Void> setBucketEncryption(SetBucketEncryptionArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Void> future = minioAsyncClient.setBucketEncryption(
SetBucketEncryptionArgs.builder().bucket("my-bucketname").config(config).build());
args
- SetBucketEncryptionArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<SseConfiguration> getBucketEncryption(GetBucketEncryptionArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<SseConfiguration> future =
minioAsyncClient.getBucketEncryption(
GetBucketEncryptionArgs.builder().bucket("my-bucketname").build());
args
- GetBucketEncryptionArgs
object.CompletableFuture
<SseConfiguration
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> deleteBucketEncryption(DeleteBucketEncryptionArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Void> future = minioAsyncClient.deleteBucketEncryption(
DeleteBucketEncryptionArgs.builder().bucket("my-bucketname").build());
args
- DeleteBucketEncryptionArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Tags> getBucketTags(GetBucketTagsArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Tags> future =
minioAsyncClient.getBucketTags(GetBucketTagsArgs.builder().bucket("my-bucketname").build());
args
- GetBucketTagsArgs
object.CompletableFuture
<Tags
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> setBucketTags(SetBucketTagsArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
Map<String, String> map = new HashMap<>();
map.put("Project", "Project One");
map.put("User", "jsmith");
CompletableFuture<Void> future = minioAsyncClient.setBucketTags(
SetBucketTagsArgs.builder().bucket("my-bucketname").tags(map).build());
args
- SetBucketTagsArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> deleteBucketTags(DeleteBucketTagsArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Void> future = minioAsyncClient.deleteBucketTags(
DeleteBucketTagsArgs.builder().bucket("my-bucketname").build());
args
- DeleteBucketTagsArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Tags> getObjectTags(GetObjectTagsArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Tags> future =
minioAsyncClient.getObjectTags(
GetObjectTagsArgs.builder().bucket("my-bucketname").object("my-objectname").build());
args
- GetObjectTagsArgs
object.CompletableFuture
<Tags
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> setObjectTags(SetObjectTagsArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
Map<String, String> map = new HashMap<>();
map.put("Project", "Project One");
map.put("User", "jsmith");
CompletableFuture<Void> future = minioAsyncClient.setObjectTags(
SetObjectTagsArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.tags((map)
.build());
args
- SetObjectTagsArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<Void> deleteObjectTags(DeleteObjectTagsArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
CompletableFuture<Void> future = minioAsyncClient.deleteObjectTags(
DeleteObjectTags.builder().bucket("my-bucketname").object("my-objectname").build());
args
- DeleteObjectTagsArgs
object.CompletableFuture
<Void
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public CompletableFuture<ObjectWriteResponse> uploadSnowballObjects(UploadSnowballObjectsArgs args) throws InsufficientDataException, InternalException, InvalidKeyException, IOException, NoSuchAlgorithmException, XmlParserException
Example:
// Upload snowball objects.
List<SnowballObject> objects = new ArrayList<SnowballObject>();
objects.add(
new SnowballObject(
"my-object-one",
new ByteArrayInputStream("hello".getBytes(StandardCharsets.UTF_8)),
5,
null));
objects.add(
new SnowballObject(
"my-object-two",
new ByteArrayInputStream("java".getBytes(StandardCharsets.UTF_8)),
4,
null));
CompletableFuture<ObjectWriteResponse> future = minioAsyncClient.uploadSnowballObjects(
UploadSnowballObjectsArgs.builder().bucket("my-bucketname").objects(objects).build());
args
- UploadSnowballObjectsArgs
object.CompletableFuture
<ObjectWriteResponse
> object.InsufficientDataException
- thrown to indicate not enough data available in InputStream.InternalException
- thrown to indicate internal library error.InvalidKeyException
- thrown to indicate missing of HMAC SHA-256 library.IOException
- thrown to indicate I/O error on S3 operation.NoSuchAlgorithmException
- thrown to indicate missing of MD5 or SHA-256 digest library.XmlParserException
- thrown to indicate XML parsing error.public static MinioAsyncClient.Builder builder()