Interface MinioOperations

  • All Known Implementing Classes:
    MinioTemplate

    @Validated
    public interface MinioOperations
    The minio operations.
    Author:
    Christian Bremer
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default boolean bucketExists​(io.minio.BucketExistsArgs args)
      Checks if a bucket exists.
      default io.minio.ObjectWriteResponse composeObject​(io.minio.ComposeObjectArgs args)
      Creates an object by combining data from different source objects using server-side copy.
      default io.minio.ObjectWriteResponse copyObject​(io.minio.CopyObjectArgs args)
      Creates an object by server-side copying data from another object.
      default void deleteBucketEncryption​(io.minio.DeleteBucketEncryptionArgs args)
      Deletes encryption configuration of a bucket.
      default void deleteBucketLifecycle​(io.minio.DeleteBucketLifecycleArgs args)
      Deletes lifecycle configuration of a bucket.
      default void deleteBucketNotification​(io.minio.DeleteBucketNotificationArgs args)
      Deletes notification configuration of a bucket.
      default void deleteBucketPolicy​(io.minio.DeleteBucketPolicyArgs args)
      Deletes bucket policy configuration to a bucket.
      default void deleteBucketReplication​(io.minio.DeleteBucketReplicationArgs args)
      Deletes bucket replication configuration from a bucket.
      default void deleteBucketTags​(io.minio.DeleteBucketTagsArgs args)
      Deletes tags of a bucket.
      default void deleteObjectLockConfiguration​(io.minio.DeleteObjectLockConfigurationArgs args)
      Deletes default object retention in a bucket.
      default void deleteObjectTags​(io.minio.DeleteObjectTagsArgs args)
      Deletes tags of an object.
      default void disableObjectLegalHold​(io.minio.DisableObjectLegalHoldArgs args)
      Disables legal hold on an object.
      default void downloadObject​(io.minio.DownloadObjectArgs args)
      Downloads data of a SSE-C encrypted object to file.
      default void enableObjectLegalHold​(io.minio.EnableObjectLegalHoldArgs args)
      Enables legal hold on an object.
      <T> T execute​(MinioClientCallback<T> callback)
      Execute minio callback.
      default io.minio.messages.SseConfiguration getBucketEncryption​(io.minio.GetBucketEncryptionArgs args)
      Gets encryption configuration of a bucket.
      default Optional<io.minio.messages.LifecycleConfiguration> getBucketLifecycle​(io.minio.GetBucketLifecycleArgs args)
      Gets lifecycle configuration of a bucket.
      default io.minio.messages.NotificationConfiguration getBucketNotification​(io.minio.GetBucketNotificationArgs args)
      Gets notification configuration of a bucket.
      default String getBucketPolicy​(io.minio.GetBucketPolicyArgs args)
      Gets bucket policy configuration of a bucket.
      default Optional<io.minio.messages.ReplicationConfiguration> getBucketReplication​(io.minio.GetBucketReplicationArgs args)
      Gets bucket replication configuration of a bucket.
      default io.minio.messages.Tags getBucketTags​(io.minio.GetBucketTagsArgs args)
      Gets tags of a bucket.
      default io.minio.messages.VersioningConfiguration getBucketVersioning​(io.minio.GetBucketVersioningArgs args)
      Gets versioning configuration of a bucket.
      default InputStream getObject​(io.minio.GetObjectArgs args)
      Gets data from offset to length of a SSE-C encrypted object.
      default io.minio.messages.ObjectLockConfiguration getObjectLockConfiguration​(io.minio.GetObjectLockConfigurationArgs args)
      Gets default object retention in a bucket.
      default io.minio.messages.Retention getObjectRetention​(io.minio.GetObjectRetentionArgs args)
      Gets retention configuration of an object.
      default io.minio.messages.Tags getObjectTags​(io.minio.GetObjectTagsArgs args)
      Gets tags of an object.
      default String getPresignedObjectUrl​(io.minio.GetPresignedObjectUrlArgs args)
      Gets presigned URL of an object for HTTP method, expiry time and custom request parameters.
      default Map<String,​String> getPresignedPostFormData​(io.minio.PostPolicy policy)
      Gets form-data of PostPolicy of an object to upload its data using POST method.
      default boolean isObjectLegalHoldEnabled​(io.minio.IsObjectLegalHoldEnabledArgs args)
      Returns true if legal hold is enabled on an object.
      default List<io.minio.messages.Bucket> listBuckets()
      Lists bucket information of all buckets.
      default List<io.minio.messages.Bucket> listBuckets​(io.minio.ListBucketsArgs args)
      Lists bucket information of all buckets.
      default io.minio.CloseableIterator<io.minio.Result<io.minio.messages.NotificationRecords>> listenBucketNotification​(io.minio.ListenBucketNotificationArgs args)
      Listens events of object prefix and suffix of a bucket.
      default Iterable<io.minio.Result<io.minio.messages.Item>> listObjects​(io.minio.ListObjectsArgs args)
      Lists objects information optionally with versions of a bucket.
      default void makeBucket​(io.minio.MakeBucketArgs args)
      Creates a bucket with region and object lock.
      default boolean objectExists​(io.minio.StatObjectArgs args)
      Check whether an object exists or not.
      default io.minio.ObjectWriteResponse putObject​(io.minio.PutObjectArgs args)
      Uploads data from a stream to an object.
      default void removeBucket​(io.minio.RemoveBucketArgs args)
      Removes an empty bucket using arguments.
      default void removeObject​(io.minio.RemoveObjectArgs args)
      Removes an object.
      default Iterable<io.minio.Result<io.minio.messages.DeleteError>> removeObjects​(io.minio.RemoveObjectsArgs args)
      Removes multiple objects lazily.
      default io.minio.SelectResponseStream selectObjectContent​(io.minio.SelectObjectContentArgs args)
      Selects content of an object by SQL expression.
      default void setBucketEncryption​(io.minio.SetBucketEncryptionArgs args)
      Sets encryption configuration of a bucket.
      default void setBucketLifecycle​(io.minio.SetBucketLifecycleArgs args)
      Sets lifecycle configuration to a bucket.
      default void setBucketNotification​(io.minio.SetBucketNotificationArgs args)
      Sets notification configuration to a bucket.
      default void setBucketPolicy​(io.minio.SetBucketPolicyArgs args)
      Sets bucket policy configuration to a bucket.
      default void setBucketReplication​(io.minio.SetBucketReplicationArgs args)
      Sets bucket replication configuration to a bucket.
      default void setBucketTags​(io.minio.SetBucketTagsArgs args)
      Sets tags to a bucket.
      default void setBucketVersioning​(io.minio.SetBucketVersioningArgs args)
      Sets versioning configuration of a bucket.
      default void setObjectLockConfiguration​(io.minio.SetObjectLockConfigurationArgs args)
      Sets default object retention in a bucket.
      default void setObjectRetention​(io.minio.SetObjectRetentionArgs args)
      Sets retention configuration to an object.
      default void setObjectTags​(io.minio.SetObjectTagsArgs args)
      Sets tags to an object.
      default io.minio.StatObjectResponse statObject​(io.minio.StatObjectArgs args)
      Gets information of an object.
      default io.minio.ObjectWriteResponse uploadObject​(io.minio.UploadObjectArgs args, DeleteMode deleteMode)
      Uploads data from a file to an object.
    • Method Detail

      • execute

        <T> T execute​(MinioClientCallback<T> callback)
        Execute minio callback.
        Type Parameters:
        T - the type of the result
        Parameters:
        callback - the callback
        Returns:
        the result
      • listBuckets

        default List<io.minio.messages.Bucket> listBuckets()
        Lists bucket information of all buckets.
        Example: 
         List<Bucket> bucketList = minioOperations.listBuckets();
         for (Bucket bucket : bucketList) {
           System.out.println(bucket.creationDate() + ", " + bucket.name());
         }
         
         
        Returns:
        list of bucket information
      • listBuckets

        default List<io.minio.messages.Bucket> listBuckets​(io.minio.ListBucketsArgs args)
        Lists bucket information of all buckets.
        Example: 
         List<Bucket> bucketList =
             minioClient.listBuckets(ListBucketsArgs.builder().extraHeaders(headers).build());
         for (Bucket bucket : bucketList) {
           System.out.println(bucket.creationDate() + ", " + bucket.name());
         }
         *
         
        Parameters:
        args - the list buckets arguments
        Returns:
        list of bucket information
      • bucketExists

        default boolean bucketExists​(io.minio.BucketExistsArgs args)
        Checks if a bucket exists.
        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");
         }
         *
         
        Parameters:
        args - the bucket exists arguments
        Returns:
        true if the bucket exists
      • makeBucket

        default void makeBucket​(io.minio.MakeBucketArgs args)
        Creates a bucket with region and object lock.
        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());
         *
         
        Parameters:
        args - object with bucket name, region and lock functionality
      • removeBucket

        default void removeBucket​(io.minio.RemoveBucketArgs args)
        Removes an empty bucket using arguments.
        Example: 
         minioClient.removeBucket(RemoveBucketArgs.builder().bucket("my-bucketname").build());
         *
         
        Parameters:
        args - the remove bucket arguments
      • getBucketEncryption

        default io.minio.messages.SseConfiguration getBucketEncryption​(io.minio.GetBucketEncryptionArgs args)
        Gets encryption configuration of a bucket.
        Example: 
         SseConfiguration config =
             minioClient.getBucketEncryption(
                 GetBucketEncryptionArgs.builder().bucket("my-bucketname").build());
         *
         
        Parameters:
        args - get bucket encryption arguments
        Returns:
        server -side encryption configuration
      • setBucketEncryption

        default void setBucketEncryption​(io.minio.SetBucketEncryptionArgs args)
        Sets encryption configuration of a bucket.
        Example: 
         minioClient.setBucketEncryption(
             SetBucketEncryptionArgs.builder().bucket("my-bucketname").config(config).build());
         *
         
        Parameters:
        args - bucket encryption arguments
      • deleteBucketEncryption

        default void deleteBucketEncryption​(io.minio.DeleteBucketEncryptionArgs args)
        Deletes encryption configuration of a bucket.
        Example: 
         minioClient.deleteBucketEncryption(
             DeleteBucketEncryptionArgs.builder().bucket("my-bucketname").build());
         *
         
        Parameters:
        args - delete bucket encryption arguments
      • getBucketLifecycle

        default Optional<io.minio.messages.LifecycleConfiguration> getBucketLifecycle​(io.minio.GetBucketLifecycleArgs args)
        Gets lifecycle configuration of a bucket.
        Example: 
         LifecycleConfiguration config =
             minioClient.getBucketLifecycle(
                 GetBucketLifecycleArgs.builder().bucket("my-bucketname").build());
         *
         
        Parameters:
        args - get bucket lifecycle arguments
        Returns:
        the lifecycle configuration
      • setBucketLifecycle

        default void setBucketLifecycle​(io.minio.SetBucketLifecycleArgs args)
        Sets lifecycle configuration to a bucket.
        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());
         *
         
        Parameters:
        args - set bucket lifecycle arguments
      • deleteBucketLifecycle

        default void deleteBucketLifecycle​(io.minio.DeleteBucketLifecycleArgs args)
        Deletes lifecycle configuration of a bucket.
        Example: 
         deleteBucketLifecycle(DeleteBucketLifecycleArgs.builder().bucket("my-bucketname").build());
         *
         
        Parameters:
        args - DeleteBucketLifecycleArgs object.
      • getBucketNotification

        default io.minio.messages.NotificationConfiguration getBucketNotification​(io.minio.GetBucketNotificationArgs args)
        Gets notification configuration of a bucket.
        Example: 
         NotificationConfiguration config =
             minioClient.getBucketNotification(
                 GetBucketNotificationArgs.builder().bucket("my-bucketname").build());
         *
         
        Parameters:
        args - get bucket notification arguments
        Returns:
        the notification configuration
      • setBucketNotification

        default void setBucketNotification​(io.minio.SetBucketNotificationArgs args)
        Sets notification configuration to a bucket.
        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());
         *
         
        Parameters:
        args - set bucket notification arguments
      • deleteBucketNotification

        default void deleteBucketNotification​(io.minio.DeleteBucketNotificationArgs args)
        Deletes notification configuration of a bucket.
        Example: 
         minioClient.deleteBucketNotification(
             DeleteBucketNotificationArgs.builder().bucket("my-bucketname").build());
         *
         
        Parameters:
        args - delete bucket notification arguments
      • listenBucketNotification

        default io.minio.CloseableIterator<io.minio.Result<io.minio.messages.NotificationRecords>> listenBucketNotification​(io.minio.ListenBucketNotificationArgs args)
        Listens events of object prefix and suffix of a bucket. The returned closable iterator is lazily evaluated hence its required to iterate to get new records and must be used with try-with-resource to release underneath network resources.
        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());
             }
           }
         }
         *
         
        Parameters:
        args - the listen bucket notification arguments
        Returns:
        lazy closable iterator contains event records
      • getBucketPolicy

        default String getBucketPolicy​(io.minio.GetBucketPolicyArgs args)
        Gets bucket policy configuration of a bucket.
        Example: 
         String config =
             minioClient.getBucketPolicy(GetBucketPolicyArgs.builder().bucket("my-bucketname").build());
         *
         
        Parameters:
        args - get bucket policy arguments
        Returns:
        bucket policy configuration as JSON string
      • setBucketPolicy

        default void setBucketPolicy​(io.minio.SetBucketPolicyArgs args)
        Sets bucket policy configuration to a bucket.
        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());
         *
         
        Parameters:
        args - set bucket policy arguments
      • deleteBucketPolicy

        default void deleteBucketPolicy​(io.minio.DeleteBucketPolicyArgs args)
        Deletes bucket policy configuration to a bucket.
        Example: 
         minioClient.deleteBucketPolicy(DeleteBucketPolicyArgs.builder().bucket("my-bucketname"));
         *
         
        Parameters:
        args - delete bucket policy arguments
      • getBucketReplication

        default Optional<io.minio.messages.ReplicationConfiguration> getBucketReplication​(io.minio.GetBucketReplicationArgs args)
        Gets bucket replication configuration of a bucket.
        Example: 
         ReplicationConfiguration config =
             minioClient.getBucketReplication(
                 GetBucketReplicationArgs.builder().bucket("my-bucketname").build());
         *
         
        Parameters:
        args - get bucket replication arguments
        Returns:
        the replication configuration
      • setBucketReplication

        default void setBucketReplication​(io.minio.SetBucketReplicationArgs args)
        Sets bucket replication configuration to a bucket.
        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());
         *
         
        Parameters:
        args - set bucket replication arguments
      • deleteBucketReplication

        default void deleteBucketReplication​(io.minio.DeleteBucketReplicationArgs args)
        Deletes bucket replication configuration from a bucket.
        Example: 
         minioClient.deleteBucketReplication(
             DeleteBucketReplicationArgs.builder().bucket("my-bucketname"));
         *
         
        Parameters:
        args - delete bucket replication arguments
      • getBucketTags

        default io.minio.messages.Tags getBucketTags​(io.minio.GetBucketTagsArgs args)
        Gets tags of a bucket.
        Example: 
         Tags tags =
             minioClient.getBucketTags(GetBucketTagsArgs.builder().bucket("my-bucketname").build());
         *
         
        Parameters:
        args - get bucket tags arguments
        Returns:
        the tags
      • setBucketTags

        default void setBucketTags​(io.minio.SetBucketTagsArgs args)
        Sets tags to a bucket.
        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());
         *
         
        Parameters:
        args - the set bucket tags arguments
      • deleteBucketTags

        default void deleteBucketTags​(io.minio.DeleteBucketTagsArgs args)
        Deletes tags of a bucket.
        Example: 
         minioClient.deleteBucketTags(DeleteBucketTagsArgs.builder().bucket("my-bucketname").build());
         *
         
        Parameters:
        args - the delete bucket tags arguments
      • getBucketVersioning

        default io.minio.messages.VersioningConfiguration getBucketVersioning​(io.minio.GetBucketVersioningArgs args)
        Gets versioning configuration of a bucket.
        Example: 
         VersioningConfiguration config =
             minioClient.getBucketVersioning(
                 GetBucketVersioningArgs.builder().bucket("my-bucketname").build());
         *
         
        Parameters:
        args - get bucket version arguments
        Returns:
        the versioning configuration.
      • setBucketVersioning

        default void setBucketVersioning​(io.minio.SetBucketVersioningArgs args)
        Sets versioning configuration of a bucket.
        Example: 
         minioClient.setBucketVersioning(
             SetBucketVersioningArgs.builder().bucket("my-bucketname").config(config).build());
         *
         
        Parameters:
        args - set bucket versioning arguments
      • getObjectLockConfiguration

        default io.minio.messages.ObjectLockConfiguration getObjectLockConfiguration​(io.minio.GetObjectLockConfigurationArgs args)
        Gets default object retention in a bucket.
        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());
         *
         
        Parameters:
        args - get object retention configuration arguments
        Returns:
        the default retention configuration
      • setObjectLockConfiguration

        default void setObjectLockConfiguration​(io.minio.SetObjectLockConfigurationArgs args)
        Sets default object retention in a bucket.
        Example: 
         ObjectLockConfiguration config = new ObjectLockConfiguration(
             RetentionMode.COMPLIANCE, new RetentionDurationDays(100));
         minioClient.setObjectLockConfiguration(
             SetObjectLockConfigurationArgs.builder().bucket("my-bucketname").config(config).build());
         *
         
        Parameters:
        args - the default object retention configuration arguments
      • deleteObjectLockConfiguration

        default void deleteObjectLockConfiguration​(io.minio.DeleteObjectLockConfigurationArgs args)
        Deletes default object retention in a bucket.
        Example: 
         minioClient.deleteObjectLockConfiguration(
             DeleteObjectLockConfigurationArgs.builder().bucket("my-bucketname").build());
         *
         
        Parameters:
        args - delete object retention configuration arguments
      • listObjects

        default Iterable<io.minio.Result<io.minio.messages.Item>> listObjects​(io.minio.ListObjectsArgs args)
        Lists objects information optionally with versions of a bucket. Supports both the versions 1 and 2 of the S3 API. By default, the version 2 API is used.
        Version 1 can be used by passing the optional argument 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 those 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 those 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());
         *
         
        Parameters:
        args - list objects arguments
        Returns:
        lazy iterator contains object information
      • putObject

        default io.minio.ObjectWriteResponse putObject​(io.minio.PutObjectArgs args)
        Uploads data from a stream to an object.
        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());
         *
         
        Parameters:
        args - put object arguments
        Returns:
        the object write response
      • uploadObject

        default io.minio.ObjectWriteResponse uploadObject​(io.minio.UploadObjectArgs args,
                                                          DeleteMode deleteMode)
        Uploads data from a file to an object.
        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());
         *
         
        Parameters:
        args - upload object arguments
        deleteMode - delete mode
        Returns:
        the object write response
      • downloadObject

        default void downloadObject​(io.minio.DownloadObjectArgs args)
        Downloads data of a SSE-C encrypted object to file.
        Example: 
         minioClient.downloadObject(
           GetObjectArgs.builder()
             .bucket("my-bucketname")
             .object("my-objectname")
             .ssec(ssec)
             .fileName("my-filename")
             .build());
         *
         
        Parameters:
        args - download object arguments
      • getPresignedObjectUrl

        default String getPresignedObjectUrl​(io.minio.GetPresignedObjectUrlArgs args)
        Gets presigned URL of an object for HTTP method, expiry time and custom request parameters.
        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);
         *
         
        Parameters:
        args - get pre-signed object url arguments
        Returns:
        the pre-signed URL
      • getPresignedPostFormData

        default Map<String,​String> getPresignedPostFormData​(io.minio.PostPolicy policy)
        Gets form-data of 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");
         }
         *
         
        Parameters:
        policy - post policy of an object
        Returns:
        contains form-data to upload an object using POST method
      • statObject

        default io.minio.StatObjectResponse statObject​(io.minio.StatObjectArgs args)
        Gets information of an object.
        Example: 
         // Get information of an object.
         ObjectStat objectStat =
             minioClient.statObject(
                 StatObjectArgs.builder().bucket("my-bucketname").object("my-objectname").build());
        
         // Get information of SSE-C encrypted object.
         ObjectStat objectStat =
             minioClient.statObject(
                 StatObjectArgs.builder()
                     .bucket("my-bucketname")
                     .object("my-objectname")
                     .ssec(ssec)
                     .build());
        
         // Get information of a versioned object.
         ObjectStat objectStat =
             minioClient.statObject(
                 StatObjectArgs.builder()
                     .bucket("my-bucketname")
                     .object("my-objectname")
                     .versionId("version-id")
                     .build());
        
         // Get information of a SSE-C encrypted versioned object.
         ObjectStat objectStat =
             minioClient.statObject(
                 StatObjectArgs.builder()
                     .bucket("my-bucketname")
                     .object("my-objectname")
                     .versionId("version-id")
                     .ssec(ssec)
                     .build());
         *
         
        Parameters:
        args - status object arguments
        Returns:
        populated object information and metadata
      • objectExists

        default boolean objectExists​(io.minio.StatObjectArgs args)
        Check whether an object exists or not.
        Parameters:
        args - status object arguments
        Returns:
        true if the object exists, otherwise false
      • getObject

        default InputStream getObject​(io.minio.GetObjectArgs args)
        Gets data from offset to length of a SSE-C encrypted object. Returned 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
         }
         *
         
        Parameters:
        args - the get object arguments
        Returns:
        the input stream
      • selectObjectContent

        default io.minio.SelectResponseStream selectObjectContent​(io.minio.SelectObjectContentArgs args)
        Selects content of an object by SQL expression.
        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();
         *
         
        Parameters:
        args - the select object content arguments
        Returns:
        the select response stream
      • removeObject

        default void removeObject​(io.minio.RemoveObjectArgs args)
        Removes an object.
        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());
         *
         
        Parameters:
        args - remove object arguments
      • removeObjects

        default Iterable<io.minio.Result<io.minio.messages.DeleteError>> removeObjects​(io.minio.RemoveObjectsArgs args)
        Removes multiple objects lazily. Its required to iterate the returned Iterable to perform removal.
        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());
         }
         *
         
        Parameters:
        args - the objects to remove
        Returns:
        lazy iterator contains object removal status
      • composeObject

        default io.minio.ObjectWriteResponse composeObject​(io.minio.ComposeObjectArgs args)
        Creates an object by combining data from different source objects using server-side copy.
        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());
         *
         
        Parameters:
        args - compose object arguments
        Returns:
        the object write response
      • copyObject

        default io.minio.ObjectWriteResponse copyObject​(io.minio.CopyObjectArgs args)
        Creates an object by server-side copying data from another object.
        Parameters:
        args - copy object arguments
        Returns:
        the object write response
      • getObjectRetention

        default io.minio.messages.Retention getObjectRetention​(io.minio.GetObjectRetentionArgs args)
        Gets retention configuration of an object.
        Example: 
         Retention retention =
             minioClient.getObjectRetention(GetObjectRetentionArgs.builder()
                .bucket(bucketName)
                .object(objectName)
                .versionId(versionId)
                .build()););
         System.out.println(
             "mode: " + retention.mode() + "until: " + retention.retainUntilDate());
         *
         
        Parameters:
        args - get object retention arguments
        Returns:
        object retention configuration
      • setObjectRetention

        default void setObjectRetention​(io.minio.SetObjectRetentionArgs args)
        Sets retention configuration to an object.
        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());
         *
         
        Parameters:
        args - set object retention arguments
      • getObjectTags

        default io.minio.messages.Tags getObjectTags​(io.minio.GetObjectTagsArgs args)
        Gets tags of an object.
        Example: 
         Tags tags =
             minioClient.getObjectTags(
                 GetObjectTagsArgs.builder().bucket("my-bucketname").object("my-objectname").build());
         *
         
        Parameters:
        args - get object tags arguments
        Returns:
        the tags
      • setObjectTags

        default void setObjectTags​(io.minio.SetObjectTagsArgs args)
        Sets tags to an object.
        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());
         *
         
        Parameters:
        args - set object tags arguments
      • deleteObjectTags

        default void deleteObjectTags​(io.minio.DeleteObjectTagsArgs args)
        Deletes tags of an object.
        Example: 
         minioClient.deleteObjectTags(
             DeleteObjectTags.builder().bucket("my-bucketname").object("my-objectname").build());
         *
         
        Parameters:
        args - delete object tags arguments
      • isObjectLegalHoldEnabled

        default boolean isObjectLegalHoldEnabled​(io.minio.IsObjectLegalHoldEnabledArgs args)
        Returns true if legal hold is enabled on an object.
        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");
          }
         *
         
        Parameters:
        args - is object legel hold enabled arguments
        Returns:
        true if legal hold is enabled
      • enableObjectLegalHold

        default void enableObjectLegalHold​(io.minio.EnableObjectLegalHoldArgs args)
        Enables legal hold on an object.
        Example: 
         minioClient.enableObjectLegalHold(
            EnableObjectLegalHoldArgs.builder()
                .bucket("my-bucketname")
                .object("my-objectname")
                .versionId("object-versionId")
                .build());
         *
         
        Parameters:
        args - enable object legal hold arguments
      • disableObjectLegalHold

        default void disableObjectLegalHold​(io.minio.DisableObjectLegalHoldArgs args)
        Disables legal hold on an object.
        Example: 
         minioClient.disableObjectLegalHold(
            DisableObjectLegalHoldArgs.builder()
                .bucket("my-bucketname")
                .object("my-objectname")
                .versionId("object-versionId")
                .build());
         *
         
        Parameters:
        args - disable object legal hold arguments