.. versionadded:: 2019.2.0

    List all virtual networks within a resource group.

    :param resource_group: The resource group name to list virtual networks
        within.

    CLI Example:

    .. code-block:: bash

        salt-call azurearm_network.virtual_networks_list testgroup

def virtual_networks_list(resource_group, **kwargs):
    '''
    .. versionadded:: 2019.2.0

    List all virtual networks within a resource group.

    :param resource_group: The resource group name to list virtual networks
        within.

    CLI Example:

    .. code-block:: bash

        salt-call azurearm_network.virtual_networks_list testgroup

    '''
    result = {}
    netconn = __utils__['azurearm.get_client']('network', **kwargs)
    try:
        vnets = __utils__['azurearm.paged_object_to_list'](
            netconn.virtual_networks.list(
                resource_group_name=resource_group
            )
        )

        for vnet in vnets:
            result[vnet['name']] = vnet
    except CloudError as exc:
        __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs)
        result = {'error': str(exc)}

    return result