// handleStatus returns status on the system.
162736
func (s *Service) handleStatus(w http.ResponseWriter, r *http.Request) {
	results, err := s.store.Stats()
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

	rt := map[string]interface{}{
		"GOARCH":        runtime.GOARCH,
		"GOOS":          runtime.GOOS,
		"GOMAXPROCS":    runtime.GOMAXPROCS(0),
		"num_cpu":       runtime.NumCPU(),
		"num_goroutine": runtime.NumGoroutine(),
		"version":       runtime.Version(),
	}

	httpStatus := map[string]interface{}{
		"addr":              s.Addr().String(),
		"auth":              prettyEnabled(s.credentialStore != nil),
		"redirect":          s.leaderAPIAddr(),
		"conn_idle_timeout": s.ConnIdleTimeout.String(),
		"conn_tx_timeout":   s.ConnTxTimeout.String(),
	}

	nodeStatus := map[string]interface{}{
		"start_time": s.start,
		"uptime":     time.Since(s.start).String(),
	}

	// Build the status response.
	status := map[string]interface{}{
		"runtime": rt,
		"store":   results,
		"http":    httpStatus,
		"node":    nodeStatus,
	}
	if !s.lastBackup.IsZero() {
		status["last_backup_time"] = s.lastBackup
	}
	if s.BuildInfo != nil {
		status["build"] = s.BuildInfo
	}

	// Add any registered statusers.
	func() {
		s.statusMu.RLock()
		defer s.statusMu.RUnlock()
		for k, v := range s.statuses {
			stat, err := v.Stats()
			if err != nil {
				http.Error(w, err.Error(), http.StatusInternalServerError)
				return
			}
			status[k] = stat
		}
	}()

	pretty, _ := isPretty(r)
	var b []byte
	if pretty {
		b, err = json.MarshalIndent(status, "", "    ")
	} else {
		b, err = json.Marshal(status)
	}
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	} else {
		_, err = w.Write([]byte(b))
		if err != nil {
			w.WriteHeader(http.StatusInternalServerError)
		}
	}
}
863576
func (s *ComplianceItem) SetStatus(v string) *ComplianceItem {
	s.Status = &v
	return s
}
608948
func (s *ElasticIpStatus) SetStatus(v string) *ElasticIpStatus {
	s.Status = &v
	return s
}
310490
func (s *TrustedAdvisorCheckRefreshStatus) SetStatus(v string) *TrustedAdvisorCheckRefreshStatus {
	s.Status = &v
	return s
}
1325822
func (s *ReprocessingSummary) SetStatus(v string) *ReprocessingSummary {
	s.Status = &v
	return s
}
603138
func (i *Import) GetStatus() string {
	if i == nil || i.Status == nil {
		return ""
	}
	return *i.Status
}
487085
func (s *RestoreStatus) SetStatus(v string) *RestoreStatus {
	s.Status = &v
	return s
}
869383
func (l *ListCheckRunsOptions) GetStatus() string {
	if l == nil || l.Status == nil {
		return ""
	}
	return *l.Status
}
1191333
func (s *ExecutionListItem) SetStatus(v string) *ExecutionListItem {
	s.Status = &v
	return s
}
736455
func (s *QueryExecution) SetStatus(v *QueryExecutionStatus) *QueryExecution {
	s.Status = v
	return s
}
646603
func (c *SCSICmd) RespondStatus(status byte) SCSIResponse {
	return SCSIResponse{
		id:     c.id,
		status: status,
	}
}
131342
func (s *ListThingRegistrationTasksInput) SetStatus(v string) *ListThingRegistrationTasksInput {
	s.Status = &v
	return s
}
977778
func (ch *CiliumHealth) GetStatus() *models.Status {
	ch.Mutex.RLock()
	status := ch.status
	ch.Mutex.RUnlock()
	return status
}
17458
func (h *Handler) handleGetStatus(w http.ResponseWriter, r *http.Request) {
	if !validHeaderAcceptJSON(r.Header) {
		http.Error(w, "JSON only acceptable response", http.StatusNotAcceptable)
		return
	}
	status := getStatusResponse{
		State:   h.api.State(),
		Nodes:   h.api.Hosts(r.Context()),
		LocalID: h.api.Node().ID,
	}
	if err := json.NewEncoder(w).Encode(status); err != nil {
		h.logger.Printf("write status response error: %s", err)
	}
}
773678
func (s *DescribeChangeSetOutput) SetStatus(v string) *DescribeChangeSetOutput {
	s.Status = &v
	return s
}
1318004
func ExitStatus(cmd *exec.Cmd, err error) string {
	ps := cmd.ProcessState

	if e, ok := err.(*exec.ExitError); ok {
		ps = e.ProcessState
	}

	if ps != nil {
		s, ok := ps.Sys().(syscall.WaitStatus)
		if ok {
			return fmt.Sprintf("%d", s.ExitStatus())
		}
	}

	return "?"
}
474990
func (s *ImportTask) SetStatus(v string) *ImportTask {
	s.Status = &v
	return s
}