9 stable releases

1.2.2 Apr 12, 2024
1.2.1 Mar 29, 2024
1.2.0 Oct 24, 2023
1.1.0 Sep 28, 2023
1.0.1 Jun 26, 2023

#912 in Web programming

Download history 112/week @ 2024-02-17 30/week @ 2024-02-24 1/week @ 2024-03-02 1/week @ 2024-03-09 78/week @ 2024-03-23 48/week @ 2024-03-30 95/week @ 2024-04-06 42/week @ 2024-04-13

263 downloads per month

Apache-2.0

42KB
1K SLoC

OSS-Rust-SDK

Latest Version

Fork from https://github.com/NoXF/oss-rust-sdk

It's an unofficial Rust port for https://github.com/aliyun/aliyun-oss-cpp-sdk, just implement core APIs of https://help.aliyun.com/document_detail/31977.html, everyone is welcome to submit a PR to implement which interface you need.

Getting Started

Put Object

async fn main() -> Result<(), OSSError> {
    let buffer = "test async put object from buffer";
    dotenvy::dotenv().unwrap();

    let buffer = "test async put object from buffer";
    let key_id = env::var("OSS_AK").unwrap();
    let key_secret = env::var("OSS_SK").unwrap();
    let endpoint = env::var("ENDPOINT").unwrap();
    let bucket = env::var("BUCKET").unwrap();
    let oss = OSS::new(
        key_id,
        key_secret,
        endpoint,
        bucket,
    );
    let mut headers = HashMap::new();
    headers.insert("content-type", "text/plain");

    let mut oss_sub_resource: HashMap<&str, Option<&str>> = HashMap::new();
    oss_sub_resource.insert("acl", None);
    oss_sub_resource.insert("response-content-type", Some("ContentType"));

    oss_instance
        .put_object(
            buffer.as_bytes(),
            "test/put_object.txt",
            headers,
            oss_sub_resource,
        )
        .await?;

    Ok(())
}

Note: I've removed the blocking code for the repository. If you need it, please move here: NoXF/oss-rust-sdk

License

  • Apache License 2.0.

Dependencies

~10–23MB
~335K SLoC