@Throws(value=S3ErrorTypeProvider.class) public class ObjectOperations extends S3Operations<ObjectService>
DEFAULT_CANNED_ACL, NOT_ENCODED, REGION_DEFAULT| Constructor and Description |
|---|
ObjectOperations() |
| Modifier and Type | Method and Description |
|---|---|
ObjectResult |
copyObject(S3Configuration config,
S3Connection connection,
String sourceBucketName,
String sourceKey,
String sourceVersionId,
String destinationBucketName,
String destinationKey,
CannedAccessControlList destinationAcl,
StorageClass destinationStorageClass,
Map<String,String> destinationUserMetadata,
LocalDateTime modifiedSince,
LocalDateTime unmodifiedSince,
String encryption,
String contentType)
Copies a source object to a new destination; to copy an object, the caller's account must have read access to the source object and write access to the destination bucket.
|
ObjectResult |
createObject(S3Configuration config,
S3Connection connection,
String bucketName,
String key,
InputStream objectContent,
ObjectMetadataParameterGroup objectMetadata,
CannedAccessControlList acl,
String kmsMasterKey)
Uploads an object to S3.
|
String |
createObjectPresignedUri(S3Configuration config,
S3Connection connection,
String bucketName,
String key,
LocalDateTime expiration,
String contentMd5,
String contentType,
HttpMethod method,
SSEAlgorithm sseS3Encryption)
Returns a pre-signed URL for accessing an Amazon S3 object.
|
void |
deleteObject(S3Configuration config,
S3Connection connection,
String bucketName,
String key,
String versionId)
Deletes a given object, only the owner of the bucket containing the version can perform this operation.
|
void |
deleteObjects(S3Configuration config,
S3Connection connection,
String bucketName,
List<KeyVersion> keys)
Deletes multiple objects in a single bucket from S3.
|
org.mule.runtime.extension.api.runtime.operation.Result<InputStream,S3ObjectAttributes> |
getObject(S3Configuration config,
S3Connection connection,
String bucketName,
String key,
Range range,
String versionId,
LocalDateTime modifiedSince,
LocalDateTime unmodifiedSince)
Gets the object stored in Amazon S3 under the specified bucket and key.
|
org.mule.runtime.extension.api.runtime.operation.Result<List<Grant>,AccessControlListAttributes> |
getObjectAcl(S3Configuration config,
S3Connection connection,
String bucketName,
String key,
String versionId)
Returns the access control list (ACL) of an object.
|
ObjectMetadataParameterGroup |
getObjectMetadata(S3Configuration config,
S3Connection connection,
String bucketName,
String key,
String versionId)
Gets only the object metadata stored in Amazon S3 under the specified bucket and key.
|
org.mule.runtime.extension.api.runtime.streaming.PagingProvider<S3Connection,S3ObjectSummary> |
listObjects(String bucketName,
String prefix,
String marker,
String delimiter,
Integer maxKeys,
EncodingType encodingType)
Lazily lists all objects for a given prefix.
|
org.mule.runtime.extension.api.runtime.streaming.PagingProvider<S3Connection,S3VersionSummary> |
listVersions(String bucketName,
String prefix,
String keyMarker,
String versionIdMarker,
String delimiter,
Integer maxResults,
EncodingType encodingType)
Lazily lists all object versions for a given bucket that has versioning enabled.
|
void |
setObjectAcl(S3Configuration config,
S3Connection connection,
String bucketName,
String key,
String versionId,
Owner owner,
List<Grant> grants)
Set the access control list (ACL) permissions for an object that already exists in a bucket
|
void |
setObjectStorageClass(S3Configuration config,
S3Connection connection,
String bucketName,
String key,
StorageClass storageClass)
Sets the Amazon S3 storage class for the given object.
|
public ObjectResult createObject(@Config S3Configuration config, @Connection S3Connection connection, String bucketName, String key, @Summary(value="The content to be uploaded to S3, capable of creating a {@link PutObjectRequest}.") @Content InputStream objectContent, @Summary(value="The additional information about the new object being created, such as content type & encoding, etc.") @ParameterGroup(name="Metadata") ObjectMetadataParameterGroup objectMetadata, @DisplayName(value="Canned ACL") @Optional(defaultValue="PRIVATE") CannedAccessControlList acl, @Optional String kmsMasterKey)
config - Configuration for Amazon S3 connector.connection - Amazon S3 connection instance.bucketName - the object's bucketkey - the object's keyobjectContent - the content to be uploaded to S3, capable of creating a PutObjectRequest.objectMetadata - the additional information about the new object being created,
such as content type & encoding, etc.acl - the access control list of the new objectkmsMasterKey - Encrypt objects uploaded to S3 buckets with AWS KMS master keypublic void deleteObject(@Config
S3Configuration config,
@Connection
S3Connection connection,
String bucketName,
String key,
@Optional
String versionId)
config - Configuration for Amazon S3 connector.connection - Amazon S3 connection instance.bucketName - the object's bucketkey - the object's keyversionId - the specific version of the object to delete, if versioning is enabled.public void deleteObjects(@Config
S3Configuration config,
@Connection
S3Connection connection,
String bucketName,
List<KeyVersion> keys)
In some cases, some objects will be successfully deleted, while some attempts will cause an error. If any object in the request cannot be deleted, this method throws a
MultiObjectDeleteException with details of the error.
config - Configuration for Amazon S3 connector.connection - Amazon S3 connection instance.bucketName - the objects bucket namekeys - the objects keys, version is optionalpublic org.mule.runtime.extension.api.runtime.streaming.PagingProvider<S3Connection,S3ObjectSummary> listObjects(String bucketName, @Optional String prefix, @Summary(value="Where in the bucket to begin listing. The list will only include keys that occur lexicographically after the marker.") @Optional String marker, @Summary(value="Causes keys that contain the same string between a prefix and the first occurrence of the delimiter to be rolled up into a single result element.") @Optional String delimiter, @Summary(value="The maximum number of keys to return per page. If not specified S3 will limit the number of returned results per page.") @Optional Integer maxKeys, @Optional(defaultValue="NOT_ENCODED") EncodingType encodingType)
bucketName - the target bucket's nameprefix - the prefix of the objects to be listed. If unspecified, all objects are listedmarker - where in the bucket to begin listing. The list will only include keys that occur lexicographically after the markerdelimiter - causes keys that contain the same string between a prefix and the first occurrence of the delimiter to be rolled up into a single result element.maxKeys - The maximum number of keys to return per page. If not specified S3 will limit the number of returned results per page.encodingType - The encoding method to be applied on the response.public void setObjectStorageClass(@Config
S3Configuration config,
@Connection
S3Connection connection,
String bucketName,
String key,
@Content @Optional(defaultValue="STANDARD")
StorageClass storageClass)
config - Configuration for Amazon S3 connector.connection - Amazon S3 connection instance.bucketName - the object's bucket namekey - the object's keystorageClass - the storage class to setpublic void setObjectAcl(@Config
S3Configuration config,
@Connection
S3Connection connection,
String bucketName,
String key,
@Optional
String versionId,
Owner owner,
@Content
List<Grant> grants)
config - Configuration for Amazon S3 connector.connection - Amazon S3 connection instance.bucketName - the object's bucket namekey - the object's keyversionId - the specific version of the objectowner - the owner of the ACLgrants - the Grants of the ACLpublic ObjectResult copyObject(@Config S3Configuration config, @Connection S3Connection connection, @Placement(order=1) String sourceBucketName, @Placement(order=2) String sourceKey, @Placement(order=3) @Summary(value="The specific version of the source object to copy, if versioning is enabled. ") @Optional String sourceVersionId, @Placement(order=4) @Summary(value="The destination object\'s bucket. If none provided, object is copied within the same bucket.") @Optional String destinationBucketName, @Placement(order=5) String destinationKey, @Placement(order=6) @DisplayName(value="Canned ACL") @Optional(defaultValue="PRIVATE") CannedAccessControlList destinationAcl, @Placement(order=7) @Summary(value="One of {@link StorageClass} enumerated values, defaults to {@link StorageClass#STANDARD}") @Optional(defaultValue="STANDARD") StorageClass destinationStorageClass, @Placement(order=8) @Summary(value="The new metadata of the destination object. If specified, overrides that copied from the source object") @Optional @NullSafe Map<String,String> destinationUserMetadata, @Placement(order=9) @Summary(value="The modified constraint that restricts this request to executing only if the object has been modified after the specified date. ") @Optional LocalDateTime modifiedSince, @Placement(order=10) @Summary(value="The unmodified constraint that restricts this request to executing only if the object has not been modified after this date. ") @Optional LocalDateTime unmodifiedSince, @Placement(order=11) @Optional String encryption, @Placement(order=12) @Optional String contentType)
config - Configuration for Amazon S3 connector.connection - Amazon S3 connection instance.sourceBucketName - the source object's bucketsourceKey - the source object's keysourceVersionId - the specific version of the source object to copy, if versioning is enabled.destinationBucketName - the destination object's bucket. If none provided, object is copied within the same bucket.destinationKey - the destination object's keydestinationAcl - the acl of the destination object.destinationStorageClass - one of StorageClass enumerated values, defaults to StorageClass.STANDARDdestinationUserMetadata - the new metadata of the destination object. If specified, overrides that copied from the source objectmodifiedSince - The modified constraint that restricts this request to executing only if the object has been modified after the specified date.unmodifiedSince - The unmodified constraint that restricts this request to executing only if the object has not been modified after this date.encryption - Encryption method for server-side encryption. Supported value AES256.contentType - the destination object's Content-Type HTTP header@MediaType(value="text/plain") public String createObjectPresignedUri(@Config S3Configuration config, @Connection S3Connection connection, String bucketName, String key, @Summary(value="The expiration date at which point the new pre-signed URL will no longer be accepted by Amazon S3.") @Optional LocalDateTime expiration, @DisplayName(value="Content MD5") @Optional String contentMd5, @Optional String contentType, @Optional(defaultValue="PUT") HttpMethod method, @Optional SSEAlgorithm sseS3Encryption)
config - Configuration for Amazon S3 connector.connection - Amazon S3 connection instance.bucketName - the name of the bucket involved in this request.key - the key of the object involved in this request.expiration - the expiration date at which point the new pre-signed URL will no longer be accepted by Amazon S3.contentMd5 - the expected content-md5 header of the request.contentType - the expected content-type of the request.method - the HTTP method (GET, PUT, DELETE, HEAD) to be used in this request.sseS3Encryption - the encryption method (KMS, AES256) to use for the presigned URL. This field is not allowed for the HTTP GET method. If you set a value for this field and use the HTTP GET method, you will get an error.@MediaType(value="application/octet-stream",
strict=false)
public org.mule.runtime.extension.api.runtime.operation.Result<InputStream,S3ObjectAttributes> getObject(@Config
S3Configuration config,
@Connection
S3Connection connection,
String bucketName,
String key,
@Summary(value="Specify these parameters in order to define range bytes of an object which is being downloaded.") @ParameterGroup(name="Range",showInDsl=true) @Placement(tab="Advanced")
Range range,
@Summary(value="The specific version of the object to get its contents, if versioning is enabled. ") @Optional
String versionId,
@Summary(value="The modified constraint that restricts this request to executing only if the object has been modified after the specified date.") @Optional
LocalDateTime modifiedSince,
@Summary(value="The unmodified constraint that restricts this request to executing only if the object has not been modified after this date.") @Optional
LocalDateTime unmodifiedSince)
Permission.Read access to the object. Callers should be very careful when using this method; the returned Amazon S3 object
contains a direct stream of data from the HTTP connection. The underlying HTTP connection cannot be closed until the user finishes reading the data and closes the stream.
Regarding conditional get constraints, Amazon S3 will ignore any dates occurring in the future.config - Configuration for Amazon S3 connector.connection - Amazon S3 connection instance.bucketName - the object's bucketkey - the object's keyversionId - the specific version of the object to get its contents, if versioning is enabled.modifiedSince - The modified constraint that restricts this request to executing only if the object has been modified after the specified date.unmodifiedSince - The unmodified constraint that restricts this request to executing only if the object has not been modified after this date.public ObjectMetadataParameterGroup getObjectMetadata(@Config S3Configuration config, @Connection S3Connection connection, String bucketName, String key, @Summary(value="The specific version of the object to get its contents, if versioning is enabled. ") @Optional String versionId)
Permission.Read access to the object.config - Configuration for Amazon S3 connector.connection - Amazon S3 connection instance.bucketName - the object's bucketkey - the object's keyversionId - the specific version of the object to get its contents, if versioning is enabled.public org.mule.runtime.extension.api.runtime.operation.Result<List<Grant>,AccessControlListAttributes> getObjectAcl(@Config S3Configuration config, @Connection S3Connection connection, String bucketName, String key, @Optional String versionId)
config - Configuration for Amazon S3 connector.connection - Amazon S3 connection instance.bucketName - the object's bucketkey - the object's keyversionId - the object's version idpublic org.mule.runtime.extension.api.runtime.streaming.PagingProvider<S3Connection,S3VersionSummary> listVersions(String bucketName, @Summary(value="Optional parameter restricting the response to keys which begin with the specified prefix. ") @Optional String prefix, @Summary(value="Where in the sorted list of all versions in the specified bucket to begin returning results. Results are always ordered first alphabetically and then from most recent version to least recent version. ") @Optional String keyMarker, @Summary(value="Where in the sorted list of all versions in the specified bucket to begin returning results. Results are always ordered first alphabetically and then from most recent version to least recent version.") @Optional String versionIdMarker, @Summary(value="Causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be rolled up into a single result element in the list. ") @Optional String delimiter, @Summary(value="The maximum number of results to return per page. If not specified, S3 will limit the number of returned results per page.") @Optional Integer maxResults, @Summary(value="The encoding method to be applied on the response. ") @Optional(defaultValue="NOT_ENCODED") EncodingType encodingType)
bucketName - the target bucket's nameprefix - optional parameter restricting the response to keys which begin with the specified prefix.keyMarker - where in the sorted list of all versions in the specified bucket to begin returning results.
Results are always ordered first alphabetically and then from most recent version to least recent version.versionIdMarker - where in the sorted list of all versions in the specified bucket to begin returning results.
Results are always ordered first alphabetically and then from most recent version to least recent version.delimiter - causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be rolled up into a single result element in the
list.maxResults - The maximum number of results to return per page. If not specified, S3 will limit the number of returned results per page.encodingType - the encoding method to be applied on the response.Copyright © 2021 MuleSoft, Inc.. All rights reserved.