def list_affinity_groups(kwargs=None, conn=None, call=None):
    if call != 'function':
        raise SaltCloudSystemExit(
            'The list_affinity_groups function must be called with -f or --function.'
        )

    if not conn:
        conn = get_conn()

    data = conn.list_affinity_groups()
    ret = {}
    for item in data.affinity_groups:
        ret[item.name] = object_to_dict(item)
    return ret
.. versionadded:: 2015.8.0
dataset/ETHPy150Open saltstack/salt/salt/cloud/clouds/msazure.py/list_affinity_groups