Lists the instances.

        Instances are returned in lexicographical order.

        :rtype: ~collections.Iterable[.Instance]
558438
def list_instances(self):
        
        # Server does not do pagination on listings of this resource.
        # Return an iterator anyway for similarity with other API methods
        response = self.get_proto(path='/instances')
        message = rest_pb2.ListInstancesResponse()
        message.ParseFromString(response.content)
        instances = getattr(message, 'instance')
        return iter([Instance(instance) for instance in instances])
1316192
def next(self):
        
        if self.row < self.data.num_instances:
            index = self.row
            self.row += 1
            return self.data.get_instance(index)
        else:
            raise StopIteration()
1028595
def db_aws_list_instances(self):
        '''  '''
        instances = self.db_services.get_db_instances()
        if not instances:
            print("There are no DB instances associated with your AWS account " \
                "in region " + self.db_services.get_region())
        else:
            print("Here are the current DB instances associated with your AWS " \
                "account in region " + self.db_services.get_region())
            for dbinst in instances:
                print '\t'+'-'*20
                print "\tInstance ID: " + dbinst.id
                print "\tStatus: " + dbinst.status
750916
def __GetInstances(self, group_name = None, state_filter=None):
    
    all_instances = self.ec2.get_all_instances()
    instances = []
    for res in all_instances:
      for group in res.groups:
        if group_name and group.name != group_name:
          continue
        for instance in res.instances:
          if state_filter == None or instance.state == state_filter:
            instances.append(instance)
    return instances
220046
def show_instance(name, call=None):
    '''
    
    '''
    response = _query('grid', 'server/get', args={'name': name})
    ret = {}
    for item in response['list']:
        name = item['name']
        ret[name] = item

        ret[name]['image_info'] = item['image']
        ret[name]['image'] = item['image']['friendlyName']
        ret[name]['size'] = item['ram']['name']
        ret[name]['public_ips'] = [item['ip']['ip']]
        ret[name]['private_ips'] = []
        ret[name]['state_info'] = item['state']
        if 'active' in item['state']['description']:
            ret[name]['state'] = 'RUNNING'
    return ret
572613
def iterargs(self):
    
    iterargs = OrderedDict()
    for name in self._iterargs:
      plural = self._profile.iterargs[name]
      iterargs[name] = tuple(self._values[plural])
    return iterargs
1088725
def DbGetInstanceNameList(self, argin):
        
        self._log.debug("In DbGetInstanceNameList()")
        return self.db.get_instance_name_list(argin)
402085
def instances_set(self, root, reservation):
        
        instances = []
        for instance_data in root.find("instancesSet"):
            instances.append(self.instance(instance_data, reservation))
        return instances
861663
async def get_instances(self, **kwargs) -> List[ApiResource]:
        """"""
        raw_resources = await self.get_resources(**kwargs)
        _instances = [
            self._resource_factory(_raw)
            for _raw in self._loop_raw(raw_resources)
        ]
        return _instances
772968
def records(self):
        
        return [self._records[i] for i in range(len(self._records))]
1026507
def ec2_instances():
    ""
    region = boto.ec2.get_region(REGION)
    reservations = region.connect().get_all_instances()
    instances = []
    for reservation in reservations:
        instances += reservation.instances
    return instances
976669
def to_list(self):
        '''
        '''
        if self.closed():
            raise ValueError("Attempt to call to_list() on a closed Queryable.")

        # Maybe use with closable(self) construct to achieve this.
        if isinstance(self._iterable, list):
            return self._iterable
        lst = list(self)
        # Ideally we would close here. Why can't we - what is the problem?
        #self.close()
        return lst
890119
public List<Instance> listInstances() {
    // [START instance_admin_client_list_instances]
    List<Instance> instances =
        Lists.newArrayList(instanceAdminClient.listInstances(Options.pageSize(1)).iterateAll());
    // [END instance_admin_client_list_instances]
    return instances;
  }
695078
def iter_instances(self):
        
        for wrkey in set(self.keys()):
            obj = self.get(wrkey)
            if obj is None:
                continue
            yield wrkey, obj
1292775
def _get_instances(cls, path, context=None, site=None, language=None):
        
        backend_context = {'view_context': context }

        for model in cls._meta.models.values():
            for instance in model.objects.get_instances(path, site, language, backend_context) or []:
                if hasattr(instance, '_process_context'):
                    instance._process_context(backend_context)
                yield instance
115363
private void displayInstances(PrintStream outps, Iterable<ServerInstanceLogRecordList> repResults) {
        boolean isZOS = false;
        ArrayList<DisplayInstance> unsortedInstances = new ArrayList<DisplayInstance>();

        Comparator<DisplayInstance> comparator = new Comparator<DisplayInstance>() {
            @Override
            public int compare(DisplayInstance serverList1, DisplayInstance serverList2) {
                long time1 = serverList1.getValue();
                long time2 = serverList2.getValue();

                if (time1 < time2) {
                    return -1;
                } else if (time1 > time2) {
                    return 1;
                }

                return 0;
            }
        };

        //setup spaces
        char[] spacesAr = new char[MAX_ZCOLUMN_SIZE]; //choose the larger of the two
        for (int i = 0; i < spacesAr.length; i++) {
            spacesAr[i] = ' ';
        }
        spaces = new String(spacesAr);

        //gather all the instances and convert to a display object
        for (ServerInstanceLogRecordList list : repResults) {
            //determine platform
            isZOS = "Y".equalsIgnoreCase(list.getHeader().getProperty(ServerInstanceLogRecordList.HEADER_ISZOS));

            ArrayList<DisplayInstance> kidResult = new ArrayList<DisplayInstance>();

            long kidTimeStamp = collectAllKids(kidResult, list);

            //if kids exist or current instance has records
            if (kidTimeStamp > 0) {
                if (list.iterator().next() == null) {
                    //if the current instance doesn't have any records, it won't be displayed. A timestamp
                    //still needs to be provided so that the instance can be sorted accordingly if it has kids,
                    //so provide the kid's timestamp
                    unsortedInstances.add(new DisplayInstance("", "", kidTimeStamp, kidResult));
                } else {
                    long timestamp = list.getStartTime().getTime();
                    unsortedInstances.add(new DisplayInstance(Long.toString(timestamp), "", timestamp, kidResult));
                }
            }
        }

        printInstances(unsortedInstances, comparator, false, isZOS);
    }
1179854
def list_commands(self, **kwargs):
        
        commands = self._commands

        command_id = kwargs.get('CommandId', None)
        if command_id:
            commands = [self.get_command_by_id(command_id)]
        instance_id = kwargs.get('InstanceId', None)
        if instance_id:
            commands = self.get_commands_by_instance_id(instance_id)

        return {
            'Commands': [command.response_object() for command in commands]
        }