Show the details from Parallels concerning an instance
979988
def show_instance(name, call=None):
    '''
    
    '''
    if call != 'action':
        raise SaltCloudSystemExit(
            'The show_instance action must be called with -a or --action.'
        )

    items = query(action='ve', command=name)

    ret = {}
    for item in items:
        if 'text' in item.__dict__:
            ret[item.tag] = item.text
        else:
            ret[item.tag] = item.attrib

        if item._children:
            ret[item.tag] = {}
            children = item._children
            for child in children:
                ret[item.tag][child.tag] = child.attrib

    __utils__['cloud.cache_node'](ret, __active_provider_name__, __opts__)
    return ret
876729
def show(only_path=False):
    """"""
    logger.setLevel(logging.INFO)
    infos = ["\n", f'Instance path: "{current_app.instance_path}"']

    logger.info("\n  ".join(infos))

    if not only_path:
        log_config(current_app.config)
858861
def _show_details(self):
        """"""
        if self.details.isVisible():
            self.details.hide()
            self.details_btn.setText(_('Show details'))
        else:
            self.resize(570, 700)
            self.details.document().setPlainText('')
            self.details.append_text_to_shell(self.error_traceback,
                                              error=True,
                                              prompt=False)
            self.details.show()
            self.details_btn.setText(_('Hide details'))
260719
def get_instances(feature_name):
        """"""
        feats = []
        for ft in AncillaryFeature.features:
            if ft.feature_name == feature_name:
                feats.append(ft)
        return feats
742475
function listInstances(search_opts, callback) {
    if (arguments.length === 1) {
        callback = search_opts;
        search_opts = {};
    }

    var uri = '/instances?' + qs.stringify(search_opts);
    return (this.get(uri, callback));
}
744562
function getInstanceDetails (id) {
  const instance = instanceMap.get(id)
  if (!instance) {
    const vnode = findInstanceOrVnode(id)

    if (!vnode) return {}

    const data = {
      id,
      name: getComponentName(vnode.fnOptions),
      file: vnode.fnOptions.__file || null,
      state: processProps({ $options: vnode.fnOptions, ...(vnode.devtoolsMeta && vnode.devtoolsMeta.renderContext.props) }),
      functional: true
    }

    return data
  } else {
    const data = {
      id: id,
      name: getInstanceName(instance),
      state: getInstanceState(instance)
    }

    let i
    if ((i = instance.$vnode) && (i = i.componentOptions) && (i = i.Ctor) && (i = i.options)) {
      data.file = i.__file || null
    }

    return data
  }
}
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)
1292615
def p_instance_or(self, p):
        ''
        instancelist = []
        for instance_name, instance_ports, instance_array in p[3]:
            instancelist.append(Instance(p[1], instance_name, instance_ports,
                                         p[2], instance_array, lineno=p.lineno(1)))
        p[0] = InstanceList(p[1], p[2], tuple(
            instancelist), lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
833218
private CloudInstance getCloudInstanceDetails(String account,
                                                  Instance currInstance, Map<String, String> autoScaleMap, CloudInstanceRepository repository) {

        long lastUpdated = System.currentTimeMillis();
        CloudInstance instance = repository.findByInstanceId(currInstance.getInstanceId());
        if (instance != null) {
            lastUpdated = instance.getLastUpdatedDate();
        }
        CloudInstance object = new CloudInstance();
        object.setAccountNumber(account);
        object.setLastUpdatedDate(System.currentTimeMillis());
        object.setAge(getInstanceAge(currInstance));
        object.setCpuUtilization(getInstanceCPUSinceLastRun(currInstance.getInstanceId(), lastUpdated));
        object.setIsTagged(isInstanceTagged(currInstance));
        object.setIsStopped(isInstanceStopped(currInstance));
        object.setNetworkIn(getLastHourInstanceNetworkIn(currInstance.getInstanceId(), lastUpdated));
        object.setNetworkOut(getLastHourIntanceNetworkOut(currInstance.getInstanceId(), lastUpdated));
        object.setDiskRead(getLastHourInstanceDiskRead(currInstance.getInstanceId(), lastUpdated));
        object.setDiskWrite(getLastInstanceHourDiskWrite(currInstance.getInstanceId()));
        // rest of the details
        object.setImageId(currInstance.getImageId());
        object.setInstanceId(currInstance.getInstanceId());
        object.setInstanceType(currInstance.getInstanceType());
        object.setIsMonitored("enabled".equalsIgnoreCase(currInstance.getMonitoring().getState()));
        object.setPrivateDns(currInstance.getPrivateDnsName());
        object.setPrivateIp(currInstance.getPrivateIpAddress());
        object.setPublicDns(currInstance.getPublicDnsName());
        object.setPublicIp(currInstance.getPublicIpAddress());
        object.setVirtualNetworkId(currInstance.getVpcId());
        object.setRootDeviceName(currInstance.getRootDeviceName());
        object.setSubnetId(currInstance.getSubnetId());
        object.setAutoScaleName(autoScaleMap.getOrDefault(currInstance.getInstanceId(), "NONE"));
        object.setLastAction("ADD");
        List<Tag> tags = currInstance.getTags();

        if (!CollectionUtils.isEmpty(tags)) {
            for (Tag tag : tags) {
                NameValue nv = new NameValue(tag.getKey(), tag.getValue());
                object.getTags().add(nv);
            }
        }
        List<GroupIdentifier> groups = currInstance.getSecurityGroups();
        for (GroupIdentifier gi : groups) {
            object.addSecurityGroups(gi.getGroupName());
        }

        return object;
    }
971658
def display_info(self):
        """"""

        if self.moc is None:
            print('No MOC information present')
            return

        if self.moc.name is not None:
            print('Name:', self.moc.name)
        if self.moc.id is not None:
            print('Identifier:', self.moc.id)
        print('Order:', self.moc.order)
        print('Cells:', self.moc.cells)
        print('Area:', self.moc.area_sq_deg, 'square degrees')
311133
def _extract_instance_info(instances):
    '''
    
    '''
    ret = {}
    for instance in instances:
        # items could be type dict or list (for stopped EC2 instances)
        if isinstance(instance['instancesSet']['item'], list):
            for item in instance['instancesSet']['item']:
                name = _extract_name_tag(item)
                ret[name] = item
                ret[name]['name'] = name
                ret[name].update(
                    dict(
                        id=item['instanceId'],
                        image=item['imageId'],
                        size=item['instanceType'],
                        state=item['instanceState']['name'],
                        private_ips=item.get('privateIpAddress', []),
                        public_ips=item.get('ipAddress', [])
                    )
                )
        else:
            item = instance['instancesSet']['item']
            name = _extract_name_tag(item)
            ret[name] = item
            ret[name]['name'] = name
            ret[name].update(
                dict(
                    id=item['instanceId'],
                    image=item['imageId'],
                    size=item['instanceType'],
                    state=item['instanceState']['name'],
                    private_ips=item.get('privateIpAddress', []),
                    public_ips=item.get('ipAddress', [])
                )
            )

    return ret
1361367
def show_objects(self):
        '''  '''
        for key in self.nodes:
            node = self.nodes[key]
            value = node.obj
            print(key, '-', repr(value), '-', node)
1249841
def show_hbonds(self):
        """"""
        grp = self.getPseudoBondGroup("Hydrogen Bonds-%i" % self.tid, associateWith=[self.model])
        grp.lineWidth = 3
        for i in self.plcomplex.hbonds.ldon_id:
            b = grp.newPseudoBond(self.atoms[i[0]], self.atoms[i[1]])
            b.color = self.colorbyname('blue')
            self.bs_res_ids.append(i[0])
        for i in self.plcomplex.hbonds.pdon_id:
            b = grp.newPseudoBond(self.atoms[i[0]], self.atoms[i[1]])
            b.color = self.colorbyname('blue')
            self.bs_res_ids.append(i[1])
1252713
def show_ver(**kwargs):
    '''
    
    '''
    command = 'show version'
    info = ''
    info = show(command, **kwargs)
    if isinstance(info, list):
        info = info[0]
    return info
150080
def show(name):
    '''
    
    '''
    ret = {}
    ret['enabled'] = False
    ret['disabled'] = True
    ret['running'] = False
    ret['service_path'] = None
    ret['autostart'] = False
    ret['command_path'] = None

    ret['available'] = available(name)
    if not ret['available']:
        return ret

    ret['enabled'] = enabled(name)
    ret['disabled'] = not ret['enabled']
    ret['running'] = status(name)
    ret['autostart'] = status_autostart(name)
    ret['service_path'] = _get_svc_path(name)[0]
    if ret['service_path']:
        ret['command_path'] = os.path.join(ret['service_path'], 'run')

    # XXX provide info about alias ?

    return ret
340003
async def detail(self, **kwargs):
        '''
        
        '''
        try:
            pk = self.pk_type(kwargs.get('pk'))
            obj = await self._meta.object_class.find_one(self.db, {self.pk: pk})
            if obj:
                return await obj.serialize()
            raise NotFound('Object matching the given {} with value {} was not found'.format(self.pk, str(pk)))
        except InvalidId:
            raise NotFound('Invalid ID')
662375
def _get_real_instance_if_mismatch(vpc_info, ipaddr, instance, eni):
    
    # Careful! A route may be a black-hole route, which still has instance and
    # ENI information for an instance that doesn't exist anymore. If a host was
    # terminated and a new host got the same IP then this route won't be
    # updated and will keep pointing to a non-existing node. So we find the
    # instance by IP and check that the route really points to this instance.
    inst_id = instance.id if instance else ""
    eni_id  = eni.id if eni else ""
    if ipaddr:
        real_instance, real_eni = \
                        find_instance_and_eni_by_ip(vpc_info, ipaddr)
        if real_instance.id != inst_id  or real_eni.id != eni_id:
            return real_instance
    return None