pub struct CreateKeyBuilder { /* private fields */ }Expand description
A builder to create a CreateKey object.
After creating the CreateKey, pass it to create_key to obtain a new
application key.
See https://www.backblaze.com/b2/docs/b2_create_key.html for more information.
Implementations§
Source§impl CreateKeyBuilder
impl CreateKeyBuilder
Sourcepub fn name<S: Into<String>>(self, name: S) -> Result<Self, ValidationError>
pub fn name<S: Into<String>>(self, name: S) -> Result<Self, ValidationError>
Create a new builder, with the key’s name provided.
Sourcepub fn capabilities<V: Into<Vec<Capability>>>(
self,
caps: V,
) -> Result<Self, ValidationError>
pub fn capabilities<V: Into<Vec<Capability>>>( self, caps: V, ) -> Result<Self, ValidationError>
Create the key with the specified capabilities.
At least one capability must be provided.
Sourcepub fn expires_after(self, dur: Duration) -> Result<Self, ValidationError>
pub fn expires_after(self, dur: Duration) -> Result<Self, ValidationError>
Set an expiration duration for the key.
If provided, the key must be positive and no more than 1,000 days.
Sourcepub fn limit_to_bucket<S: Into<String>>(
self,
id: S,
) -> Result<Self, ValidationError>
pub fn limit_to_bucket<S: Into<String>>( self, id: S, ) -> Result<Self, ValidationError>
Limit the key’s access to the specified bucket.
Sourcepub fn name_prefix<S: Into<String>>(
self,
prefix: S,
) -> Result<Self, ValidationError>
pub fn name_prefix<S: Into<String>>( self, prefix: S, ) -> Result<Self, ValidationError>
Limit access to files to those that begin with the specified prefix.
Trait Implementations§
Source§impl Default for CreateKeyBuilder
impl Default for CreateKeyBuilder
Source§fn default() -> CreateKeyBuilder
fn default() -> CreateKeyBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CreateKeyBuilder
impl RefUnwindSafe for CreateKeyBuilder
impl Send for CreateKeyBuilder
impl Sync for CreateKeyBuilder
impl Unpin for CreateKeyBuilder
impl UnwindSafe for CreateKeyBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more