[][src]Struct rusty_s3::Bucket

pub struct Bucket { /* fields omitted */ }

An S3 bucket

Path style url

let endpoint = "https://s3-eu-west-1.amazonaws.com".parse().expect("endpoint is a valid Url");
let path_style = true;
let name = String::from("rusty-s3");
let region = String::from("eu-west-1");

let bucket = Bucket::new(endpoint, path_style, name, region).expect("Url has a valid scheme and host");
assert_eq!(bucket.base_url().as_str(), "https://s3-eu-west-1.amazonaws.com/rusty-s3/");
assert_eq!(bucket.name(), "rusty-s3");
assert_eq!(bucket.region(), "eu-west-1");
assert_eq!(bucket.object_url("duck.jpg").expect("url is valid").as_str(), "https://s3-eu-west-1.amazonaws.com/rusty-s3/duck.jpg");

Domain style url

let endpoint = "https://s3-eu-west-1.amazonaws.com".parse().expect("endpoint is a valid Url");
let path_style = false;
let name = String::from("rusty-s3");
let region = String::from("eu-west-1");

let bucket = Bucket::new(endpoint, path_style, name, region).expect("Url has a valid scheme and host");
assert_eq!(bucket.base_url().as_str(), "https://rusty-s3.s3-eu-west-1.amazonaws.com/");
assert_eq!(bucket.name(), "rusty-s3");
assert_eq!(bucket.region(), "eu-west-1");
assert_eq!(bucket.object_url("duck.jpg").expect("url is valid").as_str(), "https://rusty-s3.s3-eu-west-1.amazonaws.com/duck.jpg");

Implementations

impl Bucket[src]

pub fn new(
    endpoint: Url,
    path_style: bool,
    name: String,
    region: String
) -> Option<Self>
[src]

Construct a new S3 bucket

pub fn base_url(&self) -> &Url[src]

Get the base url of this s3 Bucket

pub fn name(&self) -> &str[src]

Get the name of this Bucket

pub fn region(&self) -> &str[src]

Get the region of this Bucket

pub fn object_url(&self, object: &str) -> Result<Url, ParseError>[src]

Generate an url to an object of this Bucket

This is not a signed url, it's just the starting point for generating an url to an S3 object.

impl Bucket[src]

pub fn create_bucket<'a>(
    &'a self,
    credentials: &'a Credentials
) -> CreateBucket<'a>
[src]

Create a new bucket.

See CreateBucket for more details.

impl Bucket[src]

pub fn get_object<'a>(
    &'a self,
    credentials: Option<&'a Credentials>,
    object: &'a str
) -> GetObject<'a>
[src]

Retrieve an object from S3, using a GET request.

See GetObject for more details.

pub fn list_objects_v2<'a>(
    &'a self,
    credentials: Option<&'a Credentials>
) -> ListObjectsV2<'a>
[src]

List all objects in the bucket.

See ListObjectsV2 for more details.

pub fn put_object<'a>(
    &'a self,
    credentials: Option<&'a Credentials>,
    object: &'a str
) -> PutObject<'a>
[src]

Upload a file to S3, using a PUT request.

See PutObject for more details.

pub fn delete_object<'a>(
    &'a self,
    credentials: Option<&'a Credentials>,
    object: &'a str
) -> DeleteObject<'a>
[src]

Delete an object from S3, using a DELETE request.

See DeleteObject for more details.

impl Bucket[src]

pub fn create_multipart_upload<'a>(
    &'a self,
    credentials: Option<&'a Credentials>,
    object: &'a str
) -> CreateMultipartUpload<'a>
[src]

Create a multipart upload.

See CreateMultipartUpload for more details.

pub fn upload_part<'a>(
    &'a self,
    credentials: Option<&'a Credentials>,
    object: &'a str,
    part_number: u16,
    upload_id: &'a str
) -> UploadPart<'a>
[src]

Upload a part to a previously created multipart upload.

See UploadPart for more details.

pub fn complete_multipart_upload<'a, I>(
    &'a self,
    credentials: Option<&'a Credentials>,
    object: &'a str,
    upload_id: &'a str,
    etags: I
) -> CompleteMultipartUpload<'a, I>
[src]

Complete a multipart upload.

See CompleteMultipartUpload for more details.

pub fn abort_multipart_upload<'a>(
    &'a self,
    credentials: Option<&'a Credentials>,
    object: &'a str,
    upload_id: &'a str
) -> AbortMultipartUpload<'a>
[src]

Abort multipart upload.

See AbortMultipartUpload for more details.

Trait Implementations

impl Clone for Bucket[src]

impl Debug for Bucket[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.