// collapseEmptyStatusTags removes status tags that are completely empty.
192573
func collapseEmptyStatusTags(stream *imageapi.ImageStream) {
	for tag, ref := range stream.Status.Tags {
		if len(ref.Items) == 0 && len(ref.Conditions) == 0 {
			delete(stream.Status.Tags, tag)
		}
	}
}
421160
func DetachTags(c context.Context, inst *Instance, tags []*api.Tag) error {
	return Txn(c, "DetachTags", func(c context.Context) error {
		existing, _, err := checkExistingTags(c, inst, tags)
		if err != nil {
			return err
		}

		if err := datastore.Delete(c, existing); err != nil {
			return transient.Tag.Apply(err)
		}

		events := Events{}
		for _, t := range existing {
			events.Emit(&api.Event{
				Kind:     api.EventKind_INSTANCE_TAG_DETACHED,
				Package:  inst.Package.StringID(),
				Instance: inst.InstanceID,
				Tag:      t.Tag,
			})
		}
		return events.Flush(c)
	})
}
889648
func (c *aliCloudImplementation) AddClusterTags(tags map[string]string) {

	if c.tags != nil && len(c.tags) != 0 && tags != nil {
		for k, v := range c.tags {
			tags[k] = v
		}
	}
}
428218
func isDetachableFilesystemTag(db Database, tag names.FilesystemTag) (bool, error) {
	doc, err := getFilesystemDocByTag(db, tag)
	if err != nil {
		return false, errors.Trace(err)
	}
	return doc.HostId == "", nil
}
999819
func (client *Client) DescribeTags(args *DescribeTagsArgs) (tags []TagItemType, pagination *common.PaginationResult, err error) {
	args.Validate()
	response := DescribeTagsResponse{}
	err = client.Invoke("DescribeTags", args, &response)
	if err != nil {
		return nil, nil, err
	}
	return response.Tags.Tag, &response.PaginationResult, nil
}
1097379
func filesystemParams(ctx *context, tags []names.FilesystemTag) ([]storage.FilesystemParams, error) {
	paramsResults, err := ctx.config.Filesystems.FilesystemParams(tags)
	if err != nil {
		return nil, errors.Annotate(err, "getting filesystem params")
	}
	allParams := make([]storage.FilesystemParams, len(tags))
	for i, result := range paramsResults {
		if result.Error != nil {
			return nil, errors.Annotate(result.Error, "getting filesystem parameters")
		}
		params, err := filesystemParamsFromParams(result.Result)
		if err != nil {
			return nil, errors.Annotate(err, "getting filesystem parameters")
		}
		allParams[i] = params
	}
	return allParams, nil
}
551888
func (r *SearchRequest) Collapse(collapse *CollapseBuilder) *SearchRequest {
	r.searchSource = r.searchSource.Collapse(collapse)
	return r
}
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
}
545807
func (o *ListTasksParams) validateTags(formats strfmt.Registry) error {

	// uniqueItems: true
	if err := validate.UniqueItems("tags", "query", o.Tags); err != nil {
		return err
	}

	return nil
}
946088
func mergeTags(metricTags, outerTags map[string]string) map[string]string {
	tags := make(map[string]string)
	for k, v := range outerTags {
		tags[k] = v
	}
	for k, v := range metricTags {
		tags[k] = v
	}

	return tags
}
784152
func FilesystemToState(v params.Filesystem) (names.FilesystemTag, state.FilesystemInfo, error) {
	filesystemTag, err := names.ParseFilesystemTag(v.FilesystemTag)
	if err != nil {
		return names.FilesystemTag{}, state.FilesystemInfo{}, errors.Trace(err)
	}
	return filesystemTag, state.FilesystemInfo{
		v.Info.Size,
		"", // pool is set by state
		v.Info.FilesystemId,
	}, nil
}
1175223
func (f *filesystemAttachment) Filesystem() names.FilesystemTag {
	return names.NewFilesystemTag(f.doc.Filesystem)
}
1327538
func (b *Bitmap) removeEmptyContainers() {
	citer, _ := b.Containers.Iterator(0)
	for citer.Next() {
		k, c := citer.Value()
		if c.n == 0 {
			b.Containers.Remove(k)
		}
	}
}
358400
func (p *parser) generateImpliedEndTags(exceptions ...string) {
	var i int
loop:
	for i = len(p.oe) - 1; i >= 0; i-- {
		n := p.oe[i]
		if n.Type == ElementNode {
			switch n.DataAtom {
			case a.Dd, a.Dt, a.Li, a.Option, a.Optgroup, a.P, a.Rp, a.Rt:
				for _, except := range exceptions {
					if n.Data == except {
						break loop
					}
				}
				continue
			}
		}
		break
	}

	p.oe = p.oe[:i+1]
}
797475
func diffTagsDynamoDb(oldTags, newTags []*dynamodb.Tag) ([]*dynamodb.Tag, []*string) {
	create := make(map[string]interface{})
	for _, t := range newTags {
		create[*t.Key] = *t.Value
	}

	var remove []*string
	for _, t := range oldTags {
		// Verify the old tag is not a tag we're currently attempting to create
		old, ok := create[*t.Key]
		if !ok || old != *t.Value {
			remove = append(remove, t.Key)
		}
	}
	return tagsFromMapDynamoDb(create), remove
}
764628
func (t *table) appendTags() {
	for j := range t.cols {
		v := t.tags[j]
		if v != nil {
			b := arrow.NewStringBuilder(t.alloc)
			b.Reserve(t.l)
			b.ReserveData(t.l * len(v))
			for i := 0; i < t.l; i++ {
				b.Append(v)
			}
			t.colBufs[j] = b.NewArray()
			b.Release()
		}
	}
}
655505
func (c *awsCloudImplementation) CreateTags(resourceId string, tags map[string]string) error {
	return createTags(c, resourceId, tags)
}