Struct ObjectstoreClient

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

ObjectstoreClient manages ObjectScale resources on ObjectStore with the ObjectScale ObjectStore REST APIs.

§Examples

use objectscale_client::client::ManagementClient;
use objectscale_client::iam::AccountBuilder;
use objectscale_client::tenant::TenantBuilder;

fn main() {
    let endpoint = "https://192.168.1.1:443";
    let username = "admin";
    let password = "pass";
    let insecure = false;
    let objectstore_endpoint = "https://192.168.1.2:4443";
    let account_alias = "test";
    let mut management_client = ManagementClient::new(endpoint, username, password, insecure).expect("management client");
    let mut objectstore_client = management_client.new_objectstore_client(objectstore_endpoint).expect("objectstore client");
    let account = AccountBuilder::default().alias(account_alias).build().expect("build account");
    let account = management_client.create_account(account).expect("create account");
    let tenant_alias = "test";
    let tenant = TenantBuilder::default().alias(tenant_alias).id(&account.account_id).build().expect("build tenant");
    let tenant = objectstore_client.create_tenant(tenant).expect("create tenant");
    println!("Created tenant: {:?}", tenant);
}

Implementations§

Source§

impl ObjectstoreClient

Source

pub fn create_bucket(&mut self, bucket: Bucket) -> Result<Bucket>

Create an bucket.

bucket: Bucket to create.

Source

pub fn get_bucket(&mut self, name: &str, namespace: &str) -> Result<Bucket>

Gets bucket information for the specified bucket.

name: Bucket name for which information will be retrieved. Cannot be empty. namespace: Namespace associated. Cannot be empty.

Source

pub fn delete_bucket( &mut self, name: &str, namespace: &str, empty_bucket: bool, ) -> Result<()>

Deletes the specified bucket.

name: Bucket name to be deleted. Cannot be empty. namespace: Namespace associated. Cannot be empty. emptyBucket: If true, the contents of the bucket will be emptied as part of the delete, otherwise it will fail if the bucket is not empty.

Source

pub fn update_bucket(&mut self, bucket: Bucket) -> Result<Bucket>

Update an bucket.

bucket: Bucket to update.

Source

pub fn list_buckets( &mut self, namespace: &str, name_prefix: &str, ) -> Result<Vec<Bucket>>

Gets the list of buckets for the specified namespace.

namespace: Namespace for which buckets should be listed. Cannot be empty. name_prefix: Case sensitive prefix of the Bucket name with a wild card(). Can be empty or any_prefix_string.

Source

pub fn create_tenant(&mut self, tenant: Tenant) -> Result<Tenant>

Creates the tenant which will associate an IAM Account within an objectstore.

tenant: Tenant to create

Source

pub fn get_tenant(&mut self, name: &str) -> Result<Tenant>

Get the tenant.

name: The associated account id. Cannot be empty.

Source

pub fn update_tenant(&mut self, tenant: Tenant) -> Result<Tenant>

Updates Tenant details like default_bucket_size and alias.

tenant: Tenant to update

Source

pub fn delete_tenant(&mut self, name: &str) -> Result<()>

Delete the tenant from an object store. Tenant must not own any buckets.

name: The associated account id. Cannot be empty.

Source

pub fn list_tenants(&mut self, name_prefix: &str) -> Result<Vec<Tenant>>

Get the list of tenants.

name_prefix: Case sensitive prefix of the tenant name with a wild card(). Can be empty or any_prefix_string.

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,