Bucket

Struct Bucket 

Source
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: Query

Implementations§

Source§

impl Bucket

Source

pub fn presign_get<S: AsRef<str>>( &self, path: S, expiry_secs: u32, ) -> Result<String>

Source

pub fn presign_put<S: AsRef<str>>( &self, path: S, expiry_secs: u32, custom_headers: Option<HeaderMap>, ) -> Result<String>

Source

pub async fn create( name: &str, region: Region, credentials: Credentials, config: BucketConfiguration, ) -> Result<CreateBucketResponse>

Source

pub async fn create_with_path_style( name: &str, region: Region, credentials: Credentials, config: BucketConfiguration, ) -> Result<CreateBucketResponse>

Source

pub async fn delete(&self) -> Result<u16>

Source

pub fn new( name: &str, region: Region, credentials: Credentials, ) -> Result<Bucket>

Source

pub fn new_public(name: &str, region: Region) -> Result<Bucket>

Source

pub fn new_with_path_style( name: &str, region: Region, credentials: Credentials, ) -> Result<Bucket>

Source

pub fn new_public_with_path_style(name: &str, region: Region) -> Result<Bucket>

Source

pub async fn get_object<S: AsRef<str>>(&self, path: S) -> Result<(Vec<u8>, u16)>

Source

pub async fn get_object_torrent<S: AsRef<str>>( &self, path: S, ) -> Result<(Vec<u8>, u16)>

Source

pub async fn get_object_range<S: AsRef<str>>( &self, path: S, start: u64, end: Option<u64>, ) -> Result<(Vec<u8>, u16)>

Source

pub async fn get_object_stream<T: Write + Send, S: AsRef<str>>( &self, path: S, writer: &mut T, ) -> Result<u16>

Source

pub async fn put_object_stream<R: AsyncRead + Unpin>( &self, reader: &mut R, s3_path: impl AsRef<str>, ) -> Result<u16>

Source

pub async fn location(&self) -> Result<(Region, u16)>

Source

pub async fn delete_object<S: AsRef<str>>( &self, path: S, ) -> Result<(Vec<u8>, u16)>

Source

pub async fn head_object<S: AsRef<str>>( &self, path: S, ) -> Result<(HeadObjectResult, u16)>

Source

pub async fn put_object_with_content_type<S: AsRef<str>>( &self, path: S, content: &[u8], content_type: &str, ) -> Result<(Vec<u8>, u16)>

Source

pub async fn put_object<S: AsRef<str>>( &self, path: S, content: &[u8], ) -> Result<(Vec<u8>, u16)>

Source

pub async fn put_object_tagging<S: AsRef<str>>( &self, path: &str, tags: &[(S, S)], ) -> Result<(Vec<u8>, u16)>

Source

pub async fn delete_object_tagging<S: AsRef<str>>( &self, path: S, ) -> Result<(Vec<u8>, u16)>

Source

pub async fn get_object_tagging<S: AsRef<str>>( &self, path: S, ) -> Result<(Vec<Tag>, u16)>

Source

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)>

Source

pub async fn list( &self, prefix: String, delimiter: Option<String>, ) -> Result<Vec<ListBucketResult>>

Source

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)>

Source

pub async fn list_multiparts_uploads( &self, prefix: Option<&str>, delimiter: Option<&str>, ) -> Result<Vec<ListMultipartUploadsResult>>

Source

pub async fn abort_upload(&self, key: &str, upload_id: &str) -> Result<()>

Source

pub fn is_path_style(&self) -> bool

Get path_style field of the Bucket struct

Source

pub fn is_subdomain_style(&self) -> bool

Source

pub fn set_path_style(&mut self)

Configure bucket to use path-style urls and headers

Source

pub fn set_subdomain_style(&mut self)

Configure bucket to use subdomain style urls and headers [default]

Source

pub fn name(&self) -> String

Get a reference to the name of the S3 bucket.

Source

pub fn host(&self) -> String

Source

pub fn url(&self) -> String

Source

pub fn path_style_host(&self) -> String

Get a paths-style reference to the hostname of the S3 API endpoint.

Source

pub fn subdomain_style_host(&self) -> String

Source

pub fn scheme(&self) -> String

Source

pub fn region(&self) -> Region

Get the region this object will connect to.

Source

pub fn access_key(&self) -> Option<String>

Get a reference to the AWS access key.

Source

pub fn secret_key(&self) -> Option<String>

Get a reference to the AWS secret key.

Source

pub fn security_token(&self) -> Option<&str>

Get a reference to the AWS security token.

Source

pub fn session_token(&self) -> Option<&str>

Get a reference to the AWS session token.

Source

pub fn credentials(&self) -> &Credentials

Get a reference to the full Credentials object used by this Bucket.

Source

pub fn set_credentials(&mut self, credentials: Credentials) -> Credentials

Change the credentials used by the Bucket, returning the existing credentials.

Source

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
Source

pub fn extra_headers(&self) -> &HeaderMap

Get a reference to the extra headers to be passed to the S3 API.

Source

pub fn extra_headers_mut(&mut self) -> &mut HeaderMap

Get a mutable reference to the extra headers to be passed to the S3 API.

Source

pub fn add_query(&mut self, key: &str, value: &str)

Add an extra query pair to the URL used for S3 API access.

Source

pub fn extra_query(&self) -> &Query

Get a reference to the extra query pairs to be passed to the S3 API.

Source

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§

Source§

impl Clone for Bucket

Source§

fn clone(&self) -> Bucket

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Bucket

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Bucket

Source§

fn eq(&self, other: &Bucket) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Bucket

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,