Struct ManagementClient

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

ManagementClient manages ObjectScale resources with the ObjectScale management REST APIs.

§Examples

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

fn main() {
    let endpoint = "https://192.168.1.1:443";
    let username = "admin";
    let password = "pass";
    let insecure = false;
    let account_alias = "test";
    let mut client = ManagementClient::new(endpoint, username, password, insecure).expect("management client");
    let account = AccountBuilder::default().alias(account_alias).build().expect("build account");
    let account = client.create_account(account).expect("create account");
    println!("Created account: {:?}", account);
}

Implementations§

Source§

impl ManagementClient

Source

pub fn new( endpoint: &str, username: &str, password: &str, insecure: bool, ) -> Result<Self>

Build a new ManagementClient.

Source

pub fn new_objectstore_client( &self, endpoint: &str, ) -> Result<ObjectstoreClient>

Source

pub fn create_account(&mut self, account: Account) -> Result<Account>

Create an IAM account.

account: Iam Account to create

Source

pub fn get_account(&mut self, account_id: &str) -> Result<Account>

Get an IAM account.

account_id: Id of the account

Source

pub fn update_account(&mut self, account: Account) -> Result<Account>

Update an IAM account.

account: Iam Account to update

Source

pub fn delete_account(&mut self, account_id: &str) -> Result<()>

Delete an IAM account.

account_id: Id of the account

Source

pub fn list_accounts(&mut self) -> Result<Vec<Account>>

List all IAM accounts.

Source

pub fn create_user(&mut self, user: User) -> Result<User>

Creates a new IAM User.

user: IAM User to create

Source

pub fn get_user(&mut self, user_name: &str, namespace: &str) -> Result<User>

Returns the information about the specified IAM User.

user_name: The name of the user to retrieve. Cannot be empty. namespace: Namespace of the user(id of the account the user belongs to). Cannot be empty.

Source

pub fn delete_user(&mut self, user_name: &str, namespace: &str) -> Result<()>

Delete specified IAM User.

user_name: The name of the user to delete. Cannot be empty. namespace: Namespace of the user(id of the account the user belongs to). Cannot be empty.

Source

pub fn list_users(&mut self, namespace: &str) -> Result<Vec<User>>

Lists the IAM users.

namespace: Namespace of users(id of the account the user belongs to). Cannot be empty.

TODO: list_user won’t show tags, or permissions boundary if any fix it or report bug

Source

pub fn create_user_policy_attachment( &mut self, user_policy_attachment: UserPolicyAttachment, ) -> Result<UserPolicyAttachment>

Attaches the specified managed policy to the specified user.

user_policy_attachment: UserPolicyAttachment to create

PS: attach the same policy would throw error

Source

pub fn delete_user_policy_attachment( &mut self, user_policy_attachment: UserPolicyAttachment, ) -> Result<()>

Remove the specified managed policy attached to the specified user.

user_policy_attachment: UserPolicyAttachment to delete.

Source

pub fn list_user_policy_attachments( &mut self, user_name: &str, namespace: &str, ) -> Result<Vec<UserPolicyAttachment>>

Lists all managed policies that are attached to the specified IAM user.

user_name: The name of the user to list attached policies for. Cannot be empty. namespace: Namespace of the user(id of the account the user belongs to). Cannot be empty.

Source

pub fn create_login_profile( &mut self, login_profile: LoginProfile, ) -> Result<LoginProfile>

Creates a password for the specified IAM user.

login_profile: LoginProfile to create

Source

pub fn get_login_profile( &mut self, user_name: &str, namespace: &str, ) -> Result<LoginProfile>

Retrieves the password for the specified IAM user

user_name: Name of the user to delete password. Cannot be empty. namespace: Namespace of the user(id of the account the user belongs to). Cannot be empty.

Source

pub fn delete_login_profile( &mut self, user_name: &str, namespace: &str, ) -> Result<()>

Deletes the password for the specified IAM user

user_name: Name of the user to delete password. Cannot be empty. namespace: Namespace of the user(id of the account the user belongs to). Cannot be empty.

Source

pub fn create_access_key(&mut self, access_key: AccessKey) -> Result<AccessKey>

Creates AccessKey for user.

access_key: AccessKey to create

Source

pub fn update_access_key(&mut self, access_key: AccessKey) -> Result<AccessKey>

Updates AccessKey for user.

access_key: AccessKey to update

Source

pub fn delete_access_key( &mut self, access_key_id: &str, user_name: &str, namespace: &str, ) -> Result<()>

Deletes the access key pair associated with the specified IAM user.

access_key_id: The ID of the access key you want to delete. Cannot be empty. user_name: Name of the user to delete accesskeys. Cannot be empty. namespace: Namespace of the access key(id of the account the access key belongs to). Cannot be empty.

Source

pub fn list_access_keys( &mut self, user_name: &str, namespace: &str, ) -> Result<Vec<AccessKey>>

Returns information about the access key IDs associated with the specified IAM user.

user_name: Name of the user to list accesskeys. Cannot be empty. namespace: Namespace of the access key(id of the account the access key belongs to). Cannot be empty.

Source

pub fn create_account_access_key( &mut self, account_access_key: AccountAccessKey, ) -> Result<AccountAccessKey>

Creates account AccessKey.

account_access_key: Account Access Key to create

Source

pub fn update_account_access_key( &mut self, account_access_key: AccountAccessKey, ) -> Result<AccountAccessKey>

Updates account AccessKey.

account_access_key: Account Access Key to update

Source

pub fn delete_account_access_key( &mut self, access_key_id: &str, account_id: &str, ) -> Result<()>

Deletes the access key pair associated with the specified IAM account.

access_key_id: The ID of the access key. Cannot be empty. account_id: The id of the account. Cannot be empty.

Source

pub fn list_account_access_keys( &mut self, account_id: &str, ) -> Result<Vec<AccountAccessKey>>

Returns information about the access key IDs associated with the specified IAM account.

account_id: The id of the account. Cannot be empty.

Source

pub fn create_policy(&mut self, policy: Policy) -> Result<Policy>

Create a new Managed Policy.

policy: IAM Policy to create

Source

pub fn get_policy( &mut self, policy_arn: &str, namespace: &str, ) -> Result<Policy>

Retrieve information about the specified Managed Policy.

policy_arn: Arn of the policy to retrieve. Cannot be empty. namespace: Namespace of the policy(id of the account the policy belongs to). Cannot be empty.

Source

pub fn delete_policy(&mut self, policy_arn: &str, namespace: &str) -> Result<()>

Delete the specified Managed Policy.

policy_arn: Arn of the policy to delete. Cannot be empty. namespace: Namespace of the policy(id of the account the policy belongs to). Cannot be empty.

Source

pub fn list_policies(&mut self, namespace: &str) -> Result<Vec<Policy>>

Lists IAM Managed Policies.

namespace: Namespace of the policies(id of the account policies belongs to). Cannot be empty.

Source

pub fn create_group(&mut self, group: Group) -> Result<Group>

Creates a new IAM Group.

group: IAM Group to create

Source

pub fn get_group(&mut self, group_name: &str, namespace: &str) -> Result<Group>

Returns the information about the specified IAM Group.

group_name: The name of the group to retrieve. Cannot be empty. namespace: Namespace of the group(id of the account the group belongs to). Cannot be empty.

Source

pub fn delete_group(&mut self, group_name: &str, namespace: &str) -> Result<()>

Delete specified IAM User.

group_name: The name of the group to delete. Cannot be empty. namespace: Namespace of the group(id of the account the group belongs to). Cannot be empty.

Source

pub fn list_groups(&mut self, namespace: &str) -> Result<Vec<Group>>

Lists the IAM groups.

namespace: Namespace of groups(id of the account groups belongs to). Cannot be empty.

Source

pub fn create_group_policy_attachment( &mut self, group_policy_attachment: GroupPolicyAttachment, ) -> Result<GroupPolicyAttachment>

Attaches the specified managed policy to the specified group.

group_policy_attachment: GroupPolicyAttachment to create

Source

pub fn delete_group_policy_attachment( &mut self, group_policy_attachment: GroupPolicyAttachment, ) -> Result<()>

Remove the specified managed policy attached to the specified group.

group_policy_attachment: GroupPolicyAttachment to delete.

Source

pub fn list_group_policy_attachments( &mut self, group_name: &str, namespace: &str, ) -> Result<Vec<GroupPolicyAttachment>>

Lists all managed policies that are attached to the specified IAM Group.

group_name: The name of the group to list attached policies for. Cannot be empty. namespace: Namespace of the group(id of the account the group belongs to). Cannot be empty.

Source

pub fn create_role(&mut self, role: Role) -> Result<Role>

Creates a new IAM Role.

role: IAM Role to create

Source

pub fn get_role(&mut self, role_name: &str, namespace: &str) -> Result<Role>

Returns the information about the specified IAM Role.

role_name: The name of the role to retrieve. Cannot be empty. namespace: Namespace of the role(id of the account the role belongs to). Cannot be empty.

Source

pub fn update_role(&mut self, role: Role) -> Result<Role>

Updates a new IAM Role.

role: IAM Role to update

Source

pub fn delete_role(&mut self, role_name: &str, namespace: &str) -> Result<()>

Delete specified IAM Role.

role_name: The name of the role to delete. Cannot be empty. namespace: Namespace of the role(id of the account the role belongs to). Cannot be empty.

Source

pub fn list_roles(&mut self, namespace: &str) -> Result<Vec<Role>>

Lists the IAM roles.

namespace: Namespace of roles(id of the account roles belongs to). Cannot be empty.

Source

pub fn create_role_policy_attachment( &mut self, role_policy_attachment: RolePolicyAttachment, ) -> Result<RolePolicyAttachment>

Attaches the specified managed policy to the specified role.

role_policy_attachment: RolePolicyAttachment to create

Source

pub fn delete_role_policy_attachment( &mut self, role_policy_attachment: RolePolicyAttachment, ) -> Result<()>

Remove the specified managed policy attached to the specified role.

role_policy_attachment: RolePolicyAttachment to delete.

Source

pub fn list_role_policy_attachments( &mut self, role_name: &str, namespace: &str, ) -> Result<Vec<RolePolicyAttachment>>

Lists all managed policies that are attached to the specified IAM Role.

role_name: The name of the role to list attached policies for. Cannot be empty. namespace: Namespace of the role(id of the account the role belongs to). Cannot be empty.

Source

pub fn get_entities_for_policy( &mut self, policy_arn: &str, namespace: &str, entity_filter: &str, usage_filter: &str, ) -> Result<EntitiesForPolicy>

Lists all IAM users, groups, and roles that the specified managed policy is attached to.

policy_arn: Arn of the policy to list entities for. Cannot be empty. namespace: Namespace of the policy(id of the account the policy belongs to). Cannot be empty. entity_filter: The entity type to use for filtering the results. Valid values: User, Role, Group. usage_filter: The policy usage method to use for filtering the results. Valid values: PermissionsPolicy, PermissionsBoundary.

Source

pub fn create_user_group_membership( &mut self, user_group_membership: UserGroupMembership, ) -> Result<UserGroupMembership>

Adds the specified user to the specified group.

user_group_membership: UserGroupMembership to create.

Source

pub fn delete_user_group_membership( &mut self, user_group_membership: UserGroupMembership, ) -> Result<()>

Removes the specified user from the specified group.

user_group_membership: GroupPolicyAttachment to delete.

Source

pub fn list_user_group_memberships_by_user( &mut self, user_name: &str, namespace: &str, ) -> Result<Vec<UserGroupMembership>>

Lists the IAM groups that the specified IAM user belongs to.

user_name: The name of the user to list group membership for. Cannot be empty. namespace: Namespace of the user(id of the account the user belongs to). Cannot be empty.

Source

pub fn list_user_group_memberships_by_group( &mut self, group_name: &str, namespace: &str, ) -> Result<Vec<UserGroupMembership>>

Lists the IAM users that the specified IAM group contains.

group_name: The name of the group to list contained users for. Cannot be empty. namespace: Namespace of the group(id of the account the group belongs to). Cannot be empty.

Trait Implementations§

Source§

impl Clone for ManagementClient

Source§

fn clone(&self) -> ManagementClient

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ManagementClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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,