// Update Team Preferences
172489
func (s *Service) TeamPreferencesUpdate(ctx context.Context, teamPreferencesIdentity string, o TeamPreferencesUpdateOpts) (*TeamPreferences, error) {
	var teamPreferences TeamPreferences
	return &teamPreferences, s.Patch(ctx, &teamPreferences, fmt.Sprintf("/teams/%v/preferences", teamPreferencesIdentity), o)
}
410246
func (s *awsService) Update(ctx context.Context, group Elastigroup) error {
	input := &aws.UpdateGroupInput{
		Group: group.Obj().(*aws.Group),
	}

	_, err := s.svc.Update(ctx, input)
	return err

}
1156132
func DeleteTeam(t *Team) error {
	if err := t.GetRepositories(); err != nil {
		return err
	}

	// Get organization.
	org, err := GetUserByID(t.OrgID)
	if err != nil {
		return err
	}

	sess := x.NewSession()
	defer sess.Close()
	if err = sess.Begin(); err != nil {
		return err
	}

	// Delete all accesses.
	for _, repo := range t.Repos {
		if err = repo.recalculateTeamAccesses(sess, t.ID); err != nil {
			return err
		}
	}

	// Delete team-user.
	if _, err = sess.Where("org_id=?", org.ID).Where("team_id=?", t.ID).Delete(new(TeamUser)); err != nil {
		return err
	}

	// Delete team.
	if _, err = sess.ID(t.ID).Delete(new(Team)); err != nil {
		return err
	}
	// Update organization number of teams.
	if _, err = sess.Exec("UPDATE `user` SET num_teams=num_teams-1 WHERE id=?", t.OrgID); err != nil {
		return err
	}

	return sess.Commit()
}
603199
func (s *Settings) settingsUpdateOps() (settings.ItemChanges, []txn.Op) {
	changes := s.changes()
	if len(changes) == 0 {
		return changes, nil
	}

	updates := bson.M{}
	deletions := bson.M{}
	for _, ch := range changes {
		k := utils.EscapeKey(ch.Key)
		switch {
		case ch.IsAddition(), ch.IsModification():
			updates[k] = ch.NewValue
		case ch.IsDeletion():
			deletions[k] = 1
		}
	}

	ops := []txn.Op{{
		C:      s.collection,
		Id:     s.key,
		Assert: txn.DocExists,
		Update: setUnsetUpdateSettings(updates, deletions),
	}}
	return changes, ops
}
1130078
func NewTeamSelectiveSyncSettingsChangedDetails(PreviousValue *files.SyncSetting, NewValue *files.SyncSetting) *TeamSelectiveSyncSettingsChangedDetails {
	s := new(TeamSelectiveSyncSettingsChangedDetails)
	s.PreviousValue = PreviousValue
	s.NewValue = NewValue
	return s
}
597317
func (p *PostService) Update(teamName string, postNumber int, post Post) (*PostResponse, error) {
	var postRes PostResponse
	var postReq PostReq
	postReq.Post = post
	postNumberStr := strconv.Itoa(postNumber)
	postURL := PostURL + "/" + teamName + "/posts" + "/" + postNumberStr

	var data []byte
	var err error
	if data, err = json.Marshal(postReq); err != nil {
		return nil, err
	}

	res, err := p.client.patch(postURL, "application/json", bytes.NewReader(data), &postRes)
	if err != nil {
		return nil, err
	}

	defer res.Body.Close()

	return &postRes, nil
}
955006
func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int64, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) {
	u := fmt.Sprintf("admin/ldap/teams/%v/mapping", team)
	req, err := s.client.NewRequest("PATCH", u, mapping)
	if err != nil {
		return nil, nil, err
	}

	m := new(TeamLDAPMapping)
	resp, err := s.client.Do(ctx, req, m)
	if err != nil {
		return nil, resp, err
	}

	return m, resp, nil
}
587855
func UpdateUserPreferences(c *m.ReqContext, dtoCmd dtos.UpdatePrefsCmd) Response {
	return updatePreferencesFor(c.OrgId, c.UserId, 0, &dtoCmd)
}
1222320
func filterTeams(userTeams, configTeams []string) (teams []string) {
	teamFilter := make(map[string]struct{})
	for _, team := range configTeams {
		if _, ok := teamFilter[team]; !ok {
			teamFilter[team] = struct{}{}
		}
	}
	for _, team := range userTeams {
		if _, ok := teamFilter[team]; ok {
			teams = append(teams, team)
		}
	}
	return
}
1176458
func (s *Services) update(srvs []*apitypes.UserService) error {
	var err error
	// check if update service list conflicts
	tbd := make(map[serviceKey]bool, len(srvs))
	for _, srv := range srvs {
		key := serviceKey{srv.ServiceIP, srv.ServicePort, srv.Protocol}
		if tbd[key] {
			err = fmt.Errorf("given service list conflict: %v", srv)
			s.Log(ERROR, err)
			return err
		}
		tbd[key] = true
	}

	if s.p.IsRunning() {
		if err = s.commit(srvs, "update"); err != nil {
			return err
		}
	}
	s.spec = srvs

	return nil
}
347667
func (r *marathonClient) UpdateGroup(name string, group *Group, force bool) (*DeploymentID, error) {
	deploymentID := new(DeploymentID)
	path := fmt.Sprintf("%s/%s", marathonAPIGroups, trimRootPath(name))
	if force {
		path += "?force=true"
	}
	if err := r.apiPut(path, group, deploymentID); err != nil {
		return nil, err
	}

	return deploymentID, nil
}
198300
func NewPreferences() (*Preferences, error) {
	prefs := &Preferences{
		Core: Core{
			RegistryURI:        registryURI,
			ManifestURI:        manifestURI,
			GatekeeperAddress:  gatekeeperAddress,
			Context:            true,
			EnableHints:        true,
			EnableProgress:     true,
			EnableCheckUpdates: true,
			EnableColors:       true,
		},
	}

	filePath, _ := RcPath()
	_, err := os.Stat(filePath)
	if os.IsNotExist(err) {
		return prefs, nil
	}

	if err != nil {
		return prefs, err
	}

	err = ini.MapTo(prefs, filePath)
	return prefs, err
}
379531
func (s *Player) SetTeam(v string) *Player {
	s.Team = &v
	return s
}
298882
func (w *weightedRandomSelect) update(item wrsItem) {
	w.setWeight(item, item.Weight())
}
228086
func (s *Service) TeamPreferencesList(ctx context.Context, teamPreferencesIdentity string) (*TeamPreferences, error) {
	var teamPreferences TeamPreferences
	return &teamPreferences, s.Get(ctx, &teamPreferences, fmt.Sprintf("/teams/%v/preferences", teamPreferencesIdentity), nil, nil)
}
376826
func (k *KeybaseServiceBase) GetTeamSettings(
	ctx context.Context, teamID keybase1.TeamID,
	offline keybase1.OfflineAvailability) (
	keybase1.KBFSTeamSettings, error) {
	// TODO: get invalidations from the server and cache the settings?
	return k.kbfsClient.GetKBFSTeamSettings(
		ctx, keybase1.GetKBFSTeamSettingsArg{
			TeamID: teamID,
			Oa:     offline,
		})
}
1177713
func (a *Application) UpdateUnits(unitsOp *UpdateUnitsOperation) error {
	return a.st.ApplyOperation(unitsOp)
}