upload_data/
upload_data.rs1use qiniu_upload_rs::upload::data_uploader::DataUploader;
2use qiniu_upload_rs::utils::auth::Auth;
3
4const ACCESS_KEY: &str = "test-access-key";
5const SECRET_KEY: &str = "test-secret-key";
6
7const BUCKET: &str = "test-bucket";
8const KEY: &str = "test-key.txt";
9const DATA: &str = "hello";
10
11const EXPIRED_SECONDS: u64 = 3600;
12
13fn main() {
14 println!("Starts to upload simple data for an example");
15
16 let auth = Auth {
17 access_key: ACCESS_KEY.to_string(),
18 secret_key: SECRET_KEY.to_string(),
19 };
20 let uploader = DataUploader::new(auth);
21 uploader
22 .upload(BUCKET, KEY, EXPIRED_SECONDS, &DATA.as_bytes())
23 .unwrap();
24
25 println!("Finishes data upload");
26}