// OwnershipSetUsernameFromContext is used to create a new ownership object for
// a volume. It takes an ownership value if passed in by the user, then
// sets the `owner` value to the user name referred to in the user context
182406
func OwnershipSetUsernameFromContext(ctx context.Context, srcOwnership *Ownership) *Ownership {
	// Check if the context has information about the user. If not,
	// then security is not enabled.
	if userinfo, ok := auth.NewUserInfoFromContext(ctx); ok {

		// Merge the previous acls which may have been set by the user
		var acls *Ownership_AccessControl
		if srcOwnership != nil {
			acls = srcOwnership.GetAcls()
		}

		return &Ownership{
			Owner: userinfo.Username,
			Acls:  acls,
		}
	}

	return srcOwnership
}
375846
func (s *Endpoint) SetUsername(v string) *Endpoint {
	s.Username = &v
	return s
}
1003512
func (s *ListSigningCertificatesInput) SetUserName(v string) *ListSigningCertificatesInput {
	s.UserName = &v
	return s
}
549941
func (s *ResendConfirmationCodeInput) SetUserContextData(v *UserContextDataType) *ResendConfirmationCodeInput {
	s.UserContextData = v
	return s
}
693013
func (t *LockTable) AcquireOnNameWithContext(ctx context.Context, g VLogContext, s string) (ret *NamedLock, err error) {
	g.GetVDebugLog().CLogf(ctx, VLog1, "+ LockTable.Lock(%s)", s)
	err = AcquireWithContext(ctx, t)
	if err != nil {
		g.GetVDebugLog().CLogf(ctx, VLog1, "- LockTable.Lock(%s) outer canceled: %v", s, err)
		return nil, err
	}
	t.init()
	if ret = t.locks[s]; ret == nil {
		ret = &NamedLock{lctx: g, refs: 0, name: s, parent: t}
		t.locks[s] = ret
	}
	ret.incref()
	t.Unlock()
	err = AcquireWithContext(ctx, ret)
	if err != nil {
		g.GetVDebugLog().CLogf(ctx, VLog1, "- LockTable.Lock(%s) inner canceled: %v", s, err)
		return nil, err
	}
	g.GetVDebugLog().CLogf(ctx, VLog1, "- LockTable.Lock(%s)", s)
	return ret, nil
}
439092
func (s *InstanceAccessDetails) SetUsername(v string) *InstanceAccessDetails {
	s.Username = &v
	return s
}
690383
func (s *RDSDatabaseCredentials) SetUsername(v string) *RDSDatabaseCredentials {
	s.Username = &v
	return s
}
1053436
func (s *ImportSshPublicKeyOutput) SetUserName(v string) *ImportSshPublicKeyOutput {
	s.UserName = &v
	return s
}
393875
func (s *UpdateAccessKeyInput) SetUserName(v string) *UpdateAccessKeyInput {
	s.UserName = &v
	return s
}
1040077
func (s *ListedUser) SetUserName(v string) *ListedUser {
	s.UserName = &v
	return s
}
536134
func (s *ForgotPasswordInput) SetUsername(v string) *ForgotPasswordInput {
	s.Username = &v
	return s
}
1075861
func (s *MongoDbSettings) SetUsername(v string) *MongoDbSettings {
	s.Username = &v
	return s
}
1320658
func (s *PolicyUser) SetUserName(v string) *PolicyUser {
	s.UserName = &v
	return s
}
777132
func (s *AccessKey) SetUserName(v string) *AccessKey {
	s.UserName = &v
	return s
}
559759
func (s *EnableMFADeviceInput) SetUserName(v string) *EnableMFADeviceInput {
	s.UserName = &v
	return s
}
635615
func (s *Instance) SetUsername(v string) *Instance {
	s.Username = &v
	return s
}
210477
func (api *Client) SetUserPhotoContext(ctx context.Context, image string, params UserSetPhotoParams) error {
	response := &SlackResponse{}
	values := url.Values{
		"token": {api.token},
	}
	if params.CropX != DEFAULT_USER_PHOTO_CROP_X {
		values.Add("crop_x", strconv.Itoa(params.CropX))
	}
	if params.CropY != DEFAULT_USER_PHOTO_CROP_Y {
		values.Add("crop_y", strconv.Itoa(params.CropX))
	}
	if params.CropW != DEFAULT_USER_PHOTO_CROP_W {
		values.Add("crop_w", strconv.Itoa(params.CropW))
	}

	err := postLocalWithMultipartResponse(ctx, api.httpclient, api.endpoint+"users.setPhoto", image, "image", values, response, api)
	if err != nil {
		return err
	}

	return response.Err()
}