import requests


def get_all_service_groups(asa):
    """
    This function retrieves all service groups from ASA
    :param asa: ASA device which to retrieve the objects from ASA
    :return: Returns list of service objects.
    """
    url = asa.url() + "/api/objects/networkservicegroups"

    headers = {
        'Content-Type': 'application/json',
        'User-agent': 'REST API Agent',
        'X-Auth-Token': asa.token
    }

    response = requests.request("GET", url, headers=headers, verify=False).json()['items']

    return response