Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BackendsIndex = func(backends []*domain.Backend, clusterManager ClusterManager) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { backendsJSON, err := json.Marshal(Backends(backends).AsV0JSON(clusterManager)) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } w.Header().Set("Content-Type", "application/json; charset=utf-8") _, err = w.Write(backendsJSON) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } }) }
View Source
var ClusterEndpoint = func(clusterManager ClusterManager, logger lager.Logger) http.HandlerFunc { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { switch req.Method { case "GET": writeClusterResponse(w, clusterManager) return case "PATCH": handleUpdate(w, req, clusterManager, logger) writeClusterResponse(w, clusterManager) return default: http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) } }) }
Functions ¶
Types ¶
type BackendJSON ¶
type Backends ¶
func (Backends) AsV0JSON ¶
func (bs Backends) AsV0JSON(cluster ClusterManager) (json []V0BackendResponse)
type ClusterAPI ¶
type ClusterAPI struct { ActiveBackendChan chan *domain.Backend // contains filtered or unexported fields }
func NewClusterAPI ¶
func NewClusterAPI( logger lager.Logger) *ClusterAPI
func (*ClusterAPI) AsJSON ¶
func (c *ClusterAPI) AsJSON() ClusterJSON
func (*ClusterAPI) DisableTraffic ¶
func (c *ClusterAPI) DisableTraffic(message string)
func (*ClusterAPI) EnableTraffic ¶
func (c *ClusterAPI) EnableTraffic(message string)
func (*ClusterAPI) ListenForActiveBackend ¶
func (c *ClusterAPI) ListenForActiveBackend()
func (*ClusterAPI) RegisterTrafficEnabledChan ¶
func (c *ClusterAPI) RegisterTrafficEnabledChan(chanToRegister chan bool)
type ClusterJSON ¶
type ClusterJSON struct { ActiveBackend *BackendJSON `json:"activeBackend"` TrafficEnabled bool `json:"trafficEnabled"` Message string `json:"message"` LastUpdated time.Time `json:"lastUpdated"` }
type ClusterManager ¶
type ClusterManager interface { AsJSON() ClusterJSON EnableTraffic(string) DisableTraffic(string) }
type V0BackendResponse ¶
type V0BackendResponse struct { Host string `json:"host"` Port uint `json:"port"` Healthy bool `json:"healthy"` Name string `json:"name"` CurrentSessionCount uint `json:"currentSessionCount"` Active bool `json:"active"` // For Backwards Compatibility TrafficEnabled bool `json:"trafficEnabled"` // For Backwards Compatibility }
Click to show internal directories.
Click to hide internal directories.