def add_user(self, username, email, **kwargs): """Create a new user with provided details. Add user example: .. code-block:: python account_management_api = AccountManagementAPI() # Add user user = { "username": "******", "email": "*****@*****.**", "phone_number": "0123456789" } new_user = account_management_api.add_user(**user) :param str username: The unique username of the user (Required) :param str email: The unique email of the user (Required) :param str full_name: The full name of the user :param list groups: List of group IDs (`str`) which this user belongs to :param str password: The password string of the user :param str phone_number: Phone number of the user :param bool terms_accepted: 'General Terms & Conditions' have been accepted :param bool marketing_accepted: Marketing Information opt-in :returns: the new user object :rtype: User """ api = self._get_api(iam.AccountAdminApi) kwargs.update({'username': username, 'email': email}) user = User._create_request_map(kwargs) body = iam.UserUpdateReq(**user) return User(api.create_user(body))
def update_user(self, user_id, **kwargs): """Update user properties of specified user. :param str user_id: The ID of the user to update (Required) :param str username: The unique username of the user :param str email: The unique email of the user :param str full_name: The full name of the user :param str password: The password string of the user. :param str phone_number: Phone number of the user :param bool terms_accepted: Is 'General Terms & Conditions' accepted :param bool marketing_accepted: Is receiving marketing information accepted? :returns: the updated user object :rtype: User """ api = self._get_api(iam.AccountAdminApi) user = User._create_request_map(kwargs) body = iam.UserUpdateReq(**user) return User(api.update_user(user_id, body))