@EachBean(value=GoogleCloudStorageConfiguration.class) public class GoogleCloudStorageOperations extends java.lang.Object implements ObjectStorageOperations<com.google.cloud.storage.BlobInfo.Builder,com.google.cloud.storage.Blob,java.lang.Boolean>
ObjectStorageOperations.| Constructor and Description |
|---|
GoogleCloudStorageOperations(GoogleCloudStorageConfiguration configuration,
InputStreamMapper inputStreamMapper,
com.google.cloud.storage.Storage storage)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
copy(java.lang.String sourceKey,
java.lang.String destinationKey)
Copies an object stored at
sourceKey to destinationKey, within the
same object storage (bucket/container). |
protected com.google.cloud.storage.BlobInfo.Builder |
createBlobInfoBuilder(UploadRequest uploadRequest) |
java.lang.Boolean |
delete(java.lang.String key)
Deletes an object from the object storage.
|
boolean |
exists(java.lang.String key)
Checks whether an entry with the given key exists in the object storage.
|
java.util.Set<java.lang.String> |
listObjects()
Lists the objects that exist in the object storage.
|
java.util.Optional<GoogleCloudStorageEntry> |
retrieve(java.lang.String key)
Gets the object from object storage.
|
UploadResponse<com.google.cloud.storage.Blob> |
upload(UploadRequest uploadRequest)
Uploads an object to the object storage.
|
UploadResponse<com.google.cloud.storage.Blob> |
upload(UploadRequest uploadRequest,
java.util.function.Consumer<com.google.cloud.storage.BlobInfo.Builder> uploadRequestBuilder)
Uploads an object to the object storage.
|
public GoogleCloudStorageOperations(@Parameter
GoogleCloudStorageConfiguration configuration,
InputStreamMapper inputStreamMapper,
com.google.cloud.storage.Storage storage)
configuration - Google Storage ConfigurationinputStreamMapper - Input Stream Mapperstorage - Interface for Google Cloud Storage@NonNull public UploadResponse<com.google.cloud.storage.Blob> upload(@NonNull UploadRequest uploadRequest)
ObjectStorageOperationsupload in interface ObjectStorageOperations<com.google.cloud.storage.BlobInfo.Builder,com.google.cloud.storage.Blob,java.lang.Boolean>uploadRequest - the upload request@NonNull public UploadResponse<com.google.cloud.storage.Blob> upload(@NonNull UploadRequest uploadRequest, @NonNull java.util.function.Consumer<com.google.cloud.storage.BlobInfo.Builder> uploadRequestBuilder)
ObjectStorageOperationsupload in interface ObjectStorageOperations<com.google.cloud.storage.BlobInfo.Builder,com.google.cloud.storage.Blob,java.lang.Boolean>uploadRequest - the upload requestuploadRequestBuilder - Upload request builder consumer@NonNull public java.util.Optional<GoogleCloudStorageEntry> retrieve(@NonNull java.lang.String key)
ObjectStorageOperationsretrieve in interface ObjectStorageOperations<com.google.cloud.storage.BlobInfo.Builder,com.google.cloud.storage.Blob,java.lang.Boolean>key - the object path in the format /foo/bar/file@NonNull
public java.lang.Boolean delete(@NonNull
java.lang.String key)
ObjectStorageOperationsdelete in interface ObjectStorageOperations<com.google.cloud.storage.BlobInfo.Builder,com.google.cloud.storage.Blob,java.lang.Boolean>key - object path in the format /foo/bar/filepublic boolean exists(@NonNull
java.lang.String key)
ObjectStorageOperationsexists in interface ObjectStorageOperations<com.google.cloud.storage.BlobInfo.Builder,com.google.cloud.storage.Blob,java.lang.Boolean>key - object path in the format /foo/bar/file@NonNull public java.util.Set<java.lang.String> listObjects()
ObjectStorageOperationslistObjects in interface ObjectStorageOperations<com.google.cloud.storage.BlobInfo.Builder,com.google.cloud.storage.Blob,java.lang.Boolean>public void copy(@NonNull
java.lang.String sourceKey,
@NonNull
java.lang.String destinationKey)
ObjectStorageOperationssourceKey to destinationKey, within the
same object storage (bucket/container). If the destination exists, it will be overwritten.copy in interface ObjectStorageOperations<com.google.cloud.storage.BlobInfo.Builder,com.google.cloud.storage.Blob,java.lang.Boolean>sourceKey - the key of the source objectdestinationKey - the key of the destination object@NonNull
protected com.google.cloud.storage.BlobInfo.Builder createBlobInfoBuilder(@NonNull
UploadRequest uploadRequest)
uploadRequest - Upload Request