func (cmd *GroupList) filter() *sl.Filter { f := &sl.Filter{ Hostname: cmd.hostname, Tags: sl.Tags{}, } if cmd.tags != "" { tags := sl.NewTags(strings.Split(cmd.tags, ",")) for k, v := range tags { f.Tags[k] = v } } if cmd.env != "" { f.Tags["koding-env"] = cmd.env } if cmd.group != "" { var group models.Group query := func(c *mgo.Collection) error { return c.Find(bson.M{"slug": cmd.group}).One(&group) } if err := modelhelper.Mongo.Run("jGroups", query); err != nil { panic(err) } f.Tags["koding-groupid"] = group.Id.Hex() } return f }
func (cmd *vlanEdit) Run(ctx context.Context) error { if err := cmd.Valid(); err != nil { return err } tags := sl.NewTags(strings.Split(cmd.tags, ",")) return client.VlanSetTags(cmd.id, tags) }