Class S3ClientWrapper

    • Constructor Detail

      • S3ClientWrapper

        public S3ClientWrapper​(software.amazon.awssdk.services.s3.S3Client s3Client)
    • Method Detail

      • bucketExists

        public boolean bucketExists​(String bucketName)
        Description copied from interface: ObjectStoreClient
        Checks if an object store bucket with the specified name exists.
        Specified by:
        bucketExists in interface ObjectStoreClient
        Parameters:
        bucketName - The name of the object store bucket.
        Returns:
        True if the bucket exists.
      • getObjects

        @Retryable(value=software.amazon.awssdk.core.exception.SdkException.class,
                   maxAttemptsExpression="${services.distribution.objectstore.retry-attempts}",
                   backoff=@Backoff(delayExpression="${services.distribution.objectstore.retry-backoff}"))
        public List<S3Object> getObjects​(String bucket,
                                         String prefix)
        Description copied from interface: ObjectStoreClient
        Downloads the all objects that match the specified prefix from the specified object store bucket.
        Specified by:
        getObjects in interface ObjectStoreClient
        Parameters:
        bucket - The name of the object store bucket.
        prefix - The prefix that the names of the returned objects start with.
        Returns:
        A list of objects from the object store that match the specified parameters.
      • putObject

        @Retryable(value=software.amazon.awssdk.core.exception.SdkException.class,
                   maxAttemptsExpression="${services.distribution.objectstore.retry-attempts}",
                   backoff=@Backoff(delayExpression="${services.distribution.objectstore.retry-backoff}"))
        public void putObject​(String bucket,
                              String objectName,
                              Path filePath,
                              Map<ObjectStoreClient.HeaderKey,​String> headers)
        Description copied from interface: ObjectStoreClient
        Uploads data from the specified file to an object with the specified name.
        Specified by:
        putObject in interface ObjectStoreClient
        Parameters:
        bucket - The name of the object store bucket.
        objectName - The name of the target object.
        filePath - The path associated with the file to upload.
        headers - The headers to be used during upload.
      • removeObjects

        @Retryable(value={software.amazon.awssdk.core.exception.SdkException.class,ObjectStoreOperationFailedException.class},
                   maxAttemptsExpression="${services.distribution.objectstore.retry-attempts}",
                   backoff=@Backoff(delayExpression="${services.distribution.objectstore.retry-backoff}"))
        public void removeObjects​(String bucket,
                                  List<String> objectNames)
        Description copied from interface: ObjectStoreClient
        Removes all the specified objects from the specified object store bucket.
        Specified by:
        removeObjects in interface ObjectStoreClient
        Parameters:
        bucket - The name of the object store bucket.
        objectNames - The names of objects to delete.