// buildEC2TagSet converts raw schema lists into a codedeploy.EC2TagSet.
975189
func buildEC2TagSet(configured []interface{}) *codedeploy.EC2TagSet {
	filterSets := make([][]*codedeploy.EC2TagFilter, 0)
	for _, raw := range configured {
		m := raw.(map[string]interface{})
		rawFilters := m["ec2_tag_filter"].(*schema.Set)
		filters := buildEC2TagFilters(rawFilters.List())
		filterSets = append(filterSets, filters)
	}
	return &codedeploy.EC2TagSet{Ec2TagSetList: filterSets}
}
639468
func tagsFromMapECR(m map[string]interface{}) []*ecr.Tag {
	result := make([]*ecr.Tag, 0, len(m))
	for k, v := range m {
		t := &ecr.Tag{
			Key:   aws.String(k),
			Value: aws.String(v.(string)),
		}
		if !tagIgnoredECR(t) {
			result = append(result, t)
		}
	}

	return result
}
545021
func diffTagsECS(oldTags, newTags []*ecs.Tag) ([]*ecs.Tag, []*ecs.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 []*ecs.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 {
			// already present so remove from new
			delete(create, aws.StringValue(t.Key))
		}
	}

	return tagsFromMapECS(create), remove
}
1063435
func (e *Engine) BuildRefs(ctx context.Context, name string, tags []string) []string {
	refs := []string{}
	for _, tag := range tags {
		ref := createImageTag(e.config.Docker, name, tag)
		refs = append(refs, ref)
	}
	// use latest
	if len(refs) == 0 {
		refs = append(refs, createImageTag(e.config.Docker, name, utils.DefaultVersion))
	}
	return refs
}
1357645
func (_m *API) BuildRefs(ctx context.Context, name string, tags []string) []string {
	ret := _m.Called(ctx, name, tags)

	var r0 []string
	if rf, ok := ret.Get(0).(func(context.Context, string, []string) []string); ok {
		r0 = rf(ctx, name, tags)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]string)
		}
	}

	return r0
}
696580
func (fs *FileSet) TagValueIterator(name, key []byte) TagValueIterator {
	a := make([]TagValueIterator, 0, len(fs.files))
	for _, f := range fs.files {
		itr := f.TagValueIterator(name, key)
		if itr != nil {
			a = append(a, itr)
		}
	}
	return MergeTagValueIterators(a...)
}
25208
func setTagsDS(conn *directoryservice.DirectoryService, d *schema.ResourceData, resourceId string) error {
	if d.HasChange("tags") {
		oraw, nraw := d.GetChange("tags")
		o := oraw.(map[string]interface{})
		n := nraw.(map[string]interface{})
		create, remove := diffTagsDS(tagsFromMapDS(o), tagsFromMapDS(n))

		// Set tags
		if len(remove) > 0 {
			log.Printf("[DEBUG] Removing tags: %s", remove)
			k := make([]*string, len(remove))
			for i, t := range remove {
				k[i] = t.Key
			}

			_, err := conn.RemoveTagsFromResource(&directoryservice.RemoveTagsFromResourceInput{
				ResourceId: aws.String(resourceId),
				TagKeys:    k,
			})
			if err != nil {
				return err
			}
		}
		if len(create) > 0 {
			log.Printf("[DEBUG] Creating tags: %s", create)
			_, err := conn.AddTagsToResource(&directoryservice.AddTagsToResourceInput{
				ResourceId: aws.String(resourceId),
				Tags:       create,
			})
			if err != nil {
				return err
			}
		}
	}

	return nil
}
801551
func (s *CreateDeploymentGroupInput) SetEc2TagFilters(v []*EC2TagFilter) *CreateDeploymentGroupInput {
	s.Ec2TagFilters = v
	return s
}
643016
func (s *CreateServiceInput) SetEnableECSManagedTags(v bool) *CreateServiceInput {
	s.EnableECSManagedTags = &v
	return s
}
360688
func BuildSets(b *pb.Build) []string {
	var result []string
	for _, tag := range b.Tags {
		if tag.Key == "buildset" {
			result = append(result, tag.Value)
		}
	}
	return result
}
641962
func (s *GetObjectTaggingOutput) SetTagSet(v []*Tag) *GetObjectTaggingOutput {
	s.TagSet = v
	return s
}
615346
func parseTagFlag(tagFlag string) (tag string, err error) {
	tags := strings.Fields(tagFlag)
	if len(tags) != 1 {
		return "", fmt.Errorf("%q is not a valid single build tag, but %q", tagFlag, tags)
	}
	return tags[0], nil
}
671606
func findClusterIDs(tags []*ec2.Tag) (string, string, error) {
	legacyClusterID := ""
	newClusterID := ""

	for _, tag := range tags {
		tagKey := aws.StringValue(tag.Key)
		if strings.HasPrefix(tagKey, TagNameKubernetesClusterPrefix) {
			id := strings.TrimPrefix(tagKey, TagNameKubernetesClusterPrefix)
			if newClusterID != "" {
				return "", "", fmt.Errorf("Found multiple cluster tags with prefix %s (%q and %q)", TagNameKubernetesClusterPrefix, newClusterID, id)
			}
			newClusterID = id
		}

		if tagKey == TagNameKubernetesClusterLegacy {
			id := aws.StringValue(tag.Value)
			if legacyClusterID != "" {
				return "", "", fmt.Errorf("Found multiple %s tags (%q and %q)", TagNameKubernetesClusterLegacy, legacyClusterID, id)
			}
			legacyClusterID = id
		}
	}

	return legacyClusterID, newClusterID, nil
}
842315
func FieldSet(name string, elems ...fields.FieldInterface) *FieldSetType {
	ret := &FieldSetType{
		tmpl:       "fieldset",
		name:       name,
		class:      map[string]struct{}{},
		tags:       map[string]struct{}{},
		fields:     elems,
		fieldMap:   map[string]int{},
		AppendData: map[string]interface{}{},
	}
	for i, elem := range elems {
		ret.fieldMap[elem.Name()] = i
	}
	return ret
}
396047
func (d *driver) fittedcloudCreated(tags []*awsec2.Tag) string {
	for _, tag := range tags {
		if *tag.Key == "FittedCloudCreated" {
			return *tag.Value
		}
	}
	return ""
}
999430
func getTagSetS3(s3conn *s3.S3, bucket string) ([]*s3.Tag, error) {
	request := &s3.GetBucketTaggingInput{
		Bucket: aws.String(bucket),
	}

	response, err := s3conn.GetBucketTagging(request)
	if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "NoSuchTagSet" {
		// There is no tag set associated with the bucket.
		return []*s3.Tag{}, nil
	} else if err != nil {
		return nil, err
	}

	return response.TagSet, nil
}
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
}