def get_account(session, account_id, return_type=None, **kwargs): """ Get details of a single account. :type session: zadarapy.session.Session :param session: A valid zadarapy.session.Session object. Required. :type account_id: str :param account_id: The VPSAOS account 'id' value as returned by get_all_accounts. For example: '91ea5bd5cdc04adb9f5e3c00a346c463'. Required. :type return_type: str :param return_type: If this is set to the string 'json', this function will return a JSON string. Otherwise, it will return a Python dictionary. Optional (will return a Python dictionary by default). :rtype: dict, str :returns: A dictionary or JSON data set as a string depending on return_type parameter. """ verify_account_id(account_id=account_id) path = "/api/zios/accounts/{0}.json".format(account_id) return session.get_api(path=path, secure=True, return_type=return_type, **kwargs)
def reset_password(session, account_id, user_id, return_type=None, **kwargs): """ Reset user password :type session: zadarapy.session.Session :param session: A valid zadarapy.session.Session object. Required. :type account_id: str :param account_id: The VPSAOS account 'id' value as returned by get_all_accounts. For example: '91ea5bd5cdc04adb9f5e3c00a346c463'. Required. :type user_id: str :param user_id: User ID. Required. :type return_type: str :param return_type: If this is set to the string 'json', this function will return a JSON string. Otherwise, it will return a Python dictionary. Optional (will return a Python dictionary by default). :rtype: dict, str :returns: A dictionary or JSON data set as a string depending on return_type parameter. """ verify_account_id(account_id) verify_field(user_id, "user_id") path = '/api/zios/users/reset_password.json' body_values = {'account': account_id, 'username': user_id} return session.post_api(path=path, body=body_values, return_type=return_type, **kwargs)
def add_new_user(session, account_id, username, email, role, notify_on_events="NO", return_type=None, **kwargs): """ Add new user :type session: zadarapy.session.Session :param session: A valid zadarapy.session.Session object. Required. :type account_id: str :param account_id: The VPSAOS account 'id' value as returned by get_all_accounts. For example: '91ea5bd5cdc04adb9f5e3c00a346c463'. Required. :type username: str :param username: Username. Required. :type email: str :param email: User Email. Required. :type: role: str :param role: Role. Required. :type: notify_on_events: str :param notify_on_events: "Yes" if notify on events, else "No" :type return_type: str :param return_type: If this is set to the string 'json', this function will return a JSON string. Otherwise, it will return a Python dictionary. Optional (will return a Python dictionary by default). :rtype: dict, str :returns: A dictionary or JSON data set as a string depending on return_type parameter. """ verify_account_id(account_id) verify_boolean(notify_on_events, "notify_on_events") verify_field(username, "username") verify_email(email) verify_field(role, "role") path = "/api/zios/users.json" body_values = { 'account_id': account_id, 'username': username, 'email': email, 'role': role, 'notify_on_events': notify_on_events } return session.post_api(path=path, body=body_values, return_type=return_type, **kwargs)
def delete_account(session, account_id, force='NO', return_type=None, **kwargs): """ Delete a VPSAOS account. :type session: zadarapy.session.Session :param session: A valid zadarapy.session.Session object. Required. :type account_id: str :param account_id: The VPSAOS account 'id' value as returned by get_all_accounts. For example: '91ea5bd5cdc04adb9f5e3c00a346c463'. Required. :type force: str :param force: If set to 'YES', ignore non-critical warnings and force the VPSAOS to accept the request. If 'NO', return message on warning and abort. Set to 'NO' by default. Optional. :type return_type: str :param return_type: If this is set to the string 'json', this function will return a JSON string. Otherwise, it will return a Python dictionary. Optional (will return a Python dictionary by default). :rtype: dict, str :returns: A dictionary or JSON data set as a string depending on return_type parameter. """ verify_account_id(account_id=account_id) verify_boolean(force, 'force') path = "/api/zios/accounts/{0}.json".format(account_id) body_values = {'force': force} return session.delete_api(path=path, body=body_values, secure=True, return_type=return_type, **kwargs)
def get_all_users(session, account_id, start=None, limit=None, return_type=None, **kwargs): """ Get all VPSAOS Users information :type session: zadarapy.session.Session :param session: A valid zadarapy.session.Session object. Required. :type account_id: str :param account_id: The VPSAOS account 'id' value as returned by get_all_accounts. For example: '91ea5bd5cdc04adb9f5e3c00a346c463'. Required. :type start: int :param start: The offset to start displaying NAS users from. Optional. :type: limit: int :param limit: The maximum number of NAS users to return. Optional. :type return_type: str :param return_type: If this is set to the string 'json', this function will return a JSON string. Otherwise, it will return a Python dictionary. Optional (will return a Python dictionary by default). :rtype: dict, str :returns: A dictionary or JSON data set as a string depending on return_type parameter. """ verify_account_id(account_id=account_id) parameters = verify_start_limit(start, limit) path = "/api/zios/accounts/{0}/users.json".format(account_id) return session.get_api(path=path, parameters=parameters, return_type=return_type, **kwargs)