@Connector(name="google-cloud-storage", friendlyName="Google Cloud Storage", minMuleVersion="3.8") @RequiresEnterpriseLicense public class GoogleCloudStorageConnector extends Object
Constructor and Description |
---|
GoogleCloudStorageConnector() |
Modifier and Type | Method and Description |
---|---|
void |
closeReadChannel(com.google.cloud.ReadChannel readChannel)
Close a read channel
|
void |
closeWriteChannel(com.google.cloud.WriteChannel writeChannel)
Close a write channel
|
com.google.cloud.storage.Acl |
createAcl(Object itemId,
com.google.cloud.storage.Acl acl,
AclSelector aclSelector)
Create an ACL on a particular object(Blob, Bucket or Default) Access Control List Grant (ACL) read or write access to users for individual buckets or objects.
|
com.google.cloud.storage.Blob |
createBlob(BlobInfoPojo blobInfo,
List<com.google.cloud.storage.Storage.BlobTargetOption> blobTargetOption,
InputStream data)
Creates a Blob in a Bucket on Google Cloud Storage
|
com.google.cloud.storage.Bucket |
createBucket(BucketInfoPojo bucketInfo,
List<com.google.cloud.storage.Storage.BucketTargetOption> bucketTargetOptions)
Creates a bucket on Google Cloud Storage
|
com.google.cloud.RestorableState<com.google.cloud.ReadChannel> |
createReadRestorableState(com.google.cloud.ReadChannel readChannel)
Create a restorable state for a read channel
|
com.google.cloud.RestorableState<com.google.cloud.WriteChannel> |
createWriteRestorableState(com.google.cloud.WriteChannel writeChannel)
Create a Write Restorable state
|
Boolean |
deleteAcl(Object itemId,
com.google.cloud.storage.Acl.Entity entity,
AclSelector aclSelector)
Delete an ACL for a particular object(Blob, Bucket or Default) Access Control List Grant (ACL) read or write access to users for individual buckets or objects.
|
Boolean |
deleteBlob(BlobIdPojo blobId)
Deletes a Blob from a Bucket on Google Cloud Storage
|
Boolean |
deleteBucket(String bucketName,
List<com.google.cloud.storage.Storage.BucketSourceOption> bucketSourceOptions)
Deletes a bucket on Google Cloud Storage
|
InputStream |
downloadBlob(String bucket,
String blob,
List<com.google.cloud.storage.Storage.BlobSourceOption> options)
Download a particular blob
|
List<com.google.cloud.storage.Acl> |
getAcl(Object itemId,
AclSelector aclSelector)
Get an ACL for a particular object(Blob, Bucket or Default) Access Control List (ACL) grant read or write access to users for individual buckets or objects.
|
com.google.cloud.storage.Blob |
getBlob(BlobIdPojo blobId,
List<com.google.cloud.storage.Storage.BlobGetOption> blobGetOptions)
Retrieves Blob information from Google Cloud Storage
|
com.google.cloud.storage.Bucket |
getBucket(String bucketName,
List<com.google.cloud.storage.Storage.BucketGetOption> bucketGetOptions)
Retrieves a Bucket from Google Cloud Storage
|
GoogleCloudStorageConnectionStrategy |
getConfig() |
List<com.google.cloud.storage.Blob> |
listBlobs(String bucket,
List<com.google.cloud.storage.Storage.BlobListOption> blobListOptions)
List all blobs in a bucket
|
List<com.google.cloud.storage.Bucket> |
listBuckets(List<com.google.cloud.storage.Storage.BucketListOption> bucketListOptions)
Lists Buckets available on Google Cloud Storage
|
com.google.cloud.ReadChannel |
openReadChannel(BlobIdPojo blobId,
List<com.google.cloud.storage.Storage.BlobSourceOption> blobSourceOption)
Open a read channel
|
com.google.cloud.WriteChannel |
openWriteChannel(BlobInfoPojo blobInfo,
List<BlobWriteOptionWrapper> options)
Open a write channel
|
InputStream |
readDataFromReadChannel(com.google.cloud.ReadChannel readChannel)
Read data from a Read Channel
|
com.google.cloud.storage.Blob |
relocateBlob(BlobIdPojo blobId,
String targetBucket,
String targetBlob)
Relocate a blob from one bucket to another or/and one path to another
|
com.google.cloud.ReadChannel |
restoreReadChannel(com.google.cloud.RestorableState<com.google.cloud.ReadChannel> restorableState)
Restore a Read channel to a restorable state.
|
com.google.cloud.WriteChannel |
restoreWriteChannel(com.google.cloud.RestorableState<com.google.cloud.WriteChannel> restorableState)
Restore a write channel to a restorable state
|
void |
setConfig(GoogleCloudStorageConnectionStrategy config) |
URL |
signBlob(com.google.cloud.storage.Blob blob,
TimeUnit timeUnit,
Long timeAmount,
String keyPath)
Generates a signed URL for a blob.
|
com.google.cloud.storage.Acl |
updateAcl(Object itemId,
com.google.cloud.storage.Acl acl,
AclSelector aclSelector)
Update an ACL for a particular object(Blob, Bucket or Default) Access Control List (ACL) grant read or write access to users for individual buckets or objects.
|
com.google.cloud.storage.Blob |
updateBlob(com.google.cloud.storage.Blob blob,
Map<String,String> updateData)
Update/add blob Metadata
|
com.google.cloud.storage.Bucket |
updateBucket(BucketInfoPojo bucketInfo,
List<com.google.cloud.storage.Storage.BucketTargetOption> bucketTargetOptions)
Updates a bucket on Google Cloud Storage
|
int |
writeToChannel(com.google.cloud.WriteChannel writeChannel,
InputStream data)
Write to a Write Channel
|
@Processor public com.google.cloud.storage.Acl createAcl(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Item ID") Object itemId, @RefOnly com.google.cloud.storage.Acl acl, AclSelector aclSelector) throws IncorrectSelectorException, GoogleStorageApiException
itemId
- The id of the object; BlobId if AclSelector is Blob, otherwise String containing bucket name.acl
- The ACL with the particular Role to be granted. Example: Acl.of(User.ofAllAuthenticatedUsers(), Role.OWNER); Valid Roles: OWNER, READER, WRITERaclSelector
- The the type of object onto which the ACL is created. Valid values: Blob, Bucket, DefaultIncorrectSelectorException
- When operation selected does not exist. Use AclSelector enum class to avoid any issue. Example: AclSelector.Blob Use AclSelector enum class to avoid any issue.
Example: AclSelector.BlobGoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes @see Google Cloud Storage error codes@Processor public List<com.google.cloud.storage.Acl> getAcl(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Item ID") Object itemId, AclSelector aclSelector) throws IncorrectSelectorException, GoogleStorageApiException
itemId
- The id of the object; BlobId if AclSelector is Blob, otherwise String containing bucket name.aclSelector
- The the type of object onto which the ACL is created. Valid values: Blob, Bucket, DefaultIncorrectSelectorException
- When operation selected does not exist. Use AclSelector enum class to avoid any issue. Example: AclSelector.BlobGoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public com.google.cloud.storage.Acl updateAcl(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Item ID") Object itemId, @RefOnly com.google.cloud.storage.Acl acl, AclSelector aclSelector) throws IncorrectSelectorException, GoogleStorageApiException
itemId
- The id of the object; BlobId if AclSelector is Blob, otherwise String containing bucket name.acl
- The ACL with the particular Role to be granted. Example: Acl.of(User.ofAllAuthenticatedUsers(), Role.OWNER); Valid Roles: OWNER, READER, WRITERaclSelector
- The the type of object onto which the ACL is created. Valid values: Blob, Bucket, DefaultIncorrectSelectorException
- When operation selected does not exist. Use AclSelector enum class to avoid any issue. Example: AclSelector.BlobGoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public Boolean deleteAcl(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Item ID") Object itemId, @RefOnly com.google.cloud.storage.Acl.Entity entity, AclSelector aclSelector) throws IncorrectSelectorException, GoogleStorageApiException
itemId
- The id of the object; BlobId if AclSelector is Blob, otherwise String containing bucket name.entity
- The entity to be deletedaclSelector
- The the type of object onto which the ACL is created. Valid values: Blob, Bucket, DefaultIncorrectSelectorException
- When operation selected does not exist. Use AclSelector enum class to avoid any issue. Example: AclSelector.BlobGoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public com.google.cloud.storage.Bucket createBucket(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Bucket Info") BucketInfoPojo bucketInfo, @RefOnly @Optional @FriendlyName(value="Bucket Target Options") List<com.google.cloud.storage.Storage.BucketTargetOption> bucketTargetOptions) throws GoogleStorageApiException
bucketInfo
- BucketInfoPojo
bucketTargetOptions
- The bucket targeting options.GoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public Boolean deleteBucket(@Default(value="#[payload]") @FriendlyName(value="Bucket Name") String bucketName, @RefOnly @Optional @FriendlyName(value="Bucket Source Options") List<com.google.cloud.storage.Storage.BucketSourceOption> bucketSourceOptions) throws GoogleStorageApiException
bucketName
- The name of the bucket to be deleted.bucketSourceOptions
- The bucket sourcing options for deleting buckets. Example: BucketSourceOption.metagenerationMatch(long metageneration)true
if bucket was deleted, false
if it was not foundGoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public com.google.cloud.storage.Bucket getBucket(@Default(value="#[payload]") @FriendlyName(value="Bucket Name") String bucketName, @RefOnly @Optional @FriendlyName(value="Bucket Options") List<com.google.cloud.storage.Storage.BucketGetOption> bucketGetOptions) throws GoogleStorageApiException
bucketName
- The name of the bucketbucketGetOptions
- The blob get options. Example: BucketGetOption.metagenerationMatch(long metageneration)GoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public List<com.google.cloud.storage.Bucket> listBuckets(@RefOnly @Optional @FriendlyName(value="Bucket Options") List<com.google.cloud.storage.Storage.BucketListOption> bucketListOptions) throws GoogleStorageApiException
bucketListOptions
- The bucket list options. Example: BucketListOption.pageSize(long pagesize) returns an option to specify the maximum number of buckets returned per page.GoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public com.google.cloud.storage.Bucket updateBucket(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Bucket Info") BucketInfoPojo bucketInfo, @RefOnly @Optional @FriendlyName(value="Bucket Target Options") List<com.google.cloud.storage.Storage.BucketTargetOption> bucketTargetOptions) throws GoogleStorageApiException
bucketInfo
- BucketInfoPojo
bucketTargetOptions
- The bucket target options. Example: BucketTargetOption.predefinedAcl(Acl acl) Returns an option for specifying bucket's predefined ACL configuration.GoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public com.google.cloud.storage.Blob createBlob(@RefOnly @FriendlyName(value="Blob Info") BlobInfoPojo blobInfo, @RefOnly @Optional @FriendlyName(value="Blob Target Options") List<com.google.cloud.storage.Storage.BlobTargetOption> blobTargetOption, @Default(value="#[payload]") @RefOnly @FriendlyName(value="Data") InputStream data) throws GoogleStorageApiException
blobInfo
- BlobInfoPojo
blobTargetOption
- The blob target options. Example: BlobTargetOption.doesNotExist() returns an option that causes an operation to succeed only if the target blob does not exist.data
- the data to be stored to the blobGoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public Boolean deleteBlob(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Blob ID") BlobIdPojo blobId) throws GoogleStorageApiException
blobId
- BlobIdPojo
GoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public com.google.cloud.storage.Blob getBlob(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Blob ID") BlobIdPojo blobId, @RefOnly @Optional @FriendlyName(value="Blob Options") List<com.google.cloud.storage.Storage.BlobGetOption> blobGetOptions) throws GoogleStorageApiException
blobId
- BlobIdPojo
blobGetOptions
- The blob get options. Example: BlobGetOption.fields(BlobField... fields) returns an option to specify the blob's fields to be returnedGoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public URL signBlob(@RefOnly @Default(value="#[payload]") com.google.cloud.storage.Blob blob, @RefOnly @FriendlyName(value="Time Unit") TimeUnit timeUnit, @FriendlyName(value="Time Amount") Long timeAmount, @Optional @FriendlyName(value="Key Path") String keyPath) throws GoogleStorageApiException, IOException
blob
- the blob to be signedtimeUnit
- the time unit of the time amounttimeAmount
- the time amountkeyPath
- the path to the Key containing the service account info .json that will be used for signing the blobGoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codesIOException
@Processor public com.google.cloud.storage.Blob relocateBlob(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Blob ID") BlobIdPojo blobId, @FriendlyName(value="Target Bucket") String targetBucket, @FriendlyName(value="Target Blob") String targetBlob) throws GoogleStorageApiException
blobId
- BlobIdPojo
targetBucket
- the name of the target buckettargetBlob
- the name of the target blobGoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public com.google.cloud.storage.Blob updateBlob(@RefOnly @Default(value="#[payload]") com.google.cloud.storage.Blob blob, @RefOnly @FriendlyName(value="Data to Update") Map<String,String> updateData) throws GoogleStorageApiException
blob
- The blob to be updatedupdateData
- The metadata to be updatedGoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public List<com.google.cloud.storage.Blob> listBlobs(@Default(value="#[payload]") @FriendlyName(value="Bucket Name") String bucket, @Optional @RefOnly @FriendlyName(value="Blob Options") List<com.google.cloud.storage.Storage.BlobListOption> blobListOptions) throws GoogleStorageApiException
bucket
- The name of the bucketblobListOptions
- The blob list options. Example: BlobListOption.pageSize(long pageSize) Returns an option to specify the maximum number of blobs returned per page.GoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public InputStream downloadBlob(String bucket, @Default(value="#[payload]") String blob, @RefOnly @Optional @FriendlyName(value="Blob Source Options") List<com.google.cloud.storage.Storage.BlobSourceOption> options) throws GoogleStorageApiException
bucket
- the name of the bucket which will be downloadedblob
- the name of the blob which will be downloadedoptions
- The blob source options. Example: BlobSourceOption.generationMatch() Returns an option for blob's data generation match. If this option is used the request will
fail if blob's generation does not match. The generation value to compare with the actual blob's generation is taken from a source BlobId
GoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public com.google.cloud.ReadChannel openReadChannel(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Blob ID") BlobIdPojo blobId, @RefOnly @Optional @FriendlyName(value="Blob Source Options") List<com.google.cloud.storage.Storage.BlobSourceOption> blobSourceOption) throws GoogleStorageApiException
blobId
- BlobIdPojo
blobSourceOption
- The blob source option Example: BlobSourceOption.generationMatch() Returns an option for blob's data generation match. If this option is used the request will
fail if blob's generation does not match. The generation value to compare with the actual blob's generation is taken from a source BlobId
GoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public com.google.cloud.RestorableState<com.google.cloud.ReadChannel> createReadRestorableState(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Read Channel") com.google.cloud.ReadChannel readChannel) throws GoogleStorageApiException
readChannel
- The read channel for which the Restorable State will be createdGoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public InputStream readDataFromReadChannel(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Read Channel") com.google.cloud.ReadChannel readChannel) throws GoogleStorageApiException
readChannel
- The read channel from which data would be readGoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public void closeReadChannel(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Read Channel") com.google.cloud.ReadChannel readChannel) throws GoogleStorageApiException
readChannel
- The ReadChannel to be closed.GoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public com.google.cloud.ReadChannel restoreReadChannel(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Restorable State") com.google.cloud.RestorableState<com.google.cloud.ReadChannel> restorableState) throws GoogleStorageApiException
restorableState
- The state into which to restore the read channel.GoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public com.google.cloud.WriteChannel openWriteChannel(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Blob Info") BlobInfoPojo blobInfo, @Optional @RefOnly List<BlobWriteOptionWrapper> options) throws GoogleStorageApiException
blobInfo
- BlobInfoPojo
options
- BlobWriteOptionWrapper
BlobWriteOptionWrapper allows Anypoint Studio to use datasense for this BlobWriteOption. Example: new
BlobWriteOptionWrapper(BlobWriteOption.doesNotExist()) returns an option that causes an operation to succeed only if the target blob does not exist.GoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public com.google.cloud.RestorableState<com.google.cloud.WriteChannel> createWriteRestorableState(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Write Channel") com.google.cloud.WriteChannel writeChannel) throws GoogleStorageApiException
writeChannel
- The write channel for which the restorable state should be created for.GoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public int writeToChannel(@RefOnly @FriendlyName(value="Write Channel") com.google.cloud.WriteChannel writeChannel, @RefOnly @Default(value="#[payload]") InputStream data) throws IOException, GoogleStorageApiException
writeChannel
- The write channel that data will be written into.data
- The data to be written as an InputStream.GoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codesIOException
@Processor public void closeWriteChannel(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Write Channel") com.google.cloud.WriteChannel writeChannel) throws IOException, GoogleStorageApiException
writeChannel
- The write channel to be closed.IOException
- When the channel cannot be closed.GoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codes@Processor public com.google.cloud.WriteChannel restoreWriteChannel(@RefOnly @Default(value="#[payload]") @FriendlyName(value="Restorable State") com.google.cloud.RestorableState<com.google.cloud.WriteChannel> restorableState) throws GoogleStorageApiException
restorableState
- The restorable state created beforeGoogleStorageApiException
- When any exception is incurred during the operation. @see Google Cloud Storage error
codespublic GoogleCloudStorageConnectionStrategy getConfig()
public void setConfig(GoogleCloudStorageConnectionStrategy config)
Copyright © 2010–2018. All rights reserved.