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
impl CreateBucketBuilder
Sourcepub fn name(
self,
name: impl Into<String>,
) -> Result<Self, BucketValidationError>
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-
Sourcepub fn bucket_type(self, typ: BucketType) -> Result<Self, ValidationError>
pub fn bucket_type(self, typ: BucketType) -> Result<Self, ValidationError>
Create the bucket with the given BucketType.
Sourcepub fn bucket_info(self, info: Value) -> Result<Self, ValidationError>
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.
Sourcepub fn cache_control(self, cache_control: CacheControl) -> Self
pub fn cache_control(self, cache_control: CacheControl) -> Self
Set the default Cache-Control header value for files downloaded from the bucket.
Sourcepub fn cors_rules(
self,
rules: impl Into<Vec<CorsRule>>,
) -> Result<Self, ValidationError>
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.
Sourcepub fn with_file_lock(self) -> Self
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.
Sourcepub fn without_file_lock(self) -> Self
pub fn without_file_lock(self) -> Self
Disable the file lock on the bucket.
This is the default.
Sourcepub fn lifecycle_rules(
self,
rules: impl Into<Vec<LifecycleRule>>,
) -> Result<Self, LifecycleRuleValidationError>
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/" ],
}Sourcepub fn encryption_settings(self, settings: ServerSideEncryption) -> Self
pub fn encryption_settings(self, settings: ServerSideEncryption) -> Self
Use the provided encryption settings on the bucket.
Sourcepub fn build<'a>(self) -> Result<CreateBucket<'a>, ValidationError>
pub fn build<'a>(self) -> Result<CreateBucket<'a>, ValidationError>
Create a CreateBucket.