CreateBucketBuilder

Struct CreateBucketBuilder 

Source
pub struct CreateBucketBuilder { /* private fields */ }
Expand description

A builder for a CreateBucket.

After creating the request, pass it to create_bucket.

See https://www.backblaze.com/b2/docs/b2_create_bucket.html for further information.

Implementations§

Source§

impl CreateBucketBuilder

Source

pub fn name( self, name: impl Into<String>, ) -> Result<Self, BucketValidationError>

Create the bucket with the specified name.

Bucket names:

  • must be globally unique
  • cmust be ontain only ASCII alphanumeric text and -
  • must be between 6 and 50 characters inclusive
  • must not begin with b2-
Source

pub fn bucket_type(self, typ: BucketType) -> Result<Self, ValidationError>

Create the bucket with the given BucketType.

Source

pub fn bucket_info(self, info: Value) -> Result<Self, ValidationError>

Use the provided information with the bucket.

This can contain arbitrary metadata for your own use. You can also set cache-control settings from here (but see cache_control). If Cache-Control is set here and via the cache-control method, the latter will override this value.

Source

pub fn cache_control(self, cache_control: CacheControl) -> Self

Set the default Cache-Control header value for files downloaded from the bucket.

Source

pub fn cors_rules( self, rules: impl Into<Vec<CorsRule>>, ) -> Result<Self, ValidationError>

Use the provided CORS rules for the bucket.

See https://www.backblaze.com/b2/docs/cors_rules.html for further information.

Source

pub fn with_file_lock(self) -> Self

Enable the file lock on the bucket.

See https://www.backblaze.com/b2/docs/file_lock.html for further information.

Source

pub fn without_file_lock(self) -> Self

Disable the file lock on the bucket.

This is the default.

Source

pub fn lifecycle_rules( self, rules: impl Into<Vec<LifecycleRule>>, ) -> Result<Self, LifecycleRuleValidationError>

Use the provided list of LifecycleRules for the bucket.

No file within a bucket can be subject to multiple lifecycle rules. If any of the rules provided apply to multiple files or folders, we return a LifecycleRuleValidationError::ConflictingRules with a list of the conflicts.

The empty string ("") matches all paths, so if provided it must be the only lifecycle rule. If it is provided along with other rules, all of those rules will be listed as a conflict.

§Examples

For the following input:

[
    "Docs/Photos/",
    "Legal/",
    "Legal/Taxes/",
    "Archive/",
    "Archive/Temporary/",
]

You will receive the error output:

{
    "Legal/": [ "Legal/Taxes/" ],
    "Archive/": [ "Archive/Temporary/" ],
}

For the following input:

[
    "Docs/Photos/",
    "Docs/",
    "Docs/Documents/",
    "Legal/Taxes/",
    "Docs/Photos/Vacations/",
    "Archive/",
]

You will receive the error output (note the redundant listing):

{
    "Docs/": [
        "Docs/Documents/",
        "Docs/Photos/",
        "Docs/Photos/Vacations/",
    ],
    "Docs/Photos/": [ "Docs/Photos/Vacations/" ],
}
Source

pub fn encryption_settings(self, settings: ServerSideEncryption) -> Self

Use the provided encryption settings on the bucket.

Source

pub fn build<'a>(self) -> Result<CreateBucket<'a>, ValidationError>

Create a CreateBucket.

Trait Implementations§

Source§

impl Default for CreateBucketBuilder

Source§

fn default() -> CreateBucketBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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> ErasedDestructor for T
where T: 'static,