Light Dark

Functions

copy-object

fn (source_bucket: Str, source_key: Str, dest_bucket: Str, dest_key: Str): CopyObjectResponse | 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")

delete-object

fn (bucket: Str, key: Str): DeleteObjectResponse | AwsError

DELETE an object from S3.

Example

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

get-object

fn (bucket: Str, key: Str): GetObjectResponse | AwsError

GET an object from S3.

Example

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

head-object

fn (bucket: Str, key: Str): HeadObjectResponse | 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-objects

fn (bucket: Str, prefix: Str, max_keys: Int, continuation_token: Str?): ListObjectsResponse | AwsError
fn (bucket: Str, prefix: Str, max_keys: Int): ListObjectsResponse | AwsError
fn (bucket: Str, prefix: Str): ListObjectsResponse | AwsError
fn (bucket: Str): ListObjectsResponse | 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")

parse-list-objects-response

fn (xml-str: Str): ListObjectsResponse

parse-s3-object

fn (elem: Any): S3Object

put-object

fn (bucket: Str, key: Str, body: Any, content_type: Str): PutObjectResponse | AwsError
fn (bucket: Str, key: Str, body: Any): PutObjectResponse | 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

CopyObjectResponse

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

DeleteObjectResponse

DeleteObjectResponse type {
    delete_marker: Bool?,
    version_id: Str?
}

GetObjectResponse

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

HeadObjectResponse

HeadObjectResponse type {
    content_type: Str?,
    content_length: Int?,
    etag: Str?,
    last_modified: Str?
}

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

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

S3Object

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