// DeleteHttpCompressionProfile removes a http profile.
966953
func (b *BigIP) DeleteHttpCompressionProfile(name string) error {
	return b.delete(uriLtm, uriProfile, uriHttpCompression, name)
}
855574
func (c *Client) FilterProfile(data interface{}) (interface{}, error) {
	socket, err := net.Dial("unix", c.SocketPath)
	if err != nil {
		return nil, err
	}
	defer socket.Close()
	return c.SendRequest("filter_profile", data, socket)
}
927126
func (e Endpoints) PostProfile(ctx context.Context, p Profile) error {
	request := postProfileRequest{Profile: p}
	response, err := e.PostProfileEndpoint(ctx, request)
	if err != nil {
		return err
	}
	resp := response.(postProfileResponse)
	return resp.Err
}
450236
func (provider *GitHubIdentityProvider) Profile(ctx context.Context, token oauth2.Token) (*UserProfile, error) {
	body, err := provider.UserProfilePayload(ctx, token)
	if err != nil {
		return nil, err
	}
	var u gitHubUser
	err = json.Unmarshal(body, &u)
	if err != nil {
		return nil, err
	}
	userProfile := &UserProfile{
		Username: u.Login,
	}
	return userProfile, nil
}
279684
func (s *AutoScaleService) DeleteAutoScaleVmProfile(p *DeleteAutoScaleVmProfileParams) (*DeleteAutoScaleVmProfileResponse, error) {
	resp, err := s.cs.newRequest("deleteAutoScaleVmProfile", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r DeleteAutoScaleVmProfileResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}
1170954
func (b *BigIP) VirtualServerProfiles(vs string) (*Profiles, error) {
	var p Profiles
	err, ok := b.getForEntity(&p, uriLtm, uriVirtual, vs, "profiles")
	if err != nil {
		return nil, err
	}
	if !ok {
		return nil, nil
	}

	return &p, nil
}
1025556
func DeleteNetprofile(key string) error {
	collections.netprofileMutex.Lock()
	obj := collections.netprofiles[key]
	collections.netprofileMutex.Unlock()
	if obj == nil {
		log.Errorf("netprofile %s not found", key)
		return errors.New("netprofile not found")
	}

	// Check if we handle this object
	if objCallbackHandler.NetprofileCb == nil {
		log.Errorf("No callback registered for netprofile object")
		return errors.New("Invalid object type")
	}

	// Perform callback
	err := objCallbackHandler.NetprofileCb.NetprofileDelete(obj)
	if err != nil {
		log.Errorf("NetprofileDelete retruned error for: %+v. Err: %v", obj, err)
		return err
	}

	// delete it from modeldb
	collections.netprofileMutex.Lock()
	err = obj.Delete()
	collections.netprofileMutex.Unlock()
	if err != nil {
		log.Errorf("Error deleting netprofile %s. Err: %v", obj.Key, err)
	}

	// delete it from cache
	collections.netprofileMutex.Lock()
	delete(collections.netprofiles, key)
	collections.netprofileMutex.Unlock()

	return nil
}
118516
func callPostProfileService(reqDTO rest.RequestDTOWithProfile) (rest.ResponseDTOWithProfile, apihelper.ApiErrors, int) {

	b := new(bytes.Buffer)
	json.NewEncoder(b).Encode(reqDTO)

	// call api
	req, err := http.NewRequest("POST", profileBaseUrl, b)

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		var apiError apihelper.ApiErrors
		apiError.Errors = append(apiError.Errors, apihelper.Error{
			Detail: err.Error(),
		})
		return rest.ResponseDTOWithProfile{}, apiError, http.StatusInternalServerError
	}
	defer resp.Body.Close()

	// read response
	body, _ := ioutil.ReadAll(resp.Body)

	userWithProfile := rest.ResponseDTOWithProfile{}
	apiErrors := apihelper.ApiErrors{}
	json.Unmarshal(body, &userWithProfile)
	json.Unmarshal(body, &apiErrors)

	return userWithProfile, apiErrors, resp.StatusCode
}
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
}
1215395
func (c *UsersProfileSetCall) Profile(profile *objects.UserProfile) *UsersProfileSetCall {
	c.profile = profile
	return c
}
1130655
func (b *BigIP) ModifyHttpCompressionProfile(name string, config *HttpCompressionProfile) error {
	return b.put(config, uriLtm, uriProfile, uriHttpCompression, name)
}
152624
func IdentityFilterByProfileURL(profileURL string) func(db *gorm.DB) *gorm.DB {
	return func(db *gorm.DB) *gorm.DB {
		return db.Where("profile_url = ?", profileURL).Limit(1)
	}
}
379284
func (b *BigIP) DeleteServerSSLProfile(name string) error {
	return b.delete(uriLtm, uriProfile, uriServerSSL, name)
}
970598
func (n *NetworkServerAPI) DeleteRoutingProfile(ctx context.Context, req *ns.DeleteRoutingProfileRequest) (*empty.Empty, error) {
	var rpID uuid.UUID
	copy(rpID[:], req.Id)

	if err := storage.DeleteRoutingProfile(storage.DB(), rpID); err != nil {
		return nil, errToRPCError(err)
	}

	return &empty.Empty{}, nil
}
450225
func (e Endpoints) DeleteProfile(ctx context.Context, id string) error {
	request := deleteProfileRequest{ID: id}
	response, err := e.DeleteProfileEndpoint(ctx, request)
	if err != nil {
		return err
	}
	resp := response.(deleteProfileResponse)
	return resp.Err
}
253400
func profile(profFile string, dieAfter time.Duration, readyCh <-chan struct{}) {
	ch := make(chan os.Signal, 1)
	signal.Notify(ch, os.Interrupt)
	go func() {
		if readyCh != nil {
			<-readyCh
		}
		start := time.Now()
		initialUserTime, initialSysTime := getRusage()
		packetsInitiallySent, packetsInitiallyReceived := MQTT.GetStats()

		f, err := os.Create(profFile)
		if err != nil {
			Error.Fatalf("error creating profiling file: %s", err)
		}
		pprof.StartCPUProfile(f)

		// TBD: add timer
		var dieCh <-chan time.Time = nil
		if dieAfter > 0 {
			dieCh = time.After(dieAfter)
		}
		select {
		case <-ch:
		case <-dieCh:
		}
		newUserTime, newSysTime := getRusage()
		elapsed := time.Since(start)
		if elapsed == 0 {
			fmt.Fprintln(os.Stderr, "oops, no time elapsed?")
			return
		}
		elapsedUserTime := newUserTime - initialUserTime
		elapsedSysTime := newSysTime - initialSysTime
		elapsedCpuTime := elapsedUserTime + elapsedSysTime
		cpuLoadUser := float64(elapsedUserTime) * 100.0 / float64(elapsed)
		cpuLoadSys := float64(elapsedSysTime) * 100.0 / float64(elapsed)
		cpuLoad := float64(elapsedCpuTime) * 100.0 / float64(elapsed)

		newPacketsSent, newPacketsReceived := MQTT.GetStats()
		packetsSent := newPacketsSent - packetsInitiallySent
		packetsReceived := newPacketsReceived - packetsInitiallyReceived
		if packetsSent > 0 || packetsReceived > 0 {
			packetsSentPerSecond := float64(packetsSent) * float64(time.Second) /
				float64(elapsed)
			packetsReceivedPerSecond := float64(packetsReceived) * float64(time.Second) /
				float64(elapsed)
			packetsSentPerCpuSecond := float64(packetsSent) * float64(time.Second) /
				float64(elapsedCpuTime)
			packetsReceivedPerCpuSecond := float64(packetsReceived) * float64(time.Second) /
				float64(elapsedCpuTime)

			fmt.Printf("\n*** %d packets sent (%.2f per sec, %.2f per cpu sec), "+
				"%d packets received (%.2f per sec, %.2f per cpu sec)\n",
				packetsSent, packetsSentPerSecond, packetsSentPerCpuSecond,
				packetsReceived, packetsReceivedPerSecond, packetsReceivedPerCpuSecond)
		}

		fmt.Printf("*** %.2f seconds elapsed, %.2f user, %.2f sys\n",
			float64(elapsed)/float64(time.Second),
			float64(elapsedUserTime)/float64(time.Second),
			float64(elapsedSysTime)/float64(time.Second))
		fmt.Printf("*** %.2f%% CPU load, %.2f%% user, %.2f%% sys\n",
			cpuLoad, cpuLoadUser, cpuLoadSys)
		pprof.StopCPUProfile()
		os.Exit(130)
	}()
}
1173872
func (client *Client) GetProfile(userID string) *GetProfileCall {
	return &GetProfileCall{
		c:      client,
		userID: userID,
	}
}