// CreateLabelMapping creates a new Label mapping.
516647
func (s *LabelService) CreateLabelMapping(ctx context.Context, m *platform.LabelMapping) error {
	return s.CreateLabelMappingFn(ctx, m)
}
1210646
func (f *Field) AddLabelClass(class string) FieldInterface {
	f.labelClass = append(f.labelClass, class)
	return f
}
1242765
func (s *Service) DeleteLabelMapping(ctx context.Context, m *influxdb.LabelMapping) error {
	s.labelMappingKV.Delete(encodeLabelMappingKey(m))
	return nil
}
436418
func NewMap(name string, mapType MapType, keySize int, valueSize int, maxEntries int, flags uint32, innerID uint32, dumpParser DumpParser) *Map {
	m := &Map{
		MapInfo: MapInfo{
			MapType:       mapType,
			KeySize:       uint32(keySize),
			ValueSize:     uint32(valueSize),
			MaxEntries:    uint32(maxEntries),
			Flags:         flags,
			InnerID:       innerID,
			OwnerProgType: ProgTypeUnspec,
		},
		name:       path.Base(name),
		dumpParser: dumpParser,
	}
	return m
}
321450
func makeLabels(labelNames []string, labelValsCombined string) map[string]string {
	tags := make(map[string]string)
	labelVals := strings.Split(labelValsCombined, ".")
	for i, v := range labelVals {
		tags[labelNames[i]] = v
	}
	return tags
}
307126
func NewLabel(LabelName node.Node) *Label {
	return &Label{
		FreeFloating: nil,
		LabelName:    LabelName,
	}
}
89217
func NewLabelController(service *goa.Service, db application.DB, config LabelControllerConfiguration) *LabelController {
	return &LabelController{
		Controller: service.NewController("LabelController"),
		db:         db,
		config:     config}
}
1341204
func AddLabel(labels map[string]string, labelKey, labelValue string) map[string]string {
	if labelKey == "" {
		// Don't need to add a label.
		return labels
	}
	if labels == nil {
		labels = make(map[string]string)
	}
	labels[labelKey] = labelValue
	return labels
}
265778
func WithCreateLabels(labels map[string]string) CreateOption {
	return func(cfg *CreateConfig) {
		cfg.Labels = labels
	}
}
1216583
func NewMapInjector(tagname string, data map[string]interface{}) app.Injector {
	return app.Injector(MapInjector{
		tagname: tagname,
		data:    data,
	})
}
1261236
func (s *LabelService) CreateLabel(ctx context.Context, l *platform.Label) error {
	return s.CreateLabelFn(ctx, l)
}
163731
func datapointLabelsByName(s store.Store) map[string][]datapointLabels {
	rval := map[string][]datapointLabels{}

	for _, obj := range s.Objects() {
		m, ok := obj.(producers.MetricsMessage)
		if !ok {
			promLog.Warnf("Unsupported message type %T", obj)
			continue
		}

		// For each datapoint, collect its labels and add an entry to rval.
		dims := dimsToMap(m.Dimensions)
		for _, d := range m.Datapoints {
			labels := map[string]string{}
			for k, v := range dims {
				labels[k] = v
			}
			for k, v := range d.Tags {
				labels[k] = v
			}
			rval[d.Name] = append(rval[d.Name], datapointLabels{&d, labels})
		}
	}

	return rval
}
1198108
func (p *PortMapping) AddLabel(name, value string) *PortMapping {
	if p.Labels == nil {
		p.EmptyLabels()
	}
	(*p.Labels)[name] = value

	return p
}
877361
func (s *Service) NewMapping(w http.ResponseWriter, r *http.Request) {
	var req mappingsRequest
	if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
		invalidJSON(w, s.Logger)
		return
	}

	if err := req.Valid(); err != nil {
		invalidData(w, err, s.Logger)
		return
	}

	ctx := r.Context()

	// validate that the organization exists
	if !s.organizationExists(ctx, req.Organization) {
		invalidData(w, fmt.Errorf("organization does not exist"), s.Logger)
		return
	}

	mapping := &chronograf.Mapping{
		Organization:         req.Organization,
		Scheme:               req.Scheme,
		Provider:             req.Provider,
		ProviderOrganization: req.ProviderOrganization,
	}

	m, err := s.Store.Mappings(ctx).Add(ctx, mapping)
	if err != nil {
		Error(w, http.StatusInternalServerError, "failed to add mapping to database", s.Logger)
		return
	}

	cu := newMappingResponse(*m)
	location(w, cu.Links.Self)
	encodeJSON(w, http.StatusCreated, cu, s.Logger)
}
53307
func NewLabels(labels ...*Label) error {
	_, err := x.Insert(labels)
	return err
}
580059
func ConvertLabelSimple(request *http.Request, labelID interface{}) *app.GenericData {
	i := fmt.Sprint(labelID)
	return &app.GenericData{
		Type: ptr.String(label.APIStringTypeLabels),
		ID:   &i,
	}
}
880106
func (p *Pod) AddLabel(key, value string) *Pod {
	p.Labels[key] = value
	return p
}