Struct b2_client::account::CreateKeyBuilder
source · [−]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
sourceimpl 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
sourceimpl Default for CreateKeyBuilder
impl Default for CreateKeyBuilder
sourcefn default() -> CreateKeyBuilder
fn default() -> CreateKeyBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for CreateKeyBuilder
impl Send for CreateKeyBuilder
impl Sync for CreateKeyBuilder
impl Unpin for CreateKeyBuilder
impl UnwindSafe for CreateKeyBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more