// ExtraAttributes returns the user-defined extra attributes (labels,
// environment variables) in key-value format. This can be used by log drivers
// that support metadata to add more context to a log.
515938
func (info *Info) ExtraAttributes(keyMod func(string) string) (map[string]string, error) {
	extra := make(map[string]string)
	labels, ok := info.Config["labels"]
	if ok && len(labels) > 0 {
		for _, l := range strings.Split(labels, ",") {
			if v, ok := info.ContainerLabels[l]; ok {
				if keyMod != nil {
					l = keyMod(l)
				}
				extra[l] = v
			}
		}
	}

	labelsRegex, ok := info.Config["labels-regex"]
	if ok && len(labels) > 0 {
		re, err := regexp.Compile(labelsRegex)
		if err != nil {
			return nil, err
		}
		for k, v := range info.ContainerLabels {
			if re.MatchString(k) {
				if keyMod != nil {
					k = keyMod(k)
				}
				extra[k] = v
			}
		}
	}

	envMapping := make(map[string]string)
	for _, e := range info.ContainerEnv {
		if kv := strings.SplitN(e, "=", 2); len(kv) == 2 {
			envMapping[kv[0]] = kv[1]
		}
	}

	env, ok := info.Config["env"]
	if ok && len(env) > 0 {
		for _, l := range strings.Split(env, ",") {
			if v, ok := envMapping[l]; ok {
				if keyMod != nil {
					l = keyMod(l)
				}
				extra[l] = v
			}
		}
	}

	envRegex, ok := info.Config["env-regex"]
	if ok && len(envRegex) > 0 {
		re, err := regexp.Compile(envRegex)
		if err != nil {
			return nil, err
		}
		for k, v := range envMapping {
			if re.MatchString(k) {
				if keyMod != nil {
					k = keyMod(k)
				}
				extra[k] = v
			}
		}
	}

	return extra, nil
}
4087
func (m *Smart) getAttributes(acc telegraf.Accumulator, devices []string) {

	var wg sync.WaitGroup
	wg.Add(len(devices))

	for _, device := range devices {
		go gatherDisk(acc, m.UseSudo, m.Attributes, m.Path, m.Nocheck, device, &wg)
	}

	wg.Wait()
}
53620
func (s *Resource) SetAttributes(v map[string]*string) *Resource {
	s.Attributes = v
	return s
}
688268
func (s *CreateEndpointInput) SetExtraConnectionAttributes(v string) *CreateEndpointInput {
	s.ExtraConnectionAttributes = &v
	return s
}
329759
func (s *Endpoint) SetAttributes(v map[string]*string) *Endpoint {
	s.Attributes = v
	return s
}
843058
func (c *DOM) GetAttributes(nodeId int) ([]string, error) {
	var v DOMGetAttributesParams
	v.NodeId = nodeId
	return c.GetAttributesWithParams(&v)
}
950483
func (s *UpdatePlacementInput) SetAttributes(v map[string]*string) *UpdatePlacementInput {
	s.Attributes = v
	return s
}
711074
func (s *ListAttributesOutput) SetAttributes(v []*Attribute) *ListAttributesOutput {
	s.Attributes = v
	return s
}
53358
func (d *InstanceDiff) CopyAttributes() map[string]*ResourceAttrDiff {
	d.mu.Lock()
	defer d.mu.Unlock()

	attrs := make(map[string]*ResourceAttrDiff)
	for k, v := range d.Attributes {
		attrs[k] = v
	}

	return attrs
}
927853
func (a *AddRequest) Attribute(attrType string, attrVals []string) {
	a.Attributes = append(a.Attributes, Attribute{Type: attrType, Vals: attrVals})
}
968581
func (s *ThingDocument) SetAttributes(v map[string]*string) *ThingDocument {
	s.Attributes = v
	return s
}
450943
func (d *domainClient) GetAttributes(ctx context.Context, args *GetAttributesArgs) (reply *GetAttributesReply, err error) {
	reply = new(GetAttributesReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "DOM.getAttributes", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "DOM.getAttributes", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "DOM", Op: "GetAttributes", Err: err}
	}
	return
}
1271885
func (r Dns_Domain_Registration) GetExtendedAttributes(domainName *string) (resp []datatypes.Container_Dns_Domain_Registration_ExtendedAttribute, err error) {
	params := []interface{}{
		domainName,
	}
	err = r.Session.DoRequest("SoftLayer_Dns_Domain_Registration", "getExtendedAttributes", params, &r.Options, &resp)
	return
}
347389
func (m *Message) AddAttribute(k, v string) {
	m.Attributes = addAttribute(m.Attributes, k, v)
}
472363
func (f *FixedAttributeGroup) Attributes() []Attribute {
	ret := make([]Attribute, len(f.attributes))
	// Add Attributes
	for i, a := range f.attributes {
		ret[i] = a
	}
	return ret
}
394152
func EncodeExtendedAttributes(eas []ExtendedAttribute) ([]byte, error) {
	var buf bytes.Buffer
	for i := range eas {
		last := false
		if i == len(eas)-1 {
			last = true
		}

		err := writeEa(&buf, &eas[i], last)
		if err != nil {
			return nil, err
		}
	}
	return buf.Bytes(), nil
}
556619
func (s *PutAttributesInput) SetAttributes(v []*ReplaceableAttribute) *PutAttributesInput {
	s.Attributes = v
	return s
}