Ossify — Alibaba Cloud OSS SDK for Rust
A modern, complete, and reqwest-powered Rust SDK for Alibaba Cloud Object Storage Service (OSS). Ossify aims for parity with the official Python / Go v2 SDKs while keeping the API ergonomic and type-safe.
✨ Highlights
- 🎯 Full API surface — ~190 operations across every category listed in the official OSS operations index: bucket lifecycle, object CRUD, multipart upload, lifecycle, versioning, replication, inventory, logging, retention, access points, data indexing, DDoS protection, LiveChannel streaming, Resource Pool QoS, Vector Bucket (with ANN search), SelectObject SQL, and more.
- 🚀 reqwest-powered — built on
reqwest0.13 with full async/await, streaming uploads/downloads, andrustlsby default. - 🔐 V4 signing + flexible credentials — OSS V4 signature for both request signing and presigned URLs, with a default credentials chain covering explicit AK/SK, environment variables, and RRSA/OIDC for ACK.
- 🛡️ Type-safe — every API is one
struct+ one sub-trait; responses are strongly typed (deserialized from XML or JSON as required). - 🧱 Modular — one file per API under
src/ops/{bucket,object,service, vector_bucket}/<category>/, withOperationsaggregate supertraits for convenient blanket imports. - 🎨 Consistent ergonomics — request parameters use builder methods, path/query segments are escaped correctly, and single-byte delimiters or base64 SQL expressions are encoded for you.
🚀 Quick start
[]
= "0.4"
= { = "1", = ["full"] }
= "1"
Hello, OSS
use Bytes;
use Client;
use ;
async
📚 API coverage at a glance
Every entry below maps to one or more ready-to-call methods. Click through to the module to discover the exact parameter and response types.
Service-level (ossify::ops::service)
| Group | APIs |
|---|---|
| Regions & buckets | DescribeRegions, ListBuckets |
| User-level Anti-DDoS | InitUserAntiDDosInfo, UpdateUserAntiDDosInfo, GetUserAntiDDosInfo |
| User-level PublicAccessBlock | PutPublicAccessBlock, GetPublicAccessBlock, DeletePublicAccessBlock |
| Data redundancy | ListUserDataRedundancyTransition |
Resource Pool (resource_pool/) |
ListResourcePools, GetResourcePoolInfo, ListResourcePoolBuckets, Put/Get/List/Delete ResourcePoolRequesterQoSInfo, ListResourcePoolBucketGroups, Put/Get/List/Delete ResourcePoolBucketGroupQoSInfo |
Bucket-level (ossify::ops::bucket)
| Category | APIs |
|---|---|
base/ |
PutBucket, GetBucketInfo, GetBucketLocation, GetBucketStat, DeleteBucket, ListObjects (v2), ListObjectsV1, ListObjectVersions |
acl/ |
PutBucketACL, GetBucketACL |
access_monitor/ |
Put/Get |
access_point/ |
CreateAccessPoint, GetAccessPoint, DeleteAccessPoint, ListAccessPoints, Put/Get/Delete AccessPointPolicy |
object_fc_access_point/ |
Create/Get/Delete/ListAccessPointForObjectProcess, Put/Get/DeleteAccessPointConfigForObjectProcess, Put/Get/DeleteAccessPointPolicyForObjectProcess |
anti_ddos/ |
Init/Update/Get BucketAntiDDosInfo |
archive_direct_read/ |
Put/Get |
cname/ |
Create/Delete/List CnameToken, Put/Get BucketCnameToken |
cors/ |
Put/Get/Delete + GetBucketOptions (preflight) |
data_accelerator/ |
Put/Get/Delete |
data_indexing/ |
Open/Get/Close/DoMetaQuery |
encryption/ |
Put/Get/Delete |
https_config/ |
Put/Get |
inventory/ |
Put/Get/List/Delete |
lifecycle/ |
Put/Get/Delete |
live_channel/ |
Put/Put-status/Get-info/Get-stat/Get-history/List/Delete LiveChannel, Post/Get VodPlaylist |
logging/ |
Put/Get/Delete + CNAME variants |
policy/ |
Put/Get/Delete/GetPolicyStatus |
public_access_block/ |
Put/Get/Delete (+ access-point variants) |
qos/ + requester_qos/ |
Bucket-total QoS and per-requester QoS (Put/Get/List/Delete) |
redundancy_transition/ |
Create/Get/Delete/List BucketDataRedundancyTransition |
referer/ |
Put/Get |
replication/ |
Put/Get/Delete, ListReplicationLocation, ListReplicationRules, GetBucketReplicationProgress |
request_payment/ |
Put/Get |
resource_group/ + resource_pool_bucket_group/ |
Put/Get resource group; Put bucket→pool-group mapping |
retention/ |
InitiateBucketWorm, CompleteBucketWorm, AbortBucketWorm, ExtendBucketWormWorm, GetBucketWorm |
style/ |
Put/Get/List/Delete |
tagging/ |
Put/Get/Delete |
transfer_acceleration/ |
Put/Get |
versioning/ |
Put/Get + RestoreObject (bucket-scope) |
website/ |
Put/Get/Delete |
Object-level (ossify::ops::object)
| Category | APIs |
|---|---|
base/ |
PutObject (body / stream), GetObject (with Range, presigned URL), HeadObject, GetObjectMeta, CopyObject, DeleteObject, DeleteMultipleObjects, AppendObject, SealAppendObject, RestoreObject, CleanRestoredObject, PostObject (helpers) + Callback helpers |
acl/ |
PutObjectACL, GetObjectACL |
folder/ (HNS) |
CreateDirectory, Rename, DeleteDirectory |
multipart_upload/ |
InitiateMultipartUpload, UploadPart, UploadPartCopy, ListMultipartUploads, ListParts, CompleteMultipartUpload, AbortMultipartUpload |
select/ |
SelectObject (CSV & JSON, SQL → frame stream), CreateSelectCsvObjectMeta, CreateSelectJsonObjectMeta |
symbolic_link/ |
PutSymlink, GetSymlink |
tagging/ |
Put/Get/Delete |
Vector Bucket (ossify::ops::vector_bucket, JSON on oss-vectors.aliyuncs.com)
| Category | APIs |
|---|---|
bucket/ |
PutVectorBucket, GetVectorBucket, ListVectorBuckets, DeleteVectorBucket |
index/ |
PutVectorIndex, GetVectorIndex, ListVectorIndexes, DeleteVectorIndex |
vectors/ |
PutVectors, GetVectors, ListVectors, DeleteVectors, QueryVectors (top-K ANN with MongoDB-style filters) |
🧭 Usage guide by feature
Buckets and objects
use Bytes;
use Client;
use ;
use ;
use ;
# async
Multipart upload
use Bytes;
use Client;
use ;
# async #
Vector Bucket (ANN search)
Vector bucket APIs live on a dedicated {region}.oss-vectors.aliyuncs.com
endpoint family. Point a separate Client at that endpoint to use them:
use Client;
use ;
use ;
use Vector;
# async
SelectObject (SQL over CSV / JSON)
SelectObject returns a stream of frames — data, heartbeats, and a
terminal status frame that must be inspected for errors:
use StreamExt;
use Client;
use ;
# async
🔧 Configuration
Client builder
use Duration;
use ;
#
URL styles:
- VirtualHosted (default):
https://bucket.oss-cn-hangzhou.aliyuncs.com/object - Path:
https://oss-cn-hangzhou.aliyuncs.com/bucket/object - CName:
https://custom-domain.com/object
Credentials
Explicit AK/SK, STS token, RRSA (ACK OIDC), or the default chain — all
via the same Client::builder():
use Client;
use RrsaCredentialsProvider;
#
If neither access_key_id / access_key_secret nor an explicit
credentials_provider is supplied, the builder falls back to
DefaultCredentialsChain, which walks:
EnvironmentCredentialsProvider— readsALIBABA_CLOUD_ACCESS_KEY_ID/ALIBABA_CLOUD_ACCESS_KEY_SECRET(+ optionalALIBABA_CLOUD_SECURITY_TOKEN) or theOSS_*equivalents.RrsaCredentialsProvider::from_env— RRSA/OIDC if its env vars exist.
🌟 Advanced features
Presigned URLs
use ;
use ;
# async
Streaming uploads
put_object_stream / upload_part_stream accept any
futures::TryStream<Ok = bytes::Bytes> so large files and back-pressured
producers (e.g. channels, reqwest::Response::bytes_stream()) can be
forwarded without buffering into memory.
Error handling
use ;
use ;
# async
🏗️ Architecture
- One API = one file: every OSS operation lives in its own
src/ops/.../<operation>.rsexposing astruct, optionalParams/Options, a<Name>Opssub-trait, and a blanketimpl for Client. Categorymod.rsfiles aggregate sub-traits intoOperationssupertraits for convenient mass-imports. - Shared XML / JSON types live in
src/ops/common/. - Uniform request pipeline (
src/lib.rs): everyOpsdeclares aBody(NoneBody|ZeroBody|XMLBody<T>|JSONBody<T>|BytesBody|StreamBody<S>), aResponseprocessor (EmptyResponseProcessor|BodyResponseProcessor<T>|HeaderResponseProcessor<T>|BinaryResponseProcessor|StreamResponseProcessor), and aQuerytype that serialises to an alphabetically-sorted query string. - Signing: OSS V4 (
OSS4-HMAC-SHA256) used for both requestAuthorizationheaders and presigned URLs. - Single-endpoint client: one
Clientinstance targets one endpoint family. Vector Bucket uses a dedicatedoss-vectorsendpoint, so keep a separateClientfor vector operations.
Core dependencies
reqwest— HTTP withrustls-no-providerand streaming.tokio/futures— async runtime and stream primitives.serde+serde_jsonquick-xml— request/response encoding.jiff— timestamps and durations.bytes— zero-copy byte buffers.hmac+sha2+sha1+crc32fast— signing and SelectObject payload CRC.
📖 Documentation
🤝 Contributing
PRs are very welcome — please open an issue first for large changes.
Every API file should include unit tests for (a) query-parameter
serialisation and (b) XML/JSON round-tripping; cargo test --lib +
cargo clippy --lib --tests must both be clean.
📄 License
Licensed under either of
- Apache License 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
at your option.