// HTTPProbeDetails returns the ProbeDetailsDTO data deserialized as a HTTPProbeDetailsDTO
169762
func (s *ProbeDetailsDTO) HTTPProbeDetails() (HTTPProbeDetailsDTO, error) {
	var d HTTPProbeDetailsDTO
	err := json.Unmarshal(s.data, &d)
	return d, err
}
21951
func HttpPostJSON(client *http.Client, url string, body, v interface{}) error {
	data, err := json.Marshal(body)
	if err != nil {
		return err
	}
	rc, err := HttpPost(client, url, http.Header{"content-type": []string{"application/json"}}, data)
	if err != nil {
		return err
	}
	defer rc.Close()
	err = json.NewDecoder(rc).Decode(v)
	if _, ok := err.(*json.SyntaxError); ok {
		return fmt.Errorf("JSON syntax error at %s", url)
	}
	return nil
}
1113421
func NewSharedContentDownloadDetails(SharedContentLink string, SharedContentAccessLevel *sharing.AccessLevel) *SharedContentDownloadDetails {
	s := new(SharedContentDownloadDetails)
	s.SharedContentLink = SharedContentLink
	s.SharedContentAccessLevel = SharedContentAccessLevel
	return s
}
452695
func httpDeleteTenant(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
	log.Debugf("Received httpDeleteTenant: %+v", vars)

	key := vars["key"]

	// Delete the object
	err := DeleteTenant(key)
	if err != nil {
		log.Errorf("DeleteTenant error for: %s. Err: %v", key, err)
		return nil, err
	}

	// Return the obj
	return key, nil
}
736268
func httpInspectTenant(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
	var obj TenantInspect
	log.Debugf("Received httpInspectTenant: %+v", vars)

	key := vars["key"]

	collections.tenantMutex.Lock()
	defer collections.tenantMutex.Unlock()
	objConfig := collections.tenants[key]
	if objConfig == nil {
		log.Errorf("tenant %s not found", key)
		return nil, errors.New("tenant not found")
	}
	obj.Config = *objConfig

	if err := GetOperTenant(&obj); err != nil {
		log.Errorf("GetTenant error for: %+v. Err: %v", obj, err)
		return nil, err
	}

	// Return the obj
	return &obj, nil
}
22166
func (s *ResourcePendingMaintenanceActions) SetPendingMaintenanceActionDetails(v []*PendingMaintenanceAction) *ResourcePendingMaintenanceActions {
	s.PendingMaintenanceActionDetails = v
	return s
}
305079
func (dh *Client) ImageDetails(id string) (imageDetails *docker.ImageDetails, e error) {
	imageDetails = &docker.ImageDetails{}
	return imageDetails, dh.getJSON(dh.Address+"/images/"+id+"/json", imageDetails)
}
245261
func (component *Component) AttachPrivateAPI(group *gin.RouterGroup) {
	group.GET("/user/email/:email", component.rest.GetByEmail)
	group.GET("/user/id/:userId", component.rest.GetById)
	group.POST("/user/check-credentials", component.rest.CheckCredentials)
}
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
}
209009
func (s *ProbeDetailsDTO) GetDetailsObject(t ProbeType) (interface{}, error) {
	switch t {
	case DNSProbeType:
		return s.DNSProbeDetails()
	case FTPProbeType:
		return s.FTPProbeDetails()
	case HTTPProbeType:
		return s.HTTPProbeDetails()
	case PingProbeType:
		return s.PingProbeDetails()
	case SMTPProbeType:
		return s.SMTPProbeDetails()
	case SMTPSENDProbeType:
		return s.SMTPSENDProbeDetails()
	case TCPProbeType:
		return s.TCPProbeDetails()
	default:
		return nil, fmt.Errorf("Invalid ProbeType: %#v", t)
	}
}
1133031
func (st HTTPStats) toServerHTTPStats() ServerHTTPStats {
	serverStats := ServerHTTPStats{}
	serverStats.TotalHEADStats = ServerHTTPMethodStats{
		Count:       st.totalHEADs.Counter.Load(),
		AvgDuration: durationStr(st.totalHEADs.Duration.Load(), float64(st.totalHEADs.Counter.Load())),
	}
	serverStats.SuccessHEADStats = ServerHTTPMethodStats{
		Count:       st.successHEADs.Counter.Load(),
		AvgDuration: durationStr(st.successHEADs.Duration.Load(), float64(st.successHEADs.Counter.Load())),
	}
	serverStats.TotalGETStats = ServerHTTPMethodStats{
		Count:       st.totalGETs.Counter.Load(),
		AvgDuration: durationStr(st.totalGETs.Duration.Load(), float64(st.totalGETs.Counter.Load())),
	}
	serverStats.SuccessGETStats = ServerHTTPMethodStats{
		Count:       st.successGETs.Counter.Load(),
		AvgDuration: durationStr(st.successGETs.Duration.Load(), float64(st.successGETs.Counter.Load())),
	}
	serverStats.TotalPUTStats = ServerHTTPMethodStats{
		Count:       st.totalPUTs.Counter.Load(),
		AvgDuration: durationStr(st.totalPUTs.Duration.Load(), float64(st.totalPUTs.Counter.Load())),
	}
	serverStats.SuccessPUTStats = ServerHTTPMethodStats{
		Count:       st.successPUTs.Counter.Load(),
		AvgDuration: durationStr(st.successPUTs.Duration.Load(), float64(st.successPUTs.Counter.Load())),
	}
	serverStats.TotalPOSTStats = ServerHTTPMethodStats{
		Count:       st.totalPOSTs.Counter.Load(),
		AvgDuration: durationStr(st.totalPOSTs.Duration.Load(), float64(st.totalPOSTs.Counter.Load())),
	}
	serverStats.SuccessPOSTStats = ServerHTTPMethodStats{
		Count:       st.successPOSTs.Counter.Load(),
		AvgDuration: durationStr(st.successPOSTs.Duration.Load(), float64(st.successPOSTs.Counter.Load())),
	}
	serverStats.TotalDELETEStats = ServerHTTPMethodStats{
		Count:       st.totalDELETEs.Counter.Load(),
		AvgDuration: durationStr(st.totalDELETEs.Duration.Load(), float64(st.totalDELETEs.Counter.Load())),
	}
	serverStats.SuccessDELETEStats = ServerHTTPMethodStats{
		Count:       st.successDELETEs.Counter.Load(),
		AvgDuration: durationStr(st.successDELETEs.Duration.Load(), float64(st.successDELETEs.Counter.Load())),
	}
	return serverStats
}
261003
func (h *Host) HTTPTransport() http.RoundTripper {
	if h.transport == nil {
		return http.DefaultTransport
	}
	return h.transport
}
35643
func HTTPPost(url string, headers [][]string, payload *[]byte) ([]byte, error) {
	// setup post client
	client := &http.Client{}
	req, err := http.NewRequest("POST", url, bytes.NewReader(*payload))

	// add headers
	if len(headers) > 0 {
		for i := range headers {
			req.Header.Add(headers[i][0], headers[i][1])
		}
	}

	// perform request
	resp, err := client.Do(req)
	if err != nil {
		return nil, err
	}

	defer resp.Body.Close()

	if err != nil {
		return nil, err
	}

	// read response, check & return
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}

	return body, nil
}
621177
func HTTPPost(path string, data *[]byte, headers [][]string, username, password string) ([]byte, error) {
	var (
		req *http.Request
		err error
	)

	client := &http.Client{Transport: &transport}
	if data == nil {
		req, err = http.NewRequest("POST", path, nil)
	} else {
		req, err = http.NewRequest("POST", path, bytes.NewReader(*data))
	}

	if err != nil {
		return nil, err
	}

	if username != "" && password != "" {
		req.SetBasicAuth(username, password)
	}

	if len(headers) > 0 {
		for i := range headers {
			req.Header.Add(headers[i][0], headers[i][1])
		}
	}
	return makeRequest(client, req)
}
317836
func (w *pgWorker) publishAPIServerDetails(
	servers map[string][]network.HostPort,
	members map[string]*replicaset.Member,
) {
	details := apiserver.Details{
		Servers:   make(map[string]apiserver.APIServer),
		LocalOnly: true,
	}
	internalPort := w.config.ControllerAPIPort
	if internalPort == 0 {
		internalPort = w.config.APIPort
	}
	for id, hostPorts := range servers {
		var internalAddress string
		if members[id] != nil {
			mongoAddress, _, err := net.SplitHostPort(members[id].Address)
			if err == nil {
				internalAddress = net.JoinHostPort(mongoAddress, strconv.Itoa(internalPort))
			}
		}
		server := apiserver.APIServer{
			ID:              id,
			InternalAddress: internalAddress,
		}
		for _, hp := range network.FilterUnusableHostPorts(hostPorts) {
			server.Addresses = append(server.Addresses, hp.String())
		}
		sort.Strings(server.Addresses)
		details.Servers[server.ID] = server
	}

	if !reflect.DeepEqual(w.serverDetails, details) {
		w.config.Hub.Publish(apiserver.DetailsTopic, details)
		w.serverDetails = details
	}
}
431072
func (c *Client) HTTPStats() *httputil.StatsTransport {
	st, _ := c.httpClient.Transport.(*httputil.StatsTransport)
	return st
}
683018
func NewSharedContentAddMemberDetails(SharedContentAccessLevel *sharing.AccessLevel) *SharedContentAddMemberDetails {
	s := new(SharedContentAddMemberDetails)
	s.SharedContentAccessLevel = SharedContentAccessLevel
	return s
}