Alibaba Cloud OSS native protocol client for MoonBit
Dependencies
test "V4 的两条出口都由注入的时刻决定:Authorization 串与预签名查询串" {
let credentials = @ossauth.Credentials::new("ak-example", "sk-example")
let request = @ossauth.RequestToSign::{
verb: "GET",
canonical_uri: "/demo-bucket/note.txt",
query: [("acl", "")],
headers: [("x-oss-date", "20261018T064124Z")],
}
let signed = credentials.sign_at("cn-zhangjiakou", 1792305684000L, request)
assert_eq(signed.scope, "20261018/cn-zhangjiakou/oss/aliyun_v4_request")
assert_true(signed.authorization.has_prefix(
"OSS4-HMAC-SHA256 Credential=ak-example/20261018/cn-zhangjiakou/oss/aliyun_v4_request",
))
let presigned = credentials.presign_at(
"cn-zhangjiakou",
"20261018T064124Z",
600L,
request,
)
assert_true(presigned.query.contains("x-oss-signature="))
let config = @ossconfig.Config::new(
"https://oss-cn-zhangjiakou.aliyuncs.com",
"cn-zhangjiakou",
credentials,
)
assert_eq(config.host_of("demo-bucket"), "demo-bucket.oss-cn-zhangjiakou.aliyuncs.com")
assert_eq(config.canonical_uri_of("demo-bucket", key="note.txt"), "/demo-bucket/note.txt")
let _client = @sdk.Client::new(config, @transport.AsyncHttpTransport::new())
}| 要的那一格 | 本 SDK 的件 | 状态 |
|---|---|---|
| 上传 / 下载 / 删除 / 存在 | put_object get_object delete_object stat_object | 已实现 |
| 用户元数据读写 | metadata~(x-oss-meta-*,写了能读回) | 已实现 |
| 单层列举 | list_objects(前缀/分隔符/续页) | 已实现 |
| 手动分片五步 | create_multipart_upload upload_part list_parts complete_multipart_upload abort_multipart_upload | 已实现 |
| 预签名 GET 与 PUT | presigned_get_url presigned_put_url | 已实现 |
| 同平台复制 | copy_object(移动=复制+delete_object) | 已实现 |
| 对象 ACL 读写 | put_object_acl get_object_acl | 已实现 |
| 服务级列桶 | list_buckets | 已实现 |
| 大文件"一条式"上传(自动切分片) | 无对应件,分片由调用侧按五步走 | 待开发 |
| 上传进度回调 | 无对应件 | 待开发 |
| STS 临时凭据(x-oss-security-token) | 无对应件,Credentials 只有永久密钥两把 | 待开发 |
| 桶族(建/删/配置) | 无对应件 | 不适用 |
Install
Download zipAlibaba Cloud OSS native protocol client for MoonBit
Dependencies