// serviced snapshot tag SNAPSHOTID TAG-NAME
420572
func (c *ServicedCli) cmdSnapshotTag(ctx *cli.Context) {
	args := ctx.Args()

	var (
		err error
	)

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

	if err = c.driver.TagSnapshot(args[0], args[1]); err != nil {
		fmt.Fprintln(os.Stderr, err)
		return
	}
}
96551
func (c *retryRepository) Tags(ctx context.Context) distribution.TagService {
	return &retryTags{TagService: c.Repository.Tags(ctx), repo: c}
}
601496
func (dfs *DistributedFilesystem) TagInfo(tenantID, tagName string) (*SnapshotInfo, error) {
	vol, err := dfs.disk.Get(tenantID)
	if err != nil {
		glog.Errorf("Could not get tenant volume %s: %s", tenantID, err)
		return nil, err
	}
	info, err := vol.GetSnapshotWithTag(tagName)
	if err != nil {
		glog.Errorf("Could not get info for snapshot with tag %s: %s", tagName, err)
		return nil, err
	}
	return readSnapshotInfo(vol, info)
}
319081
func (r *TasksService) Tags() *TasksTagsCall {
	c := &TasksTagsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	return c
}
126402
func (c *Client) TagBareMetalServer(id, tag string) error {
	values := url.Values{
		"SUBID": {id},
		"tag":   {tag},
	}

	return c.post(`baremetal/tag_set`, values, nil)
}
258994
func ImageTag(conf *yaml.Config) error {
	for _, image := range conf.Pipeline {
		if !strings.Contains(image.Image, ":") {
			image.Image = image.Image + ":latest"
		}
	}
	for _, image := range conf.Services {
		if !strings.Contains(image.Image, ":") {
			image.Image = image.Image + ":latest"
		}
	}
	return nil
}
998477
func serviceTags(s *ipvs.Service) map[string]string {
	ret := map[string]string{
		"sched":          s.SchedName,
		"netmask":        strconv.Itoa(bits.OnesCount32(s.Netmask)),
		"address_family": addressFamilyToString(s.AddressFamily),
	}
	// Per the ipvsadm man page, a virtual service is defined "based on
	// protocol/addr/port or firewall mark"
	if s.FWMark > 0 {
		ret["fwmark"] = strconv.Itoa(int(s.FWMark))
	} else {
		ret["protocol"] = protocolToString(s.Protocol)
		ret["address"] = s.Address.String()
		ret["port"] = strconv.Itoa(int(s.Port))
	}
	return ret
}
715098
func (dao *ControlPlaneDao) TagSnapshot(request model.TagSnapshotRequest, _ *int) error {
	return dao.facade.TagSnapshot(request.SnapshotID, request.TagName)
}
75890
func serviceTagFilter(sn *structs.ServiceNode, tag string) bool {
	tag = strings.ToLower(tag)

	// Look for the lower cased version of the tag.
	for _, t := range sn.ServiceTags {
		if strings.ToLower(t) == tag {
			return false
		}
	}

	// If we didn't hit the tag above then we should filter.
	return true
}
244641
func getTagsKinesisFirehose(conn *firehose.Firehose, d *schema.ResourceData, sn string) error {
	tags := make([]*firehose.Tag, 0)
	var exclusiveStartTagKey string
	for {
		req := &firehose.ListTagsForDeliveryStreamInput{
			DeliveryStreamName: aws.String(sn),
		}
		if exclusiveStartTagKey != "" {
			req.ExclusiveStartTagKey = aws.String(exclusiveStartTagKey)
		}

		resp, err := conn.ListTagsForDeliveryStream(req)
		if err != nil {
			return err
		}

		tags = append(tags, resp.Tags...)

		// If HasMoreTags is true in the response, more tags are available.
		// To list the remaining tags, set ExclusiveStartTagKey to the key
		// of the last tag returned and call ListTagsForDeliveryStream again.
		if !aws.BoolValue(resp.HasMoreTags) {
			break
		}
		exclusiveStartTagKey = aws.StringValue(tags[len(tags)-1].Key)
	}

	err := d.Set("tags", tagsToMapKinesisFirehose(tags))
	return err
}
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
}
1073463
func (v *BtrfsVolume) Snapshot(label, message string, tags []string) error {
	// make sure the label doesn't already exist
	path := v.snapshotPath(label)
	if ok, err := volume.IsDir(path); err != nil {
		return err
	} else if ok {
		return volume.ErrSnapshotExists
	}
	// check the tags for duplicates
	for _, tagName := range tags {
		if tagInfo, err := v.GetSnapshotWithTag(tagName); err != volume.ErrSnapshotDoesNotExist {
			if err != nil {
				glog.Errorf("Could not look up snapshot with tag %s: %s", tagName, err)
				return err
			} else {
				glog.Errorf("Tag '%s' is already in use by snapshot %s", tagName, tagInfo.Name)
				return volume.ErrTagAlreadyExists
			}
		}
	}
	v.Lock()
	defer v.Unlock()
	info := volume.SnapshotInfo{
		Name:     v.rawSnapshotLabel(label),
		TenantID: v.Tenant(),
		Label:    v.prettySnapshotLabel(label),
		Tags:     tags,
		Message:  message,
		Created:  time.Now(),
	}
	if err := v.writeSnapshotInfo(label, &info); err != nil {
		return err
	}
	_, err := volume.RunBtrFSCmd(v.sudoer, "subvolume", "snapshot", "-r", v.Path(), path)
	return err
}
1265943
func (c *TasksCountCall) Tags(tags ...string) *TasksCountCall {
	c.urlParams_.SetMulti("tags", append([]string{}, tags...))
	return c
}
132735
func (s *Store) ServiceTagNodes(ws memdb.WatchSet, service string, tags []string) (uint64, structs.ServiceNodes, error) {
	tx := s.db.Txn(false)
	defer tx.Abort()

	// List all the services.
	services, err := tx.Get("services", "service", service)
	if err != nil {
		return 0, nil, fmt.Errorf("failed service lookup: %s", err)
	}
	ws.Add(services.WatchCh())

	// Gather all the services and apply the tag filter.
	serviceExists := false
	var results structs.ServiceNodes
	for service := services.Next(); service != nil; service = services.Next() {
		svc := service.(*structs.ServiceNode)
		serviceExists = true
		if !serviceTagsFilter(svc, tags) {
			results = append(results, svc)
		}
	}

	// Fill in the node details.
	results, err = s.parseServiceNodes(tx, ws, results)
	if err != nil {
		return 0, nil, fmt.Errorf("failed parsing service nodes: %s", err)
	}
	// Get the table index.
	idx := maxIndexForService(tx, service, serviceExists, false)

	return idx, results, nil
}
1136663
func OnlyFromDBTagHandler(ctx *tagContext) error {
	ctx.col.MapType = core.ONLYFROMDB
	return nil
}
1015279
func (f *filesystem) FilesystemTag() names.FilesystemTag {
	return names.NewFilesystemTag(f.doc.FilesystemId)
}
647622
func (c *ServicedCli) initSnapshot() {
	c.app.Commands = append(c.app.Commands, cli.Command{
		Name:        "snapshot",
		Usage:       "Administers environment snapshots",
		Description: "",
		Subcommands: []cli.Command{
			{
				Name:         "list",
				Usage:        "Lists all snapshots",
				Description:  "serviced snapshot list [SERVICEID]",
				BashComplete: c.printServicesFirst,
				Action:       c.cmdSnapshotList,
				Flags: []cli.Flag{
					cli.BoolFlag{
						Name:  "show-tags, t",
						Usage: "shows tags associated with each snapshot",
					},
				},
			}, {
				Name:         "add",
				Usage:        "Take a snapshot of an existing service",
				Description:  "serviced snapshot add SERVICEID",
				BashComplete: c.printServicesFirst,
				Action:       c.cmdSnapshotAdd,
				Flags: []cli.Flag{
					cli.StringFlag{
						Name:  "description, d",
						Value: "",
						Usage: "a description of the snapshot",
					},
					cli.StringFlag{
						Name:  "tag, t",
						Value: "",
						Usage: "a unique tag for the snapshot",
					},
				},
			}, {
				Name:         "remove",
				ShortName:    "rm",
				Usage:        "Removes an existing snapshot",
				Description:  "serviced snapshot remove [SNAPSHOTID | SERVICED TAG-NAME]",
				BashComplete: c.printServicesFirst,
				Action:       c.cmdSnapshotRemove,
				Flags: []cli.Flag{
					cli.BoolFlag{
						Name:  "force, f",
						Usage: "required for deleting all snapshots",
					},
				},
			}, {
				Name:        "commit",
				Usage:       "Snapshots and commits a given service instance",
				Description: "serviced snapshot commit DOCKERID",
				Action:      c.cmdSnapshotCommit,
			}, {
				Name:        "rollback",
				Usage:       "Restores the environment to the state of the given snapshot",
				Description: "serviced snapshot rollback SNAPSHOTID",
				Flags: []cli.Flag{
					cli.BoolFlag{
						Name:  "force-restart",
						Usage: "restarts running services during rollback",
					},
				},
				BashComplete: c.printSnapshotsFirst,
				Action:       c.cmdSnapshotRollback,
			}, {
				Name:         "tag",
				Usage:        "Tags an existing snapshot with TAG-NAME",
				Description:  "serviced snapshot tag SNAPSHOTID TAG-NAME",
				BashComplete: c.printSnapshotsFirst,
				Action:       c.cmdSnapshotTag,
			}, {
				Name:         "untag",
				Usage:        "Removes a tag from an existing snapshot",
				Description:  "serviced snapshot untag SERVICEID TAG-NAME",
				BashComplete: c.printServicesFirst,
				Action:       c.cmdSnapshotRemoveTag,
			},
		},
	})
}