// AssignProfile is an assign profile request to DEP
327017
func (s profileService) AssignProfile(profileUUID string, devices []string) (*ProfileResponse, error) {
	var response ProfileResponse
	var request = struct {
		ProfileUUID string   `json:"profile_uuid"`
		Devices     []string `json:"devices"`
	}{profileUUID, devices}
	req, err := s.client.NewRequest("PUT", assignProfilePath, request)
	if err != nil {
		return nil, err
	}
	err = s.client.Do(req, &response)
	if err != nil {
		return nil, err
	}
	return &response, nil
}
1142538
func (e Endpoints) PutProfile(ctx context.Context, id string, p Profile) error {
	request := putProfileRequest{ID: id, Profile: p}
	response, err := e.PutProfileEndpoint(ctx, request)
	if err != nil {
		return err
	}
	resp := response.(putProfileResponse)
	return resp.Err
}
614355
func (m *containerManager) AssignLXDProfiles(instId string, profilesNames []string, profilePosts []lxdprofile.ProfilePost) (current []string, err error) {
	report := func(err error) ([]string, error) {
		// Always return the current profiles assigned to the instance.
		currentProfiles, err2 := m.LXDProfileNames(instId)
		if err != nil && err2 != nil {
			logger.Errorf("secondary error, retrieving profile names: %s", err2)
		}
		return currentProfiles, err
	}

	// Write any new profilePosts and gather a slice of profile
	// names to be deleted, after removal.
	var deleteProfiles []string
	for _, p := range profilePosts {
		if p.Profile != nil {
			pr := charm.LXDProfile(*p.Profile)
			if err := m.MaybeWriteLXDProfile(p.Name, &pr); err != nil {
				return report(err)
			}
		} else {
			deleteProfiles = append(deleteProfiles, p.Name)
		}
	}

	if err := m.server.UpdateContainerProfiles(instId, profilesNames); err != nil {
		return report(errors.Trace(err))
	}

	for _, name := range deleteProfiles {
		if err := m.server.DeleteProfile(name); err != nil {
			// Most likely the failure is because the profile is already in use.
			logger.Debugf("failed to delete profile %q: %s", name, err)
		}
	}
	return report(nil)
}
644916
func ProfileFromFile(filePath string) (*ClientProfile, error) {
	bytes, err := ioutil.ReadFile(filePath)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	var cp *ClientProfile
	if err = yaml.Unmarshal(bytes, &cp); err != nil {
		return nil, trace.Wrap(err)
	}
	return cp, nil
}
122292
func hapiProfile(w http.ResponseWriter, r *http.Request) {
	if os.Getenv("ABOT_ENV") != "test" {
		if !isLoggedIn(w, r) {
			return
		}
	}
	cookie, err := r.Cookie("id")
	if err != nil {
		writeErrorInternal(w, err)
		return
	}
	uid := cookie.Value
	var user struct {
		Name   string
		Email  string
		Phones []dt.Phone
	}
	q := `SELECT name, email FROM users WHERE id=$1`
	err = db.Get(&user, q, uid)
	if err != nil {
		writeErrorInternal(w, err)
		return
	}
	q = `SELECT flexid FROM userflexids
	     WHERE flexidtype=2 AND userid=$1
	     LIMIT 10`
	err = db.Select(&user.Phones, q, uid)
	if err != nil && err != sql.ErrNoRows {
		writeErrorInternal(w, err)
		return
	}
	writeBytes(w, user)
}
1086670
func (e *Environ) assignPublicIP(fip *string, serverId string) (err error) {
	if *fip == "" {
		return errors.Errorf("cannot assign a nil public IP to %q", serverId)
	}
	// At startup nw_info is not yet cached so this may fail
	// temporarily while the server is being built
	for a := common.LongAttempt.Start(); a.Next(); {
		err = e.nova().AddServerFloatingIP(serverId, *fip)
		if err == nil {
			return nil
		}
	}
	return err
}
1173872
func (client *Client) GetProfile(userID string) *GetProfileCall {
	return &GetProfileCall{
		c:      client,
		userID: userID,
	}
}
425549
func (s *CreateLoginProfileOutput) SetLoginProfile(v *LoginProfile) *CreateLoginProfileOutput {
	s.LoginProfile = v
	return s
}
902481
func (s *SearchSource) Profile(profile bool) *SearchSource {
	s.profile = profile
	return s
}
5507
func (c *Client) SetWebProfile(wp WebProfile) error {

	if wp.ID == "" {
		return fmt.Errorf("paypalsdk: no ID specified for WebProfile")
	}

	url := fmt.Sprintf("%s%s%s", c.APIBase, "/v1/payment-experience/web-profiles/", wp.ID)

	req, err := c.NewRequest("PUT", url, wp)

	if err != nil {
		return err
	}

	if err = c.SendWithAuth(req, nil); err != nil {
		return err
	}

	return nil
}
659587
func deleteProfile(sid string) error {
	if err := procDeleteProfile.Find(); err != nil {
		return err
	}
	psid, err := syscall.UTF16PtrFromString(sid)
	if err != nil {
		return err
	}
	r1, _, e1 := syscall.Syscall(procDeleteProfile.Addr(), 3,
		uintptr(unsafe.Pointer(psid)), // _In_     LPCTSTR lpSidString,
		0,                             // _In_opt_ LPCTSTR lpProfilePath,
		0,                             // _In_opt_ LPCTSTR lpComputerName
	)
	if r1 == 0 {
		if e1 == 0 {
			return os.NewSyscallError("DeleteProfile", syscall.EINVAL)
		}
		return os.NewSyscallError("DeleteProfile", e1)
	}
	return nil
}
156228
func GetProfile(scheme, emailHash string) (g GravatarProfile, err error) {
	url := &url.URL{
		Scheme: scheme,
		Host:   gravatarHost,
		Path:   "/" + emailHash + ".json",
	}

	err = run(url, unmarshal_json(&g))
	return
}
904339
func (s profileService) DefineProfile(request *Profile) (*ProfileResponse, error) {
	var response ProfileResponse
	req, err := s.client.NewRequest("POST", defineProfilePath, request)
	if err != nil {
		return nil, err
	}
	err = s.client.Do(req, &response)
	if err != nil {
		return nil, err
	}
	return &response, nil
}
849518
func (e Endpoints) PatchProfile(ctx context.Context, id string, p Profile) error {
	request := patchProfileRequest{ID: id, Profile: p}
	response, err := e.PatchProfileEndpoint(ctx, request)
	if err != nil {
		return err
	}
	resp := response.(patchProfileResponse)
	return resp.Err
}
477898
func (s *StartSigningJobParameter) SetSigningProfileParameter(v *SigningProfileParameter) *StartSigningJobParameter {
	s.SigningProfileParameter = v
	return s
}
225795
func (s *ListSigningProfilesOutput) SetProfiles(v []*SigningProfile) *ListSigningProfilesOutput {
	s.Profiles = v
	return s
}
83123
func (env *environ) AssignLXDProfiles(instId string, profilesNames []string, profilePosts []lxdprofile.ProfilePost) (current []string, err error) {
	return profilesNames, nil
}