// PutLabel creates a label from the provided struct, without generating a new ID.
422944
func (c *Client) PutLabel(ctx context.Context, l *influxdb.Label) error {
	return c.db.Update(func(tx *bolt.Tx) error {
		var err error
		pe := c.putLabel(ctx, tx, l)
		if pe != nil {
			err = pe
		}
		return err
	})
}
97673
func (s *DeleteLabelsInput) SetLabels(v []*string) *DeleteLabelsInput {
	s.Labels = v
	return s
}
396590
func (s *Service) UpdateLabel(ctx context.Context, id influxdb.ID, upd influxdb.LabelUpdate) (*influxdb.Label, error) {
	label, err := s.FindLabelByID(ctx, id)
	if err != nil {
		return nil, &influxdb.Error{
			Code: influxdb.ENotFound,
			Op:   OpPrefix + influxdb.OpUpdateLabel,
			Msg:  influxdb.ErrLabelNotFound,
		}
	}

	if len(upd.Properties) > 0 && label.Properties == nil {
		label.Properties = make(map[string]string)
	}

	for k, v := range upd.Properties {
		if v == "" {
			delete(label.Properties, k)
		} else {
			label.Properties[k] = v
		}
	}

	if upd.Name != "" {
		label.Name = upd.Name
	}

	if err := label.Validate(); err != nil {
		return nil, &influxdb.Error{
			Code: influxdb.EInvalid,
			Op:   OpPrefix + influxdb.OpUpdateLabel,
			Err:  err,
		}
	}

	s.labelKV.Store(label.ID.String(), *label)

	return label, nil
}
1070303
func (c *Client) putLabel(ctx context.Context, tx *bolt.Tx, l *influxdb.Label) error {
	v, err := json.Marshal(l)
	if err != nil {
		return &influxdb.Error{
			Err: err,
		}
	}

	encodedID, err := l.ID.Encode()
	if err != nil {
		return &influxdb.Error{
			Err: err,
		}
	}

	if err := tx.Bucket(labelBucket).Put(encodedID, v); err != nil {
		return &influxdb.Error{
			Err: err,
		}
	}

	return nil
}
1264973
func (s *ModifyHapgInput) SetLabel(v string) *ModifyHapgInput {
	s.Label = &v
	return s
}
214812
func (s *GetLabelDetectionOutput) SetLabels(v []*LabelDetection) *GetLabelDetectionOutput {
	s.Labels = v
	return s
}
813769
func (l Labels) upsertLabel(label Label) bool {
	oldLabel, found := l[label.Key]
	if found {
		// Key is the same, check if Value and Source are also the same
		if label.Value == oldLabel.Value && label.Source == oldLabel.Source {
			return false // No change
		}
	}
	// Insert or replace old label
	l[label.Key] = label
	return true
}
1004788
func (s *CreateApplicationOutput) SetLabels(v []*string) *CreateApplicationOutput {
	s.Labels = v
	return s
}
470132
func WithLabel(label string) EnrollmentOption {
	return func(o *enrollmentOptions) error {
		o.label = label
		return nil
	}
}
700358
func (p *Pod) SetLabels(labels map[string]string) *Pod {
	p.Labels = labels
	return p
}
972597
func (s *StreamDescription) SetStreamLabel(v string) *StreamDescription {
	s.StreamLabel = &v
	return s
}
230086
func (s *Cluster) SetReleaseLabel(v string) *Cluster {
	s.ReleaseLabel = &v
	return s
}
842351
func (p *Profile) SetLabel(key string, value []string) {
	for _, sample := range p.Sample {
		if sample.Label == nil {
			sample.Label = map[string][]string{key: value}
		} else {
			sample.Label[key] = value
		}
	}
}
609873
func (s *CreateHapgInput) SetLabel(v string) *CreateHapgInput {
	s.Label = &v
	return s
}
1248377
func (s *MetricDataResult) SetLabel(v string) *MetricDataResult {
	s.Label = &v
	return s
}
890030
func (b *Button) SetLabel(label string) *Button {
	b.label = label
	return b
}
300457
func (s *UpdateApplicationOutput) SetLabels(v []*string) *UpdateApplicationOutput {
	s.Labels = v
	return s
}