github.com/yasker/longhorn-engine@v0.0.0-20160621014712-6ed6cfca0729/agent/status/controller.go (about)

     1  package status
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/rancher/longhorn/controller/client"
     7  )
     8  
     9  type ControllerStatus struct {
    10  	controller *client.ControllerClient
    11  }
    12  
    13  func NewControllerStatus() *ControllerStatus {
    14  
    15  	controllerClient := client.NewControllerClient("http://localhost:9501/v1")
    16  	return &ControllerStatus{
    17  		controller: controllerClient,
    18  	}
    19  }
    20  
    21  func (s *ControllerStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
    22  	_, err := s.controller.GetVolume()
    23  	if err != nil {
    24  		writeError(rw, err)
    25  		return
    26  	}
    27  
    28  	writeOK(rw)
    29  }