github.com/outbrain/consul@v1.4.5/agent/status_endpoint.go (about)

     1  package agent
     2  
     3  import (
     4  	"net/http"
     5  )
     6  
     7  func (s *HTTPServer) StatusLeader(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
     8  	var out string
     9  	if err := s.agent.RPC("Status.Leader", struct{}{}, &out); err != nil {
    10  		return nil, err
    11  	}
    12  	return out, nil
    13  }
    14  
    15  func (s *HTTPServer) StatusPeers(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
    16  	var out []string
    17  	if err := s.agent.RPC("Status.Peers", struct{}{}, &out); err != nil {
    18  		return nil, err
    19  	}
    20  	return out, nil
    21  }