// Get all the VDI instances with the given label.
422546
func (_class VDIClass) GetByNameLabel(sessionID SessionRef, label string) (_retval []VDIRef, _err error) {
	_method := "VDI.get_by_name_label"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_labelArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "label"), label)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _labelArg)
	if _err != nil {
		return
	}
	_retval, _err = convertVDIRefSetToGo(_method + " -> ", _result.Value)
	return
}
102727
func (_class PVSSiteClass) GetByNameLabel(sessionID SessionRef, label string) (_retval []PVSSiteRef, _err error) {
	_method := "PVS_site.get_by_name_label"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_labelArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "label"), label)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _labelArg)
	if _err != nil {
		return
	}
	_retval, _err = convertPVSSiteRefSetToGo(_method + " -> ", _result.Value)
	return
}
1317314
func (_class HostClass) GetByNameLabel(sessionID SessionRef, label string) (_retval []HostRef, _err error) {
	_method := "host.get_by_name_label"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_labelArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "label"), label)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _labelArg)
	if _err != nil {
		return
	}
	_retval, _err = convertHostRefSetToGo(_method + " -> ", _result.Value)
	return
}
1148638
func (c *Client) GetGroupByLabel(label string) (common.Group, error) {
	groups, _ := c.GetGroups()
	for _, dev := range groups {
		if label == dev.GetLabel() {
			return dev, nil
		}
	}

	var timeout <-chan time.Time
	if c.timeout > 0 {
		timeout = time.After(c.timeout)
	} else {
		timeout = make(<-chan time.Time)
	}

	sub := c.protocol.Subscribe()
	defer func() {
		if err := sub.Close(); err != nil {
			common.Log.Warnf("Failed closing group subscription: %+v", err)
		}
	}()
	events := sub.Events()

	for {
		select {
		case event, ok := <-events:
			if !ok {
				return nil, common.ErrClosed
			}
			switch event := event.(type) {
			case common.EventNewGroup:
				if label == event.Group.GetLabel() {
					return event.Group, nil
				}
			}
		case <-timeout:
			return nil, common.ErrNotFound
		}
	}
}
627681
func (_class NetworkClass) GetByNameLabel(sessionID SessionRef, label string) (_retval []NetworkRef, _err error) {
	_method := "network.get_by_name_label"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_labelArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "label"), label)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _labelArg)
	if _err != nil {
		return
	}
	_retval, _err = convertNetworkRefSetToGo(_method + " -> ", _result.Value)
	return
}
1133329
func (b *Board) GetLabels(args Arguments) (labels []*Label, err error) {
	path := fmt.Sprintf("boards/%s/labels", b.ID)
	err = b.client.Get(path, args, &labels)
	return
}
470509
func (_class VMApplianceClass) GetByNameLabel(sessionID SessionRef, label string) (_retval []VMApplianceRef, _err error) {
	_method := "VM_appliance.get_by_name_label"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_labelArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "label"), label)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _labelArg)
	if _err != nil {
		return
	}
	_retval, _err = convertVMApplianceRefSetToGo(_method + " -> ", _result.Value)
	return
}
908027
func (_class VIFClass) GetAllRecords(sessionID SessionRef) (_retval map[VIFRef]VIFRecord, _err error) {
	_method := "VIF.get_all_records"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg)
	if _err != nil {
		return
	}
	_retval, _err = convertVIFRefToVIFRecordMapToGo(_method + " -> ", _result.Value)
	return
}
1295354
func (u *User) GetAvatarByLabel(label string) (avatar Avatar, err error) {
	for _, avatar = range u.Avatars {
		if avatar.Label == label {
			return
		}
	}
	err = errors.New("Could not find Avatar with Label " + label)
	return
}
285996
func (l Labels) Clone() Labels {
	if l == nil {
		return nil
	}
	out := make(Labels, len(l))
	for key, vals := range l {
		cvals := make([]string, len(vals))
		copy(cvals, vals)
		out[key] = cvals
	}
	return out
}
284274
func (l Labels) Get(name string) (val string, ok bool) {
	for _, lbl := range l {
		if lbl.Name.String() == name {
			return lbl.Value, true
		}
	}
	return "", false
}
359383
func (s *Service) FindLabels(ctx context.Context, filter influxdb.LabelFilter, opt ...influxdb.FindOptions) ([]*influxdb.Label, error) {
	ls := []*influxdb.Label{}
	err := s.kv.View(ctx, func(tx Tx) error {
		labels, err := s.findLabels(ctx, tx, filter)
		if err != nil {
			return err
		}
		ls = labels
		return nil
	})

	if err != nil {
		return nil, err
	}

	return ls, nil
}
927682
func (v *VirtualIPManager) GetAll() (ips []IP) {
	cmd := exec.Command("ip", "-o", "a", "show", "label", fmt.Sprintf("*:%s*", v.label))
	stdout, _ := cmd.StdoutPipe()

	cmd.Start()
	defer cmd.Wait()

	scanner := bufio.NewScanner(stdout)
	for scanner.Scan() {
		if ip := v.loadIP(scanner.Bytes()); ip != nil {
			ips = append(ips, *ip)
		}
	}

	return
}
445414
func getLabelNames(datapointsLabels []datapointLabels) []string {
	// Collect all label names used among datapointsLabels.
	nameMap := map[string]bool{}
	for _, kv := range datapointsLabels {
		for k := range kv.labels {
			nameMap[k] = true
		}
	}

	// Return a slice of nameMap keys.
	names := []string{}
	for n := range nameMap {
		names = append(names, n)
	}
	return names
}
1365159
func (_class VBDClass) GetAll(sessionID SessionRef) (_retval []VBDRef, _err error) {
	_method := "VBD.get_all"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg)
	if _err != nil {
		return
	}
	_retval, _err = convertVBDRefSetToGo(_method + " -> ", _result.Value)
	return
}
223634
func (c *Client) GetLightByLabel(label string) (common.Light, error) {
	dev, err := c.GetDeviceByLabel(label)
	if err != nil {
		return nil, err
	}

	light, ok := dev.(common.Light)
	if !ok {
		return nil, common.ErrDeviceInvalidType
	}

	return light, nil
}
1323359
func (s *Service) FindLabels(ctx context.Context, filter influxdb.LabelFilter, opt ...influxdb.FindOptions) ([]*influxdb.Label, error) {
	filterFunc := func(label *influxdb.Label) bool {
		return (filter.Name == "" || (filter.Name == label.Name))
	}

	labels, err := s.filterLabels(ctx, filterFunc)
	if err != nil {
		return nil, err
	}

	return labels, nil
}