// Generate a DogStatsD tag suffix
427948
func t(tags []string) string {
	t := ""
	if len(tags) > 0 {
		t = "|#" + strings.Join(tags, ",")
	}
	return t
}
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
}
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
}
957208
func (q *TagQuery) tagFilterMatchesName() bool {
	matchName := false

	if q.tagClause == PREFIX_TAG || q.startWith == PREFIX_TAG {
		if strings.HasPrefix("name", q.tagPrefix) {
			matchName = true
		}
	} else if q.tagClause == MATCH_TAG || q.startWith == MATCH_TAG {
		if q.tagMatch.value.MatchString("name") {
			matchName = true
		}
	} else {
		// some tag queries might have no prefix specified yet, in this case
		// we do not need to filter by the name
		// f.e. we know that every metric has a name, and we know that the
		// prefix "" matches the string "name", so we know that every metric
		// will pass the tag prefix test. hence we can omit the entire test.
		matchName = true
	}

	return matchName
}
1012392
func tagIgnoredGeneric(k string) bool {
	filter := []string{"^aws:"}
	for _, v := range filter {
		log.Printf("[DEBUG] Matching %v with %v\n", v, k)
		r, _ := regexp.MatchString(v, k)
		if r {
			log.Printf("[DEBUG] Found AWS specific tag %s, ignoring.\n", k)
			return true
		}
	}
	return false
}
37817
func (p *propTags) AppendTag(target string) {
	if p.HasTag(target) {
		return
	}

	p.Tags = append(p.Tags, target)
}
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
}
162397
func (c *Client) UpdateTags(t MetricType, id string, tags map[string]string, o ...Modifier) error {
	o = prepend(o, c.URL("PUT", TypeEndpoint(t), SingleMetricEndpoint(id), TagEndpoint()), Data(tags))

	r, err := c.Send(o...)
	if err != nil {
		return err
	}

	defer r.Body.Close()

	if r.StatusCode > 399 {
		return c.parseErrorResponse(r)
	}

	return nil
}
646686
func TagsDeep(obj interface{}, key string) (map[string]string, error) {
	return tags(obj, key, true)
}
1347060
func (t *Tag) Patch(src *Tag) {
	if src.Name != "" {
		t.Name = src.Name
	}
	if src.Description != "" {
		t.Description = src.Description
	}
	if src.CategoryID != "" {
		t.CategoryID = src.CategoryID
	}
}
528033
func diffTagsDX(oldTags, newTags []*directconnect.Tag) ([]*directconnect.Tag, []*directconnect.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 []*directconnect.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)
		}
	}

	return tagsFromMapDX(create), remove
}
2918
func (c *Client) CreateTags(p *CreateTagsParameter) (*Result, error) {
	obj, err := c.Request("createTags", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*Result), err
}
377012
func (v *vcsCmd) tags(dir string) ([]string, error) {
	var tags []string
	for _, tc := range v.tagCmd {
		out, err := v.runOutput(dir, tc.cmd)
		if err != nil {
			return nil, err
		}
		re := regexp.MustCompile(`(?m-s)` + tc.pattern)
		for _, m := range re.FindAllStringSubmatch(string(out), -1) {
			tags = append(tags, m[1])
		}
	}
	return tags, nil
}
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
}
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
}
1167826
func tagsToMapDS(ts []*directoryservice.Tag) map[string]string {
	result := make(map[string]string)
	for _, t := range ts {
		if !tagIgnoredDS(t) {
			result[*t.Key] = *t.Value
		}
	}

	return result
}
496751
func TagName(tag int) string {
	if (tag & TinyStrTagMask) == TinyStrTag {
		return "String"
	}
	switch tag {
	case NullTag:
		return "Null"
	case BoolTag:
		return "Bool"
	case Int8Tag:
		return "Int8"
	case Int16Tag:
		return "Int16"
	case Int32Tag:
		return "Int32"
	case Int64Tag:
		return "Int64"
	case Float32Tag:
		return "Float32"
	case Float64Tag:
		return "Float64"
	case BytesTag:
		return "Bytes"
	case StringTag:
		return "String"
	case TimestampTag:
		return "Timestamp"
	case SymbolTag:
		return "Symbol"
	case UUIDTag:
		return "UUID"
	case ArrayTag:
		return "Array"
	case MapTag:
		return "Map"
	case StructTag:
		return "Struct"
	case AnyTag:
		return "Any"
	case EnumTag:
		return "Enum"
	default:
		return fmt.Sprintf("0x%02x", tag)
	}
}