// UntagSnapshot implements volume.Volume.UntagSnapshot
185128
func (v *RsyncVolume) UntagSnapshot(tagName string) (string, error) {
	v.Lock()
	defer v.Unlock()
	// find the snapshot with the provided tag
	info, err := v.getSnapshotWithTag(tagName, false)
	if err != nil {
		glog.Errorf("Could not find snapshot with tag %s: %s", tagName, err)
		return "", err
	}
	// remove the tag and update the snapshot
	var tags []string
	for _, tag := range info.Tags {
		if tag != tagName {
			tags = append(tags, tag)
		}
	}
	info.Tags = tags
	if err := v.writeSnapshotInfo(info.Label, info); err != nil {
		glog.Errorf("Could not remove tag '%s' from snapshot %s: %s", tagName, info.Name, err)
		return "", err
	}
	return info.Label, err
}
217457
func removeVolumeParams(ctx *context, tags []names.VolumeTag) ([]params.RemoveVolumeParams, error) {
	paramsResults, err := ctx.config.Volumes.RemoveVolumeParams(tags)
	if err != nil {
		return nil, errors.Annotate(err, "getting volume params")
	}
	allParams := make([]params.RemoveVolumeParams, len(tags))
	for i, result := range paramsResults {
		if result.Error != nil {
			return nil, errors.Annotate(result.Error, "getting volume removal parameters")
		}
		allParams[i] = result.Result
	}
	return allParams, nil
}
111008
func (ts *tagStore) Untag(ctx context.Context, tag string) error {
	tagPath, err := pathFor(manifestTagPathSpec{
		name: ts.repository.Named().Name(),
		tag:  tag,
	})
	if err != nil {
		return err
	}

	if err := ts.blobStore.driver.Delete(ctx, tagPath); err != nil {
		switch err.(type) {
		case storagedriver.PathNotFoundError:
			return nil // Untag is idempotent, we don't care if it didn't exist
		default:
			return err
		}
	}

	return nil
}
1151315
func isDetachableVolumeTag(db Database, tag names.VolumeTag) (bool, error) {
	doc, err := getVolumeDocByTag(db, tag)
	if err != nil {
		return false, errors.Trace(err)
	}
	return detachableVolumeDoc(&doc), nil
}
263324
func (f *Facade) RemoveSnapshotTag(ctx datastore.Context, serviceID, tagName string) (string, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RemoveSnapshotTag"))
	logger := plog.WithFields(logrus.Fields{
		"serviceid": serviceID,
		"tagname":   tagName,
	})
	tenantID, err := f.GetTenantID(ctx, serviceID)
	if err != nil {
		logger.WithError(err).Debug("Could not find tenant for service")
		return "", err
	}
	logger = logger.WithField("tenantid", tenantID)
	snapshotID, err := f.dfs.Untag(tenantID, tagName)
	if err != nil {
		logger.WithError(err).Debug("Could not remove tag from tenant")
		return "", err
	}
	return snapshotID, nil
}
717023
func (v *volume) VolumeTag() names.VolumeTag {
	return names.NewVolumeTag(v.doc.Name)
}
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)
	})
}
752788
func (a *Client) DeleteNodesIdentifierTagsTagname(params *DeleteNodesIdentifierTagsTagnameParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteNodesIdentifierTagsTagnameOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeleteNodesIdentifierTagsTagnameParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "DeleteNodesIdentifierTagsTagname",
		Method:             "DELETE",
		PathPattern:        "/nodes/{identifier}/tags/{tagname}",
		ProducesMediaTypes: []string{"application/json", "application/x-gzip"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeleteNodesIdentifierTagsTagnameReader{formats: a.formats},
		AuthInfo:           authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*DeleteNodesIdentifierTagsTagnameOK), nil
}
224039
func (c *ServicedCli) cmdSnapshotRemoveTag(ctx *cli.Context) {
	args := ctx.Args()

	var (
		snapshotID string
		err        error
	)

	if len(args) != 2 {
		fmt.Printf("Incorrect Usage.\n\n")
		cli.ShowCommandHelp(ctx, "untag")
		return
	}

	//remove specified tag
	if snapshotID, err = c.driver.RemoveSnapshotTag(args[0], args[1]); err != nil {
		fmt.Fprintln(os.Stderr, err)
		return
	}
	fmt.Printf("%s\n", snapshotID)
}
1036121
func (s *ModifyDBClusterInput) SetCopyTagsToSnapshot(v bool) *ModifyDBClusterInput {
	s.CopyTagsToSnapshot = &v
	return s
}
1228391
func tagsFromMapDynamoDb(m map[string]interface{}) []*dynamodb.Tag {
	result := make([]*dynamodb.Tag, 0, len(m))
	for k, v := range m {
		t := &dynamodb.Tag{
			Key:   aws.String(k),
			Value: aws.String(v.(string)),
		}
		result = append(result, t)
	}
	return result
}
1167801
func (f *FieldSetType) RemoveTag(tag string) *FieldSetType {
	delete(f.tags, tag)
	return f
}
1370863
func (v *BtrfsVolume) RemoveSnapshot(label string) error {
	if exists, err := v.snapshotExists(label); err != nil || !exists {
		if err != nil {
			return err
		} else {
			return volume.ErrSnapshotDoesNotExist
		}
	}

	v.Lock()
	defer v.Unlock()
	_, err := volume.RunBtrFSCmd(v.sudoer, "subvolume", "delete", v.snapshotPath(label))
	if err != nil {
		glog.Errorf("could not remove snapshot: %s", err)
		return volume.ErrRemovingSnapshot
	}
	return nil
}
855831
func (f *Facade) TagSnapshot(snapshotID string, tagName string) error {
	logger := plog.WithFields(logrus.Fields{
		"snapshotid": snapshotID,
		"tagname":    tagName,
	})
	if err := f.dfs.Tag(snapshotID, tagName); err != nil {
		logger.WithError(err).Debug("Could not add tag to snapshot")
		return err
	}
	return nil
}
652570
func (mp *TxPool) RemoveOrphansByTag(tag Tag) uint64 {
	var numEvicted uint64
	mp.mtx.Lock()
	for _, otx := range mp.orphans {
		if otx.tag == tag {
			mp.removeOrphan(otx.tx, true)
			numEvicted++
		}
	}
	mp.mtx.Unlock()
	return numEvicted
}
1252423
func (client *Client) RemoveTags(args *RemoveTagsArgs) error {
	response := RemoveTagsResponse{}
	err := client.Invoke("RemoveTags", args, &response)
	return err
}
605477
func (p *propTags) RemoveTag(target string) {
	if !p.HasTag(target) {
		return
	}
	res := []string{}
	for _, tag := range p.Tags {
		if tag != target {
			res = append(res, tag)
		}
	}

	p.Tags = res
}