Interface ObjectStorageOperations<I,O,D>

Type Parameters:
I - Cloud vendor-specific upload request class or builder.
O - Cloud vendor-specific upload response.
D - Cloud vendor-specific delete response.
All Known Implementing Classes:
AwsS3Operations, AzureBlobStorageOperations, GoogleCloudStorageOperations, LocalStorageOperations, OracleCloudStorageOperations

public interface ObjectStorageOperations<I,O,D>
Main interface for object storage operations.
Since:
1.0
Author:
Pavol Gressa
  • Method Details

    • upload

      @NonNull @NonNull UploadResponse<O> upload(@NonNull @NonNull UploadRequest request)
      Uploads an object to the object storage. If there is an existing entry, it will be updated.
      Parameters:
      request - the upload request
      Returns:
      the upload response
      Throws:
      ObjectStorageException - if there was a failure storing the object
    • upload

      @NonNull @NonNull UploadResponse<O> upload(@NonNull @NonNull UploadRequest request, @NonNull @NonNull Consumer<I> requestConsumer)
      Uploads an object to the object storage. If there is an existing entry, it will be updated.
      Parameters:
      request - the upload request
      requestConsumer - Upload request builder consumer
      Returns:
      the upload response
      Throws:
      ObjectStorageException - if there was a failure storing the object
    • retrieve

      @NonNull <E extends ObjectStorageEntry<?>> @NonNull Optional<E> retrieve(@NonNull @NonNull String key)
      Gets the object from object storage.
      Type Parameters:
      E - an instance of ObjectStorageEntry.
      Parameters:
      key - the object path in the format /foo/bar/file
      Returns:
      the object, or empty optional if the object does not exist
      Throws:
      ObjectStorageException - if there was a failure retrieving the object
    • delete

      @NonNull D delete(@NonNull @NonNull String key)
      Deletes an object from the object storage.
      Parameters:
      key - object path in the format /foo/bar/file
      Returns:
      Cloud vendor-specific delete response.
      Throws:
      ObjectStorageException - if there was a failure deleting the object
    • exists

      default boolean exists(@NonNull @NonNull String key)
      Checks whether an entry with the given key exists in the object storage.
      Parameters:
      key - object path in the format /foo/bar/file
      Returns:
      true if the entry exists, false otherwise.
      Since:
      1.1.0
    • listObjects

      @NonNull default @NonNull Set<String> listObjects()
      Lists the objects that exist in the object storage.
      Returns:
      a set of keys (paths) of the existing objects, if any, or an empty list otherwise.
      Since:
      1.1.0
    • copy

      default void copy(@NonNull @NonNull String sourceKey, @NonNull @NonNull String destinationKey)
      Copies an object stored at sourceKey to destinationKey, within the same object storage (bucket/container). If the destination exists, it will be overwritten.
      Parameters:
      sourceKey - the key of the source object
      destinationKey - the key of the destination object
      Since:
      1.1.0
    • presign

      @NonNull default @NonNull PresignResponse presign(@NonNull @NonNull PresignRequest request)
      Generates a pre-authorized (signed) request for the given operation.
      Parameters:
      request - the presign request parameters
      Returns:
      information with the generated URL and its expiration
      Throws:
      UnsupportedOperationException - if the provider does not support presigned operations
      Since:
      2.10.0
    • invalidatePresignedRequest

      default void invalidatePresignedRequest(@NonNull @NonNull PresignResponse presignResponse)
      Explicitly invalidates a previously generated pre-signed request.
      Parameters:
      presignResponse - The response returned by presign(PresignRequest).
      Throws:
      UnsupportedOperationException - if the provider does not support explicit invalidation
      Since:
      2.10.0