.. versionadded:: 2019.2.0

    List all subnets within a virtual network.

    :param virtual_network: The virtual network name to list subnets within.

    :param resource_group: The resource group name assigned to the
        virtual network.

    CLI Example:

    .. code-block:: bash

        salt-call azurearm_network.subnets_list testnet testgroup

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

    List all subnets within a virtual network.

    :param virtual_network: The virtual network name to list subnets within.

    :param resource_group: The resource group name assigned to the
        virtual network.

    CLI Example:

    .. code-block:: bash

        salt-call azurearm_network.subnets_list testnet testgroup

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

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

    return result