pub struct OssConfig {
pub access_key_id: String,
pub access_key_secret: String,
pub bucket_name: String,
pub bucket_location: BucketLocation,
pub path: String,
pub is_internal: bool,
}Fields§
§access_key_id: String§access_key_secret: String§bucket_name: String§bucket_location: BucketLocation§path: String§is_internal: boolImplementations§
source§impl OssConfig
impl OssConfig
pub fn from_env() -> Result<Self>
pub fn new( access_key_id: String, access_key_secret: String, bucket_name: String, bucket_location: String, path: String, is_internal: bool, ) -> Self
sourcepub fn generate_endpoint_url(
bucket_location: &str,
is_internal: bool,
) -> Result<Url>
pub fn generate_endpoint_url( bucket_location: &str, is_internal: bool, ) -> Result<Url>
§返回 endpoint 对应的链接地址
可以是内网地址,默认为外网地址
assert_eq!(OssConfig::generate_endpoint_url("oss-cn-hangzhou", true).unwrap(), Url::parse("https://oss-cn-hangzhou-internal.aliyuncs.com").unwrap());
assert_eq!(OssConfig::generate_endpoint_url("oss-cn-hangzhou", false).unwrap(), Url::parse("https://oss-cn-hangzhou.aliyuncs.com").unwrap());sourcepub fn generate_bucket_url(
backet_name: &str,
bucket_location: &str,
is_internal: bool,
) -> Result<Url>
pub fn generate_bucket_url( backet_name: &str, bucket_location: &str, is_internal: bool, ) -> Result<Url>
§返回 bucket 对应的链接地址
可以是内网地址,默认为外网地址
assert_eq!(OssConfig::generate_bucket_url("hello", "oss-cn-hangzhou", true).unwrap(), Url::parse("https://hello.oss-cn-hangzhou-internal.aliyuncs.com").unwrap());
assert_eq!(OssConfig::generate_bucket_url("hello", "oss-cn-hangzhou", false).unwrap(), Url::parse("https://hello.oss-cn-hangzhou.aliyuncs.com").unwrap());source§impl OssConfig
impl OssConfig
pub fn get_object_name<'a>(&self, object_name: &'a str) -> Cow<'a, str>
pub fn get_endpoint_url(&self) -> Result<Url>
pub fn get_endpoint_request(&self, method: Method) -> Result<Request>
pub fn get_bucket_url(&self) -> Result<Url>
pub fn get_bucket_request( &self, method: Method, body: Option<Bytes>, ) -> Result<Request>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OssConfig
impl RefUnwindSafe for OssConfig
impl Send for OssConfig
impl Sync for OssConfig
impl Unpin for OssConfig
impl UnwindSafe for OssConfig
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)