// RetrieveWithProfile retrieve a user with its profile
424772
func (s *service) RetrieveWithProfile(email string) (rest.ResponseDTOWithProfile, *servicehelper.Error) {
	if _, err := s.Retrieve(email); err != nil {
		return rest.ResponseDTOWithProfile{}, err
	}
	resDTO, apiErrors, statusCode := callGetProfileService(email)
	if statusCode != http.StatusOK {
		s.Remove(resDTO.Email)
		if len(apiErrors.Errors) > 0 {
			return rest.ResponseDTOWithProfile{}, &servicehelper.Error{
				Detail:  errors.New(apiErrors.Errors[0].(apihelper.Error).Detail),
				Message: apiErrors.Errors[0].(apihelper.Error).Message,
				Param:   apiErrors.Errors[0].(apihelper.Error).Param,
				Code:    servicehelper.Code(statusCode),
			}
		}
		return rest.ResponseDTOWithProfile{}, &servicehelper.Error{
			Detail:  errors.New("server unavailable"),
			Message: "Please try again later",
			Code:    servicehelper.UnexpectedError,
		}
	}
	return resDTO, nil
}
1061754
func (u *User) Profile() (interface{}, error) {
	urlStr := GetApiBaseURL() + "/user/"
	return u.c.execute("GET", urlStr, "")
}
985351
func (c *Client) GetUserProfilePhotos(userID int, opts ...sendOption) (*UserProfilePhotos, error) {
	req := url.Values{}
	req.Set("user_id", fmt.Sprint(userID))
	for _, opt := range opts {
		opt(req)
	}
	photos := &UserProfilePhotos{}
	err := c.doRequest("getUserProfilePhotos", req, photos)
	return photos, err
}
899406
func (r *rest) Get(c *gin.Context) {
	if resDTO, err := r.service.Retrieve(c.Param("profileId")); err != nil {
		c.JSON(apihelper.BuildResponseError(err))
	} else {
		c.JSON(http.StatusOK, resDTO)
	}
}
1283384
func GetRoutingProfile(db sqlx.Queryer, id uuid.UUID) (RoutingProfile, error) {
	var rp RoutingProfile
	err := sqlx.Get(db, &rp, "select * from routing_profile where routing_profile_id = $1", id)
	if err != nil {
		return rp, handlePSQLError(err, "select error")
	}

	return rp, nil
}
415373
func (provider *DefaultIdentityProvider) UserProfilePayload(ctx context.Context, token oauth2.Token) ([]byte, error) {
	req, err := http.NewRequest("GET", provider.ProfileURL, nil)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"err":         err.Error(),
			"profile_url": provider.ProfileURL,
		}, "unable to create http request")
		return nil, err
	}
	req.Header.Add("Authorization", "Bearer "+token.AccessToken)
	res, err := http.DefaultClient.Do(req)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"err":         err.Error(),
			"profile_url": provider.ProfileURL,
		}, "unable to get user profile")
		return nil, err
	}
	defer rest.CloseResponse(res)
	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"err":         err.Error(),
			"profile_url": provider.ProfileURL,
		}, "unable to read user profile payload")
		return body, err
	}
	if res.StatusCode < 200 || res.StatusCode > 299 {
		log.Error(ctx, map[string]interface{}{
			"status":        res.Status,
			"response_body": string(body),
			"profile_url":   provider.ProfileURL,
		}, "unable to get user profile")
		return nil, errors.NewInternalErrorFromString(ctx, "unable to get user profile")
	}
	return body, nil
}
460591
func (t *Template) GetAWSOpsWorksUserProfileWithName(name string) (*resources.AWSOpsWorksUserProfile, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSOpsWorksUserProfile:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSOpsWorksUserProfile not found", name)
}
52780
func (client *Client) GetGroupMemberProfile(groupID, userID string) *GetGroupMemberProfileCall {
	return &GetGroupMemberProfileCall{
		c:       client,
		groupID: groupID,
		userID:  userID,
	}
}
437513
func (provider *OpenShiftIdentityProviderImpl) Profile(ctx context.Context, token oauth2.Token) (*UserProfile, error) {
	body, err := provider.UserProfilePayload(ctx, token)
	if err != nil {
		return nil, err
	}
	var u openshiftUser
	err = json.Unmarshal(body, &u)
	if err != nil {
		return nil, err
	}
	userProfile := &UserProfile{
		Username: u.Metadata.Name,
	}
	return userProfile, nil
}
970550
func WithProfile(profile string) oci.SpecOpts {
	return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error {
		s.Process.ApparmorProfile = profile
		return nil
	}
}
499566
func (a *Account) Profile() (user Profile, err error) {
	err = a.get(a.auth, "/api/v2/users/me", &user)
	if err != nil {
		return user, fmt.Errorf("Could not get user profile: %s", err)
	}

	return user, nil
}
708110
func validateProfile(profile string, loadedProfiles map[string]bool) error {
	if err := ValidateProfileFormat(profile); err != nil {
		return err
	}

	if strings.HasPrefix(profile, ProfileNamePrefix) {
		profileName := strings.TrimPrefix(profile, ProfileNamePrefix)
		if !loadedProfiles[profileName] {
			return fmt.Errorf("profile %q is not loaded", profileName)
		}
	}

	return nil
}
304859
func (s *Server) GetContainerProfiles(name string) ([]string, error) {
	container, _, err := s.GetContainer(name)
	if err != nil {
		return []string{}, errors.Trace(err)
	}
	return container.Profiles, nil
}
698092
func GetProfileName(pod *v1.Pod, containerName string) string {
	return GetProfileNameFromPodAnnotations(pod.Annotations, containerName)
}
184255
func (_m *DBClient) GetDeviceProfilesWithLabel(l string) ([]models.DeviceProfile, error) {
	ret := _m.Called(l)

	var r0 []models.DeviceProfile
	if rf, ok := ret.Get(0).(func(string) []models.DeviceProfile); ok {
		r0 = rf(l)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]models.DeviceProfile)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string) error); ok {
		r1 = rf(l)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
317445
func httpGetNetprofile(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
	log.Debugf("Received httpGetNetprofile: %+v", vars)

	key := vars["key"]

	collections.netprofileMutex.Lock()
	defer collections.netprofileMutex.Unlock()
	obj := collections.netprofiles[key]
	if obj == nil {
		log.Infof("netprofile %s not found", key)
		return nil, errors.New("netprofile not found")
	}

	// Return the obj
	return obj, nil
}
388480
func parseJavaProfile(b []byte) (*Profile, error) {
	h := bytes.SplitAfterN(b, []byte("\n"), 2)
	if len(h) < 2 {
		return nil, errUnrecognized
	}

	p := &Profile{
		PeriodType: &ValueType{},
	}
	header := string(bytes.TrimSpace(h[0]))

	var err error
	var pType string
	switch header {
	case "--- heapz 1 ---":
		pType = "heap"
	case "--- contentionz 1 ---":
		pType = "contention"
	default:
		return nil, errUnrecognized
	}

	if b, err = parseJavaHeader(pType, h[1], p); err != nil {
		return nil, err
	}
	var locs map[uint64]*Location
	if b, locs, err = parseJavaSamples(pType, b, p); err != nil {
		return nil, err
	}
	if err = parseJavaLocations(b, locs, p); err != nil {
		return nil, err
	}

	// Strip out addresses for better merge.
	if err = p.Aggregate(true, true, true, true, false); err != nil {
		return nil, err
	}

	return p, nil
}