// UpdateMembership Updates a user his role in an organization
484634
func (m *Manager) UpdateMembership(globalid string, username string, oldrole string, newrole string) error {
	qry := bson.M{"globalid": globalid}
	pull := bson.M{
		"$pull": bson.M{oldrole: username},
	}
	push := bson.M{
		"$addToSet": bson.M{newrole: username},
	}
	err := m.collection.Update(qry, pull)
	if err != nil {
		return err
	}
	return m.collection.Update(qry, push)
}
410871
func (c *Client) UpdateUser(p *UpdateUserParameter) (*User, error) {
	obj, err := c.Request("updateUser", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*User), err
}
864333
func (s *Node) SetMemberId(v string) *Node {
	s.MemberId = &v
	return s
}
1363505
func (s *UpdateS3ResourcesInput) SetMemberAccountId(v string) *UpdateS3ResourcesInput {
	s.MemberAccountId = &v
	return s
}
739746
func (s *OrganizationsService) RemoveMember(ctx context.Context, org, user string) (*Response, error) {
	u := fmt.Sprintf("orgs/%v/members/%v", org, user)
	req, err := s.client.NewRequest("DELETE", u, nil)
	if err != nil {
		return nil, err
	}

	return s.client.Do(ctx, req, nil)
}
856672
func (s *ListNodesInput) SetMemberId(v string) *ListNodesInput {
	s.MemberId = &v
	return s
}
511994
func (s *Service) OrganizationFeatureUpdate(ctx context.Context, organizationIdentity string, organizationFeatureIdentity string, o OrganizationFeatureUpdateOpts) (*OrganizationFeature, error) {
	var organizationFeature OrganizationFeature
	return &organizationFeature, s.Patch(ctx, &organizationFeature, fmt.Sprintf("/organizations/%v/features/%v", organizationIdentity, organizationFeatureIdentity), o)
}
870895
func (s *RemoveAction) SetMemberId(v string) *RemoveAction {
	s.MemberId = &v
	return s
}
707857
func (s *OrganizationsStore) Update(ctx context.Context, o *chronograf.Organization) error {
	org, err := s.get(ctx, o.ID)
	if err != nil {
		return err
	}
	if o.Name != org.Name && !s.nameIsUnique(ctx, o.Name) {
		return chronograf.ErrOrganizationAlreadyExists
	}
	return s.client.db.Update(func(tx *bolt.Tx) error {
		if v, err := internal.MarshalOrganization(o); err != nil {
			return err
		} else if err := tx.Bucket(OrganizationsBucket).Put([]byte(o.ID), v); err != nil {
			return err
		}
		return nil
	})
}
337881
func (s *Service) UpdateOrganization(w http.ResponseWriter, r *http.Request) {
	var req organizationRequest
	if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
		invalidJSON(w, s.Logger)
		return
	}

	if err := req.ValidUpdate(); err != nil {
		invalidData(w, err, s.Logger)
		return
	}

	ctx := r.Context()
	id := httprouter.GetParamFromContext(ctx, "oid")

	org, err := s.Store.Organizations(ctx).Get(ctx, chronograf.OrganizationQuery{ID: &id})
	if err != nil {
		Error(w, http.StatusBadRequest, err.Error(), s.Logger)
		return
	}

	if req.Name != "" {
		org.Name = req.Name
	}

	if req.DefaultRole != "" {
		org.DefaultRole = req.DefaultRole
	}

	err = s.Store.Organizations(ctx).Update(ctx, org)
	if err != nil {
		Error(w, http.StatusBadRequest, err.Error(), s.Logger)
		return
	}

	res := newOrganizationResponse(org)
	location(w, res.Links.Self)
	encodeJSON(w, http.StatusOK, res, s.Logger)

}
685206
func (s *UsersService) UpdatePassword(username string, body UsersUsernamePasswordPutReqBody, headers, queryParams map[string]interface{}) (*http.Response, error) {
	var err error

	resp, err := s.client.doReqWithBody("PUT", s.client.BaseURI+"/users/"+username+"/password", &body, headers, queryParams)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	switch resp.StatusCode {
	case 422:
		var respBody422 Error
		err = goraml.NewAPIError(resp, &respBody422)
	default:
		err = goraml.NewAPIError(resp, nil)
	}

	return resp, err
}
92720
func UpdateGroup(hexid, name string, members []string) (*Group, error) {
	g, err := changeGroup(hexid, name, members)
	if err != nil {
		return nil, err
	}
	return g, sendUpdate(g)
}
313138
func (client *Client) UpdateOrganizationManagerByUsername(guid string, username string) (Warnings, error) {
	requestBody := updateOrgManagerByUsernameRequestBody{
		Username: username,
	}

	body, err := json.Marshal(requestBody)
	if err != nil {
		return nil, err
	}

	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.PutOrganizationManagerByUsernameRequest,
		Body:        bytes.NewReader(body),
		URIParams:   Params{"organization_guid": guid},
	})
	if err != nil {
		return nil, err
	}

	response := cloudcontroller.Response{}
	err = client.connection.Make(request, &response)

	return response.Warnings, err
}
320687
func (auth *Auth) UpdateUser(ctx context.Context, user *User) error {
	_, err := auth.client.SetAccountInfo(&identitytoolkit.IdentitytoolkitRelyingpartySetAccountInfoRequest{
		LocalId:       user.UserID,
		Email:         user.Email,
		EmailVerified: user.EmailVerified,
		Password:      user.Password,
		DisplayName:   user.DisplayName,
		DisableUser:   user.Disabled,
		PhotoUrl:      user.PhotoURL,
		PhoneNumber:   user.PhoneNumber,
	}).Context(ctx).Do()
	if err != nil {
		return err
	}
	return nil
}
28738
func (mg *MailgunImpl) UpdateMember(ctx context.Context, s, l string, prototype Member) (Member, error) {
	r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, l) + "/" + s)
	r.setClient(mg.Client())
	r.setBasicAuth(basicAuthUser, mg.APIKey())
	p := newFormDataPayload()
	if prototype.Address != "" {
		p.addValue("address", prototype.Address)
	}
	if prototype.Name != "" {
		p.addValue("name", prototype.Name)
	}
	if prototype.Vars != nil {
		vs, err := json.Marshal(prototype.Vars)
		if err != nil {
			return Member{}, err
		}
		p.addValue("vars", string(vs))
	}
	if prototype.Subscribed != nil {
		p.addValue("subscribed", yesNo(*prototype.Subscribed))
	}
	response, err := makePutRequest(ctx, r, p)
	if err != nil {
		return Member{}, err
	}
	var envelope struct {
		Member Member `json:"member"`
	}
	err = response.parseFromJSON(&envelope)
	return envelope.Member, err
}
1250935
func (s *CreateEnvironmentMembershipOutput) SetMembership(v *EnvironmentMember) *CreateEnvironmentMembershipOutput {
	s.Membership = v
	return s
}
1232697
func (s *UsersService) UpdateAuthorization(grantedTo, username string, body Authorization, headers, queryParams map[string]interface{}) (*http.Response, error) {
	var err error

	resp, err := s.client.doReqWithBody("PUT", s.client.BaseURI+"/users/"+username+"/authorizations/"+grantedTo, &body, headers, queryParams)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	return resp, err
}