Struct backblaze_b2::raw::authorize::B2Authorization
[−]
[src]
pub struct B2Authorization<'a> { pub credentials: &'a B2Credentials, pub authorization_token: String, pub api_url: String, pub download_url: String, pub recommended_part_size: usize, pub absolute_minimum_part_size: usize, }
This struct contains the needed authorization to perform any b2 api call.
Fields
credentials: &'a B2Credentials
api_url: String
download_url: String
recommended_part_size: usize
absolute_minimum_part_size: usize
Methods
impl<'a> B2Authorization<'a>
[src]
fn auth_header(&self) -> B2AuthHeader
Returns a hyper header that correctly authorizes an api call to backblaze.
impl<'a> B2Authorization<'a>
[src]
fn list_buckets<InfoType>(
&self,
client: &Client
) -> Result<Vec<Bucket<InfoType>>, B2Error> where
InfoType: Deserialize<'de>,
&self,
client: &Client
) -> Result<Vec<Bucket<InfoType>>, B2Error> where
InfoType: Deserialize<'de>,
Performs a b2_list_buckets api call.
Errors
This function returns a B2Error
in case something goes wrong. This function is only
going to fail with the standard errors.
fn create_bucket<InfoType>(
&self,
bucket_name: &str,
bucket_type: BucketType,
bucket_info: InfoType,
lifecycle_rules: Vec<LifecycleRule>,
client: &Client
) -> Result<Bucket<InfoType>, B2Error> where
InfoType: Serialize + Deserialize<'de>,
&self,
bucket_name: &str,
bucket_type: BucketType,
bucket_info: InfoType,
lifecycle_rules: Vec<LifecycleRule>,
client: &Client
) -> Result<Bucket<InfoType>, B2Error> where
InfoType: Serialize + Deserialize<'de>,
Performs a b2_create_bucket api call.
Errors
This function returns a B2Error
in case something goes wrong. Besides the standard
errors, this function can fail with is_maximum_bucket_limit
,
is_duplicate_bucket_name
and is_invalid_bucket_name
.
fn create_bucket_no_info(
&self,
bucket_name: &str,
bucket_type: BucketType,
lifecycle_rules: Vec<LifecycleRule>,
client: &Client
) -> Result<Bucket<JsonValue>, B2Error>
&self,
bucket_name: &str,
bucket_type: BucketType,
lifecycle_rules: Vec<LifecycleRule>,
client: &Client
) -> Result<Bucket<JsonValue>, B2Error>
Performs a b2_create_bucket api call. This function initializes the bucket with no info.
Errors
This function returns a B2Error
in case something goes wrong. Besides the standard
errors, this function can fail with is_maximum_bucket_limit
,
is_duplicate_bucket_name
and is_invalid_bucket_name
.
fn delete_bucket_id<InfoType>(
&self,
bucket_id: &str,
client: &Client
) -> Result<Bucket<InfoType>, B2Error> where
InfoType: Deserialize<'de>,
&self,
bucket_id: &str,
client: &Client
) -> Result<Bucket<InfoType>, B2Error> where
InfoType: Deserialize<'de>,
Performs a b2_delete_bucket api call.
Errors
This function returns a B2Error
in case something goes wrong. Besides the standard
errors, this function can fail with is_bucket_not_found
.
fn delete_bucket<InfoType>(
&self,
bucket: &Bucket<InfoType>,
client: &Client
) -> Result<Bucket<InfoType>, B2Error> where
InfoType: Deserialize<'de>,
&self,
bucket: &Bucket<InfoType>,
client: &Client
) -> Result<Bucket<InfoType>, B2Error> where
InfoType: Deserialize<'de>,
Performs a b2_delete_bucket api call.
Errors
This function returns a B2Error
in case something goes wrong. Besides the standard
errors, this function can fail with is_bucket_not_found
.
impl<'a> B2Authorization<'a>
[src]
fn get_file_info<IT>(
&self,
file_id: &str,
client: &Client
) -> Result<MoreFileInfo<IT>, B2Error> where
IT: Deserialize<'de>,
&self,
file_id: &str,
client: &Client
) -> Result<MoreFileInfo<IT>, B2Error> where
IT: Deserialize<'de>,
Performs a b2_get_file_info api call.
fn list_file_names<IT>(
&self,
bucket_id: &str,
start_file_name: Option<&str>,
max_file_count: u32,
prefix: Option<&str>,
delimiter: Option<char>,
client: &Client
) -> Result<(FileNameListing<IT>, Option<String>), B2Error> where
IT: Deserialize<'de>,
&self,
bucket_id: &str,
start_file_name: Option<&str>,
max_file_count: u32,
prefix: Option<&str>,
delimiter: Option<char>,
client: &Client
) -> Result<(FileNameListing<IT>, Option<String>), B2Error> where
IT: Deserialize<'de>,
Performs a b2_list_file_names api call. This function returns at most max_file_count files.
In order to list all the files on b2, pass None as start_file_name on the first call to this function and to subsequent calls pass the Option returned by this function to the next call of this function, until that Option is None. This is also done by the convenience function list_all_file_names.
Filenames hidden by a hide marker are not returned.
fn list_all_file_names<IT>(
&self,
bucket_id: &str,
files_per_request: u32,
prefix: Option<&str>,
delimiter: Option<char>,
client: &Client
) -> Result<FileNameListing<IT>, B2Error> where
IT: Deserialize<'de>,
&self,
bucket_id: &str,
files_per_request: u32,
prefix: Option<&str>,
delimiter: Option<char>,
client: &Client
) -> Result<FileNameListing<IT>, B2Error> where
IT: Deserialize<'de>,
Uses the function list_file_names several times in order to download a list of all file names on b2.
Filenames hidden by a hide marker are not returned.
fn list_file_versions<IT>(
&self,
bucket_id: &str,
start_file_name: Option<&str>,
start_file_id: Option<&str>,
max_file_count: u32,
prefix: Option<&str>,
delimiter: Option<char>,
client: &Client
) -> Result<(FileVersionListing<IT>, Option<String>, Option<String>), B2Error> where
IT: Deserialize<'de>,
&self,
bucket_id: &str,
start_file_name: Option<&str>,
start_file_id: Option<&str>,
max_file_count: u32,
prefix: Option<&str>,
delimiter: Option<char>,
client: &Client
) -> Result<(FileVersionListing<IT>, Option<String>, Option<String>), B2Error> where
IT: Deserialize<'de>,
Performs a b2_list_file_versions api call. This function returns at most max_file_count files.
In order to list all the files on b2, pass None as start_file_name on the first call to this function and to subsequent calls pass the Option returned by this function to the next call of this function, until that Option is None. This is also done by the convenience function list_all_file_names.
fn list_all_file_versions<IT>(
&self,
bucket_id: &str,
files_per_request: u32,
prefix: Option<&str>,
delimiter: Option<char>,
client: &Client
) -> Result<FileVersionListing<IT>, B2Error> where
IT: Deserialize<'de>,
&self,
bucket_id: &str,
files_per_request: u32,
prefix: Option<&str>,
delimiter: Option<char>,
client: &Client
) -> Result<FileVersionListing<IT>, B2Error> where
IT: Deserialize<'de>,
Uses the function list_file_versions several times in order to download a list of all file versions on b2.
fn delete_file_version(
&self,
file_name: &str,
file_id: &str,
client: &Client
) -> Result<(), B2Error>
&self,
file_name: &str,
file_id: &str,
client: &Client
) -> Result<(), B2Error>
Performs a b2_delete_file_version api call.
This function also works on unfinished large files and hide markers.
fn hide_file(
&self,
file_name: &str,
bucket_id: &str,
client: &Client
) -> Result<HideMarkerInfo, B2Error>
&self,
file_name: &str,
bucket_id: &str,
client: &Client
) -> Result<HideMarkerInfo, B2Error>
Performs a b2_hide_file api call.
This function creates a hide marker with the given name.
impl<'a> B2Authorization<'a>
[src]
fn get_upload_url(
&self,
bucket_id: &str,
client: &Client
) -> Result<UploadAuthorization, B2Error>
&self,
bucket_id: &str,
client: &Client
) -> Result<UploadAuthorization, B2Error>
Performs a b2_get_upload_url api call.
impl<'a> B2Authorization<'a>
[src]
Use the authorization token in this B2Authorization as a download authorization. The DownloadAuthorization returned by this function can download any file on any bucket owned by this user.
Performs a b2_get_download_authorization api call. The DownloadAuthorization returned by this method can only download files from the specified bucket and with the specified prefix.
Errors
This function returns a B2Error
in case something goes wrong. Besides the standard
errors, this function can fail with is_bucket_not_found
.