pub struct Bucket {
pub name: String,
pub region: Region,
pub credentials: Credentials,
pub extra_headers: HeaderMap,
pub extra_query: Query,
/* private fields */
}Fields§
§name: String§region: Region§credentials: Credentials§extra_headers: HeaderMap§extra_query: QueryImplementations§
Source§impl Bucket
impl Bucket
pub fn presign_get<S: AsRef<str>>( &self, path: S, expiry_secs: u32, ) -> Result<String>
pub fn presign_put<S: AsRef<str>>( &self, path: S, expiry_secs: u32, custom_headers: Option<HeaderMap>, ) -> Result<String>
pub async fn create( name: &str, region: Region, credentials: Credentials, config: BucketConfiguration, ) -> Result<CreateBucketResponse>
pub async fn create_with_path_style( name: &str, region: Region, credentials: Credentials, config: BucketConfiguration, ) -> Result<CreateBucketResponse>
pub async fn delete(&self) -> Result<u16>
pub fn new( name: &str, region: Region, credentials: Credentials, ) -> Result<Bucket>
pub fn new_public(name: &str, region: Region) -> Result<Bucket>
pub fn new_with_path_style( name: &str, region: Region, credentials: Credentials, ) -> Result<Bucket>
pub fn new_public_with_path_style(name: &str, region: Region) -> Result<Bucket>
pub async fn get_object<S: AsRef<str>>(&self, path: S) -> Result<(Vec<u8>, u16)>
pub async fn get_object_torrent<S: AsRef<str>>( &self, path: S, ) -> Result<(Vec<u8>, u16)>
pub async fn get_object_range<S: AsRef<str>>( &self, path: S, start: u64, end: Option<u64>, ) -> Result<(Vec<u8>, u16)>
pub async fn get_object_stream<T: Write + Send, S: AsRef<str>>( &self, path: S, writer: &mut T, ) -> Result<u16>
pub async fn put_object_stream<R: AsyncRead + Unpin>( &self, reader: &mut R, s3_path: impl AsRef<str>, ) -> Result<u16>
pub async fn location(&self) -> Result<(Region, u16)>
pub async fn delete_object<S: AsRef<str>>( &self, path: S, ) -> Result<(Vec<u8>, u16)>
pub async fn head_object<S: AsRef<str>>( &self, path: S, ) -> Result<(HeadObjectResult, u16)>
pub async fn put_object_with_content_type<S: AsRef<str>>( &self, path: S, content: &[u8], content_type: &str, ) -> Result<(Vec<u8>, u16)>
pub async fn put_object<S: AsRef<str>>( &self, path: S, content: &[u8], ) -> Result<(Vec<u8>, u16)>
pub async fn put_object_tagging<S: AsRef<str>>( &self, path: &str, tags: &[(S, S)], ) -> Result<(Vec<u8>, u16)>
pub async fn delete_object_tagging<S: AsRef<str>>( &self, path: S, ) -> Result<(Vec<u8>, u16)>
pub async fn get_object_tagging<S: AsRef<str>>( &self, path: S, ) -> Result<(Vec<Tag>, u16)>
pub async fn list_page( &self, prefix: String, delimiter: Option<String>, continuation_token: Option<String>, start_after: Option<String>, max_keys: Option<usize>, ) -> Result<(ListBucketResult, u16)>
pub async fn list( &self, prefix: String, delimiter: Option<String>, ) -> Result<Vec<ListBucketResult>>
pub async fn list_multiparts_uploads_page( &self, prefix: Option<&str>, delimiter: Option<&str>, key_marker: Option<String>, max_uploads: Option<usize>, ) -> Result<(ListMultipartUploadsResult, u16)>
pub async fn list_multiparts_uploads( &self, prefix: Option<&str>, delimiter: Option<&str>, ) -> Result<Vec<ListMultipartUploadsResult>>
pub async fn abort_upload(&self, key: &str, upload_id: &str) -> Result<()>
Sourcepub fn is_path_style(&self) -> bool
pub fn is_path_style(&self) -> bool
Get path_style field of the Bucket struct
pub fn is_subdomain_style(&self) -> bool
Sourcepub fn set_path_style(&mut self)
pub fn set_path_style(&mut self)
Configure bucket to use path-style urls and headers
Sourcepub fn set_subdomain_style(&mut self)
pub fn set_subdomain_style(&mut self)
Configure bucket to use subdomain style urls and headers [default]
pub fn host(&self) -> String
pub fn url(&self) -> String
Sourcepub fn path_style_host(&self) -> String
pub fn path_style_host(&self) -> String
Get a paths-style reference to the hostname of the S3 API endpoint.
pub fn subdomain_style_host(&self) -> String
pub fn scheme(&self) -> String
Sourcepub fn access_key(&self) -> Option<String>
pub fn access_key(&self) -> Option<String>
Get a reference to the AWS access key.
Sourcepub fn secret_key(&self) -> Option<String>
pub fn secret_key(&self) -> Option<String>
Get a reference to the AWS secret key.
Sourcepub fn security_token(&self) -> Option<&str>
pub fn security_token(&self) -> Option<&str>
Get a reference to the AWS security token.
Sourcepub fn session_token(&self) -> Option<&str>
pub fn session_token(&self) -> Option<&str>
Get a reference to the AWS session token.
Sourcepub fn credentials(&self) -> &Credentials
pub fn credentials(&self) -> &Credentials
Get a reference to the full Credentials
object used by this Bucket.
Sourcepub fn set_credentials(&mut self, credentials: Credentials) -> Credentials
pub fn set_credentials(&mut self, credentials: Credentials) -> Credentials
Change the credentials used by the Bucket, returning the existing credentials.
Sourcepub fn add_header(&mut self, key: &str, value: &str)
pub fn add_header(&mut self, key: &str, value: &str)
Add an extra header to send with requests to S3.
Add an extra header to send with requests. Note that the library already sets a number of headers - headers set with this method will be overridden by the library headers:
- Host
- Content-Type
- Date
- Content-Length
- Authorization
- X-Amz-Content-Sha256
- X-Amz-Date
Sourcepub fn extra_headers(&self) -> &HeaderMap
pub fn extra_headers(&self) -> &HeaderMap
Get a reference to the extra headers to be passed to the S3 API.
Sourcepub fn extra_headers_mut(&mut self) -> &mut HeaderMap
pub fn extra_headers_mut(&mut self) -> &mut HeaderMap
Get a mutable reference to the extra headers to be passed to the S3 API.
Sourcepub fn add_query(&mut self, key: &str, value: &str)
pub fn add_query(&mut self, key: &str, value: &str)
Add an extra query pair to the URL used for S3 API access.
Sourcepub fn extra_query(&self) -> &Query
pub fn extra_query(&self) -> &Query
Get a reference to the extra query pairs to be passed to the S3 API.
Sourcepub fn extra_query_mut(&mut self) -> &mut Query
pub fn extra_query_mut(&mut self) -> &mut Query
Get a mutable reference to the extra query pairs to be passed to the S3 API.
Trait Implementations§
impl Eq for Bucket
impl StructuralPartialEq for Bucket
Auto Trait Implementations§
impl Freeze for Bucket
impl RefUnwindSafe for Bucket
impl Send for Bucket
impl Sync for Bucket
impl Unpin for Bucket
impl UnwindSafe for Bucket
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.