// tagsToMapRAM turns the list of RAM tags into a map.
498956
func tagsToMapRAM(ts []*ram.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnoredRAM(t) {
			result[aws.StringValue(t.Key)] = aws.StringValue(t.Value)
		}
	}

	return result
}
257456
func (m *UnpartitionedMemoryIdx) indexTags(def *schema.MetricDefinition) {
	tags, ok := m.tags[def.OrgId]
	if !ok {
		tags = make(TagIndex)
		m.tags[def.OrgId] = tags
	}

	for _, tag := range def.Tags {
		tagSplits := strings.SplitN(tag, "=", 2)
		if len(tagSplits) < 2 {
			// should never happen because every tag in the index
			// must have a valid format
			invalidTag.Inc()
			log.Errorf("memory-idx: Tag %q of id %q has an invalid format", tag, def.Id)
			continue
		}

		tagName := tagSplits[0]
		tagValue := tagSplits[1]
		tags.addTagId(tagName, tagValue, def.Id)
	}
	tags.addTagId("name", def.Name, def.Id)

	m.defByTagSet.add(def)
}
1340993
func tagsToMapDax(ts []*dax.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnoredDax(t) {
			result[*t.Key] = *t.Value
		}
	}

	return result
}
382160
func tagsToMapSfn(tags []*sfn.Tag) map[string]string {
	tagMap := make(map[string]string)
	for _, tag := range tags {
		if !tagIgnoredSfn(tag) {
			tagMap[aws.StringValue(tag.Key)] = aws.StringValue(tag.Value)
		}
	}

	return tagMap
}
151632
func diffTagsRAM(oldTags, newTags []*ram.Tag) ([]*ram.Tag, []*ram.Tag) {
	// First, we're creating everything we have
	create := make(map[string]interface{})
	for _, t := range newTags {
		create[aws.StringValue(t.Key)] = aws.StringValue(t.Value)
	}

	// Build the list of what to remove
	var remove []*ram.Tag
	for _, t := range oldTags {
		old, ok := create[aws.StringValue(t.Key)]
		if !ok || old != aws.StringValue(t.Value) {
			// Delete it!
			remove = append(remove, t)
		} else if ok {
			delete(create, aws.StringValue(t.Key))
		}
	}

	return tagsFromMapRAM(create), remove
}
424975
func valuesToMap(values map[string][]string) map[string]interface{} {
	ret := make(map[string]interface{})

	for key, value := range values {
		if len(value) > 0 {
			ret[key] = value[0]
		}
	}

	return ret
}
355039
func tagsFromMapDS(m map[string]interface{}) []*directoryservice.Tag {
	result := make([]*directoryservice.Tag, 0, len(m))
	for k, v := range m {
		t := &directoryservice.Tag{
			Key:   aws.String(k),
			Value: aws.String(v.(string)),
		}
		if !tagIgnoredDS(t) {
			result = append(result, t)
		}
	}

	return result
}
310526
func Tags(tags map[string]string) SpanOption {
	return func(t *Tracer, s *spanImpl) {
		for k, v := range tags {
			s.Tags[k] = v
		}
	}
}
734236
func tagsFromMapRoute53Resolver(m map[string]interface{}) []*route53resolver.Tag {
	result := make([]*route53resolver.Tag, 0, len(m))
	for k, v := range m {
		t := &route53resolver.Tag{
			Key:   aws.String(k),
			Value: aws.String(v.(string)),
		}
		if !tagIgnoredRoute53Resolver(t) {
			result = append(result, t)
		}
	}

	return result
}
1255179
func ParseTagSliceToMap(tags []string) map[string]string {
	mappedTags := make(map[string]string)
	for _, tag := range tags {
		splt := strings.SplitN(tag, ":", 2)
		if len(splt) < 2 {
			mappedTags[splt[0]] = ""
		} else {
			mappedTags[splt[0]] = splt[1]
		}
	}
	return mappedTags
}
682127
func tagsFromMapKMS(m map[string]interface{}) []*kms.Tag {
	result := make([]*kms.Tag, 0, len(m))
	for k, v := range m {
		t := &kms.Tag{
			TagKey:   aws.String(k),
			TagValue: aws.String(v.(string)),
		}
		if !tagIgnoredKMS(t) {
			result = append(result, t)
		}
	}

	return result
}
65468
func tagsToMapRoute53Resolver(ts []*route53resolver.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnoredRoute53Resolver(t) {
			result[aws.StringValue(t.Key)] = aws.StringValue(t.Value)
		}
	}

	return result
}
883026
func tagsToMapGeneric(ts map[string]*string) map[string]string {
	result := make(map[string]string)
	for k, v := range ts {
		if !tagIgnoredGeneric(k) {
			result[k] = aws.StringValue(v)
		}
	}

	return result
}
946220
func structToMapString(i interface{}) map[string][]string {
	ms := map[string][]string{}
	iv := reflect.ValueOf(i).Elem()
	tp := iv.Type()

	for i := 0; i < iv.NumField(); i++ {
		k := tp.Field(i).Name
		f := iv.Field(i)
		ms[k] = valueToString(f)
	}

	return ms
}
666015
func tagKeysIam(ts []*iam.Tag) []*string {
	result := make([]*string, 0, len(ts))
	for _, t := range ts {
		result = append(result, t.Key)
	}
	return result
}
251865
func tagsFromMapEFS(m map[string]interface{}) []*efs.Tag {
	var result []*efs.Tag
	for k, v := range m {
		t := &efs.Tag{
			Key:   aws.String(k),
			Value: aws.String(v.(string)),
		}
		if !tagIgnoredEFS(t) {
			result = append(result, t)
		}
	}

	return result
}
340982
func tagsFromMapDX(m map[string]interface{}) []*directconnect.Tag {
	result := make([]*directconnect.Tag, 0, len(m))
	for k, v := range m {
		t := &directconnect.Tag{
			Key:   aws.String(k),
			Value: aws.String(v.(string)),
		}
		if !tagIgnoredDX(t) {
			result = append(result, t)
		}
	}

	return result
}