Group management API
Updated at:2025-10-27
Create group
Create a group with reference to the following codes:
Java
1public void createGroup(IamClient client) {
2 CreateGroupRequest createGroupRequest = new CreateGroupRequest();
3 // Group name
4 createGroupRequest.setName("test_group_name");
5 // Group description
6 createGroupRequest.setDescription("test_group_description");
7
8 client.createGroup(createGroupRequest);
9}
Query group
Query a group with reference to the following codes:
Java
1public void getGroup(IamClient client) {
2 // Group name
3 String groupName = "test_group_name";
4
5 client.getGroup(groupName);
6}
Update group
Update a group with reference to the following codes:
Java
1public void updateGroup(IamClient client) {
2 // Group name
3 String groupName = "test_group_name";
4 // Set updated group information
5 UpdateGroupRequest updateGroupRequest = new UpdateGroupRequest();
6 // Set updated group name
7 updateGroupRequest.setName("new_group_name");
8 // Set updated group description
9 updateGroupRequest.setDescription("new_group_description");
10
11 client.updateGroup(groupName, updateGroupRequest);
12}
Delete group
Delete a group with reference to the following codes:
Java
1public void deleteGroup(IamClient client) {
2 // Group name
3 String groupName = "test_group_name";
4
5 client.deleteGroup(groupName);
6}
List groups
List groups with reference to the following codes:
Java
1public void listGroup(IamClient client) {
2 client.listGroup();
3}
Add user to group
Add a user to a group with reference to the following codes:
Java
1public void addUserToGroup(IamClient client) {
2 // Group name
3 String groupName = "test_group_name";
4 // Username
5 String userName = "test_user_name";
6
7 client.addUserToGroup(userName, groupName);
8}
Remove user from group
Remove a user from a group with reference to the following codes:
Java
1public void removeUserFromGroup(IamClient client) {
2 // Group name
3 String groupName = "test_group_name";
4 // Username
5 String userName = "test_user_name";
6
7 client.removeUserFromGroup(userName, groupName)
8}
List the group to which a user belongs
List groups to which the users belong with reference to the following codes:
Java
1public void listGroupsForUser(IamClient client) {
2 // Username
3 String userName = "test_user_name";
4
5 client.listGroupsForUser(userName);
6}
List users within a group
List users within a group with reference to the following codes:
Java
1public void listUsersInGroup(IamClient client) {
2 // Group name
3 String groupName = "test_group_name";
4
5 client.listUsersInGroup(groupName);
6}
