List PaaS instances.
972015
def list(gandi, state, id, vhosts, type, limit):
    """"""
    options = {
        'items_per_page': limit,
    }
    if state:
        options['state'] = state

    output_keys = ['name', 'state']
    if id:
        output_keys.append('id')
    if vhosts:
        output_keys.append('vhost')
    if type:
        output_keys.append('type')

    paas_hosts = {}
    result = gandi.paas.list(options)
    for num, paas in enumerate(result):
        paas_hosts[paas['id']] = []
        if vhosts:
            list_vhost = gandi.vhost.list({'paas_id': paas['id']})
            for host in list_vhost:
                paas_hosts[paas['id']].append(host['name'])

        if num:
            gandi.separator_line()
        output_paas(gandi, paas, [], paas_hosts[paas['id']],
                    output_keys)

    return result
709772
def list_ec2(region, filter_by_kwargs):
    """"""
    conn = boto.ec2.connect_to_region(region)
    instances = conn.get_only_instances()
    return lookup(instances, filter_by=filter_by_kwargs)
726630
def list_streams(self):
        
        # Server does not do pagination on listings of this resource.
        # Return an iterator anyway for similarity with other API methods
        path = '/archive/{}/streams'.format(self._instance)
        response = self._client.get_proto(path=path)
        message = rest_pb2.ListStreamsResponse()
        message.ParseFromString(response.content)
        streams = getattr(message, 'stream')
        return iter([Stream(stream) for stream in streams])
1180513
def list_nic(self, instance_id):
        """"""
        output = self.client.describe_instances(InstanceIds=[instance_id])
        output = output.get("Reservations")[0].get("Instances")[0]
        return output.get("NetworkInterfaces")
108934
def list(gandi, resource):
    """"""
    keys = gandi.dnssec.list(resource)
    gandi.pretty_echo(keys)

    return keys
238729
def list_instance_profiles(path_prefix='/', region=None, key=None,
                           keyid=None, profile=None):
    '''
    
    '''
    p = get_all_instance_profiles(path_prefix, region, key, keyid, profile)
    return [i['instance_profile_name'] for i in p]
752774
def instances(self):
        
        # It would be more efficient to do this with filters now
        # but not all services that implement EC2 API support filters.
        instances = []
        rs = self.connection.get_all_instances()
        for reservation in rs:
            uses_group = [g.name for g in reservation.groups if g.name == self.name]
            if uses_group:
                instances.extend(reservation.instances)
        return instances
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())}
755212
def list_buckets(self, instance):
        
        # Server does not do pagination on listings of this resource.
        # Return an iterator anyway for similarity with other API methods
        response = self._client.get_proto(path='/buckets/' + instance)
        message = rest_pb2.ListBucketsResponse()
        message.ParseFromString(response.content)
        buckets = getattr(message, 'bucket')
        return iter([
            Bucket(bucket, instance, self) for bucket in buckets])
1171851
def list_resource_groups(access_token, subscription_id):
    '''
    '''
    endpoint = ''.join([get_rm_endpoint(),
                        '/subscriptions/', subscription_id,
                        '/resourceGroups/',
                        '?api-version=', RESOURCE_API])
    return do_get(endpoint, access_token)
409598
def ListGrrUsers(self):
    """"""

    args = user_management_pb2.ApiListGrrUsersArgs()

    items = self._context.SendIteratorRequest("ListGrrUsers", args)
    return utils.MapItemsIterator(
        lambda data: GrrUser(data=data, context=self._context), items)
1177038
def describe_instances(self, *instance_ids):
        """"""
        instances = {}
        for pos, instance_id in enumerate(instance_ids):
            instances["InstanceId.%d" % (pos + 1)] = instance_id
        query = self.query_factory(
            action="DescribeInstances", creds=self.creds,
            endpoint=self.endpoint, other_params=instances)
        d = query.submit()
        return d.addCallback(self.parser.describe_instances)
813825
def list(cls, options=None, target=None):
        
        options = options or {}

        result = []
        if not target or target == 'paas':
            for profile in cls.safe_call('paas.snapshotprofile.list', options):
                profile['target'] = 'paas'
                result.append((profile['id'], profile))

        if not target or target == 'vm':
            for profile in cls.safe_call('hosting.snapshotprofile.list',
                                         options):
                profile['target'] = 'vm'
                result.append((profile['id'], profile))

        result = sorted(result, key=lambda item: item[0])
        return [profile for id_, profile in result]
402085
def instances_set(self, root, reservation):
        
        instances = []
        for instance_data in root.find("instancesSet"):
            instances.append(self.instance(instance_data, reservation))
        return instances
214333
def scheduling_block_instances(self):
        """"""
        # TODO(BMo) change this to a pipe?
        sbi_list = SchedulingBlockInstanceList()
        return json.dumps(dict(active=sbi_list.active,
                               completed=sbi_list.completed,
                               aborted=sbi_list.aborted))
485625
def list_processors(self, instance=None):
        
        # Server does not do pagination on listings of this resource.
        # Return an iterator anyway for similarity with other API methods
        url = '/processors'
        if instance:
            url += '/' + instance
        response = self.get_proto(path=url)
        message = rest_pb2.ListProcessorsResponse()
        message.ParseFromString(response.content)
        processors = getattr(message, 'processor')
        return iter([Processor(processor) for processor in processors])
784708
def query_instances(session, client=None, **query):
    
    if client is None:
        client = session.client('ec2')
    p = client.get_paginator('describe_instances')
    results = p.paginate(**query)
    return list(itertools.chain(
        *[r["Instances"] for r in itertools.chain(
            *[pp['Reservations'] for pp in results])]))