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
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 update_account(&mut self, account: Account) -> Result<Account>
pub fn update_account(&mut self, account: Account) -> Result<Account>
Update an IAM account.
account: Iam Account to update
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 fix it or report bug
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 update_access_key(&mut self, access_key: AccessKey) -> Result<AccessKey>
pub fn update_access_key(&mut self, access_key: AccessKey) -> Result<AccessKey>
Updates AccessKey for user.
access_key: AccessKey to update
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 update_account_access_key(
&mut self,
account_access_key: AccountAccessKey,
) -> Result<AccountAccessKey>
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
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.
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 create_role(&mut self, role: Role) -> Result<Role>
pub fn create_role(&mut self, role: Role) -> Result<Role>
Creates a new IAM Role.
role: IAM Role to create
Sourcepub fn get_role(&mut self, role_name: &str, namespace: &str) -> Result<Role>
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.
Sourcepub fn update_role(&mut self, role: Role) -> Result<Role>
pub fn update_role(&mut self, role: Role) -> Result<Role>
Updates a new IAM Role.
role: IAM Role to update
Sourcepub fn delete_role(&mut self, role_name: &str, namespace: &str) -> Result<()>
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.
Sourcepub fn list_roles(&mut self, namespace: &str) -> Result<Vec<Role>>
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.
Sourcepub fn create_role_policy_attachment(
&mut self,
role_policy_attachment: RolePolicyAttachment,
) -> Result<RolePolicyAttachment>
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
Sourcepub fn delete_role_policy_attachment(
&mut self,
role_policy_attachment: RolePolicyAttachment,
) -> Result<()>
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.
Sourcepub fn list_role_policy_attachments(
&mut self,
role_name: &str,
namespace: &str,
) -> Result<Vec<RolePolicyAttachment>>
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.
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 more