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
impl ObjectstoreClient
Sourcepub fn create_bucket(&mut self, bucket: Bucket) -> Result<Bucket>
pub fn create_bucket(&mut self, bucket: Bucket) -> Result<Bucket>
Create an bucket.
bucket: Bucket to create.
Sourcepub fn get_bucket(&mut self, name: &str, namespace: &str) -> Result<Bucket>
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.
Sourcepub fn delete_bucket(
&mut self,
name: &str,
namespace: &str,
empty_bucket: bool,
) -> Result<()>
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.
Sourcepub fn update_bucket(&mut self, bucket: Bucket) -> Result<Bucket>
pub fn update_bucket(&mut self, bucket: Bucket) -> Result<Bucket>
Update an bucket.
bucket: Bucket to update.
Sourcepub fn list_buckets(
&mut self,
namespace: &str,
name_prefix: &str,
) -> Result<Vec<Bucket>>
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.
Sourcepub fn create_tenant(&mut self, tenant: Tenant) -> Result<Tenant>
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
Sourcepub fn get_tenant(&mut self, name: &str) -> Result<Tenant>
pub fn get_tenant(&mut self, name: &str) -> Result<Tenant>
Get the tenant.
name: The associated account id. Cannot be empty.
Sourcepub fn update_tenant(&mut self, tenant: Tenant) -> Result<Tenant>
pub fn update_tenant(&mut self, tenant: Tenant) -> Result<Tenant>
Updates Tenant details like default_bucket_size and alias.
tenant: Tenant to update
Sourcepub fn delete_tenant(&mut self, name: &str) -> Result<()>
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.