Functions

copy-object alias of ::aws::s3::objects/copy-object

fn (source_bucket: Str, source_key: Str, dest_bucket: Str, dest_key: Str): CopyObjectResponse | ::aws::core/AwsError

Copy an object within S3. Can copy between buckets or within the same bucket.

Example

// Copy within the same bucket
::aws::s3::objects/copy-object("my-bucket", "original.txt", "my-bucket", "backup.txt")

// Copy to a different bucket
::aws::s3::objects/copy-object("source-bucket", "file.txt", "dest-bucket", "file.txt")

create-bucket alias of ::aws::s3::buckets/create-bucket

fn (bucket: Str, region: Str): CreateBucketResponse | ::aws::core/AwsError
fn (bucket: Str): CreateBucketResponse | ::aws::core/AwsError

Create a new S3 bucket.

Example

result ::aws::s3::buckets/create-bucket("my-new-bucket", "us-east-1")
result.location  // => "http://my-new-bucket.s3.amazonaws.com/"

// Use default region from context
result ::aws::s3::buckets/create-bucket("my-new-bucket")

delete-bucket alias of ::aws::s3::buckets/delete-bucket

fn (bucket: Str): Bool | ::aws::core/AwsError

Delete an S3 bucket. The bucket must be empty before it can be deleted.

Example

::aws::s3::buckets/delete-bucket("my-bucket")
// => true

delete-object alias of ::aws::s3::objects/delete-object

fn (bucket: Str, key: Str): DeleteObjectResponse | ::aws::core/AwsError

DELETE an object from S3.

Example

::aws::s3::objects/delete-object("my-bucket", "path/to/file.txt")

generate-presigned-delete-url alias of ::aws::s3::presigned/generate-presigned-delete-url

fn (bucket: Str, key: Str, expires_in: Int): Str
fn (bucket: Str, key: Str): Str

Generate a presigned URL for deleting an S3 object.

The URL allows temporary delete access without credentials. expires_in is in seconds (default 3600 = 1 hour, max 604800 = 7 days).

Example

url ::aws::s3::presigned/generate-presigned-delete-url("my-bucket", "path/to/file.txt", 3600)

generate-presigned-upload-url alias of ::aws::s3::presigned/generate-presigned-upload-url

fn (bucket: Str, key: Str, expires_in: Int): Str
fn (bucket: Str, key: Str): Str

Generate a presigned URL for uploading an S3 object.

The URL allows temporary upload access without credentials. expires_in is in seconds (default 3600 = 1 hour, max 604800 = 7 days).

Example

// Generate a 1-hour upload URL
url ::aws::s3::presigned/generate-presigned-upload-url("my-bucket", "uploads/file.txt", 3600)

// Upload using the presigned URL (no AWS credentials needed)
::http ::hot::http
::http/put(url, "File content here")

generate-presigned-url alias of ::aws::s3::presigned/generate-presigned-url

fn (bucket: Str, key: Str, expires_in: Int): Str
fn (bucket: Str, key: Str): Str

Generate a presigned URL for downloading an S3 object.

The URL allows temporary access to the object without credentials. expires_in is in seconds (default 3600 = 1 hour, max 604800 = 7 days).

Example

// Generate a 1-hour download URL
url ::aws::s3::presigned/generate-presigned-url("my-bucket", "path/to/file.pdf", 3600)
// => "https://my-bucket.s3.amazonaws.com/path/to/file.pdf?X-Amz-Algorithm=..."

// Download using the presigned URL (no AWS credentials needed)
::http ::hot::http
response ::http/get(url)
response.body  // => file contents

get-object alias of ::aws::s3::objects/get-object

fn (bucket: Str, key: Str): GetObjectResponse | ::aws::core/AwsError

GET an object from S3.

Example

result ::aws::s3::objects/get-object("my-bucket", "path/to/file.txt")
result.body  // => "Hello!"

head-bucket alias of ::aws::s3::buckets/head-bucket

fn (bucket: Str): HeadBucketResponse | ::aws::core/AwsError

HEAD a bucket to check if it exists and get its region.

Example

result ::aws::s3::buckets/head-bucket("my-bucket")
result.exists  // => true

head-object alias of ::aws::s3::objects/head-object

fn (bucket: Str, key: Str): HeadObjectResponse | ::aws::core/AwsError

HEAD an object to get metadata without downloading the body.

Example

result ::aws::s3::objects/head-object("my-bucket", "data.json")
result.content_type  // => "application/json"
result.etag          // => "\"d41d8cd98f00b204e9800998ecf8427e\""

list-buckets alias of ::aws::s3::buckets/list-buckets

fn (): ListBucketsResponse | ::aws::core/AwsError

List all S3 buckets in the account.

Example

result ::aws::s3::buckets/list-buckets()
result.buckets
// => [{name: "my-bucket", creation_date: "2024-01-01T00:00:00Z"}, ...]

list-objects alias of ::aws::s3::objects/list-objects

fn (bucket: Str, prefix: Str, max_keys: Int, continuation_token: Str?): ListObjectsResponse | ::aws::core/AwsError
fn (bucket: Str, prefix: Str, max_keys: Int): ListObjectsResponse | ::aws::core/AwsError
fn (bucket: Str, prefix: Str): ListObjectsResponse | ::aws::core/AwsError
fn (bucket: Str): ListObjectsResponse | ::aws::core/AwsError

List objects in an S3 bucket using the ListObjectsV2 API.

Supports pagination via continuation_token. When is_truncated is true, use next_continuation_token for the next request.

Example

// List objects with a prefix
result ::aws::s3::objects/list-objects("my-bucket", "uploads/", 10)
result.name      // => "my-bucket"
result.contents  // => [{key: "uploads/file1.txt", size: 1024, ...}, ...]

// List all objects in a bucket
result ::aws::s3::objects/list-objects("my-bucket")

put-object alias of ::aws::s3::objects/put-object

fn (bucket: Str, key: Str, body: Any, content_type: Str): PutObjectResponse | ::aws::core/AwsError
fn (bucket: Str, key: Str, body: Any): PutObjectResponse | ::aws::core/AwsError

PUT an object to S3.

Example

// Upload text content
::aws::s3::objects/put-object("my-bucket", "path/to/file.txt", "Hello!", "text/plain")

// Upload JSON
data to-json({name: "Alice", active: true})
::aws::s3::objects/put-object("my-bucket", "data.json", data, "application/json")

Types

AwsError alias of ::aws::core/AwsError

CopyObjectResponse alias of ::aws::s3::objects/CopyObjectResponse

CopyObjectResponse type {
    etag: Str?,
    last_modified: Str?
}

Credentials alias of ::aws::core/Credentials

GetObjectResponse alias of ::aws::s3::objects/GetObjectResponse

GetObjectResponse type {
    body: Any,
    body-bytes: Bytes?,
    content_type: Str?,
    content_length: Int?,
    etag: Str?,
    last_modified: Str?
}

ListObjectsResponse alias of ::aws::s3::objects/ListObjectsResponse

ListObjectsResponse type {
    name: Str?,
    prefix: Str?,
    key_count: Int?,
    max_keys: Int?,
    is_truncated: Bool?,
    continuation_token: Str?,
    next_continuation_token: Str?,
    start_after: Str?,
    contents: Vec?
}

PutObjectResponse alias of ::aws::s3::objects/PutObjectResponse

PutObjectResponse type {
    etag: Str?,
    version_id: Str?
}

S3Bucket alias of ::aws::s3::buckets/S3Bucket

S3Bucket type {
    name: Str,
    creation_date: Str?
}

S3Object alias of ::aws::s3::objects/S3Object

S3Object type {
    key: Str,
    size: Int?,
    last_modified: Str?,
    etag: Str?,
    storage_class: Str?
}