1use std::time::Duration;
4
5use url::Url;
6
7pub use self::create_bucket::CreateBucket;
8pub use self::delete_bucket::DeleteBucket;
9pub use self::delete_object::DeleteObject;
10#[cfg(feature = "full")]
11pub use self::delete_objects::{DeleteObjects, ObjectIdentifier};
12pub use self::get_bucket_info::GetBucketInfo;
13pub use self::get_object::GetObject;
14pub use self::head_object::HeadObject;
15#[cfg(feature = "full")]
16#[doc(inline)]
17pub use self::list_objects_v2::{ListObjectsV2, ListObjectsV2Response};
18pub use self::multipart_upload::abort::AbortMultipartUpload;
19#[cfg(feature = "full")]
20pub use self::multipart_upload::complete::CompleteMultipartUpload;
21#[cfg(feature = "full")]
22pub use self::multipart_upload::create::{CreateMultipartUpload, CreateMultipartUploadResponse};
23#[cfg(feature = "full")]
24pub use self::multipart_upload::list_parts::{ListParts, ListPartsResponse};
25pub use self::multipart_upload::upload::UploadPart;
26pub use self::put_object::PutObject;
27use crate::{Map, Method};
28
29mod create_bucket;
30mod delete_bucket;
31mod delete_object;
32#[cfg(feature = "full")]
33mod delete_objects;
34mod get_bucket_info;
35mod get_object;
36mod head_object;
37#[cfg(feature = "full")]
38pub mod list_objects_v2;
39mod multipart_upload;
40mod put_object;
41
42use time::OffsetDateTime;
43
44pub trait OSSAction<'a> {
46 const METHOD: Method;
47
48 fn sign(&self, expires_in: Duration) -> Url {
50 let now = OffsetDateTime::now_utc();
51 self.sign_with_time(expires_in, &now)
52 }
53
54 fn query_mut(&mut self) -> &mut Map<'a>;
56
57 fn headers_mut(&mut self) -> &mut Map<'a>;
62
63 fn sign_with_time(&self, expires_in: Duration, time: &OffsetDateTime) -> Url;
66}