[][src]Struct s3handler::Handler

pub struct Handler<'a> {
    pub access_key: &'a str,
    pub secret_key: &'a str,
    pub host: &'a str,
    pub auth_type: AuthType,
    pub format: Format,
    pub url_style: UrlStyle,
    pub region: Option<String>,
    // some fields omitted
}

The struct for generate the request

  • host is a parameter for the server you want to link
    • it can be s3.us-east-1.amazonaws.com or a ip, ex 10.1.1.100, for a ceph node
  • auth_type specify the signature version of S3
  • format specify the s3 response from server
  • url_style specify the s3 request url style
  • region is a paramter for the S3 cluster location
    • if region is not specified, it will take default value us-east-1
  • handle redirect It can be init from the config structure, for example:
let config = s3handler::CredentialConfig{
    host: "s3.us-east-1.amazonaws.com".to_string(),
    access_key: "akey".to_string(),
    secret_key: "skey".to_string(),
    user: None,
    region: None, // default is us-east-1
    s3_type: None, // default will try to config as AWS S3 handler
    secure: None, // dafault is false, because the integrity protect by HMAC
};
let mut handler = s3handler::Handler::from(&config);

Fields

access_key: &'a strsecret_key: &'a strhost: &'a strauth_type: AuthTypeformat: Formaturl_style: UrlStyleregion: Option<String>

Methods

impl<'_> Handler<'_>[src]

pub fn la(&mut self) -> Result<Vec<S3Object>, Error>[src]

List all objects in a bucket

pub fn ls(&mut self, prefix: Option<&str>) -> Result<Vec<S3Object>, Error>[src]

List all bucket of an account or List all object of an bucket

pub fn put(&mut self, file: &str, dest: &str) -> Result<(), Error>[src]

Upload a file to a S3 bucket

pub fn get(&mut self, src: &str, file: Option<&str>) -> Result<(), Error>[src]

Download an object from S3 service

pub fn cat(&mut self, src: &str) -> Result<(), Error>[src]

Show an object's content, this method is use for quick check a small object on the fly

pub fn del_with_flag(
    &mut self,
    src: &str,
    headers: &mut Vec<(&str, &str)>
) -> Result<(), Error>
[src]

Delete with header flags for some deletion features

  • AWS - delete-marker
  • Bigtera - secure-delete

pub fn del(&mut self, src: &str) -> Result<(), Error>[src]

Delete an object

pub fn mb(&mut self, bucket: &str) -> Result<(), Error>[src]

Make a new bucket

pub fn rb(&mut self, bucket: &str) -> Result<(), Error>[src]

Remove a bucket

pub fn list_tag(&mut self, target: &str) -> Result<(), Error>[src]

list all tags of an object

pub fn add_tag(
    &mut self,
    target: &str,
    tags: &Vec<(&str, &str)>
) -> Result<(), Error>
[src]

Put a tag on an object

pub fn del_tag(&mut self, target: &str) -> Result<(), Error>[src]

Remove aa tag from an object

pub fn usage(
    &mut self,
    target: &str,
    options: &Vec<(&str, &str)>
) -> Result<(), Error>
[src]

Show the usage of a bucket (CEPH only)

pub fn url_command(&mut self, url: &str) -> Result<(), Error>[src]

Do a GET request for the specific URL This method is easily to show the configure of S3 not implemented

pub fn change_s3_type(&mut self, command: &str)[src]

Change S3 type to aws/ceph

pub fn change_auth_type(&mut self, command: &str)[src]

Change signature version to aws2/aws4 CEPH support aws2 and aws4 following AWS region support v2 signature before June 24, 2019

  • US East (N. Virginia) Region
  • US West (N. California) Region
  • US West (Oregon) Region
  • EU (Ireland) Region
  • Asia Pacific (Tokyo) Region
  • Asia Pacific (Singapore) Region
  • Asia Pacific (Sydney) Region
  • South America (So Paulo) Region

pub fn change_format_type(&mut self, command: &str)[src]

Change response format to xml/json CEPH support json and xml AWS only support xml

pub fn change_url_style(&mut self, command: &str)[src]

Change request url style

Trait Implementations

impl<'a> From<&'a CredentialConfig> for Handler<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Handler<'a>

impl<'a> !Send for Handler<'a>

impl<'a> !Sync for Handler<'a>

impl<'a> Unpin for Handler<'a>

impl<'a> !UnwindSafe for Handler<'a>

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, 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.

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

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