def getConnectionManagerGroups(session, url):
    """
    Return a list of connection manager groups (by the index endpoint).
    """
    groups = []
    page = 1
    per_page = 100

    done = False
    while not done:
        new_cm_groups = session.get("{}/api/v2/connection_manager_groups.json".format(url), params={"page": page, "per_page": per_page}).json()
        groups += new_cm_groups
        page += 1
        done = True if len(new_cm_groups) < per_page else False
    return groups