This commit is contained in:
2019-11-28 00:51:05 +08:00
parent b0ec510880
commit 730b3b7728
3 changed files with 22 additions and 4 deletions

View File

@@ -1,19 +1,30 @@
pub mod oss_util;
use std::{
fs::File,
time::SystemTime,
};
use oss_util::{
OSS_VERB_GET,
OSSClient
};
use rust_util::{
XResult,
};
fn main() {
fn main() -> XResult<()> {
println!("Hello, world!");
println!("{}", SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs());
let oss_client = OSSClient::new("shanghai.aliyuncs.com", "aaa", "bbb");
let oss_client = OSSClient::new("oss-cn-shanghai.aliyuncs.com", "***", "***");
let oss_put_url = oss_client.generate_signed_put_url("hatterbucket", "abc_2.txt", 1000_u64);
println!("{}", oss_client.generate_signed_url(OSS_VERB_GET, "aaaa", "b.txt", 1_u64, true));
let client = reqwest::Client::new();
let f = File::open("README.md")?;
let resp = client.put(&oss_put_url)
.body(f)
.send()?;
println!("RESP: {:?}", resp);
Ok(())
}