Struct objectscale_client::client::ManagementClient
source · pub struct ManagementClient { /* private fields */ }Expand description
ManagementClient manages ObjectScale resources with the ObjectScale REST API calls. It also gets and manages tokens for authentication.
§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);
let account = AccountBuilder::default().alias(account_alias).build().expect("build account");
client.create_account(account).expect("create account");
}Implementations§
source§impl ManagementClient
impl ManagementClient
sourcepub fn new(
endpoint: &str,
username: &str,
password: &str,
insecure: bool,
) -> Result<Self>
pub fn new( endpoint: &str, username: &str, password: &str, insecure: bool, ) -> Result<Self>
Build a new ManagementClient.
pub fn new_objectstore_client( &self, endpoint: &str, ) -> Result<ObjectstoreClient>
sourcepub fn create_account(&mut self, account: Account) -> Result<Account>
pub fn create_account(&mut self, account: Account) -> Result<Account>
Create an IAM account.
account: Iam Account to create
sourcepub fn get_account(&mut self, account_id: &str) -> Result<Account>
pub fn get_account(&mut self, account_id: &str) -> Result<Account>
Get an IAM account.
account_id: Id of the account
sourcepub fn delete_account(&mut self, account_id: &str) -> Result<()>
pub fn delete_account(&mut self, account_id: &str) -> Result<()>
Delete an IAM account.
account_id: Id of the account
sourcepub fn list_accounts(&mut self) -> Result<Vec<Account>>
pub fn list_accounts(&mut self) -> Result<Vec<Account>>
List all IAM accounts.
sourcepub fn create_user(&mut self, user: User) -> Result<User>
pub fn create_user(&mut self, user: User) -> Result<User>
Creates a new IAM User.
user: IAM User to create
sourcepub fn get_user(&mut self, user_name: &str, namespace: &str) -> Result<User>
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.
sourcepub fn delete_user(&mut self, user_name: &str, namespace: &str) -> Result<()>
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.
sourcepub fn list_users(&mut self, namespace: &str) -> Result<Vec<User>>
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
sourcepub fn create_user_policy_attachment(
&mut self,
user_policy_attachment: UserPolicyAttachment,
) -> Result<UserPolicyAttachment>
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
sourcepub fn delete_user_policy_attachment(
&mut self,
user_policy_attachment: UserPolicyAttachment,
) -> Result<()>
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.
sourcepub fn list_user_policy_attachments(
&mut self,
user_name: &str,
namespace: &str,
) -> Result<Vec<UserPolicyAttachment>>
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.
sourcepub fn create_login_profile(
&mut self,
login_profile: LoginProfile,
) -> Result<LoginProfile>
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
sourcepub fn get_login_profile(
&mut self,
user_name: &str,
namespace: &str,
) -> Result<LoginProfile>
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.
sourcepub fn delete_login_profile(
&mut self,
user_name: &str,
namespace: &str,
) -> Result<()>
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.
sourcepub fn create_access_key(&mut self, access_key: AccessKey) -> Result<AccessKey>
pub fn create_access_key(&mut self, access_key: AccessKey) -> Result<AccessKey>
Creates AccessKey for user.
access_key: AccessKey to create
sourcepub fn delete_access_key(
&mut self,
access_key_id: &str,
user_name: &str,
namespace: &str,
) -> Result<()>
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.
sourcepub fn list_access_keys(
&mut self,
user_name: &str,
namespace: &str,
) -> Result<Vec<AccessKey>>
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.
sourcepub fn create_account_access_key(
&mut self,
account_access_key: AccountAccessKey,
) -> Result<AccountAccessKey>
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
sourcepub fn delete_account_access_key(
&mut self,
access_key_id: &str,
account_id: &str,
) -> Result<()>
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.
sourcepub fn list_account_access_keys(
&mut self,
account_id: &str,
) -> Result<Vec<AccountAccessKey>>
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.
sourcepub fn create_policy(&mut self, policy: Policy) -> Result<Policy>
pub fn create_policy(&mut self, policy: Policy) -> Result<Policy>
Create a new Managed Policy.
policy: IAM Policy to create
sourcepub fn get_policy(
&mut self,
policy_arn: &str,
namespace: &str,
) -> Result<Policy>
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.
sourcepub fn delete_policy(&mut self, policy_arn: &str, namespace: &str) -> Result<()>
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.
sourcepub fn list_policies(&mut self, namespace: &str) -> Result<Vec<Policy>>
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.
sourcepub fn create_group(&mut self, group: Group) -> Result<Group>
pub fn create_group(&mut self, group: Group) -> Result<Group>
Creates a new IAM Group.
group: IAM Group to create
sourcepub fn get_group(&mut self, group_name: &str, namespace: &str) -> Result<Group>
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.
TODO: show contained users in separate method
sourcepub fn delete_group(&mut self, group_name: &str, namespace: &str) -> Result<()>
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.
sourcepub fn list_groups(&mut self, namespace: &str) -> Result<Vec<Group>>
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.
sourcepub fn create_group_policy_attachment(
&mut self,
group_policy_attachment: GroupPolicyAttachment,
) -> Result<GroupPolicyAttachment>
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
sourcepub fn delete_group_policy_attachment(
&mut self,
group_policy_attachment: GroupPolicyAttachment,
) -> Result<()>
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.
sourcepub fn list_group_policy_attachments(
&mut self,
group_name: &str,
namespace: &str,
) -> Result<Vec<GroupPolicyAttachment>>
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.
sourcepub fn get_entities_for_policy(
&mut self,
policy_arn: &str,
namespace: &str,
entity_filter: &str,
usage_filter: &str,
) -> Result<EntitiesForPolicy>
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
sourcepub fn create_user_group_membership(
&mut self,
user_group_membership: UserGroupMembership,
) -> Result<UserGroupMembership>
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
sourcepub fn delete_user_group_membership(
&mut self,
user_group_membership: UserGroupMembership,
) -> Result<()>
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.
sourcepub fn list_user_group_memberships_by_user(
&mut self,
user_name: &str,
namespace: &str,
) -> Result<Vec<UserGroupMembership>>
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.
sourcepub fn list_user_group_memberships_by_group(
&mut self,
group_name: &str,
namespace: &str,
) -> Result<Vec<UserGroupMembership>>
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
impl Clone for ManagementClient
source§fn clone(&self) -> ManagementClient
fn clone(&self) -> ManagementClient
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ManagementClient
impl !RefUnwindSafe for ManagementClient
impl Send for ManagementClient
impl Sync for ManagementClient
impl Unpin for ManagementClient
impl !UnwindSafe for ManagementClient
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)