aws
Amazon S3, SQS and STS, and any S3 compatible service, with Signature Version 4.
import aws
This package works with Amazon S3 and any storage compatible with it without the official SDK, including MinIO, Cloudflare R2, DigitalOcean Spaces, Wasabi, Backblaze and any other S3 compatible cloud storage. Build the configuration with ForAws or ForEndpoint and hand it the keys with WithCredentials, or let the package find them itself with FromEnvironment and ResolveConfig.
The S3... functions work with objects and buckets: writing and reading, listing, copying, files and folders, multipart uploads for large files, and presigned URLs so a browser can talk to S3 directly. The Sqs... functions cover SQS message queues and the AssumeRole... functions cover temporary STS credentials. For other services, such as DynamoDB, call any API with NewJsonCall and Invoke.
Use this package when a program stores files in object storage, hands out upload links, runs queue workers or calls another AWS API. It signs every request with Signature Version 4 itself and sends it over net.http, so it needs no SDK and no C library. For a plain HTTP API that is not AWS, use net.http directly.
Core ideas
- Config. A
Configis a plain value: endpoint, region, bucket, keys and whether the bucket goes in the path. Every call takes it first. Change it with theWith...functions or by setting a field; nothing is global. - Results, not errors. Calls return a struct with
ok, the HTTPstatus, AWS's errorcodeand a readableerror. A network failure (codeisTransport), a 429 or a 5xx answer is tried again with a doubling pause, up toretryattempts in all (3 by default), before you see it. - Keys are names. S3 has no folders.
reports/2026/may.csvis one key, and "folders" are prefixes you list by.
Things that trip people up
S3Getreturns the body as astr, which stops at the first zero byte. For images, archives and other binary data useS3GetBytesorS3DownloadFile.S3ListPrefixreturns one page of at most 1000 keys.S3ListAllfollows the pages for you, up to 100000 keys, and setstruncatedwhen it stopped there.S3Keysreturns an empty list when the listing failed, so it cannot tell "empty" from "error".Configuredalso wants a bucket. A program that only uses SQS, STS orInvokeshould checkaccess_keyandsecret_keyitself.- Lists hold memory of their own: free them with
ListFree,KeyFree,MessageListFree,FreeBytesand the like.
Never write keys into your code; use environment variables or an IAM role. The examples that need an AWS account or a running MinIO are only checked on the site, not run.
One program, any S3 provider
Every provider speaks the same S3 API; what differs is the address, the region and whether the bucket goes in the path or in the host name. The For... functions fill those in, so the provider can be a setting of your program and the rest of the code never changes. R2 uses the region auto and path style addresses; AWS and Spaces put the bucket in the host name.
import aws
func storage(provider: str, bucket: str): aws.Config:
switch provider:
"r2":
ret aws.ForR2("0123456789abcdef", bucket)
end
"spaces":
ret aws.ForSpaces("ams3", bucket)
end
"minio":
ret aws.ForMinio("http://127.0.0.1:9000", bucket)
end
end
ret aws.ForAws("eu-central-1", bucket)
end
func main:
each provider in ["aws", "r2", "spaces", "minio"]:
cfg := storage(provider, "media")
println provider, cfg.endpoint, cfg.region, cfg.path_style
end
endNone of these calls touch the network, so the output above is exact. Add the keys with WithCredentials, or start from FromEnvironment, which reads AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION and AWS_ENDPOINT_URL.
Trying it locally with MinIO
MinIO runs an S3 compatible server on your own machine, which is the cheapest way to develop and test. Start it with Docker:
docker run -p 9000:9000 -p 9001:9001 minio/minio server /data --console-address :9001
The default keys are minioadmin and minioadmin. The program creates the bucket if it is missing, writes two objects under a date prefix, lists that prefix and reads one object back. Keys are just names: the slashes only look like folders, and listing by prefix is how you walk them.
import aws
func main:
mut cfg := aws.ForMinio("http://127.0.0.1:9000", "backups")
cfg = aws.WithCredentials(cfg, "minioadmin", "minioadmin")
if not aws.S3BucketExists(cfg, "backups"):
made := aws.S3CreateBucket(cfg, "backups")
if not made.ok:
println "could not create the bucket:", made.status, made.code, made.error
ret 1
end
end
_ := aws.S3Put(cfg, "2026/10/notes.txt", "first backup", "text/plain")
_ := aws.S3Put(cfg, "2026/10/todo.txt", "buy milk", "text/plain")
mut listing := aws.S3ListPrefix(cfg, "2026/10/")
each item in listing.items:
println item.key, item.size
end
aws.ListFree(listing)
got := aws.S3Get(cfg, "2026/10/notes.txt")
if got.ok:
println "read back:", got.body
else:
println "read failed:", got.status, got.code
end
endEach call returns a Result. When ok is false, status is the HTTP status and code is S3's own error code, such as NoSuchKey or AccessDenied; branch on code, not on the message text. A list holds memory of its own, so free it with ListFree when you are done.
Large files and binary data
S3UploadFile reads a file from disk and picks the method by size. Up to the part size (8 MB by default, set part_size in PutOptions, never less than 5 MB) it sends one PUT; above that it streams the file in parts with a multipart upload, so memory use stays at one part. S3DownloadFile fetches the object in 8 MB ranges into name.part and renames it only when the whole file has arrived, so a failed download never leaves a half-written file under the real name.
import aws
func main:
mut cfg := aws.ForMinio("http://127.0.0.1:9000", "backups")
cfg = aws.WithCredentials(cfg, "minioadmin", "minioadmin")
opts := aws.PutOptions { content_type = "application/gzip", storage_class = "STANDARD_IA" }
up := aws.S3UploadFile(cfg, "db/2026-10-17.sql.gz", "/var/backups/shop.sql.gz", opts)
if not up.ok:
println "upload failed:", up.code, up.error
ret 1
end
println "uploaded", up.bytes, "bytes in", up.parts, "part(s)"
down := aws.S3DownloadFile(cfg, "db/2026-10-17.sql.gz", "/tmp/restore.sql.gz")
if not down.ok:
println "download failed:", down.code, down.error
ret 1
end
println "restored", down.bytes, "bytes to", down.path
mut logo := aws.S3GetBytes(cfg, "site/logo.png")
if logo.ok:
println "logo.png is", logo.len, "bytes"
end
aws.FreeBytes(logo)
endTransferResult tells you how many bytes moved and in how many parts. storage_class, cache_control, sse and the other PutOptions fields become the matching S3 headers. For a whole directory there is S3UploadDir.
Letting the browser upload directly
A presigned URL lets a browser upload or download one object without ever seeing your keys, and without the file passing through your server. Your server signs the URL; the browser sends a plain PUT to it. When content_type is set, it becomes part of the signature and the upload must send exactly that type. response_content_disposition on a download makes the browser save the file under the name you choose.
import aws
func main:
mut cfg := aws.ForAws("eu-central-1", "user-uploads")
cfg = aws.WithCredentials(cfg, "AKIAIOSFODNN7EXAMPLE", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY")
at := 1792224000 as i64
upload := aws.PresignOptions { expires = 300, content_type = "image/jpeg" }
put_url := aws.S3PresignWith(cfg, "PUT", "avatars/42.jpg", upload, at)
println "upload:", put_url.Len() > 0
println put_url.Substr(0, put_url.Find("?"))
println "expires in 300s:", put_url.Find("X-Amz-Expires=300") >= 0
println "content type is signed:", put_url.Find("content-type") >= 0
download := aws.PresignOptions { expires = 3600, response_content_disposition = "attachment; filename=\"photo.jpg\"" }
get_url := aws.S3PresignWith(cfg, "GET", "avatars/42.jpg", download, at)
println "download asks to save:", get_url.Find("response-content-disposition=attachment") >= 0
println "same signature twice:", get_url == aws.S3PresignWith(cfg, "GET", "avatars/42.jpg", download, at)
endSigning is a local computation, so this program runs without a network. It uses S3PresignWith with a fixed time to get the same URL on every run; in a real program use S3PresignPut or S3PresignGet, which sign with the current time. Keep expires short: anyone who has the URL can use it until then.
A queue worker with SQS
SQS holds jobs until a worker takes them. SqsReceive waits up to wait_seconds for messages, which costs far less than asking again and again. A received message is hidden from other workers, not removed: delete it with its receipt once the work is done, or release it with SqsRelease so another worker can try at once. A message that is neither comes back by itself when its visibility timeout ends.
import aws
func handle(body: str): bool:
println "resizing", body
ret body.Len() > 0
end
func main:
cfg := aws.FromEnvironment("")
if cfg.access_key.Len() == 0 or cfg.secret_key.Len() == 0:
println "set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_REGION"
ret 1
end
queue := aws.SqsQueueUrl(cfg, "image-jobs")
if queue.Len() == 0:
println "the queue image-jobs does not exist"
ret 1
end
_ := aws.SqsSend(cfg, queue, "photos/beach.jpg")
opts := aws.ReceiveOptions { max_messages = 10, wait_seconds = 20 }
batch := aws.SqsReceive(cfg, queue, opts)
if not batch.ok:
println "receive failed:", batch.code, batch.error
ret 1
end
each m in batch.items:
if handle(m.body):
_ := aws.SqsDelete(cfg, queue, m.receipt)
else:
_ := aws.SqsRelease(cfg, queue, m.receipt)
end
end
println "handled", batch.items.Len(), "message(s)"
endThe program checks the keys itself instead of calling Configured, because a queue worker has no bucket. Run it with real AWS credentials and an existing queue named image-jobs. In a real worker, put the receive in a loop and make each job safe to run twice, because SQS delivers every message at least once.
Calling any other AWS API
Most AWS services take a signed POST with a JSON body and an X-Amz-Target header that names the operation. NewJsonCall builds such a call (NewJson11Call for services that want JSON 1.1, NewQueryCall for the older form APIs, NewRestCall for REST ones), and Invoke signs and sends it. The endpoint comes from the service name and the region. This program looks up one DynamoDB item. PreparedCall shows the exact request Invoke would send, signed at a fixed time, without touching the network:
import aws
func main:
mut cfg := aws.Config { region = "eu-west-1" }
cfg = aws.WithCredentials(cfg, "AKIDEXAMPLE", "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY")
item := `{"TableName": "orders", "Key": {"order_id": {"S": "A-1042"}}}`
mut call := aws.NewJsonCall("dynamodb", "DynamoDB_20120810.GetItem", item)
println aws.PreparedCall(cfg, call, 1760000000 as i64)
aws.CallFree(call)
endWith real keys, res := aws.Invoke(cfg, call) sends it; res.body is the JSON answer and, on failure, res.code is the AWS error type such as ResourceNotFoundException. The JSON format of each operation is in the AWS API reference of that service.
Which function for which job
| Job | Functions |
|---|---|
| Choose the provider | ForAws, ForMinio, ForR2, ForSpaces, ForEndpoint, FromEnvironment |
| Write and read small objects | S3Put, S3Get, S3Stat, S3Delete |
| Files of any size | S3UploadFile, S3DownloadFile (multipart when needed) |
| Walk a folder | S3ListPrefix, S3ListAll, S3Keys |
| Browser uploads and downloads | S3PresignPut, S3PresignGet, S3PresignPost |
| Background jobs | SqsSend, SqsReceive, SqsDelete |
| Temporary credentials | AssumeRole, then Apply |
| Any other AWS API | NewJsonCall and Invoke |
Types
ChainOptions
struct ChainOptions| Name | Type | Description |
|---|---|---|
use_env | bool = true | Read the environment variables. |
use_profile | bool = true | Read the profile. |
profile | str = "" | The profile name; empty means AWS_PROFILE or default. |
use_web_identity | bool = false | Read the web identity token. |
use_container | bool = false | Read the container role. |
use_instance | bool = false | Read the EC2 instance role. |
follow_roles | bool = true | Assume the roles a profile names with role_arn. |
max_role_depth | int = 4 | The longest chain of roles. |
session_name | str = "" | The session name for assuming a role. |
duration | int = 0 | How long the role is valid, in seconds. |
timeout_ms | int = 1000 | The timeout for asking the container and the instance, in milliseconds. |
import aws
func main:
println aws.AwsEndpoint("eu-central-1"), aws.StsEndpoint("eu-central-1"), aws.ServiceEndpoint("sqs", "eu-west-1")
println aws.ForAws("eu-central-1", "photos").endpoint, aws.ForMinio("http://127.0.0.1:9000/", "photos").endpoint
println aws.ForR2("acct", "photos").endpoint, aws.ForSpaces("ams3", "photos").endpoint
println aws.ForWasabi("eu-central-1", "photos").endpoint, aws.ForBackblaze("us-west-004", "photos").endpoint
println aws.ForEndpoint("https://s3.example.ir", "ir-tehran", "photos").region
mut cfg := aws.NewConfig("http://127.0.0.1:9000", "photos")
println aws.Configured(cfg)
cfg = aws.WithCredentials(cfg, "AKIDEXAMPLE", "secret")
cfg = aws.WithBucket(cfg, "backup")
cfg = aws.WithSessionToken(cfg, "token")
cfg = aws.WithRetry(cfg, 5, 200)
println aws.Configured(cfg), cfg.bucket, cfg.retry, cfg.retry_base_ms, cfg.path_style, cfg.service
println aws.Describe(cfg)
text := "[default]\nregion = eu-west-1\n\n[profile work]\nregion = me-central-1\n"
println aws.ParseIni(text, "default", "region"), aws.ParseIni(text, "profile work", "region")
println aws.CredentialsPath().Len() > 0, aws.ConfigPath().Len() > 0
println aws.FromEnvironment("photos").bucket
creds := aws.StaticCredentials("AKIDEXAMPLE", "secret")
println creds.ok, creds.source, aws.ExpiredNow(creds), aws.SOURCE_CONTAINER
applied := aws.Apply(aws.ForAws("", "photos"), creds)
println applied.access_key
body := `<AssumeRoleResponse><AssumeRoleResult><Credentials><AccessKeyId>ASIAEXAMPLE</AccessKeyId><SecretAccessKey>s</SecretAccessKey><SessionToken>t</SessionToken><Expiration>2030-01-01T00:00:00Z</Expiration></Credentials></AssumeRoleResult></AssumeRoleResponse>`
temp := aws.ParseCredentials(body, 200, "sts")
println temp.ok, temp.access_key, temp.session_token, temp.expires, temp.source
now := 1893455000 as i64
println aws.Expired(temp, now, aws.STS_DEFAULT_SKEW), aws.SecondsRemaining(temp, now)
println aws.DescribeCredentials(temp)
println aws.SOURCE_ENV, aws.SOURCE_PROFILE, aws.SOURCE_WEB_IDENTITY, aws.SOURCE_INSTANCE
println aws.STS_VERSION, aws.STS_MIN_DURATION, aws.STS_MAX_DURATION
chain := aws.DefaultChain()
println chain.use_env, chain.use_profile, chain.use_instance, aws.ContainerChain().use_instance
failed := aws.Failure("no network")
println failed.ok, failed.error
endCredentials
struct Credentials| Name | Type | Description |
|---|---|---|
ok | bool = false | Credentials were found. |
access_key | str = "" | The access key id. |
secret_key | str = "" | The secret key. |
session_token | str = "" | The session token for temporary credentials. |
expires | str = "" | The expiry time in ISO 8601 form; empty for static credentials. |
expires_epoch | i64 = 0 | The expiry time in Unix seconds. |
source | str = "" | The source, one of the SOURCE_... constants. |
error | str = "" | The error message. |
code | str = "" | The service error code, such as NoSuchKey. |
The example for this item is shown with the ones above: aws-Config.salam
Identity
struct Identity| Name | Type | Description |
|---|---|---|
ok | bool = false | It succeeded. |
account | str = "" | The account number. |
arn | str = "" | The ARN of the user or role. |
user_id | str = "" | The user id. |
error | str = "" | The error message. |
code | str = "" | The service error code, such as NoSuchKey. |
The example for this item is shown with the ones above: aws-Config.salam
Config
struct Config| Name | Type | Description |
|---|---|---|
endpoint | str = "" | The service address. |
region | str = "us-east-1" | The region; us-east-1 by default. |
bucket | str = "" | The default bucket. |
access_key | str = "" | The access key id. |
secret_key | str = "" | The secret key. |
session_token | str = "" | The session token. |
path_style | bool = true | Path addressing, host/bucket/key, instead of bucket.host/key. |
service | str = "s3" | The service name in the signature. |
expires | int = 900 | The default expiry of presigned URLs, in seconds. |
retry | int = 3 | The number of attempts in all, from 1 to 10; network errors, 429 and 5xx answers are tried again. |
retry_base_ms | int = 100 | The base delay between attempts. |
anonymous | bool = false | Unsigned, for public buckets. |
request_payer | bool = false | The requester pays for the request. |
timeout_ms | int = 0 | The timeout of each request, in milliseconds. |
The example for this item is shown with the ones above: aws-Config.salam
Result
struct Result| Name | Type | Description |
|---|---|---|
ok | bool = false | The status code was 2xx. |
status | int = 0 | The HTTP status code. |
body | str = "" | The response body. |
etag | str = "" | The ETag without quotes. |
length | i64 = 0 | The body length. |
error | str = "" | The error message. |
head | str = "" | The raw response headers. |
code | str = "" | The service error code, such as NoSuchKey. |
request_id | str = "" | The request id for AWS support. |
version_id | str = "" | The object version id. |
import aws
func example(): aws.Config:
ret aws.Config {
endpoint = "https://s3.amazonaws.com", bucket = "examplebucket", access_key = "AKIAIOSFODNN7EXAMPLE", secret_key = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", path_style = false
}
end
func main:
at := 1369353600 as i64
date := aws.AmzDate(at)
println date, aws.DateStamp(date), aws.Scope(aws.DateStamp(date), "us-east-1", aws.SERVICE_S3)
println aws.EncodeKey("photos/a b+c.png"), aws.UriEncode("a b/c", true), aws.UriEncode("a b/c", false)
println aws.ALGORITHM, aws.UNSIGNED_PAYLOAD
println aws.EMPTY_SHA256 == aws.Sha256Bytes(null, 0)
headers := "host:examplebucket.s3.amazonaws.com\nrange:bytes=0-9\nx-amz-content-sha256:" + aws.EMPTY_SHA256 + "\nx-amz-date:" + date + "\n"
signed := aws.SignRequest(example(), "GET", "/test.txt", "", headers, "host;range;x-amz-content-sha256;x-amz-date", aws.EMPTY_SHA256, at)
println signed.ok, signed.amz_date
println signed.authorization
println aws.SignString(example(), aws.DateStamp(date), "text").Len()
println aws.SignQuery(example(), "GET", "/test.txt", "", "examplebucket.s3.amazonaws.com", at).Len() > 0
println aws.SignQueryHeaders(example(), "GET", "/test.txt", "", "host:examplebucket.s3.amazonaws.com\n", "host", at).Len() > 0
mut req := aws.NewRequest("GET", "test.txt")
aws.SetHeader(req, "Range", "bytes=0-9")
aws.SetQuery(req, "versionId", "v1")
aws.SetQueryInt(req, "partNumber", 2)
aws.SetFlag(req, "acl")
print aws.CanonicalRequest(example(), req, at)
println ""
mut put := aws.NewRequest("PUT", "notes/a.txt")
aws.SetText(put, "hello")
head := aws.PreparedHead(example(), put, at)
println head.Find("PUT /notes/a.txt HTTP/1.1") == 0, head.Find("Content-Length: 5") >= 0
mut big := aws.NewRequest("PUT", "big.bin")
aws.SetUnsignedPayload(big)
println big.body_hash
other := aws.NewBucketRequest("GET", "other", "")
println other.bucket, aws.NewServiceRequest("GET").service_level
text := "salam"
aws.SetBody(big, text as void*, text.Len())
println big.body_len
println aws.S3ContentHash(text as void*, text.Len())
println aws.S3ContentMd5(text as void*, text.Len()), aws.S3ChecksumSha256(text as void*, text.Len())
println aws.S3ContentHashMd5(text as void*, text.Len()), aws.S3MultipartEtag(text as void*, text.Len(), 4)
mut h := aws.NewHeaders()
aws.HeaderSet(h, "Content-Type", "text/plain")
aws.HeaderSet(h, "content-type", "text/html")
aws.HeaderAdd(h, "x-amz-meta-tag", "a")
aws.HeaderAdd(h, "x-amz-meta-tag", "b")
println aws.HeaderCount(h), aws.HeaderGet(h, "CONTENT-TYPE"), aws.HeaderHas(h, "range")
println aws.HeaderNameAt(h, 2), aws.HeaderValueAt(h, 2)
aws.HeaderFree(h)
mut tags := aws.NewTags()
aws.TagSet(tags, "team", "web")
aws.TagSet(tags, "env", "prod test")
println aws.TagString(tags)
println aws.Unquote("\"9b2cf5\"")
err := "<Error><Code>NoSuchKey</Code><Message>The key does not exist</Message></Error>"
println aws.ResultErrorCode(err), aws.ResultTag(err, "Message")
println aws.ResultErrorMessage(err, 404)
println aws.ResultErrorMessage("", 503)
endCall
struct Call| Name | Type | Description |
|---|---|---|
service | str = "" | The service name. |
region | str = "" | The region; empty means the region of the configuration. |
method | str = "POST" | The HTTP method. |
path | str = "/" | The path. |
target | str = "" | The X-Amz-Target header for the JSON APIs. |
content_type | str = "" | The content type. |
query | Headers | The query string parameters. |
headers | Headers | The headers. |
params | Headers | The form parameters for the query APIs. |
body | str = "" | The body. |
endpoint | str = "" | A custom address, such as LocalStack. |
global_endpoint | bool = false | The service is global, such as IAM. |
import aws
func main:
mut cfg := aws.ForAws("eu-west-1", "")
cfg = aws.WithCredentials(cfg, "AKIAIOSFODNN7EXAMPLE", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY")
at := 1369353600 as i64
listing := `<ListBucketResult><Name>photos</Name><Prefix>2026/</Prefix><KeyCount>2</KeyCount><IsTruncated>true</IsTruncated><NextContinuationToken>tok2</NextContinuationToken>
<Contents><Key>2026/a.jpg</Key><Size>1200</Size><ETag>"aa11"</ETag><LastModified>2026-03-20T10:00:00.000Z</LastModified><StorageClass>STANDARD</StorageClass></Contents>
<Contents><Key>2026/b.jpg</Key><Size>800</Size><ETag>"bb22"</ETag><LastModified>2026-03-21T10:00:00.000Z</LastModified><StorageClass>STANDARD</StorageClass></Contents>
<CommonPrefixes><Prefix>2026/thumbs/</Prefix></CommonPrefixes></ListBucketResult>`
mut list := aws.ParseListing(listing, 200)
println list.ok, list.name, list.truncated, list.next_token, aws.ListCount(list), aws.ListTotalSize(list)
entry := aws.ListAt(list, 0)
println entry.key, entry.size, entry.etag, entry.last_modified, entry.storage_class
println aws.ListPrefixCount(list), aws.ListPrefixAt(list, 0)
println aws.ListToResult(list).ok
aws.ListFree(list)
mut keys := aws.NewKeyList()
aws.KeyPush(keys, "tmp/1")
aws.KeyPush(keys, "tmp/2")
println aws.KeyCount(keys), aws.KeyAt(keys, 1)
aws.KeyFree(keys)
println aws.S3ExpiryRule("logs/", 30, 7)
queue := "https://sqs.eu-west-1.amazonaws.com/123456789012/jobs"
reply := "<ReceiveMessageResponse><ReceiveMessageResult><Message><MessageId>m-1</MessageId><ReceiptHandle>AQEB==</ReceiptHandle><MD5OfBody>fafb</MD5OfBody><Body>invoice 42</Body><Attribute><Name>ApproximateReceiveCount</Name><Value>2</Value></Attribute><MessageAttribute><Name>tenant</Name><Value><DataType>String</DataType><StringValue>acme</StringValue></Value></MessageAttribute></Message></ReceiveMessageResult></ReceiveMessageResponse>"
mut messages := aws.ParseReceive(reply, 200)
println messages.ok, aws.MessageCount(messages)
msg := aws.MessageAt(messages, 0)
println msg.id, msg.body, msg.receipt, msg.receive_count, aws.MessageAttribute(msg, "tenant")
aws.MessageListFree(messages)
mut out := aws.OutMessage { body = "job", delay = 30, group_id = "g1", dedup_id = "d1" }
aws.HeaderSet(out.attributes, "tenant", "acme")
mut send := aws.SqsSendCall(queue, out)
println aws.CallBodyText(send)
aws.CallFree(send)
mut receive := aws.SqsReceiveCall(queue, aws.ReceiveOptions { max_messages = 99, wait_seconds = 60 })
println aws.CallBodyText(receive)
aws.CallFree(receive)
println aws.SQS_VERSION, aws.SQS_MAX_MESSAGES, aws.SQS_MAX_WAIT, aws.SQS_MAX_BATCH
println aws.SqsRedrivePolicy("arn:aws:sqs:eu-west-1:123456789012:dead", 5)
mut call := aws.NewQueryCall("sts", "GetCallerIdentity", aws.STS_VERSION)
aws.CallParam(call, "Name", "ali")
aws.CallParamInt(call, "DurationSeconds", 900)
println aws.CallBodyText(call)
head := aws.PreparedCall(cfg, call, at)
println head.Find("POST / HTTP/1.1") == 0, head.Find("Host: sts.eu-west-1.amazonaws.com") >= 0
aws.CallFree(call)
mut dynamo := aws.NewJsonCall("dynamodb", "DynamoDB_20120810.ListTables", "{}")
aws.CallRegion(dynamo, "eu-central-1")
aws.CallHeader(dynamo, "x-amz-meta-app", "salam")
println aws.PreparedCall(cfg, dynamo, at).Find("X-Amz-Target: DynamoDB_20120810.ListTables") >= 0
logs := aws.NewJson11Call("logs", "Logs_20140328.DescribeLogGroups", "{}")
println logs.content_type
mut rest := aws.NewRestCall("lambda", "GET", "/2015-03-31/functions")
aws.CallQuery(rest, "MaxItems", "5")
aws.CallBody(rest, "", "application/json")
aws.CallEndpoint(rest, "http://127.0.0.1:4566")
println aws.PreparedCall(cfg, rest, at).Find("GET /2015-03-31/functions?MaxItems=5 HTTP/1.1") == 0
failure := `{"__type":"com.amazon#ResourceNotFoundException","message":"Table not found"}`
println aws.ServiceErrorCode(failure), aws.ServiceErrorMessage(failure, 400)
endHeaders
struct Headers| Name | Type | Description |
|---|---|---|
names | Vector | The names. |
values | Vector | The values. |
The example for this item is shown with the ones above: aws-Sign.salam
Request
struct Request| Name | Type | Description |
|---|---|---|
method | str = "GET" | The HTTP method. |
key | str = "" | The object key. |
bucket | str = "" | The bucket; empty means the bucket of the configuration. |
service_level | bool = false | The request goes to the service itself, not to a bucket. |
headers | Headers | The headers. |
query | Headers | The query parameters. |
body | void* | The body pointer. |
body_len | int = 0 | The body length. |
body_hash | str = "" | The body digest, or UNSIGNED-PAYLOAD. |
The example for this item is shown with the ones above: aws-Sign.salam
Bytes
struct Bytes| Name | Type | Description |
|---|---|---|
ok | bool = false | It succeeded. |
status | int = 0 | The HTTP status code. |
data | void* | The data pointer; free it with FreeBytes. |
len | int = 0 | The data length. |
etag | str = "" | The ETag. |
head | str = "" | The raw headers. |
code | str = "" | The service error code, such as NoSuchKey. |
error | str = "" | The error message. |
import aws
func main:
cfg := aws.FromEnvironment("photos")
if not aws.Configured(cfg):
println "set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY"
ret
end
put := aws.S3Put(cfg, "notes/hello.txt", "hello world", "text/plain; charset=utf-8")
println put.ok, put.status, put.etag, put.request_id
o := aws.PutOptions { content_type = "text/html", cache_control = "max-age=3600", storage_class = "STANDARD_IA", acl = "public-read" }
aws.HeaderSet(o.meta, "owner", "ali")
_ := aws.S3PutWith(cfg, "site/index.html", "<h1>hello</h1>", o)
data := "salam"
_ := aws.S3PutBytes(cfg, "raw.bin", data as void*, data.Len(), "application/octet-stream")
_ := aws.S3PutBytesWith(cfg, "raw2.bin", data as void*, data.Len(), o)
got := aws.S3Get(cfg, "notes/hello.txt")
if got.ok:
println got.body, got.length, aws.ResultHeader(got, "Content-Type")
else:
println got.status, got.code, got.error
end
_ := aws.S3GetWith(cfg, "notes/hello.txt", aws.GetOptions { if_none_match = got.etag })
mut b := aws.S3GetBytes(cfg, "raw.bin")
println b.ok, b.len, aws.BytesHeader(b, "ETag")
aws.FreeBytes(b)
mut b2 := aws.S3GetRange(cfg, "raw.bin", 0, 1)
aws.FreeBytes(b2)
mut b3 := aws.S3GetBytesWith(cfg, "raw.bin", aws.GetOptions { range_start = 2, range_end = 4 })
aws.FreeBytes(b3)
info := aws.S3Stat(cfg, "site/index.html")
println info.ok, info.size, info.content_type, info.last_modified, info.storage_class
_ := aws.S3StatVersion(cfg, "site/index.html", info.version_id)
println aws.S3Head(cfg, "raw.bin").status, aws.S3Exists(cfg, "raw.bin"), aws.S3Size(cfg, "raw.bin")
println aws.S3ObjectChecksum(cfg, "raw.bin")
_ := aws.S3Copy(cfg, "notes/hello.txt", "notes/copy.txt")
_ := aws.S3CopyWith(cfg, "notes/hello.txt", "archive/hello.txt", aws.CopyOptions { storage_class = "GLACIER" })
_ := aws.S3Move(cfg, "notes/copy.txt", "notes/moved.txt")
_ := aws.S3Touch(cfg, "notes/moved.txt", aws.CopyOptions {})
_ := aws.S3Restore(cfg, "archive/hello.txt", 2, "Standard")
_ := aws.S3SetObjectTags(cfg, "raw.bin", aws.NewTags())
_ := aws.S3AddObjectTag(cfg, "raw.bin", "team", "web")
mut t := aws.S3ObjectTags(cfg, "raw.bin")
println aws.TagString(t)
aws.HeaderFree(t)
mut t2 := aws.S3ObjectTagsVersion(cfg, "raw.bin", "")
aws.HeaderFree(t2)
_ := aws.S3DeleteObjectTags(cfg, "raw.bin")
_ := aws.S3MakePublic(cfg, "raw.bin")
_ := aws.S3MakePrivate(cfg, "raw.bin")
_ := aws.S3SetObjectAcl(cfg, "raw.bin", "private")
println aws.S3ObjectAcl(cfg, "raw.bin").Len() > 0
_ := aws.S3SetLegalHold(cfg, "raw.bin", true)
println aws.S3LegalHold(cfg, "raw.bin")
_ := aws.S3SetRetention(cfg, "raw.bin", "GOVERNANCE", 1893456000 as i64)
mut l := aws.S3List(cfg, aws.ListOptions { prefix = "notes/", max_keys = 100 })
each e in l.items:
println e.key, e.size
end
aws.ListFree(l)
mut l2 := aws.S3ListPrefix(cfg, "site/")
aws.ListFree(l2)
mut l3 := aws.S3ListFolder(cfg, "")
println aws.ListPrefixCount(l3)
aws.ListFree(l3)
mut l4 := aws.S3ListAll(cfg, "")
println aws.ListCount(l4), aws.ListTotalSize(l4)
aws.ListFree(l4)
mut l5 := aws.S3ListAllWith(cfg, aws.ListOptions { prefix = "site/" })
aws.ListFree(l5)
mut l6 := aws.S3ListV1(cfg, aws.ListOptions {}, "")
aws.ListFree(l6)
mut l7 := aws.S3ListVersions(cfg, aws.ListOptions { prefix = "raw" }, "", "")
aws.ListFree(l7)
mut keys := aws.S3Keys(cfg, "notes/")
_ := aws.S3DeleteMany(cfg, keys)
aws.KeyFree(keys)
_ := aws.S3DeletePrefix(cfg, "site/")
_ := aws.S3DeleteVersion(cfg, "raw2.bin", "")
println aws.S3Delete(cfg, "raw.bin").ok
endPartRef
struct PartRef| Name | Type | Description |
|---|---|---|
number | int = 0 | The number, from 1. |
etag | str = "" | The ETag of the part. |
size | i64 = 0 | The size. |
import aws
func main:
cfg := aws.FromProfile("default", "backup")
if not aws.Configured(cfg):
println "the default profile was not found in ~/.aws"
ret
end
o := aws.PutOptions { part_size = aws.S3_PART_DEFAULT }
up := aws.S3UploadFile(cfg, "db/dump.sql", "/tmp/dump_en.sql", o)
println up.ok, up.bytes, up.parts, up.etag
println aws.S3FileEtag("/tmp/dump_en.sql", aws.S3_PART_DEFAULT) == up.etag
_ := aws.S3UploadFileAs(cfg, "img/logo.png", "/tmp/logo_en.png", "image/png")
down := aws.S3DownloadFile(cfg, "db/dump.sql", "/tmp/restore_en.sql")
println down.ok, down.path, down.error
dir := aws.S3UploadDir(cfg, "/var/www/site", "site/", aws.PutOptions {})
println dir.ok, dir.files, dir.bytes, dir.skipped, dir.failed_path
_ := aws.S3DownloadPrefix(cfg, "site/", "/tmp/site_en")
println aws.S3_PART_MIN, aws.S3_PART_MAX_COUNT
mut upload := aws.S3CreateUpload(cfg, "video.mp4", aws.PutOptions { content_type = "video/mp4" })
if not upload.ok:
println upload.error
ret
end
chunk := "x" * aws.S3_PART_MIN
_ := aws.S3UploadPart(cfg, upload, 1, chunk as void*, chunk.Len())
_ := aws.S3UploadPartCopy(cfg, upload, 2, "old.mp4", aws.CopyOptions {}, 0, 5242879)
println aws.UploadParts(upload), aws.UploadBytes(upload)
parts := aws.S3ListParts(cfg, "video.mp4", upload.upload_id)
repeat aws.PartCount(parts) in i:
p := aws.PartAt(parts, i)
println p.number, p.etag, p.size
end
println aws.S3CompleteUpload(cfg, upload).ok
aws.UploadFreeParts(upload)
pending := aws.S3ListUploads(cfg, "")
repeat aws.UploadCount(pending) in j:
u := aws.UploadAt(pending, j)
_ := aws.S3AbortUpload(cfg, aws.Upload { key = u.key, upload_id = u.upload_id })
end
_ := aws.S3PutLarge(cfg, "big.bin", chunk as void*, chunk.Len(), 0, aws.PutOptions {})
_ := aws.S3CopyLarge(cfg, "big.bin", "big2.bin", 0, aws.CopyOptions {})
endUpload
struct Upload| Name | Type | Description |
|---|---|---|
ok | bool = false | It succeeded. |
status | int = 0 | The HTTP status code. |
upload_id | str = "" | The upload id. |
key | str = "" | The key. |
bucket | str = "" | The bucket. |
parts | Vector | The uploaded parts. |
error | str = "" | The error message. |
code | str = "" | The service error code, such as NoSuchKey. |
The example for this item is shown with the ones above: aws-Files.salam
PartList
struct PartList| Name | Type | Description |
|---|---|---|
ok | bool = false | It succeeded. |
status | int = 0 | The HTTP status code. |
items | Vector | The parts. |
truncated | bool = false | There are more parts. |
next_marker | str = "" | Where the next page starts. |
error | str = "" | The error message. |
code | str = "" | The service error code, such as NoSuchKey. |
The example for this item is shown with the ones above: aws-Files.salam
UploadRef
struct UploadRef| Name | Type | Description |
|---|---|---|
key | str = "" | The key. |
upload_id | str = "" | The id. |
initiated | str = "" | When it started. |
initiated_epoch | i64 = 0 | When it started, in Unix seconds. |
storage_class | str = "" | The storage class. |
The example for this item is shown with the ones above: aws-Files.salam
UploadList
struct UploadList| Name | Type | Description |
|---|---|---|
ok | bool = false | It succeeded. |
status | int = 0 | The HTTP status code. |
items | Vector | The uploads. |
truncated | bool = false | There are more. |
next_key_marker | str = "" | The key of the next page. |
next_upload_marker | str = "" | The id of the next page. |
error | str = "" | The error message. |
code | str = "" | The service error code, such as NoSuchKey. |
The example for this item is shown with the ones above: aws-Files.salam
PutOptions
struct PutOptions| Name | Type | Description |
|---|---|---|
content_type | str = "" | The content type. |
cache_control | str = "" | The Cache-Control header. |
content_disposition | str = "" | The Content-Disposition header. |
content_encoding | str = "" | The Content-Encoding header. |
content_language | str = "" | The content language. |
expires | str = "" | The Expires header. |
storage_class | str = "" | The storage class, such as STANDARD_IA. |
acl | str = "" | The canned ACL. |
sse | str = "" | Server side encryption: AES256 or aws:kms. |
sse_kms_key | str = "" | The KMS key. |
tagging | str = "" | The tags as a query string. |
if_none_match | str = "" | With *, write only when the object does not exist. |
if_match | str = "" | Only when the ETag matches. |
checksum_md5 | bool = false | Send the MD5 digest of the body. |
checksum_sha256 | bool = false | Send the SHA-256 digest of the body. |
unsigned_payload | bool = false | Leave the body unsigned. |
meta | Headers | The x-amz-meta-* metadata. |
part_size | int = 0 | The part size for large files. |
The example for this item is shown with the ones above: aws-Objects.salam
GetOptions
struct GetOptions| Name | Type | Description |
|---|---|---|
range_start | i64 = -1 | The start of the range. |
range_end | i64 = -1 | The end of the range; -1 means to the end. |
version_id | str = "" | The version. |
if_none_match | str = "" | When the ETag matches, a 304. |
if_match | str = "" | Only when the ETag matches. |
if_modified_since | str = "" | Only when it changed after this time. |
if_unmodified_since | str = "" | Only when it has not changed since this time. |
response_content_type | str = "" | Overrides the content type of the response. |
response_content_disposition | str = "" | Overrides the Content-Disposition of the response. |
part_number | int = 0 | Only one part of a multipart object. |
The example for this item is shown with the ones above: aws-Objects.salam
CopyOptions
struct CopyOptions| Name | Type | Description |
|---|---|---|
source_bucket | str = "" | The source bucket; empty means the bucket of the configuration. |
source_version_id | str = "" | The source version. |
replace_metadata | bool = false | Replace the metadata instead of copying it. |
content_type | str = "" | The new content type. |
cache_control | str = "" | The new Cache-Control. |
content_disposition | str = "" | The new Content-Disposition. |
storage_class | str = "" | The storage class. |
acl | str = "" | The ACL. |
sse | str = "" | The encryption. |
tagging | str = "" | The tags. |
if_match | str = "" | Only when the source ETag matches. |
if_none_match | str = "" | Only when the source ETag does not match. |
if_modified_since | str = "" | Only when the source changed. |
if_unmodified_since | str = "" | Only when the source has not changed. |
meta | Headers | The new metadata. |
The example for this item is shown with the ones above: aws-Objects.salam
ObjectInfo
struct ObjectInfo| Name | Type | Description |
|---|---|---|
ok | bool = false | The object exists. |
status | int = 0 | The HTTP status code. |
key | str = "" | The key. |
size | i64 = 0 | The size. |
etag | str = "" | The ETag. |
content_type | str = "" | The content type. |
content_encoding | str = "" | The Content-Encoding. |
cache_control | str = "" | The Cache-Control. |
content_disposition | str = "" | The Content-Disposition. |
last_modified | str = "" | When it last changed. |
modified_epoch | i64 = 0 | The same in Unix seconds. |
storage_class | str = "" | The storage class. |
version_id | str = "" | The version. |
sse | str = "" | The encryption. |
delete_marker | bool = false | It is a delete marker. |
parts | int = 0 | The number of parts. |
meta | Headers | The metadata. |
error | str = "" | The error message. |
code | str = "" | The service error code, such as NoSuchKey. |
The example for this item is shown with the ones above: aws-Objects.salam
PresignOptions
struct PresignOptions| Name | Type | Description |
|---|---|---|
expires | int = 0 | How long it is valid, in seconds; seven days at most. |
version_id | str = "" | The version. |
content_type | str = "" | The content type the uploader must send. |
acl | str = "" | The ACL. |
storage_class | str = "" | The class. |
response_content_type | str = "" | The content type of the response. |
response_content_disposition | str = "" | The Content-Disposition of the response; for the downloaded file name. |
response_cache_control | str = "" | The Cache-Control of the response. |
import aws
func main:
mut cfg := aws.ForAws("", "examplebucket")
cfg = aws.WithCredentials(cfg, "AKIAIOSFODNN7EXAMPLE", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY")
at := 1369353600 as i64
println aws.S3Url(cfg, "cdn/42.png")
println aws.S3PresignAt(cfg, "GET", "test.txt", 86400, at)
o := aws.PresignOptions { expires = 600, content_type = "image/png" }
url := aws.S3PresignWith(cfg, "PUT", "up.png", o, at)
println url.Find("X-Amz-SignedHeaders=content-type%3Bhost") >= 0, url.Find("X-Amz-Expires=600") >= 0
println aws.S3Presign(cfg, "DELETE", "old.txt", 60).Find("X-Amz-Expires=60&") >= 0
println aws.S3PresignGet(cfg, "report.pdf", 3600).Find("https://examplebucket.s3.amazonaws.com/report.pdf?") == 0
println aws.S3PresignPut(cfg, "avatar.png", "image/png", 300).Find("content-type") >= 0
println aws.S3PresignDownload(cfg, "r/123.pdf", "report.pdf", 300).Find("response-content-disposition") >= 0
po := aws.PostOptions {
expires = 3600, key_is_prefix = true, content_type = "image/", content_type_is_prefix = true, max_bytes = 1048576 as i64, acl = "private"
}
form := aws.S3PresignPostAt(cfg, "incoming/", po, at)
println form.ok, form.url
println form.policy
println aws.HeaderGet(form.fields, "x-amz-signature")
println aws.PostFormHtml(form, "file").Find("<form") >= 0
println aws.S3PresignPost(cfg, "a.png", aws.PostOptions {}).ok
endPostOptions
struct PostOptions| Name | Type | Description |
|---|---|---|
expires | int = 0 | How long the policy is valid. |
key_is_prefix | bool = false | The key is only a prefix and the browser decides the rest. |
content_type | str = "" | The content type. |
content_type_is_prefix | bool = false | The content type is only a prefix, such as image/. |
acl | str = "" | The ACL. |
cache_control | str = "" | The Cache-Control. |
storage_class | str = "" | The class. |
min_bytes | i64 = 0 | The smallest size. |
max_bytes | i64 = 0 | The largest size. |
success_status | str = "" | The status code of a successful response. |
success_redirect | str = "" | The address to return to after the upload. |
meta | Headers | The metadata. |
The example for this item is shown with the ones above: aws-Presign.salam
PostForm
struct PostForm| Name | Type | Description |
|---|---|---|
ok | bool = false | It succeeded. |
url | str = "" | The form action address. |
fields | Headers | The hidden form fields. |
policy | str = "" | The JSON policy before Base64. |
error | str = "" | The error message. |
The example for this item is shown with the ones above: aws-Presign.salam
Message
struct Message| Name | Type | Description |
|---|---|---|
id | str = "" | The id. |
body | str = "" | The text. |
receipt | str = "" | The receipt handle; for deleting it and changing its visibility. |
md5 | str = "" | The MD5 digest of the text. |
receive_count | int = 0 | How many times it was received. |
sent_epoch | i64 = 0 | When it was sent, in Unix seconds. |
group_id | str = "" | The group in a FIFO queue. |
dedup_id | str = "" | The deduplication id. |
attributes | Headers | The system attributes. |
message_attributes | Headers | The sender attributes. |
The example for this item is shown with the ones above: aws-Parse.salam
MessageList
struct MessageList| Name | Type | Description |
|---|---|---|
ok | bool = false | It succeeded. |
status | int = 0 | The HTTP status code. |
items | Vector | The messages. |
error | str = "" | The error message. |
code | str = "" | The service error code, such as NoSuchKey. |
The example for this item is shown with the ones above: aws-Parse.salam
SendResult
struct SendResult| Name | Type | Description |
|---|---|---|
ok | bool = false | It succeeded. |
id | str = "" | The message id. |
md5 | str = "" | The MD5 digest of the text. |
sequence | str = "" | The sequence number in a FIFO queue. |
error | str = "" | The error message. |
code | str = "" | The service error code, such as NoSuchKey. |
import aws
func main:
chain := aws.DefaultChain()
creds := aws.Resolve(chain)
if not creds.ok:
println "no credentials were found:", creds.error
ret
end
println aws.DescribeCredentials(creds)
cfg := aws.ResolveConfig("photos", "eu-central-1", chain)
println aws.FromEnvironmentCredentials().ok, aws.FromProfileCredentials("default", chain).ok
println aws.FromWebIdentityCredentials(chain).ok, aws.FromContainerCredentials(1000).ok
println aws.FromInstanceCredentials(1000).ok, aws.InstanceRegion(1000)
who := aws.GetCallerIdentity(cfg)
println who.ok, who.account, who.arn, who.user_id
role := aws.AssumeRole(cfg, "arn:aws:iam::123456789012:role/deploy", "salam", 900)
if role.ok:
cfg2 := aws.Apply(cfg, role)
println aws.Describe(cfg2)
end
_ := aws.AssumeRoleWith(cfg, "arn:aws:iam::123456789012:role/partner", "salam", 3600, "ext-42", "")
_ := aws.AssumeRoleWithWebIdentity(cfg, "arn:aws:iam::123456789012:role/ci", "ci", "token", 900)
_ := aws.GetSessionToken(cfg, 3600, "arn:aws:iam::123456789012:mfa/ali", "123456")
_ := aws.GetFederationToken(cfg, "guest", "", 900)
created := aws.SqsCreateQueue(cfg, "jobs", aws.NewHeaders())
queue := aws.SqsQueueUrl(cfg, "jobs")
println created == queue, aws.SqsQueueArn(cfg, queue)
mut queues := aws.SqsListQueues(cfg, "")
repeat aws.QueueCount(queues) in i:
println aws.QueueAt(queues, i)
end
aws.QueueListFree(queues)
sent := aws.SqsSend(cfg, queue, "invoice 42")
println sent.ok, sent.id, sent.md5, sent.sequence
_ := aws.SqsSendWith(cfg, queue, aws.OutMessage { body = "later", delay = 60 })
mut messages := aws.SqsReceive(cfg, queue, aws.ReceiveOptions { max_messages = 5, wait_seconds = 10 })
each msg in messages.items:
println msg.body
_ := aws.SqsDelete(cfg, queue, msg.receipt)
end
aws.MessageListFree(messages)
mut batch := aws.SqsReceiveBatch(cfg, queue, 10)
_ := aws.SqsDeleteBatch(cfg, queue, batch)
aws.MessageListFree(batch)
mut waiting := aws.SqsPoll(cfg, queue)
if aws.MessageCount(waiting) > 0:
receipt := aws.MessageAt(waiting, 0).receipt
_ := aws.SqsChangeVisibility(cfg, queue, receipt, 120)
_ := aws.SqsRelease(cfg, queue, receipt)
end
aws.MessageListFree(waiting)
println aws.SqsDepth(cfg, queue)
mut attrs := aws.NewHeaders()
aws.HeaderSet(attrs, "RedrivePolicy", aws.SqsRedrivePolicy("arn:aws:sqs:eu-central-1:123456789012:dead", 5))
_ := aws.SqsSetAttributes(cfg, queue, attrs)
aws.HeaderFree(attrs)
mut current := aws.SqsAttributes(cfg, queue)
println aws.HeaderGet(current, "VisibilityTimeout")
aws.HeaderFree(current)
_ := aws.SqsPurge(cfg, queue)
_ := aws.SqsDeleteQueue(cfg, queue)
mut call := aws.NewJsonCall("dynamodb", "DynamoDB_20120810.ListTables", "{}")
result := aws.Invoke(cfg, call)
println result.status, result.body
aws.CallFree(call)
req := aws.NewRequest("GET", "notes/hello.txt")
println aws.Do(cfg, req).status
mut raw := aws.DoBytes(cfg, req)
aws.FreeBytes(raw)
endOutMessage
struct OutMessage| Name | Type | Description |
|---|---|---|
body | str = "" | The text. |
delay | int = 0 | The delay in seconds. |
group_id | str = "" | The group, for a FIFO queue. |
dedup_id | str = "" | The deduplication id. |
attributes | Headers | The message attributes. |
The example for this item is shown with the ones above: aws-Parse.salam
ReceiveOptions
struct ReceiveOptions| Name | Type | Description |
|---|---|---|
max_messages | int = 1 | The most messages, 1 to 10. |
wait_seconds | int = 20 | The long poll, 0 to 20 seconds. |
visibility_timeout | int = 0 | How long the received messages stay hidden. |
want_attributes | bool = true | Ask for the system attributes. |
want_message_attributes | bool = true | Ask for the message attributes. |
receive_request_attempt_id | str = "" | An id for safely repeating a receive in a FIFO queue. |
The example for this item is shown with the ones above: aws-Parse.salam
QueueList
struct QueueList| Name | Type | Description |
|---|---|---|
ok | bool = false | It succeeded. |
items | Vector | The queue URLs. |
error | str = "" | The error message. |
code | str = "" | The service error code, such as NoSuchKey. |
The example for this item is shown with the ones above: aws-Services.salam
Signed
struct Signed| Name | Type | Description |
|---|---|---|
authorization | str = "" | The value of the Authorization header. |
amz_date | str = "" | The value of the x-amz-date header. |
payload_hash | str = "" | The body digest. |
ok | bool = false | It was signed; not without a secret key. |
The example for this item is shown with the ones above: aws-Sign.salam
ObjectEntry
struct ObjectEntry| Name | Type | Description |
|---|---|---|
key | str = "" | The key. |
size | i64 = 0 | The size. |
etag | str = "" | The ETag. |
last_modified | str = "" | When it changed. |
modified_epoch | i64 = 0 | The same in Unix seconds. |
storage_class | str = "" | The class. |
owner | str = "" | The owner. |
version_id | str = "" | The version. |
is_latest | bool = false | It is the latest version. |
delete_marker | bool = false | It is a delete marker. |
The example for this item is shown with the ones above: aws-Parse.salam
ObjectList
struct ObjectList| Name | Type | Description |
|---|---|---|
ok | bool = false | It succeeded. |
status | int = 0 | The HTTP status code. |
items | Vector | The objects. |
prefixes | Vector | The common prefixes, that is, the "folders". |
truncated | bool = false | There is another page. |
next_token | str = "" | The token of the next page. |
next_key_marker | str = "" | The key of the next page in a version listing. |
next_version_marker | str = "" | The version of the next page. |
key_count | int = 0 | The number of keys. |
name | str = "" | The bucket name. |
prefix | str = "" | The prefix. |
delimiter | str = "" | The delimiter. |
error | str = "" | The error message. |
code | str = "" | The service error code, such as NoSuchKey. |
The example for this item is shown with the ones above: aws-Parse.salam
BucketEntry
struct BucketEntry| Name | Type | Description |
|---|---|---|
name | str = "" | The name. |
created | str = "" | When it was created. |
created_epoch | i64 = 0 | The same in Unix seconds. |
region | str = "" | The region. |
import aws
func main:
cfg := aws.FromEnvironment("")
if not aws.Configured(cfg):
println "AWS credentials are not set"
ret
end
bucket := "salam-demo-2026"
_ := aws.S3CreateBucket(cfg, bucket)
_ := aws.S3CreateBucketAcl(cfg, bucket + "-logs", "private")
println aws.S3BucketExists(cfg, bucket), aws.S3HeadBucket(cfg, bucket).status, aws.S3BucketRegion(cfg, bucket)
mut list := aws.S3ListBuckets(cfg)
println list.ok, list.owner, aws.BucketCount(list)
repeat aws.BucketCount(list) in i:
b := aws.BucketAt(list, i)
println b.name, b.created, b.region
end
aws.BucketListFree(list)
_ := aws.S3SetVersioning(cfg, bucket, true)
println aws.S3Versioning(cfg, bucket)
mut tags := aws.NewTags()
aws.TagSet(tags, "project", "salam")
_ := aws.S3SetBucketTags(cfg, bucket, tags)
aws.HeaderFree(tags)
mut current := aws.S3BucketTags(cfg, bucket)
println aws.HeaderGet(current, "project")
aws.HeaderFree(current)
_ := aws.S3DeleteBucketTags(cfg, bucket)
policy := `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":"*","Action":"s3:GetObject","Resource":"arn:aws:s3:::salam-demo-2026/public/*"}]}`
_ := aws.S3SetBucketPolicy(cfg, bucket, policy)
println aws.S3BucketPolicy(cfg, bucket).Len() > 0
_ := aws.S3DeleteBucketPolicy(cfg, bucket)
_ := aws.S3SetBucketCors(cfg, bucket, "https://salamlang.ir", "GET,PUT", 3600)
println aws.S3BucketCors(cfg, bucket).Len() > 0
_ := aws.S3DeleteBucketCors(cfg, bucket)
_ := aws.S3SetLifecycle(cfg, bucket, aws.S3ExpiryRule("tmp/", 7, 1))
println aws.S3Lifecycle(cfg, bucket).Len() > 0
_ := aws.S3DeleteLifecycle(cfg, bucket)
_ := aws.S3DeleteBucket(cfg, bucket + "-logs")
println aws.S3DeleteBucket(cfg, bucket).ok
endBucketList
struct BucketList| Name | Type | Description |
|---|---|---|
ok | bool = false | It succeeded. |
status | int = 0 | The HTTP status code. |
items | Vector | The buckets. |
owner | str = "" | The owner. |
error | str = "" | The error message. |
code | str = "" | The service error code, such as NoSuchKey. |
The example for this item is shown with the ones above: aws-Buckets.salam
ListOptions
struct ListOptions| Name | Type | Description |
|---|---|---|
prefix | str = "" | The prefix. |
delimiter | str = "" | The delimiter, usually /. |
max_keys | int = 0 | The most keys on a page. |
continuation_token | str = "" | The token of the next page. |
start_after | str = "" | Start after this key. |
fetch_owner | bool = false | Ask for the owner too. |
url_encode | bool = true | The keys come encoded. |
The example for this item is shown with the ones above: aws-Objects.salam
KeyList
struct KeyList| Name | Type | Description |
|---|---|---|
items | Vector | The keys. |
The example for this item is shown with the ones above: aws-Parse.salam
TransferResult
struct TransferResult| Name | Type | Description |
|---|---|---|
ok | bool = false | It succeeded. |
status | int = 0 | The HTTP status code. |
bytes | i64 = 0 | The bytes transferred. |
parts | int = 0 | The number of parts; 1 for a small file. |
etag | str = "" | The ETag. |
path | str = "" | The file path. |
key | str = "" | The key. |
error | str = "" | The error message. |
code | str = "" | The service error code, such as NoSuchKey. |
The example for this item is shown with the ones above: aws-Files.salam
DirResult
struct DirResult| Name | Type | Description |
|---|---|---|
ok | bool = false | Everything was transferred. |
files | int = 0 | The number of files. |
bytes | i64 = 0 | The total bytes. |
skipped | int = 0 | The files that were skipped. |
failed_path | str = "" | The first file that failed. |
error | str = "" | The error message. |
code | str = "" | The service error code, such as NoSuchKey. |
The example for this item is shown with the ones above: aws-Files.salam
Constants and variables
SOURCE_ENV
const SOURCE_ENV: str = "environment"AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.The example for this item is shown with the ones above: aws-Config.salam
SOURCE_PROFILE
const SOURCE_PROFILE: str = "profile"~/.aws/credentials.The example for this item is shown with the ones above: aws-Config.salam
SOURCE_WEB_IDENTITY
const SOURCE_WEB_IDENTITY: str = "web-identity"The example for this item is shown with the ones above: aws-Config.salam
SOURCE_CONTAINER
const SOURCE_CONTAINER: str = "container"The example for this item is shown with the ones above: aws-Config.salam
SOURCE_INSTANCE
const SOURCE_INSTANCE: str = "instance"The example for this item is shown with the ones above: aws-Config.salam
STS_VERSION
const STS_VERSION: str = "2011-06-15"The example for this item is shown with the ones above: aws-Config.salam
STS_MIN_DURATION
const STS_MIN_DURATION: i32 = 900The example for this item is shown with the ones above: aws-Config.salam
STS_MAX_DURATION
const STS_MAX_DURATION: i32 = 43200The example for this item is shown with the ones above: aws-Config.salam
STS_DEFAULT_SKEW
const STS_DEFAULT_SKEW: i32 = 300The example for this item is shown with the ones above: aws-Config.salam
SERVICE_S3
const SERVICE_S3: str = "s3"The example for this item is shown with the ones above: aws-Sign.salam
ALGORITHM
const ALGORITHM: str = "AWS4-HMAC-SHA256"The example for this item is shown with the ones above: aws-Sign.salam
EMPTY_SHA256
const EMPTY_SHA256: str = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"The example for this item is shown with the ones above: aws-Sign.salam
UNSIGNED_PAYLOAD
const UNSIGNED_PAYLOAD: str = "UNSIGNED-PAYLOAD"The example for this item is shown with the ones above: aws-Sign.salam
S3_PART_MIN
const S3_PART_MIN: i32 = 5242880The example for this item is shown with the ones above: aws-Files.salam
S3_PART_MAX_COUNT
const S3_PART_MAX_COUNT: i32 = 10000The example for this item is shown with the ones above: aws-Files.salam
S3_PART_DEFAULT
const S3_PART_DEFAULT: i32 = 8388608The example for this item is shown with the ones above: aws-Files.salam
SQS_VERSION
const SQS_VERSION: str = "2012-11-05"The example for this item is shown with the ones above: aws-Parse.salam
SQS_MAX_MESSAGES
const SQS_MAX_MESSAGES: i32 = 10The example for this item is shown with the ones above: aws-Parse.salam
SQS_MAX_WAIT
const SQS_MAX_WAIT: i32 = 20The example for this item is shown with the ones above: aws-Parse.salam
SQS_MAX_BATCH
const SQS_MAX_BATCH: i32 = 10The example for this item is shown with the ones above: aws-Parse.salam
Functions
FromEnvironmentCredentials
func FromEnvironmentCredentials(): CredentialsThe example for this item is shown with the ones above: aws-Services.salam
FromProfileCredentials
func FromProfileCredentials(profile: str, o: ChainOptions): CredentialsThe example for this item is shown with the ones above: aws-Services.salam
FromWebIdentityCredentials
func FromWebIdentityCredentials(o: ChainOptions): CredentialsAWS_ROLE_ARN role with the AWS_WEB_IDENTITY_TOKEN_FILE file.The example for this item is shown with the ones above: aws-Services.salam
FromContainerCredentials
func FromContainerCredentials(timeout_ms: int): CredentialsThe example for this item is shown with the ones above: aws-Services.salam
FromInstanceCredentials
func FromInstanceCredentials(timeout_ms: int): CredentialsAWS_EC2_METADATA_SERVICE_ENDPOINT replaces the address of the service.The example for this item is shown with the ones above: aws-Services.salam
InstanceRegion
func InstanceRegion(timeout_ms: int): strThe example for this item is shown with the ones above: aws-Services.salam
DefaultChain
func DefaultChain(): ChainOptionsThe example for this item is shown with the ones above: aws-Config.salam
ContainerChain
func ContainerChain(): ChainOptionsThe example for this item is shown with the ones above: aws-Config.salam
Resolve
func Resolve(o: ChainOptions): CredentialsThe example for this item is shown with the ones above: aws-Services.salam
ResolveConfig
func ResolveConfig(bucket: str, region: str, o: ChainOptions): ConfigThe example for this item is shown with the ones above: aws-Services.salam
StsEndpoint
func StsEndpoint(region: str): strThe example for this item is shown with the ones above: aws-Config.salam
AssumeRole
func AssumeRole(cfg: Config, role_arn: str, session_name: str, duration: int): CredentialsThe example for this item is shown with the ones above: aws-Services.salam
AssumeRoleWith
func AssumeRoleWith(cfg: Config, role_arn: str, session_name: str, duration: int, external_id: str, policy_arn: str): CredentialsThe example for this item is shown with the ones above: aws-Services.salam
AssumeRoleWithWebIdentity
func AssumeRoleWithWebIdentity(cfg: Config, role_arn: str, session_name: str, web_identity_token: str, duration: int): CredentialsThe example for this item is shown with the ones above: aws-Services.salam
GetSessionToken
func GetSessionToken(cfg: Config, duration: int, mfa_serial: str, mfa_code: str): CredentialsThe example for this item is shown with the ones above: aws-Services.salam
GetFederationToken
func GetFederationToken(cfg: Config, name: str, policy_json: str, duration: int): CredentialsThe example for this item is shown with the ones above: aws-Services.salam
GetCallerIdentity
func GetCallerIdentity(cfg: Config): IdentityThe example for this item is shown with the ones above: aws-Services.salam
Apply
func Apply(cfg: Config, creds: Credentials): ConfigThe example for this item is shown with the ones above: aws-Config.salam
StaticCredentials
func StaticCredentials(access_key: str, secret_key: str): CredentialsThe example for this item is shown with the ones above: aws-Config.salam
Expired
func Expired(creds: Credentials, now: i64, skew: int): boolThe example for this item is shown with the ones above: aws-Config.salam
ExpiredNow
func ExpiredNow(creds: Credentials): boolThe example for this item is shown with the ones above: aws-Config.salam
SecondsRemaining
func SecondsRemaining(creds: Credentials, now: i64): i64The example for this item is shown with the ones above: aws-Config.salam
DescribeCredentials
func DescribeCredentials(creds: Credentials): strThe example for this item is shown with the ones above: aws-Config.salam
ParseCredentials
func ParseCredentials(body: str, status: int, source: str): CredentialsThe example for this item is shown with the ones above: aws-Config.salam
AwsEndpoint
func AwsEndpoint(region: str): strThe example for this item is shown with the ones above: aws-Config.salam
ForAws
func ForAws(region: str, bucket: str): ConfigThe example for this item is shown with the ones above: aws-Config.salam
ForMinio
func ForMinio(endpoint: str, bucket: str): ConfigThe example for this item is shown with the ones above: aws-Config.salam
ForR2
func ForR2(account_id: str, bucket: str): ConfigThe example for this item is shown with the ones above: aws-Config.salam
ForSpaces
func ForSpaces(region: str, bucket: str): ConfigThe example for this item is shown with the ones above: aws-Config.salam
ForWasabi
func ForWasabi(region: str, bucket: str): ConfigThe example for this item is shown with the ones above: aws-Config.salam
ForBackblaze
func ForBackblaze(region: str, bucket: str): ConfigThe example for this item is shown with the ones above: aws-Config.salam
ForEndpoint
func ForEndpoint(endpoint: str, region: str, bucket: str): ConfigThe example for this item is shown with the ones above: aws-Config.salam
FromEnvironment
func FromEnvironment(bucket: str): ConfigAWS_REGION and AWS_ENDPOINT_URL.The example for this item is shown with the ones above: aws-Config.salam
CredentialsPath
func CredentialsPath(): str~/.aws/credentials.The example for this item is shown with the ones above: aws-Config.salam
ConfigPath
func ConfigPath(): str~/.aws/config.The example for this item is shown with the ones above: aws-Config.salam
FromProfile
func FromProfile(profile: str, bucket: str): Config~/.aws files.The example for this item is shown with the ones above: aws-Files.salam
ParseIni
func ParseIni(text: str, section: str, key: str): strThe example for this item is shown with the ones above: aws-Config.salam
WithBucket
func WithBucket(cfg: Config, bucket: str): ConfigThe example for this item is shown with the ones above: aws-Config.salam
WithSessionToken
func WithSessionToken(cfg: Config, token: str): ConfigThe example for this item is shown with the ones above: aws-Config.salam
WithRetry
func WithRetry(cfg: Config, attempts: int, base_ms: int): ConfigThe example for this item is shown with the ones above: aws-Config.salam
Describe
func Describe(cfg: Config): strThe example for this item is shown with the ones above: aws-Config.salam
NewConfig
func NewConfig(endpoint: str, bucket: str): ConfigThe example for this item is shown with the ones above: aws-Config.salam
WithCredentials
func WithCredentials(cfg: Config, access_key: str, secret_key: str): ConfigThe example for this item is shown with the ones above: aws-Config.salam
Configured
func Configured(cfg: Config): boolThe example for this item is shown with the ones above: aws-Config.salam
Failure
func Failure(reason: str): ResultThe example for this item is shown with the ones above: aws-Config.salam
S3CreateBucket
func S3CreateBucket(cfg: Config, bucket: str): ResultThe example for this item is shown with the ones above: aws-Buckets.salam
S3CreateBucketAcl
func S3CreateBucketAcl(cfg: Config, bucket: str, acl: str): Resultprivate.The example for this item is shown with the ones above: aws-Buckets.salam
S3DeleteBucket
func S3DeleteBucket(cfg: Config, bucket: str): ResultThe example for this item is shown with the ones above: aws-Buckets.salam
S3HeadBucket
func S3HeadBucket(cfg: Config, bucket: str): ResultThe example for this item is shown with the ones above: aws-Buckets.salam
S3BucketExists
func S3BucketExists(cfg: Config, bucket: str): boolThe example for this item is shown with the ones above: aws-Buckets.salam
S3ListBuckets
func S3ListBuckets(cfg: Config): BucketListThe example for this item is shown with the ones above: aws-Buckets.salam
BucketCount
func BucketCount(l: BucketList): intThe example for this item is shown with the ones above: aws-Buckets.salam
BucketAt
func BucketAt(l: BucketList, i: int): BucketEntryThe example for this item is shown with the ones above: aws-Buckets.salam
BucketListFree
func BucketListFree(l &: BucketList)The example for this item is shown with the ones above: aws-Buckets.salam
S3BucketRegion
func S3BucketRegion(cfg: Config, bucket: str): strThe example for this item is shown with the ones above: aws-Buckets.salam
S3SetVersioning
func S3SetVersioning(cfg: Config, bucket: str, enabled: bool): ResultThe example for this item is shown with the ones above: aws-Buckets.salam
S3Versioning
func S3Versioning(cfg: Config, bucket: str): strThe example for this item is shown with the ones above: aws-Buckets.salam
S3SetBucketTags
func S3SetBucketTags(cfg: Config, bucket: str, tags: Headers): ResultThe example for this item is shown with the ones above: aws-Buckets.salam
S3BucketTags
func S3BucketTags(cfg: Config, bucket: str): HeadersThe example for this item is shown with the ones above: aws-Buckets.salam
S3DeleteBucketTags
func S3DeleteBucketTags(cfg: Config, bucket: str): ResultThe example for this item is shown with the ones above: aws-Buckets.salam
S3SetBucketPolicy
func S3SetBucketPolicy(cfg: Config, bucket: str, policy_json: str): ResultThe example for this item is shown with the ones above: aws-Buckets.salam
S3BucketPolicy
func S3BucketPolicy(cfg: Config, bucket: str): strThe example for this item is shown with the ones above: aws-Buckets.salam
S3DeleteBucketPolicy
func S3DeleteBucketPolicy(cfg: Config, bucket: str): ResultThe example for this item is shown with the ones above: aws-Buckets.salam
S3SetBucketCors
func S3SetBucketCors(cfg: Config, bucket: str, origin: str, methods: str, max_age: int): ResultThe example for this item is shown with the ones above: aws-Buckets.salam
S3BucketCors
func S3BucketCors(cfg: Config, bucket: str): strThe example for this item is shown with the ones above: aws-Buckets.salam
S3DeleteBucketCors
func S3DeleteBucketCors(cfg: Config, bucket: str): ResultThe example for this item is shown with the ones above: aws-Buckets.salam
S3SetLifecycle
func S3SetLifecycle(cfg: Config, bucket: str, config_xml: str): ResultThe example for this item is shown with the ones above: aws-Buckets.salam
S3Lifecycle
func S3Lifecycle(cfg: Config, bucket: str): strThe example for this item is shown with the ones above: aws-Buckets.salam
S3DeleteLifecycle
func S3DeleteLifecycle(cfg: Config, bucket: str): ResultThe example for this item is shown with the ones above: aws-Buckets.salam
S3ExpiryRule
func S3ExpiryRule(prefix: str, days: int, abort_days: int): strThe example for this item is shown with the ones above: aws-Parse.salam
ServiceEndpoint
func ServiceEndpoint(service: str, region: str): strThe example for this item is shown with the ones above: aws-Config.salam
NewQueryCall
func NewQueryCall(service: str, action: str, version: str): CallThe example for this item is shown with the ones above: aws-Parse.salam
NewJsonCall
func NewJsonCall(service: str, target: str, json: str): CallThe example for this item is shown with the ones above: aws-Parse.salam
NewJson11Call
func NewJson11Call(service: str, target: str, json: str): CallThe example for this item is shown with the ones above: aws-Parse.salam
NewRestCall
func NewRestCall(service: str, method: str, path: str): CallThe example for this item is shown with the ones above: aws-Parse.salam
CallParam
func CallParam(c &: Call, name: str, value: str)The example for this item is shown with the ones above: aws-Parse.salam
CallParamInt
func CallParamInt(c &: Call, name: str, value: int)The example for this item is shown with the ones above: aws-Parse.salam
CallHeader
func CallHeader(c &: Call, name: str, value: str)The example for this item is shown with the ones above: aws-Parse.salam
CallQuery
func CallQuery(c &: Call, name: str, value: str)The example for this item is shown with the ones above: aws-Parse.salam
CallBody
func CallBody(c &: Call, body: str, content_type: str)The example for this item is shown with the ones above: aws-Parse.salam
CallRegion
func CallRegion(c &: Call, region: str)The example for this item is shown with the ones above: aws-Parse.salam
CallEndpoint
func CallEndpoint(c &: Call, endpoint: str)The example for this item is shown with the ones above: aws-Parse.salam
Invoke
func Invoke(cfg: Config, c: Call): ResultThe example for this item is shown with the ones above: aws-Services.salam
ServiceErrorCode
func ServiceErrorCode(body: str): strThe example for this item is shown with the ones above: aws-Parse.salam
ServiceErrorMessage
func ServiceErrorMessage(body: str, status: int): strThe example for this item is shown with the ones above: aws-Parse.salam
CallFree
func CallFree(c &: Call)The example for this item is shown with the ones above: aws-Parse.salam
PreparedCall
func PreparedCall(cfg: Config, c: Call, at: i64): strThe example for this item is shown with the ones above: aws-Parse.salam
CallBodyText
func CallBodyText(c: Call): strThe example for this item is shown with the ones above: aws-Parse.salam
NewHeaders
func NewHeaders(): HeadersThe example for this item is shown with the ones above: aws-Sign.salam
HeaderSet
func HeaderSet(h &: Headers, name: str, value: str)The example for this item is shown with the ones above: aws-Sign.salam
HeaderAdd
func HeaderAdd(h &: Headers, name: str, value: str)The example for this item is shown with the ones above: aws-Sign.salam
HeaderGet
func HeaderGet(h: Headers, name: str): strThe example for this item is shown with the ones above: aws-Sign.salam
HeaderHas
func HeaderHas(h: Headers, name: str): boolThe example for this item is shown with the ones above: aws-Sign.salam
HeaderCount
func HeaderCount(h: Headers): intThe example for this item is shown with the ones above: aws-Sign.salam
HeaderNameAt
func HeaderNameAt(h: Headers, i: int): strThe example for this item is shown with the ones above: aws-Sign.salam
HeaderValueAt
func HeaderValueAt(h: Headers, i: int): strThe example for this item is shown with the ones above: aws-Sign.salam
HeaderFree
func HeaderFree(h &: Headers)The example for this item is shown with the ones above: aws-Sign.salam
NewRequest
func NewRequest(method: str, key: str): RequestThe example for this item is shown with the ones above: aws-Sign.salam
NewBucketRequest
func NewBucketRequest(method: str, bucket: str, key: str): RequestThe example for this item is shown with the ones above: aws-Sign.salam
NewServiceRequest
func NewServiceRequest(method: str): RequestThe example for this item is shown with the ones above: aws-Sign.salam
SetQuery
func SetQuery(r &: Request, name: str, value: str)The example for this item is shown with the ones above: aws-Sign.salam
SetQueryInt
func SetQueryInt(r &: Request, name: str, value: int)The example for this item is shown with the ones above: aws-Sign.salam
SetFlag
func SetFlag(r &: Request, name: str)?acl.The example for this item is shown with the ones above: aws-Sign.salam
SetHeader
func SetHeader(r &: Request, name: str, value: str)The example for this item is shown with the ones above: aws-Sign.salam
SetBody
func SetBody(r &: Request, p: void*, n: int)The example for this item is shown with the ones above: aws-Sign.salam
SetText
func SetText(r &: Request, s: str)The example for this item is shown with the ones above: aws-Sign.salam
SetUnsignedPayload
func SetUnsignedPayload(r &: Request)The example for this item is shown with the ones above: aws-Sign.salam
Do
func Do(cfg: Config, r: Request): ResultThe example for this item is shown with the ones above: aws-Services.salam
DoBytes
func DoBytes(cfg: Config, r: Request): BytesThe example for this item is shown with the ones above: aws-Services.salam
FreeBytes
func FreeBytes(b &: Bytes)The example for this item is shown with the ones above: aws-Objects.salam
ResultHeader
func ResultHeader(r: Result, name: str): strThe example for this item is shown with the ones above: aws-Objects.salam
BytesHeader
func BytesHeader(b: Bytes, name: str): strThe example for this item is shown with the ones above: aws-Objects.salam
ResultErrorCode
func ResultErrorCode(body: str): strThe example for this item is shown with the ones above: aws-Sign.salam
ResultErrorMessage
func ResultErrorMessage(body: str, status: int): strThe example for this item is shown with the ones above: aws-Sign.salam
ResultTag
func ResultTag(body: str, tag: str): strThe example for this item is shown with the ones above: aws-Sign.salam
Unquote
func Unquote(s: str): strThe example for this item is shown with the ones above: aws-Sign.salam
CanonicalRequest
func CanonicalRequest(cfg: Config, r: Request, at: i64): strThe example for this item is shown with the ones above: aws-Sign.salam
PreparedHead
func PreparedHead(cfg: Config, r: Request, at: i64): strThe example for this item is shown with the ones above: aws-Sign.salam
S3CreateUpload
func S3CreateUpload(cfg: Config, key: str, o: PutOptions): UploadThe example for this item is shown with the ones above: aws-Files.salam
S3UploadPart
func S3UploadPart(cfg: Config, u &: Upload, number: int, data: void*, n: int): ResultThe example for this item is shown with the ones above: aws-Files.salam
S3UploadPartCopy
func S3UploadPartCopy(cfg: Config, u &: Upload, number: int, src_key: str, o: CopyOptions, start: i64, stop: i64): ResultThe example for this item is shown with the ones above: aws-Files.salam
S3CompleteUpload
func S3CompleteUpload(cfg: Config, u: Upload): ResultThe example for this item is shown with the ones above: aws-Files.salam
S3AbortUpload
func S3AbortUpload(cfg: Config, u: Upload): ResultThe example for this item is shown with the ones above: aws-Files.salam
S3ListParts
func S3ListParts(cfg: Config, key: str, upload_id: str): PartListThe example for this item is shown with the ones above: aws-Files.salam
S3ListUploads
func S3ListUploads(cfg: Config, prefix: str): UploadListThe example for this item is shown with the ones above: aws-Files.salam
S3PutLarge
func S3PutLarge(cfg: Config, key: str, data: void*, n: int, part_size: int, o: PutOptions): ResultThe example for this item is shown with the ones above: aws-Files.salam
S3CopyLarge
func S3CopyLarge(cfg: Config, src_key: str, dst_key: str, part_size: int, o: CopyOptions): ResultThe example for this item is shown with the ones above: aws-Files.salam
S3MultipartEtag
func S3MultipartEtag(data: void*, n: int, part_size: int): strThe example for this item is shown with the ones above: aws-Sign.salam
S3ContentHashMd5
func S3ContentHashMd5(data: void*, n: int): strThe example for this item is shown with the ones above: aws-Sign.salam
PartCount
func PartCount(p: PartList): intThe example for this item is shown with the ones above: aws-Files.salam
PartAt
func PartAt(p: PartList, i: int): PartRefThe example for this item is shown with the ones above: aws-Files.salam
UploadCount
func UploadCount(u: UploadList): intThe example for this item is shown with the ones above: aws-Files.salam
UploadAt
func UploadAt(u: UploadList, i: int): UploadRefThe example for this item is shown with the ones above: aws-Files.salam
UploadParts
func UploadParts(u: Upload): intThe example for this item is shown with the ones above: aws-Files.salam
UploadBytes
func UploadBytes(u: Upload): i64The example for this item is shown with the ones above: aws-Files.salam
UploadFreeParts
func UploadFreeParts(u &: Upload)The example for this item is shown with the ones above: aws-Files.salam
NewTags
func NewTags(): HeadersThe example for this item is shown with the ones above: aws-Sign.salam
TagSet
func TagSet(h &: Headers, name: str, value: str)The example for this item is shown with the ones above: aws-Sign.salam
TagString
func TagString(tags: Headers): strx-amz-tagging header.The example for this item is shown with the ones above: aws-Sign.salam
S3SetObjectTags
func S3SetObjectTags(cfg: Config, key: str, tags: Headers): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3ObjectTags
func S3ObjectTags(cfg: Config, key: str): HeadersThe example for this item is shown with the ones above: aws-Objects.salam
S3ObjectTagsVersion
func S3ObjectTagsVersion(cfg: Config, key: str, version_id: str): HeadersThe example for this item is shown with the ones above: aws-Objects.salam
S3DeleteObjectTags
func S3DeleteObjectTags(cfg: Config, key: str): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3AddObjectTag
func S3AddObjectTag(cfg: Config, key: str, name: str, value: str): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3SetObjectAcl
func S3SetObjectAcl(cfg: Config, key: str, acl: str): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3ObjectAcl
func S3ObjectAcl(cfg: Config, key: str): strThe example for this item is shown with the ones above: aws-Objects.salam
S3MakePublic
func S3MakePublic(cfg: Config, key: str): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3MakePrivate
func S3MakePrivate(cfg: Config, key: str): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3SetLegalHold
func S3SetLegalHold(cfg: Config, key: str, held: bool): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3LegalHold
func S3LegalHold(cfg: Config, key: str): boolThe example for this item is shown with the ones above: aws-Objects.salam
S3SetRetention
func S3SetRetention(cfg: Config, key: str, mode: str, until_epoch: i64): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3PutBytes
func S3PutBytes(cfg: Config, key: str, body: void*, n: int, content_type: str): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3PutBytesWith
func S3PutBytesWith(cfg: Config, key: str, body: void*, n: int, o: PutOptions): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3Put
func S3Put(cfg: Config, key: str, body: str, content_type: str): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3PutWith
func S3PutWith(cfg: Config, key: str, body: str, o: PutOptions): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3Get
func S3Get(cfg: Config, key: str): Resultstr and stops at the first zero byte; use S3GetBytes for binary data.The example for this item is shown with the ones above: aws-Objects.salam
S3GetWith
func S3GetWith(cfg: Config, key: str, o: GetOptions): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3GetBytes
func S3GetBytes(cfg: Config, key: str): BytesThe example for this item is shown with the ones above: aws-Objects.salam
S3GetBytesWith
func S3GetBytesWith(cfg: Config, key: str, o: GetOptions): BytesThe example for this item is shown with the ones above: aws-Objects.salam
S3GetRange
func S3GetRange(cfg: Config, key: str, start: i64, stop: i64): BytesThe example for this item is shown with the ones above: aws-Objects.salam
S3Head
func S3Head(cfg: Config, key: str): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3Stat
func S3Stat(cfg: Config, key: str): ObjectInfoThe example for this item is shown with the ones above: aws-Objects.salam
S3StatVersion
func S3StatVersion(cfg: Config, key: str, version_id: str): ObjectInfoThe example for this item is shown with the ones above: aws-Objects.salam
S3Delete
func S3Delete(cfg: Config, key: str): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3DeleteVersion
func S3DeleteVersion(cfg: Config, key: str, version_id: str): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3Exists
func S3Exists(cfg: Config, key: str): boolThe example for this item is shown with the ones above: aws-Objects.salam
S3Size
func S3Size(cfg: Config, key: str): i64The example for this item is shown with the ones above: aws-Objects.salam
S3Copy
func S3Copy(cfg: Config, src_key: str, dst_key: str): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3CopyWith
func S3CopyWith(cfg: Config, src_key: str, dst_key: str, o: CopyOptions): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3Move
func S3Move(cfg: Config, src_key: str, dst_key: str): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3Touch
func S3Touch(cfg: Config, key: str, o: CopyOptions): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3Restore
func S3Restore(cfg: Config, key: str, days: int, tier: str): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3ContentHash
func S3ContentHash(body: void*, n: int): strThe example for this item is shown with the ones above: aws-Sign.salam
S3ContentMd5
func S3ContentMd5(body: void*, n: int): strThe example for this item is shown with the ones above: aws-Sign.salam
S3ChecksumSha256
func S3ChecksumSha256(body: void*, n: int): strThe example for this item is shown with the ones above: aws-Sign.salam
S3ObjectChecksum
func S3ObjectChecksum(cfg: Config, key: str): strThe example for this item is shown with the ones above: aws-Objects.salam
S3Url
func S3Url(cfg: Config, key: str): strThe example for this item is shown with the ones above: aws-Presign.salam
S3Presign
func S3Presign(cfg: Config, method: str, key: str, expires: int): strThe example for this item is shown with the ones above: aws-Presign.salam
S3PresignAt
func S3PresignAt(cfg: Config, method: str, key: str, expires: int, epoch_seconds: i64): strThe example for this item is shown with the ones above: aws-Presign.salam
S3PresignWith
func S3PresignWith(cfg: Config, method: str, key: str, o: PresignOptions, epoch_seconds: i64): strThe example for this item is shown with the ones above: aws-Presign.salam
S3PresignGet
func S3PresignGet(cfg: Config, key: str, expires: int): strThe example for this item is shown with the ones above: aws-Presign.salam
S3PresignPut
func S3PresignPut(cfg: Config, key: str, content_type: str, expires: int): strThe example for this item is shown with the ones above: aws-Presign.salam
S3PresignDownload
func S3PresignDownload(cfg: Config, key: str, filename: str, expires: int): strThe example for this item is shown with the ones above: aws-Presign.salam
S3PresignPost
func S3PresignPost(cfg: Config, key: str, o: PostOptions): PostFormThe example for this item is shown with the ones above: aws-Presign.salam
S3PresignPostAt
func S3PresignPostAt(cfg: Config, key: str, o: PostOptions, epoch_seconds: i64): PostFormThe example for this item is shown with the ones above: aws-Presign.salam
PostFormHtml
func PostFormHtml(f: PostForm, file_field: str): strThe example for this item is shown with the ones above: aws-Presign.salam
SqsQueueUrl
func SqsQueueUrl(cfg: Config, name: str): strThe example for this item is shown with the ones above: aws-Services.salam
SqsCreateQueue
func SqsCreateQueue(cfg: Config, name: str, attributes: Headers): str.fifo makes a FIFO queue.The example for this item is shown with the ones above: aws-Services.salam
SqsDeleteQueue
func SqsDeleteQueue(cfg: Config, url: str): ResultThe example for this item is shown with the ones above: aws-Services.salam
SqsListQueues
func SqsListQueues(cfg: Config, prefix: str): QueueListThe example for this item is shown with the ones above: aws-Services.salam
QueueCount
func QueueCount(l: QueueList): intThe example for this item is shown with the ones above: aws-Services.salam
QueueAt
func QueueAt(l: QueueList, i: int): strThe example for this item is shown with the ones above: aws-Services.salam
QueueListFree
func QueueListFree(l &: QueueList)The example for this item is shown with the ones above: aws-Services.salam
SqsSend
func SqsSend(cfg: Config, url: str, body: str): SendResultThe example for this item is shown with the ones above: aws-Services.salam
SqsSendWith
func SqsSendWith(cfg: Config, url: str, m: OutMessage): SendResultThe example for this item is shown with the ones above: aws-Services.salam
SqsSendCall
func SqsSendCall(url: str, m: OutMessage): CallThe example for this item is shown with the ones above: aws-Parse.salam
SqsReceive
func SqsReceive(cfg: Config, url: str, o: ReceiveOptions): MessageListThe example for this item is shown with the ones above: aws-Services.salam
SqsReceiveCall
func SqsReceiveCall(url: str, o: ReceiveOptions): CallThe example for this item is shown with the ones above: aws-Parse.salam
ParseReceive
func ParseReceive(body: str, status: int): MessageListThe example for this item is shown with the ones above: aws-Parse.salam
SqsPoll
func SqsPoll(cfg: Config, url: str): MessageListThe example for this item is shown with the ones above: aws-Services.salam
SqsReceiveBatch
func SqsReceiveBatch(cfg: Config, url: str, count: int): MessageListThe example for this item is shown with the ones above: aws-Services.salam
MessageCount
func MessageCount(l: MessageList): intThe example for this item is shown with the ones above: aws-Parse.salam
MessageAt
func MessageAt(l: MessageList, i: int): MessageThe example for this item is shown with the ones above: aws-Parse.salam
MessageListFree
func MessageListFree(l &: MessageList)The example for this item is shown with the ones above: aws-Parse.salam
MessageAttribute
func MessageAttribute(m: Message, name: str): strThe example for this item is shown with the ones above: aws-Parse.salam
SqsDelete
func SqsDelete(cfg: Config, url: str, receipt: str): ResultThe example for this item is shown with the ones above: aws-Services.salam
SqsDeleteBatch
func SqsDeleteBatch(cfg: Config, url: str, l: MessageList): ResultThe example for this item is shown with the ones above: aws-Services.salam
SqsChangeVisibility
func SqsChangeVisibility(cfg: Config, url: str, receipt: str, seconds: int): ResultThe example for this item is shown with the ones above: aws-Services.salam
SqsRelease
func SqsRelease(cfg: Config, url: str, receipt: str): ResultThe example for this item is shown with the ones above: aws-Services.salam
SqsPurge
func SqsPurge(cfg: Config, url: str): ResultThe example for this item is shown with the ones above: aws-Services.salam
SqsAttributes
func SqsAttributes(cfg: Config, url: str): HeadersThe example for this item is shown with the ones above: aws-Services.salam
SqsSetAttributes
func SqsSetAttributes(cfg: Config, url: str, attributes: Headers): ResultThe example for this item is shown with the ones above: aws-Services.salam
SqsDepth
func SqsDepth(cfg: Config, url: str): intThe example for this item is shown with the ones above: aws-Services.salam
SqsRedrivePolicy
func SqsRedrivePolicy(dead_letter_arn: str, max_receives: int): strThe example for this item is shown with the ones above: aws-Parse.salam
SqsQueueArn
func SqsQueueArn(cfg: Config, url: str): strThe example for this item is shown with the ones above: aws-Services.salam
AmzDate
func AmzDate(epoch_seconds: i64): str20130524T000000Z form.The example for this item is shown with the ones above: aws-Sign.salam
DateStamp
func DateStamp(amz_date: str): str20130524.The example for this item is shown with the ones above: aws-Sign.salam
Scope
func Scope(date_stamp: str, region: str, service: str): strThe example for this item is shown with the ones above: aws-Sign.salam
UriEncode
func UriEncode(s: str, keep_slash: bool): str/ is kept.The example for this item is shown with the ones above: aws-Sign.salam
EncodeKey
func EncodeKey(key: str): strThe example for this item is shown with the ones above: aws-Sign.salam
Sha256Bytes
func Sha256Bytes(ptr: void*, n: int): strThe example for this item is shown with the ones above: aws-Sign.salam
SignRequest
func SignRequest(cfg: Config, method: str, path: str, query: str, canonical_headers: str, signed_headers: str, payload_hash: str, epoch_seconds: i64): SignedThe example for this item is shown with the ones above: aws-Sign.salam
SignString
func SignString(cfg: Config, date_stamp: str, payload: str): strThe example for this item is shown with the ones above: aws-Sign.salam
SignQueryHeaders
func SignQueryHeaders(cfg: Config, method: str, path: str, query: str, canonical_headers: str, signed_headers: str, epoch_seconds: i64): strThe example for this item is shown with the ones above: aws-Sign.salam
SignQuery
func SignQuery(cfg: Config, method: str, path: str, query: str, host: str, epoch_seconds: i64): strThe example for this item is shown with the ones above: aws-Sign.salam
S3List
func S3List(cfg: Config, o: ListOptions): ObjectListThe example for this item is shown with the ones above: aws-Objects.salam
S3ListPrefix
func S3ListPrefix(cfg: Config, prefix: str): ObjectListtruncated or use S3ListAll.The example for this item is shown with the ones above: aws-Objects.salam
S3ListFolder
func S3ListFolder(cfg: Config, prefix: str): ObjectList/ delimiter.The example for this item is shown with the ones above: aws-Objects.salam
S3ListV1
func S3ListV1(cfg: Config, o: ListOptions, marker: str): ObjectListThe example for this item is shown with the ones above: aws-Objects.salam
S3ListAll
func S3ListAll(cfg: Config, prefix: str): ObjectListtruncated is set when it stopped there.The example for this item is shown with the ones above: aws-Objects.salam
S3ListAllWith
func S3ListAllWith(cfg: Config, o: ListOptions): ObjectListThe example for this item is shown with the ones above: aws-Objects.salam
S3ListVersions
func S3ListVersions(cfg: Config, o: ListOptions, key_marker: str, version_marker: str): ObjectListThe example for this item is shown with the ones above: aws-Objects.salam
S3Keys
func S3Keys(cfg: Config, prefix: str): KeyListThe example for this item is shown with the ones above: aws-Objects.salam
ListCount
func ListCount(l: ObjectList): intThe example for this item is shown with the ones above: aws-Parse.salam
ListAt
func ListAt(l: ObjectList, i: int): ObjectEntryThe example for this item is shown with the ones above: aws-Parse.salam
ListPrefixCount
func ListPrefixCount(l: ObjectList): intThe example for this item is shown with the ones above: aws-Parse.salam
ListPrefixAt
func ListPrefixAt(l: ObjectList, i: int): strThe example for this item is shown with the ones above: aws-Parse.salam
ListTotalSize
func ListTotalSize(l: ObjectList): i64The example for this item is shown with the ones above: aws-Parse.salam
ListFree
func ListFree(l &: ObjectList)The example for this item is shown with the ones above: aws-Parse.salam
KeyCount
func KeyCount(k: KeyList): intThe example for this item is shown with the ones above: aws-Parse.salam
KeyAt
func KeyAt(k: KeyList, i: int): strThe example for this item is shown with the ones above: aws-Parse.salam
NewKeyList
func NewKeyList(): KeyListThe example for this item is shown with the ones above: aws-Parse.salam
KeyPush
func KeyPush(k &: KeyList, key: str)The example for this item is shown with the ones above: aws-Parse.salam
KeyFree
func KeyFree(k &: KeyList)The example for this item is shown with the ones above: aws-Parse.salam
S3DeleteMany
func S3DeleteMany(cfg: Config, keys: KeyList): ResultThe example for this item is shown with the ones above: aws-Objects.salam
S3DeletePrefix
func S3DeletePrefix(cfg: Config, prefix: str): ResultThe example for this item is shown with the ones above: aws-Objects.salam
ListToResult
func ListToResult(l: ObjectList): ResultThe example for this item is shown with the ones above: aws-Parse.salam
ParseListing
func ParseListing(body: str, status: int): ObjectListThe example for this item is shown with the ones above: aws-Parse.salam
S3UploadFile
func S3UploadFile(cfg: Config, key: str, path: str, o: PutOptions): TransferResultThe example for this item is shown with the ones above: aws-Files.salam
S3UploadFileAs
func S3UploadFileAs(cfg: Config, key: str, path: str, content_type: str): TransferResultThe example for this item is shown with the ones above: aws-Files.salam
S3DownloadFile
func S3DownloadFile(cfg: Config, key: str, path: str): TransferResultThe example for this item is shown with the ones above: aws-Files.salam
S3UploadDir
func S3UploadDir(cfg: Config, dir: str, prefix: str, o: PutOptions): DirResultThe example for this item is shown with the ones above: aws-Files.salam
S3DownloadPrefix
func S3DownloadPrefix(cfg: Config, prefix: str, dir: str): DirResultThe example for this item is shown with the ones above: aws-Files.salam
S3FileEtag
func S3FileEtag(path: str, part_size: int): strThe example for this item is shown with the ones above: aws-Files.salam