With the S3 adapter, you can create, delete and list buckets of an S3 endpoint, and retrieve contents and status information of a bucket.
Storing an Object to a Bucket
Using the putObject operation, you can store an object to a bucket of an S3 endpoint.
- If the bucket is versioned, a new version of the object will be stored.
- If the bucket is not versioned, the object will be updated without any further notice.
There are two ways to define the source of the object to store:
- Provide the object data as a blob in parameter objectData.
putObject ( bucketName : String, objectName : String, objectData: Blob )
- Provide a path to a file in the local filesystem (service context) in parameter filePath. The contents of this file will be stored then.
putObject ( bucketName : String, objectName : String, filePath : String )
Multiexcerpt include |
---|
MultiExcerptName | putObject |
---|
PageWithExcerpt | S3 |
---|
shouldDisplayInlineCommentsInIncludes | false |
---|
|
Retrieving an Object From a Bucket
Using the getObject operation, you can retrieve an object from a bucket of an S3 endpoint. You can get the object data
- as a Blob to your service, or
- written to a file in a path relative to the service context.
Retrieve as a Blob
There are two ways to retrieve object data as a Blob depending on whether the bucket is versioned or not.
- Get the object data without specifying a version. This will get the data for unversioned buckets, and the data of the latest version for versioned buckets.
getObject ( bucketName : String, objectName : String, objectData: Blob )
- Get the object data for a specific version.
getObject ( bucketName : String, objectName : String, version : String, objectData: Blob )
Retrieve to a File
There are two ways to retrieve object data into a file depending on whether the bucket is versioned or not.
- Get the object data without specifying a version. This will get the data for unversioned buckets, and the data of the latest version for versioned buckets.
getObject ( bucketName : String, objectName : String, filePath : String )
- Get the object data for a specific version.
getObject ( bucketName : String, objectName : String, filePath : String, version : String )
If the file path is not valid, an exception will be thrown.
Parameters
Multiexcerpt include |
---|
MultiExcerptName | getObject |
---|
PageWithExcerpt | S3 |
---|
shouldDisplayInlineCommentsInIncludes | false |
---|
|
Listing all Objects Within a Bucket
Using the listObjects operation of the S3 adapter, you can get a list of all objects that are contained in the given bucket.
Multiexcerpt include |
---|
MultiExcerptName | listObjects |
---|
PageWithExcerpt | S3 |
---|
shouldDisplayInlineCommentsInIncludes | false |
---|
|
Deleting an Object From a Bucket
Using the deleteObject operation of the S3 adapter, you can delete an object from a bucket. The deletion handling differs depending on if the bucket is versioned or not.
Delete an Object From an Unversioned Bucket
If the bucket you want to delete an object from is not versioned, the object is simply deleted. There is no error reported if the object is not existing in the bucket.
Delete an Object From a Versioned Bucket
If the bucket you want to delete an object from is versioned, you can provide a version identifier with the call.
- Version specified
If a version is specified this particular version of the file is deleted from the bucket. If this version cannot be found, no error is reported. - No version specified
A new delete marker is created and the object is marked as deleted.
Parameters
Multiexcerpt include |
---|
MultiExcerptName | deleteObject |
---|
PageWithExcerpt | S3 |
---|
shouldDisplayInlineCommentsInIncludes | false |
---|
|
Copying an Object Between Buckets
Using the copyObject operation of the S3 adapter, you can copy an object from one bucket to another.
Multiexcerpt include |
---|
MultiExcerptName | copyObject |
---|
PageWithExcerpt | S3 |
---|
shouldDisplayInlineCommentsInIncludes | false |
---|
|
Using the objectStatus operation of the S3 adapter, you can get some general information on the object including a list of all object versions if the bucket is versioned.
Multiexcerpt include |
---|
MultiExcerptName | objectStatus |
---|
PageWithExcerpt | S3 |
---|
shouldDisplayInlineCommentsInIncludes | false |
---|
|
The returned status information has the following structure:
Multiexcerpt include |
---|
MultiExcerptName | ObjectStatus |
---|
PageWithExcerpt | S3 |
---|
shouldDisplayInlineCommentsInIncludes | false |
---|
|