Amazon Simple Storage Service (S3)

Amazon Simple Storage Service (S3) provides a storage service for any amount of data. 

Refer to Amazon Simple Storage Service User Guide for general guidance using S3.

API Access

The IS3Client interface and it's implementation TS3Client provides direct access to S3 operations.

Model Access

The IS3Bucket/TS3Bucket models can be used to represent a bucket and make calls to operations relating to that bucket. For example:

var Bucket: IS3Bucket; begin // Instantiate a bucket. Bucket := TS3Bucket.Create('my-bucket'); // Work with the bucket. for var LObject in Bucket.Objects do begin // Do something with each object. end; end;

 

The IS3Object/TS3Object models be used to represent an object in a bucket and make calls to operations relating to that object.

var LObject: IS3Object; begin LObject := TS3Object.Create('my-bucket', 'my-object'); LObject.DownloadFile('/path/to/file'); end;
Uploading Objects

There are several ways to upload an object to Amazon S3 and the correct way depends on a number of factors. To simplify this, utility classes TS3FileUploader and TS3StreamUploader simplify the process of uploading files and streams respectively. 

When using the IS3Object model, the the easiest way is to use the UploadFile and UploadStream functions.

Pre-signing Requests

Requests can be pre-signed for later execution using the utility classes IS3Presigner/TS3Presigner. This can be useful for generating URLs for use on websites or other external resources that don't have direct access to valid credentials.

Waiters

Waiters are utility classes that help wait on conditions you expect to come true. For example, if you know a bucket does not currently exist but will shortly, you can use a TS3BucketExistsWaiter like:

var S3: IS3Client; Waiter: IS3BucketWaiter; begin S3 := TS3Client.Create; Waiter := TSBucketExistsWaiter.Create(S3); var Result := Waiter.Wait('a-bucket-name'); if Result.IsSuccessful then begin // Bucket exists. end; end;

Available waiters:

Waiter Class
Purpose
Waits for a bucket to exist.
Waits for a bucket to not exist.
Waits for an object to exist.
Waits for an object to not exist.
Copyright © 2019-2021 Appercept Ltd. All rights reserved.