CreateKeyBuilder

Struct 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§

Source§

impl CreateKeyBuilder

Source

pub fn name<S: Into<String>>(self, name: S) -> Result<Self, ValidationError>

Create a new builder, with the key’s name provided.

Source

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.

Source

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.

Source

pub fn limit_to_bucket<S: Into<String>>( self, id: S, ) -> Result<Self, ValidationError>

Limit the key’s access to the specified bucket.

Source

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.

Source

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

Create a new CreateKey.

Trait Implementations§

Source§

impl Default for CreateKeyBuilder

Source§

fn default() -> CreateKeyBuilder

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,