private static async Task UserAndGroupOps(IdentityClient client, string compartmentId) { // create a test user CreateUserDetails createUserDetails = new CreateUserDetails { CompartmentId = compartmentId, Name = userName, Description = "testing oci sdk for .NET" }; CreateUserRequest createUserRequest = new CreateUserRequest { CreateUserDetails = createUserDetails }; CreateUserResponse createUserResponse = await client.CreateUser(createUserRequest); User user = createUserResponse.User; logger.Info($"user created, Name : {user.Name} , ID : {user.Id}"); // create a test group CreateGroupDetails createGroupDetails = new CreateGroupDetails { CompartmentId = compartmentId, Name = "oci-dotnetsdk-testgroup", Description = "testing oci sdk for .NET" }; CreateGroupRequest createGroupRequest = new CreateGroupRequest { CreateGroupDetails = createGroupDetails }; CreateGroupResponse createGroupResponse = await client.CreateGroup(createGroupRequest); logger.Info($"new group created, Name : {createGroupResponse.Group.Name} , Id : {createGroupResponse.Group.Id}"); Group group = createGroupResponse.Group; // add the user to the group logger.Info("Adding new user to the new group"); AddUserToGroupDetails addUserToGroupDetails = new AddUserToGroupDetails { UserId = user.Id, GroupId = group.Id }; AddUserToGroupRequest addUserToGroupRequest = new AddUserToGroupRequest { AddUserToGroupDetails = addUserToGroupDetails }; AddUserToGroupResponse addUserToGroupResponse = await client.AddUserToGroup(addUserToGroupRequest); logger.Info($"Added user: {user.Name} to the group: {group.Name}"); // remove user from the group logger.Info($"removing user: {user.Name} from the group: {group.Name}"); RemoveUserFromGroupRequest removeUserFromGroupRequest = new RemoveUserFromGroupRequest { UserGroupMembershipId = addUserToGroupResponse.UserGroupMembership.Id }; await client.RemoveUserFromGroup(removeUserFromGroupRequest); // delete the user logger.Info($"deleting the user: {user.Name}"); DeleteUserRequest deleteUserRequest = new DeleteUserRequest { UserId = user.Id }; await client.DeleteUser(deleteUserRequest); // delete the group logger.Info($"deleting the group: {group.Name}"); DeleteGroupRequest deleteGroupRequest = new DeleteGroupRequest { GroupId = group.Id }; await client.DeleteGroup(deleteGroupRequest); logger.Info("Finished delete user and group"); }