pub struct Config {
pub secret_id: String,
pub secret_key: String,
pub region: String,
pub bucket: String,
pub timeout: Duration,
pub use_https: bool,
pub domain: Option<String>,
pub app_id: Option<String>,
}
Expand description
COS 客户端配置
Fields§
§secret_id: String
腾讯云 SecretId
secret_key: String
腾讯云 SecretKey
region: String
地域
bucket: String
存储桶名称
timeout: Duration
请求超时时间
use_https: bool
是否使用 HTTPS
domain: Option<String>
自定义域名
app_id: Option<String>
应用 ID(从存储桶名称中提取)
Implementations§
Source§impl Config
impl Config
Sourcepub fn new<S: Into<String>>(
secret_id: S,
secret_key: S,
region: S,
bucket: S,
) -> Self
pub fn new<S: Into<String>>( secret_id: S, secret_key: S, region: S, bucket: S, ) -> Self
创建新的配置
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
设置请求超时时间
Sourcepub fn with_https(self, use_https: bool) -> Self
pub fn with_https(self, use_https: bool) -> Self
设置是否使用 HTTPS
Sourcepub fn with_domain<S: Into<String>>(self, domain: S) -> Self
pub fn with_domain<S: Into<String>>(self, domain: S) -> Self
设置自定义域名
Sourcepub fn bucket_url(&self) -> Result<String>
pub fn bucket_url(&self) -> Result<String>
获取存储桶的完整 URL
Sourcepub fn service_url(&self) -> String
pub fn service_url(&self) -> String
获取服务 URL(用于获取存储桶列表等操作)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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