add put
This commit is contained in:
19
src/main.rs
19
src/main.rs
@@ -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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user