Exemplo n.º 1
0
def get_all_virtual_controllers(session, start=None, limit=None, return_type=None, **kwargs):
    """
    Get details on all VPSAOS virtual controllers.

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type start: int
    :param start: The offset to start displaying accounts from.  Optional.

    :type: limit: int
    :param limit: The maximum number of accounts 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.
    """
    parameters = verify_start_limit(start=start, limit=limit)

    path = "/api/zios/virtual_controllers.json"

    return session.get_api(path=path, parameters=parameters,
                           return_type=return_type, **kwargs)
Exemplo n.º 2
0
def get_free_drives(session,
                    start=None,
                    limit=None,
                    return_type=None,
                    **kwargs):
    """
    Retrieves details for all drives that are available for use (not
    participating in a RAID group).

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type start: int
    :param start: The offset to start displaying drives from.  Optional.

    :type: limit: int
    :param limit: The maximum number of drives 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.
    """
    parameters = verify_start_limit(start, limit)

    path = '/api/drives/free.json'

    return session.get_api(path=path,
                           parameters=parameters,
                           return_type=return_type,
                           **kwargs)
Exemplo n.º 3
0
def get_all_snapshot_policies(session, start=None, limit=None,
                              return_type=None, **kwargs):
    """
    Retrieves details for all snapshot policies configured on the VPSA.

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type start: int
    :param start: The offset to start displaying snapshot policies from.
        Optional.

    :type: limit: int
    :param limit: The maximum number of snapshot policies 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.
    """
    parameters = verify_start_limit(start, limit)

    path = '/api/snapshot_policies.json'

    return session.get_api(path=path, parameters=parameters,
                           return_type=return_type, **kwargs)
Exemplo n.º 4
0
def get_volumes_attached_to_server(session, server_id, start=None, limit=None,
                                   return_type=None, **kwargs):
    """
    Retrieves details for all volumes attached to the specified server.

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type server_id: str
    :param server_id: The server 'name' value as returned by get_all_servers.
        For example: 'srv-00000001'.  Required.

    :type start: int
    :param start: The offset to start displaying volumes from.  Optional.

    :type: limit: int
    :param limit: The maximum number of volumes 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_server_id(server_id)
    parameters = verify_start_limit(start, limit)

    path = '/api/servers/{0}/volumes.json'.format(server_id)

    return session.get_api(path=path, parameters=parameters,
                           return_type=return_type, **kwargs)
Exemplo n.º 5
0
def get_logs(session,
             severity,
             attr_key,
             attr_value,
             start=None,
             limit=None,
             return_type=None,
             **kwargs):
    """
    Retrieves event logs from ZIOS.

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type severity: int
    :param severity: If set to None, all logs are returned.  If set to an
        integer, only messages for that severity are returned.  For example,
        critical messages have a 3 severity while warning messages have a 4
        severity.  Optional (will bet set to None by default).

    :type attr_key: str
    :param attr_key: Attribute key to get

    :type attr_value: str
    :param attr_value: Attribute value to get

    :type start: int
    :param start: The offset to start displaying logs from.  Optional.

    :type: limit: int
    :param limit: The maximum number of logs 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.
    """
    list_more_options = [('severity', severity), ('attr_key', attr_key),
                         ('attr_value', attr_value)]

    parameters = verify_start_limit(start, limit, list_more_options)

    path = '/api/messages.json'
    body_values = {}

    return session.get_api(path=path,
                           parameters=parameters,
                           body=body_values,
                           return_type=return_type,
                           **kwargs)
Exemplo n.º 6
0
def get_suggested_mirrors(session,
                          rvpsa_id,
                          cg_id,
                          start=None,
                          limit=None,
                          return_type=None,
                          **kwargs):
    """
    Retrieves a list of broken mirror jobs from the remote VPSA and validates
    if one can be re-used for the consistency group ID passed to this
    function.  Re-using a pre-existing mirror can save a lot of transfer time
    for large volumes.

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type rvpsa_id: str
    :param rvpsa_id: The remote VPSA 'name' value as returned by
        get_all_remote_vpsas.  For example: 'rvpsa-00000001'.  Required.

    :type cg_id: str
    :param cg_id: The consistency group 'cg_name' value as returned by
        get_all_volumes for the volume to be mirrored.  For example:
        'cg-00000001'.  Required.

    :type start: int
    :param start: The offset to start displaying suggested mirrors from.
        Optional.

    :type: limit: int
    :param limit: The maximum number of suggested mirrors 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_remote_vpsa_id(rvpsa_id)
    verify_cg_id(cg_id)

    parameters = verify_start_limit(start,
                                    limit,
                                    list_options=[('cgname', cg_id)])
    path = '/api/remote_vpsas/{0}/suggested_jobs.json'.format(rvpsa_id)

    return session.get_api(path=path,
                           parameters=parameters,
                           return_type=return_type,
                           **kwargs)
Exemplo n.º 7
0
def get_all_ros_destination_backup_jobs(session,
                                        ros_destination_id,
                                        start=None,
                                        limit=None,
                                        return_type=None,
                                        **kwargs):
    """
    Retrieves details for all remote object storage backup jobs for the
    specified remote object storage destination.

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type ros_destination_id: str
    :param ros_destination_id: The remote object storage destination 'name'
        value as returned by get_all_ros_destinations.  For example:
        'obsdst-00000001'.  Required.

    :type start: int
    :param start: The offset to start displaying remote object storage
        backup jobs from.  Optional.

    :type: limit: int
    :param limit: The maximum number of remote object storage backup jobs 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_ros_destination_id(ros_destination_id)

    path = '/api/object_storage_destinations/{0}/backup_jobs.json' \
        .format(ros_destination_id)

    parameters = verify_start_limit(start, limit)

    return session.get_api(path=path,
                           parameters=parameters,
                           return_type=return_type,
                           **kwargs)
Exemplo n.º 8
0
def get_all_zcs_containers_by_image(session,
                                    zcs_image_id,
                                    start=None,
                                    limit=None,
                                    return_type=None,
                                    **kwargs):
    """
    Retrieves details for all Zadara Container Services (ZCS) containers
    instantiated from the specified ZCS image.

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type zcs_image_id: str
    :param zcs_image_id: The ZCS image 'name' value as returned by
        get_all_zcs_images.  For example: 'img-00000001'.  Required.

    :type start: int
    :param start: The offset to start displaying ZCS containers from.
        Optional.

    :type: limit: int
    :param limit: The maximum number of ZCS containers 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_zcs_image_id(zcs_image_id)
    parameters = verify_start_limit(start, limit)

    path = '/api/images/{0}/containers.json'.format(zcs_image_id)

    return session.get_api(path=path,
                           parameters=parameters,
                           return_type=return_type,
                           **kwargs)
Exemplo n.º 9
0
def get_drives_in_raid_group(session,
                             raid_id,
                             start=None,
                             limit=None,
                             return_type=None,
                             **kwargs):
    """
    Retrieves details for all drives in a RAID group.

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type raid_id: str
    :param raid_id: The RAID group 'name' value as returned by
        get_all_raid_groups.  For example: 'RaidGroup-1'.  Required.

    :type start: int
    :param start: The offset to start displaying drives from.  Optional.

    :type: limit: int
    :param limit: The maximum number of drives 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_raid_id(raid_id)
    parameters = verify_start_limit(start, limit)

    path = '/api/raid_groups/{0}/disks.json'.format(raid_id)

    return session.get_api(path=path,
                           parameters=parameters,
                           return_type=return_type,
                           **kwargs)
Exemplo n.º 10
0
def get_volumes_in_pool_recycle_bin(session,
                                    pool_id,
                                    start=None,
                                    limit=None,
                                    return_type=None,
                                    **kwargs):
    """
    Retrieves a list of volumes in the pool's recycle bin.

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type pool_id: str
    :param pool_id: The pool 'name' value as returned by get_all_pools.  For
        example: 'pool-00000001'.  Required.

    :type start: int
    :param start: The offset to start displaying volumes from.  Optional.

    :type: limit: int
    :param limit: The maximum number of volumes 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_pool_id(pool_id)
    parameters = verify_start_limit(start, limit)

    path = '/api/pools/{0}/volumes_in_recycle_bin.json'.format(pool_id)

    return session.get_api(path=path,
                           parameters=parameters,
                           return_type=return_type,
                           **kwargs)
Exemplo n.º 11
0
def get_remote_vpsa_pools(session,
                          rvpsa_id,
                          start=None,
                          limit=None,
                          return_type=None,
                          **kwargs):
    """
    Retrieves details for all pools on the remote VPSA.

    :type session: zadarapy.session.Session
    :param session: A valid zadarapy.session.Session object.  Required.

    :type rvpsa_id: str
    :param rvpsa_id: The remote VPSA 'name' value as returned by
        get_all_remote_vpsas.  For example: 'rvpsa-00000001'.  Required.

    :type start: int
    :param start: The offset to start displaying remote pools from.  Optional.

    :type: limit: int
    :param limit: The maximum number of remote pools 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_remote_vpsa_id(rvpsa_id)
    parameters = verify_start_limit(start, limit)

    path = '/api/remote_vpsas/{0}/pools.json'.format(rvpsa_id)

    return session.get_api(path=path,
                           parameters=parameters,
                           return_type=return_type,
                           **kwargs)
Exemplo n.º 12
0
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)