// tagsToMap turns the list of tags into a map.
482046
func tagsToMapRDS(ts []*rds.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnoredRDS(t) {
			result[*t.Key] = *t.Value
		}
	}

	return result
}
351912
func tagsToMapBeanstalk(ts []*elasticbeanstalk.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnoredBeanstalk(t) {
			result[*t.Key] = *t.Value
		}
	}

	return result
}
1356678
func (c *Config) ReadStringListToMap(key string) map[string]struct{} {
	s := strings.TrimSpace(c.Read(key))
	list := make(map[string]struct{})
	if s != "" {
		for _, e := range strings.Split(s, ",") {
			trimmed := strings.TrimSpace(e)
			list[trimmed] = struct{}{}
		}
	}
	return list
}
1041528
func parseTagIntoMap(tag string) tagOptionsMap {
	optionsMap := make(tagOptionsMap)
	options := strings.Split(tag, ",")

	for i, option := range options {
		option = strings.TrimSpace(option)

		validationOptions := strings.Split(option, "~")
		if !isValidTag(validationOptions[0]) {
			continue
		}
		if len(validationOptions) == 2 {
			optionsMap[validationOptions[0]] = tagOption{validationOptions[0], validationOptions[1], i}
		} else {
			optionsMap[validationOptions[0]] = tagOption{validationOptions[0], "", i}
		}
	}
	return optionsMap
}
762556
func buildTagSet(name string) map[string]string {
	labelMap := map[string]string{}
	tags := strings.Split(name, ";")
	labelMap["__name__"] = tags[0]
	for _, lbl := range tags[1:] {
		kv := strings.Split(lbl, "=")
		labelMap[kv[0]] = kv[1]
	}
	return labelMap
}
744120
func tagsToMapSSM(ts []*ssm.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnoredSSM(t) {
			result[*t.Key] = *t.Value
		}
	}

	return result
}
509090
func tagsToMapLicenseManager(ts []*licensemanager.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnoredLicenseManager(t) {
			result[*t.Key] = *t.Value
		}
	}

	return result
}
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
}
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
}
754752
func tagsFromMapElasticsearchService(m map[string]interface{}) []*elasticsearch.Tag {
	var result []*elasticsearch.Tag
	for k, v := range m {
		t := &elasticsearch.Tag{
			Key:   aws.String(k),
			Value: aws.String(v.(string)),
		}
		if !tagIgnoredElasticsearchService(t) {
			result = append(result, t)
		}
	}

	return result
}
517540
func StringToMap(str string) (data map[string]string) {
	re := regexp.MustCompile(`\s*([\w-]+)\s*=\s*(['"]?)(.*)`)
	data = make(map[string]string)
	matches := re.FindAllStringSubmatch(str, -1)
	if len(matches) > 0 {
		first := matches[0]
		var reg2_txt string
		if first[2] == "'" || first[2] == `"` {
			reg2_txt = fmt.Sprintf(`([^%s]*)%s(\s+.*)?`, first[2], first[2])
		} else if first[2] == "" {
			reg2_txt = `(\S+)\s*(.*)`
		}
		re2 := regexp.MustCompile(reg2_txt)
		subResult := re2.FindAllStringSubmatch(first[3], -1)

		if len(subResult) > 0 && len(subResult[0]) > 1 {
			data[first[1]] = subResult[0][1]
			if len(subResult[0][2]) > 0 {
				_subResult := StringToMap(subResult[0][2])
				for k, v := range _subResult {
					data[k] = v
				}
			}
		}
	}
	return
}
1003996
func tagsFromMapEC(m map[string]interface{}) []*elasticache.Tag {
	result := make([]*elasticache.Tag, 0, len(m))
	for k, v := range m {
		t := &elasticache.Tag{
			Key:   aws.String(k),
			Value: aws.String(v.(string)),
		}
		if !tagIgnoredEC(t) {
			result = append(result, t)
		}
	}

	return result
}
812757
func tagsToMapCloudWatchEvents(ts []*events.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnoredCloudWatchEvents(t) {
			result[*t.Key] = *t.Value
		}
	}

	return result
}
591773
func tagsToMapDX(ts []*directconnect.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnoredDX(t) {
			result[aws.StringValue(t.Key)] = aws.StringValue(t.Value)
		}
	}

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

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

	return result
}
54477
func tagsToMapElasticsearchService(ts []*elasticsearch.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnoredElasticsearchService(t) {
			result[*t.Key] = *t.Value
		}
	}

	return result
}