.. versionadded:: 2019.2.0

    List all load balancers within a subscription.

    CLI Example:

    .. code-block:: bash

        salt-call azurearm_network.load_balancers_list_all
179154
def load_balancers_list_all(**kwargs):
    '''
    

    '''
    result = {}
    netconn = __utils__['azurearm.get_client']('network', **kwargs)
    try:
        load_balancers = __utils__['azurearm.paged_object_to_list'](netconn.load_balancers.list_all())

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

    return result
782658
def cli(env, identifier):
    """"""
    mgr = SoftLayer.LoadBalancerManager(env.client)

    loadbal_id, group_id = loadbal.parse_id(identifier)

    mgr.reset_service_group(loadbal_id, group_id)
    env.fout('Load balancer service group connections are being reset!')
1315377
def list_resource_groups(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_hosted_services function must be called with '
            '-f or --function'
        )

    resconn = get_conn(client_type='resource')
    ret = {}
    try:
        groups = resconn.resource_groups.list()

        for group_obj in groups:
            group = group_obj.as_dict()
            ret[group['name']] = group
    except CloudError as exc:
        __utils__['azurearm.log_cloud_error']('resource', exc.message)
        ret = {'Error': exc.message}

    return ret
1290378
def list_loadbalancers(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_images function must be called with '
            '-f or --function, or with the --list-loadbalancers option'
        )

    ret = {}
    conn = get_conn()
    datacenter = get_datacenter(conn)

    for item in conn.list_loadbalancers(datacenter['id'])['items']:
        lb = {'id': item['id']}
        lb.update(item['properties'])
        ret[lb['name']] = lb

    return ret
1040578
def cli(env, identifier, allocation, port, routing_type, routing_method):
    """"""
    mgr = SoftLayer.LoadBalancerManager(env.client)

    loadbal_id, group_id = loadbal.parse_id(identifier)

    # check if any input is provided
    if not any([allocation, port, routing_type, routing_method]):
        raise exceptions.CLIAbort(
            'At least one property is required to be changed!')

    mgr.edit_service_group(loadbal_id,
                           group_id,
                           allocation=allocation,
                           port=port,
                           routing_type=routing_type,
                           routing_method=routing_method)

    env.fout('Load balancer service group %s is being updated!' % identifier)
80700
def list_networks(conn=None, call=None):
    '''
    

    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_networks function must be called with '
            '-f or --function'
        )
    if conn is None:
        conn = get_conn()
    return conn.list_networks()
1266330
def delete_access_list(self, loadbalancer):
        
        uri = "/loadbalancers/%s/accesslist" % utils.get_id(loadbalancer)
        resp, body = self.api.method_delete(uri)
        return body
348426
def route_filters_list_all(**kwargs):
    '''
    

    '''
    result = {}
    netconn = __utils__['azurearm.get_client']('network', **kwargs)
    try:
        filters = __utils__['azurearm.paged_object_to_list'](netconn.route_filters.list())

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

    return result
550115
def list_nodes_full(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes_full function must be called with -f or --function.'
        )

    zone = _get_specified_zone()

    params = {
        'action': 'DescribeInstances',
        'zone': zone,
        'status': ['pending', 'running', 'stopped', 'suspended'],
    }
    items = query(params=params)

    log.debug('Total %s instances found in zone %s', items['total_count'], zone)

    result = {}

    if items['total_count'] == 0:
        return result

    for node in items['instance_set']:
        normalized_node = _show_normalized_node(node)
        node.update(normalized_node)

        result[node['instance_id']] = node

    provider = __active_provider_name__ or 'qingcloud'
    if ':' in provider:
        comps = provider.split(':')
        provider = comps[0]

    __opts__['update_cachedir'] = True
    __utils__['cloud.cache_node_list'](result, provider, __opts__)

    return result
767571
def deployments_list(resource_group, **kwargs):
    '''
    

    '''
    result = {}
    resconn = __utils__['azurearm.get_client']('resource', **kwargs)
    try:
        deployments = __utils__['azurearm.paged_object_to_list'](
            resconn.deployments.list_by_resource_group(
                resource_group_name=resource_group
            )
        )

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

    return result
52006
def subscriptions_list_locations(subscription_id=None, **kwargs):
    '''
    

    '''
    result = {}

    if not subscription_id:
        subscription_id = kwargs.get('subscription_id')
    elif not kwargs.get('subscription_id'):
        kwargs['subscription_id'] = subscription_id

    subconn = __utils__['azurearm.get_client']('subscription', **kwargs)
    try:
        locations = __utils__['azurearm.paged_object_to_list'](
            subconn.subscriptions.list_locations(
                subscription_id=kwargs['subscription_id']
            )
        )

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

    return result
1164349
def sr_list(call=None):
    '''
    

    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'This function must be called with -f, --function argument.'
        )
    ret = {}
    session = _get_session()
    srs = session.xenapi.SR.get_all()
    for sr in srs:
        sr_record = session.xenapi.SR.get_record(sr)
        ret[sr_record['name_label']] = sr_record
    return ret
160846
def list_(saltenv='base', test=None):
    '''
    
    '''
    sevent = salt.utils.event.get_event(
            'master',
            __opts__['sock_dir'],
            __opts__['transport'],
            opts=__opts__,
            listen=True)

    master_key = salt.utils.master.get_master_key('root', __opts__)

    __jid_event__.fire_event({'key': master_key}, 'salt/reactors/manage/list')

    results = sevent.get_event(wait=30, tag='salt/reactors/manage/list-results')
    reactors = results['reactors']
    return reactors
640892
def list_vapps(kwargs=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The list_vapps function must be called with '
            '-f or --function.'
        )

    return {'vApps': salt.utils.vmware.list_vapps(_get_si())}
944241
def list_nodes_full(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes_full function must be called with -f or --function.'
        )

    netapi_versions = get_api_versions(kwargs={
        'resource_provider': 'Microsoft.Network',
        'resource_type': 'networkInterfaces'
        }
    )
    netapi_version = netapi_versions[0]
    compconn = get_conn(client_type='compute')

    ret = {}

    def _get_node_info(node):
        '''
        Get node info.
        '''
        node_ret = {}
        node['id'] = node['vm_id']
        node['size'] = node['hardware_profile']['vm_size']
        node['state'] = node['provisioning_state']
        node['public_ips'] = []
        node['private_ips'] = []
        node_ret[node['name']] = node
        try:
            image_ref = node['storage_profile']['image_reference']
            node['image'] = '|'.join([
                image_ref['publisher'],
                image_ref['offer'],
                image_ref['sku'],
                image_ref['version'],
            ])
        except (TypeError, KeyError):
            try:
                node['image'] = node['storage_profile']['os_disk']['image']['uri']
            except (TypeError, KeyError):
                node['image'] = node.get('storage_profile', {}).get('image_reference', {}).get('id')
        try:
            netifaces = node['network_profile']['network_interfaces']
            for index, netiface in enumerate(netifaces):
                netiface_name = get_resource_by_id(
                    netiface['id'],
                    netapi_version,
                    'name'
                )
                netiface, pubips, privips = _get_network_interface(
                    netiface_name,
                    node['resource_group']
                )
                node['network_profile']['network_interfaces'][index].update(netiface)
                node['public_ips'].extend(pubips)
                node['private_ips'].extend(privips)
        except Exception:
            pass

        node_ret[node['name']] = node

        return node_ret

    for group in list_resource_groups():
        nodes = []
        nodes_query = compconn.virtual_machines.list(
            resource_group_name=group
        )
        for node_obj in nodes_query:
            node = node_obj.as_dict()
            node['resource_group'] = group
            nodes.append(node)

        pool = ThreadPool(cpu_count() * 6)
        results = pool.map_async(_get_node_info, nodes)
        results.wait()

        group_ret = {k: v for result in results.get() for k, v in six.iteritems(result)}
        ret.update(group_ret)

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

    if kwargs is None:
        kwargs = {}

    if 'service' not in kwargs:
        raise SaltCloudSystemExit('A service name must be specified as "service"')

    if 'deployment' not in kwargs:
        raise SaltCloudSystemExit('A deployment name must be specified as "deployment"')

    path = 'services/hostedservices/{0}/deployments/{1}'.format(
        kwargs['service'],
        kwargs['deployment'],
    )

    data = query(path)
    if data is None:
        raise SaltCloudSystemExit(
            'There was an error listing endpoints with the {0} service on the {1} deployment.'.format(
                kwargs['service'],
                kwargs['deployment']
            )
        )

    ret = {}
    for item in data:
        if 'Role' in item:
            role = item['Role']
            if not isinstance(role, dict):
                return ret
            input_endpoint = role['ConfigurationSets']['ConfigurationSet'].get('InputEndpoints', {}).get('InputEndpoint')
            if not input_endpoint:
                continue
            if not isinstance(input_endpoint, list):
                input_endpoint = [input_endpoint]
            for endpoint in input_endpoint:
                ret[endpoint['Name']] = endpoint
            return ret
    return ret
162996
def list_nodes_full(call=None):
    ''' 
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'list_nodes_full must be called with -f or --function'
        )

    items = query(method='servers')

    # For each server, iterate on its parameters.
    ret = {}
    for node in items['servers']:
        ret[node['name']] = {}
        for item in node:
            value = node[item]
            ret[node['name']][item] = value
    return ret