public class MinioClient extends Object implements AutoCloseable
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 MinioClient.builder()
to create S3 client.
// Create client with anonymous access.
MinioClient minioClient = MinioClient.builder().endpoint("https://play.min.io").build();
// Create client with credentials.
MinioClient minioClient =
MinioClient.builder()
.endpoint("https://play.min.io")
.credentials("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG")
.build();
Modifier and Type | Class and Description |
---|---|
static class |
MinioClient.Builder
Argument builder of
MinioClient . |
Modifier | Constructor and Description |
---|---|
protected |
MinioClient(MinioClient client) |
Modifier and Type | Method and Description |
---|---|
boolean |
bucketExists(BucketExistsArgs args)
Checks if a bucket exists.
|
static MinioClient.Builder |
builder() |
void |
close() |
ObjectWriteResponse |
composeObject(ComposeObjectArgs args)
Creates an object by combining data from different source objects using server-side copy.
|
ObjectWriteResponse |
copyObject(CopyObjectArgs args)
Creates an object by server-side copying data from another object.
|
void |
deleteBucketEncryption(DeleteBucketEncryptionArgs args)
Deletes encryption configuration of a bucket.
|
void |
deleteBucketLifecycle(DeleteBucketLifecycleArgs args)
Deletes lifecycle configuration of a bucket.
|
void |
deleteBucketNotification(DeleteBucketNotificationArgs args)
Deletes notification configuration of a bucket.
|
void |
deleteBucketPolicy(DeleteBucketPolicyArgs args)
Deletes bucket policy configuration to a bucket.
|
void |
deleteBucketReplication(DeleteBucketReplicationArgs args)
Deletes bucket replication configuration from a bucket.
|
void |
deleteBucketTags(DeleteBucketTagsArgs args)
Deletes tags of a bucket.
|
void |
deleteObjectLockConfiguration(DeleteObjectLockConfigurationArgs args)
Deletes default object retention in a bucket.
|
void |
deleteObjectTags(DeleteObjectTagsArgs args)
Deletes tags of an object.
|
void |
disableAccelerateEndpoint()
Deprecated.
This method is no longer supported.
|
void |
disableDualStackEndpoint()
Disables dual-stack endpoint for Amazon S3 endpoint.
|
void |
disableObjectLegalHold(DisableObjectLegalHoldArgs args)
Disables legal hold on an object.
|
void |
disableVirtualStyleEndpoint()
Disables virtual-style endpoint.
|
void |
downloadObject(DownloadObjectArgs args)
Downloads data of a SSE-C encrypted object to file.
|
void |
enableAccelerateEndpoint()
Deprecated.
This method is no longer supported.
|
void |
enableDualStackEndpoint()
Enables dual-stack endpoint for Amazon S3 endpoint.
|
void |
enableObjectLegalHold(EnableObjectLegalHoldArgs args)
Enables legal hold on an object.
|
void |
enableVirtualStyleEndpoint()
Enables virtual-style endpoint.
|
SseConfiguration |
getBucketEncryption(GetBucketEncryptionArgs args)
Gets encryption configuration of a bucket.
|
LifecycleConfiguration |
getBucketLifecycle(GetBucketLifecycleArgs args)
Gets lifecycle configuration of a bucket.
|
NotificationConfiguration |
getBucketNotification(GetBucketNotificationArgs args)
Gets notification configuration of a bucket.
|
String |
getBucketPolicy(GetBucketPolicyArgs args)
Gets bucket policy configuration of a bucket.
|
ReplicationConfiguration |
getBucketReplication(GetBucketReplicationArgs args)
Gets bucket replication configuration of a bucket.
|
Tags |
getBucketTags(GetBucketTagsArgs args)
Gets tags of a bucket.
|
VersioningConfiguration |
getBucketVersioning(GetBucketVersioningArgs args)
Gets versioning configuration of a bucket.
|
GetObjectResponse |
getObject(GetObjectArgs args)
Gets data from offset to length of a SSE-C encrypted object.
|
ObjectLockConfiguration |
getObjectLockConfiguration(GetObjectLockConfigurationArgs args)
Gets default object retention in a bucket.
|
Retention |
getObjectRetention(GetObjectRetentionArgs args)
Gets retention configuration of an object.
|
Tags |
getObjectTags(GetObjectTagsArgs args)
Gets tags of an object.
|
String |
getPresignedObjectUrl(GetPresignedObjectUrlArgs args)
Gets presigned URL of an object for HTTP method, expiry time and custom request parameters.
|
Map<String,String> |
getPresignedPostFormData(PostPolicy policy)
Gets form-data of
PostPolicy of an object to upload its data using POST method. |
void |
ignoreCertCheck()
Ignores check on server certificate for HTTPS connection.
|
boolean |
isObjectLegalHoldEnabled(IsObjectLegalHoldEnabledArgs args)
Returns true if legal hold is enabled on an object.
|
List<Bucket> |
listBuckets()
Lists bucket information of all buckets.
|
List<Bucket> |
listBuckets(ListBucketsArgs args)
Lists bucket information of all buckets.
|
CloseableIterator<Result<NotificationRecords>> |
listenBucketNotification(ListenBucketNotificationArgs args)
Listens events of object prefix and suffix of a bucket.
|
Iterable<Result<Item>> |
listObjects(ListObjectsArgs args)
Lists objects information optionally with versions of a bucket.
|
void |
makeBucket(MakeBucketArgs args)
Creates a bucket with region and object lock.
|
ObjectWriteResponse |
putObject(PutObjectArgs args)
Uploads data from a stream to an object.
|
void |
removeBucket(RemoveBucketArgs args)
Removes an empty bucket using arguments
|
void |
removeObject(RemoveObjectArgs args)
Removes an object.
|
Iterable<Result<DeleteError>> |
removeObjects(RemoveObjectsArgs args)
Removes multiple objects lazily.
|
void |
restoreObject(RestoreObjectArgs args)
Restores an object.
|
SelectResponseStream |
selectObjectContent(SelectObjectContentArgs args)
Selects content of an object by SQL expression.
|
void |
setAppInfo(String name,
String version)
Sets application's name/version to user agent.
|
void |
setAwsS3Prefix(String awsS3Prefix)
Sets AWS S3 domain prefix.
|
void |
setBucketEncryption(SetBucketEncryptionArgs args)
Sets encryption configuration of a bucket.
|
void |
setBucketLifecycle(SetBucketLifecycleArgs args)
Sets lifecycle configuration to a bucket.
|
void |
setBucketNotification(SetBucketNotificationArgs args)
Sets notification configuration to a bucket.
|
void |
setBucketPolicy(SetBucketPolicyArgs args)
Sets bucket policy configuration to a bucket.
|
void |
setBucketReplication(SetBucketReplicationArgs args)
Sets bucket replication configuration to a bucket.
|
void |
setBucketTags(SetBucketTagsArgs args)
Sets tags to a bucket.
|
void |
setBucketVersioning(SetBucketVersioningArgs args)
Sets versioning configuration of a bucket.
|
void |
setObjectLockConfiguration(SetObjectLockConfigurationArgs args)
Sets default object retention in a bucket.
|
void |
setObjectRetention(SetObjectRetentionArgs args)
Sets retention configuration to an object.
|
void |
setObjectTags(SetObjectTagsArgs args)
Sets tags to an object.
|
void |
setTimeout(long connectTimeout,
long writeTimeout,
long readTimeout)
Sets HTTP connect, write and read timeouts.
|
StatObjectResponse |
statObject(StatObjectArgs args)
Gets information of an object.
|
void |
traceOff()
Disables HTTP call tracing previously enabled.
|
void |
traceOn(OutputStream traceStream)
Enables HTTP call tracing and written to traceStream.
|
ObjectWriteResponse |
uploadObject(UploadObjectArgs args)
Uploads data from a file to an object.
|
ObjectWriteResponse |
uploadSnowballObjects(UploadSnowballObjectsArgs args)
Uploads multiple objects in a single put call.
|
protected MinioClient(MinioClient client)
public StatObjectResponse statObject(StatObjectArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
// Get information of an object.
StatObjectResponse stat =
minioClient.statObject(
StatObjectArgs.builder().bucket("my-bucketname").object("my-objectname").build());
// Get information of SSE-C encrypted object.
StatObjectResponse stat =
minioClient.statObject(
StatObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.ssec(ssec)
.build());
// Get information of a versioned object.
StatObjectResponse stat =
minioClient.statObject(
StatObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.versionId("version-id")
.build());
// Get information of a SSE-C encrypted versioned object.
StatObjectResponse stat =
minioClient.statObject(
StatObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.versionId("version-id")
.ssec(ssec)
.build());
args
- StatObjectArgs
object.StatObjectResponse
- Populated object information and metadata.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
StatObjectResponse
public GetObjectResponse getObject(GetObjectArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
InputStream
must
be closed after use to release network resources.
Example:
try (InputStream stream =
minioClient.getObject(
GetObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.offset(offset)
.length(len)
.ssec(ssec)
.build()
) {
// Read data from stream
}
args
- Object of GetObjectArgs
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 void downloadObject(DownloadObjectArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
minioClient.downloadObject(
DownloadObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.ssec(ssec)
.filename("my-filename")
.build());
args
- Object of DownloadObjectArgs
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 ObjectWriteResponse copyObject(CopyObjectArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
// Create object "my-objectname" in bucket "my-bucketname" by copying from object
// "my-objectname" in bucket "my-source-bucketname".
minioClient.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".
minioClient.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".
minioClient.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".
minioClient.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".
minioClient.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".
minioClient.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".
minioClient.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.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 ObjectWriteResponse composeObject(ComposeObjectArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, 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.
minioClient.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");
minioClient.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.
minioClient.composeObject(
ComposeObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.sources(sourceObjectList)
.userMetadata(userMetadata)
.ssec(sse)
.build());
args
- ComposeObjectArgs
object.ObjectWriteResponse
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 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 =
minioClient.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 =
minioClient.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 =
minioClient.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 = minioClient.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 void removeObject(RemoveObjectArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
// Remove object.
minioClient.removeObject(
RemoveObjectArgs.builder().bucket("my-bucketname").object("my-objectname").build());
// Remove versioned object.
minioClient.removeObject(
RemoveObjectArgs.builder()
.bucket("my-bucketname")
.object("my-versioned-objectname")
.versionId("my-versionid")
.build());
// Remove versioned object bypassing Governance mode.
minioClient.removeObject(
RemoveObjectArgs.builder()
.bucket("my-bucketname")
.object("my-versioned-objectname")
.versionId("my-versionid")
.bypassRetentionMode(true)
.build());
args
- RemoveObjectArgs
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 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 =
minioClient.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 void restoreObject(RestoreObjectArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
// Restore object.
minioClient.restoreObject(
RestoreObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.request(new RestoreRequest(null, null, null, null, null, null))
.build());
// Restore versioned object.
minioClient.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.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 Iterable<Result<Item>> listObjects(ListObjectsArgs args)
useVersion1
as true
.
Example:
// Lists objects information.
Iterable<Result<Item>> results = minioClient.listObjects(
ListObjectsArgs.builder().bucket("my-bucketname").build());
// Lists objects information recursively.
Iterable<Result<Item>> results = minioClient.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 = minioClient.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 = minioClient.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 List<Bucket> listBuckets() throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
List<Bucket> bucketList = minioClient.listBuckets();
for (Bucket bucket : bucketList) {
System.out.println(bucket.creationDate() + ", " + bucket.name());
}
List<Bucket>
- List of bucket information.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 List<Bucket> listBuckets(ListBucketsArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
List<Bucket> bucketList =
minioClient.listBuckets(ListBucketsArgs.builder().extraHeaders(headers).build());
for (Bucket bucket : bucketList) {
System.out.println(bucket.creationDate() + ", " + bucket.name());
}
List<Bucket>
- List of bucket information.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 boolean bucketExists(BucketExistsArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
boolean found =
minioClient.bucketExists(BucketExistsArgs.builder().bucket("my-bucketname").build());
if (found) {
System.out.println("my-bucketname exists");
} else {
System.out.println("my-bucketname does not exist");
}
args
- BucketExistsArgs
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 void makeBucket(MakeBucketArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
// Create bucket with default region.
minioClient.makeBucket(
MakeBucketArgs.builder()
.bucket("my-bucketname")
.build());
// Create bucket with specific region.
minioClient.makeBucket(
MakeBucketArgs.builder()
.bucket("my-bucketname")
.region("us-west-1")
.build());
// Create object-lock enabled bucket with specific region.
minioClient.makeBucket(
MakeBucketArgs.builder()
.bucket("my-bucketname")
.region("us-west-1")
.objectLock(true)
.build());
args
- Object with bucket name, region and lock functionalityErrorResponseException
- 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 void setBucketVersioning(SetBucketVersioningArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
minioClient.setBucketVersioning(
SetBucketVersioningArgs.builder().bucket("my-bucketname").config(config).build());
args
- SetBucketVersioningArgs
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 VersioningConfiguration getBucketVersioning(GetBucketVersioningArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
VersioningConfiguration config =
minioClient.getBucketVersioning(
GetBucketVersioningArgs.builder().bucket("my-bucketname").build());
args
- GetBucketVersioningArgs
object.VersioningConfiguration
- Versioning configuration.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 void setObjectLockConfiguration(SetObjectLockConfigurationArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
ObjectLockConfiguration config = new ObjectLockConfiguration(
RetentionMode.COMPLIANCE, new RetentionDurationDays(100));
minioClient.setObjectLockConfiguration(
SetObjectLockConfigurationArgs.builder().bucket("my-bucketname").config(config).build());
args
- SetObjectLockConfigurationArgs
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 void deleteObjectLockConfiguration(DeleteObjectLockConfigurationArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
minioClient.deleteObjectLockConfiguration(
DeleteObjectLockConfigurationArgs.builder().bucket("my-bucketname").build());
args
- DeleteObjectLockConfigurationArgs
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 ObjectLockConfiguration getObjectLockConfiguration(GetObjectLockConfigurationArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
ObjectLockConfiguration config =
minioClient.getObjectLockConfiguration(
GetObjectLockConfigurationArgs.builder().bucket("my-bucketname").build());
System.out.println("Mode: " + config.mode());
System.out.println(
"Duration: " + config.duration().duration() + " " + config.duration().unit());
args
- GetObjectLockConfigurationArgs
object.ObjectLockConfiguration
- Default retention configuration.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 void setObjectRetention(SetObjectRetentionArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
Retention retention = new Retention(
RetentionMode.COMPLIANCE, ZonedDateTime.now().plusYears(1));
minioClient.setObjectRetention(
SetObjectRetentionArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.config(config)
.bypassGovernanceMode(true)
.build());
args
- SetObjectRetentionArgs
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 Retention getObjectRetention(GetObjectRetentionArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
Retention retention =
minioClient.getObjectRetention(GetObjectRetentionArgs.builder()
.bucket(bucketName)
.object(objectName)
.versionId(versionId)
.build()););
System.out.println(
"mode: " + retention.mode() + "until: " + retention.retainUntilDate());
args
- GetObjectRetentionArgs
object.Retention
- Object retention configuration.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 void enableObjectLegalHold(EnableObjectLegalHoldArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
minioClient.enableObjectLegalHold(
EnableObjectLegalHoldArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.versionId("object-versionId")
.build());
args
- EnableObjectLegalHoldArgs
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 void disableObjectLegalHold(DisableObjectLegalHoldArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
minioClient.disableObjectLegalHold(
DisableObjectLegalHoldArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.versionId("object-versionId")
.build());
args
- DisableObjectLegalHoldArgs
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 boolean isObjectLegalHoldEnabled(IsObjectLegalHoldEnabledArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
boolean status =
s3Client.isObjectLegalHoldEnabled(
IsObjectLegalHoldEnabledArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.versionId("object-versionId")
.build());
if (status) {
System.out.println("Legal hold is on");
} else {
System.out.println("Legal hold is off");
}
args IsObjectLegalHoldEnabledArgs
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 void removeBucket(RemoveBucketArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
minioClient.removeBucket(RemoveBucketArgs.builder().bucket("my-bucketname").build());
args
- RemoveBucketArgs
bucket.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 ObjectWriteResponse putObject(PutObjectArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
// Upload known sized input stream.
minioClient.putObject(
PutObjectArgs.builder().bucket("my-bucketname").object("my-objectname").stream(
inputStream, size, -1)
.contentType("video/mp4")
.build());
// Upload unknown sized input stream.
minioClient.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).
minioClient.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");
minioClient.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.
minioClient.putObject(
PutObjectArgs.builder().bucket("my-bucketname").object("my-objectname").stream(
inputStream, size, -1)
.sse(sse)
.build());
args
- PutObjectArgs
object.ObjectWriteResponse
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 ObjectWriteResponse uploadObject(UploadObjectArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
// Upload an JSON file.
minioClient.uploadObject(
UploadObjectArgs.builder()
.bucket("my-bucketname").object("my-objectname").filename("person.json").build());
// Upload a video file.
minioClient.uploadObject(
UploadObjectArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.filename("my-video.avi")
.contentType("video/mp4")
.build());
args
- UploadObjectArgs
object.ObjectWriteResponse
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 String getBucketPolicy(GetBucketPolicyArgs args) throws BucketPolicyTooLargeException, ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
String config =
minioClient.getBucketPolicy(GetBucketPolicyArgs.builder().bucket("my-bucketname").build());
args
- GetBucketPolicyArgs
object.BucketPolicyTooLargeException
- thrown to indicate returned bucket policy is too large.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 void setBucketPolicy(SetBucketPolicyArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, 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"
// }
//
minioClient.setBucketPolicy(
SetBucketPolicyArgs.builder().bucket("my-bucketname").config(policyJson).build());
args
- SetBucketPolicyArgs
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 void deleteBucketPolicy(DeleteBucketPolicyArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
minioClient.deleteBucketPolicy(DeleteBucketPolicyArgs.builder().bucket("my-bucketname"));
args
- DeleteBucketPolicyArgs
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 void setBucketLifecycle(SetBucketLifecycleArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, 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);
minioClient.setBucketLifecycle(
SetBucketLifecycleArgs.builder().bucket("my-bucketname").config(config).build());
args
- SetBucketLifecycleArgs
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 void deleteBucketLifecycle(DeleteBucketLifecycleArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
deleteBucketLifecycle(DeleteBucketLifecycleArgs.builder().bucket("my-bucketname").build());
args
- DeleteBucketLifecycleArgs
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 LifecycleConfiguration getBucketLifecycle(GetBucketLifecycleArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
LifecycleConfiguration config =
minioClient.getBucketLifecycle(
GetBucketLifecycleArgs.builder().bucket("my-bucketname").build());
args
- GetBucketLifecycleArgs
object.LifecycleConfiguration
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 NotificationConfiguration getBucketNotification(GetBucketNotificationArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
NotificationConfiguration config =
minioClient.getBucketNotification(
GetBucketNotificationArgs.builder().bucket("my-bucketname").build());
args
- GetBucketNotificationArgs
object.NotificationConfiguration
- Notification configuration.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 void setBucketNotification(SetBucketNotificationArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, 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);
minioClient.setBucketNotification(
SetBucketNotificationArgs.builder().bucket("my-bucketname").config(config).build());
args
- SetBucketNotificationArgs
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 void deleteBucketNotification(DeleteBucketNotificationArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
minioClient.deleteBucketNotification(
DeleteBucketNotificationArgs.builder().bucket("my-bucketname").build());
args
- DeleteBucketNotificationArgs
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 ReplicationConfiguration getBucketReplication(GetBucketReplicationArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
ReplicationConfiguration config =
minioClient.getBucketReplication(
GetBucketReplicationArgs.builder().bucket("my-bucketname").build());
args
- GetBucketReplicationArgs
object.ReplicationConfiguration
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 void setBucketReplication(SetBucketReplicationArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, 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);
minioClient.setBucketReplication(
SetBucketReplicationArgs.builder().bucket("my-bucketname").config(config).build());
args
- SetBucketReplicationArgs
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 void deleteBucketReplication(DeleteBucketReplicationArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
minioClient.deleteBucketReplication(
DeleteBucketReplicationArgs.builder().bucket("my-bucketname"));
args
- DeleteBucketReplicationArgs
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 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 =
minioClient.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 =
minioClient.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 void setBucketEncryption(SetBucketEncryptionArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
minioClient.setBucketEncryption(
SetBucketEncryptionArgs.builder().bucket("my-bucketname").config(config).build());
args
- SetBucketEncryptionArgs
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 SseConfiguration getBucketEncryption(GetBucketEncryptionArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
SseConfiguration config =
minioClient.getBucketEncryption(
GetBucketEncryptionArgs.builder().bucket("my-bucketname").build());
args
- GetBucketEncryptionArgs
object.SseConfiguration
- Server-side encryption configuration.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 void deleteBucketEncryption(DeleteBucketEncryptionArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
minioClient.deleteBucketEncryption(
DeleteBucketEncryptionArgs.builder().bucket("my-bucketname").build());
args
- DeleteBucketEncryptionArgs
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 Tags getBucketTags(GetBucketTagsArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
Tags tags =
minioClient.getBucketTags(GetBucketTagsArgs.builder().bucket("my-bucketname").build());
args
- GetBucketTagsArgs
object.Tags
- Tags.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 void setBucketTags(SetBucketTagsArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
Map<String, String> map = new HashMap<>();
map.put("Project", "Project One");
map.put("User", "jsmith");
minioClient.setBucketTags(
SetBucketTagsArgs.builder().bucket("my-bucketname").tags(map).build());
args
- SetBucketTagsArgs
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 void deleteBucketTags(DeleteBucketTagsArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
minioClient.deleteBucketTags(DeleteBucketTagsArgs.builder().bucket("my-bucketname").build());
args
- DeleteBucketTagsArgs
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 Tags getObjectTags(GetObjectTagsArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
Tags tags =
minioClient.getObjectTags(
GetObjectTagsArgs.builder().bucket("my-bucketname").object("my-objectname").build());
args
- GetObjectTagsArgs
object.Tags
- Tags.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 void setObjectTags(SetObjectTagsArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
Map<String, String> map = new HashMap<>();
map.put("Project", "Project One");
map.put("User", "jsmith");
minioClient.setObjectTags(
SetObjectTagsArgs.builder()
.bucket("my-bucketname")
.object("my-objectname")
.tags((map)
.build());
args
- SetObjectTagsArgs
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 void deleteObjectTags(DeleteObjectTagsArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException
Example:
minioClient.deleteObjectTags(
DeleteObjectTags.builder().bucket("my-bucketname").object("my-objectname").build());
args
- DeleteObjectTagsArgs
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 ObjectWriteResponse uploadSnowballObjects(UploadSnowballObjectsArgs args) throws ErrorResponseException, InsufficientDataException, InternalException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, 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));
minioClient.uploadSnowballObjects(
UploadSnowballObjectsArgs.builder().bucket("my-bucketname").objects(objects).build());
args
- UploadSnowballObjectsArgs
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 void setTimeout(long connectTimeout, long writeTimeout, long readTimeout)
Example:
minioClient.setTimeout(TimeUnit.SECONDS.toMillis(10), TimeUnit.SECONDS.toMillis(10),
TimeUnit.SECONDS.toMillis(30));
connectTimeout
- HTTP connect timeout in milliseconds.writeTimeout
- HTTP write timeout in milliseconds.readTimeout
- HTTP read timeout in milliseconds.public void ignoreCertCheck() throws KeyManagementException, NoSuchAlgorithmException
Example:
minioClient.ignoreCertCheck();
KeyManagementException
- thrown to indicate key management error.NoSuchAlgorithmException
- thrown to indicate missing of SSL library.public void setAppInfo(String name, String version)
name
- Your application name.version
- Your application version.public void traceOn(OutputStream traceStream)
traceStream
- OutputStream
for writing HTTP call tracing.traceOff()
public void traceOff() throws IOException
IOException
- upon connection errortraceOn(java.io.OutputStream)
@Deprecated public void enableAccelerateEndpoint()
@Deprecated public void disableAccelerateEndpoint()
public void enableDualStackEndpoint()
public void disableDualStackEndpoint()
public void enableVirtualStyleEndpoint()
public void disableVirtualStyleEndpoint()
public void setAwsS3Prefix(String awsS3Prefix)
public void close() throws Exception
close
in interface AutoCloseable
Exception
public static MinioClient.Builder builder()