// Code generated by go-swagger; DO NOT EDIT.

package operations

import (
	"net/http"

	"github.com/go-openapi/runtime/middleware"
)

// ClusterHealthHandlerFunc turns a function with the right signature into a cluster health handler
type ClusterHealthHandlerFunc func(ClusterHealthParams) middleware.Responder

// Handle executing the request and returning a response
func (fn ClusterHealthHandlerFunc) Handle(params ClusterHealthParams) middleware.Responder {
	return fn(params)
}

// ClusterHealthHandler interface for that can handle valid cluster health params
type ClusterHealthHandler interface {
	Handle(ClusterHealthParams) middleware.Responder
}

// NewClusterHealth creates a new http.Handler for the cluster health operation
func NewClusterHealth(ctx *middleware.Context, handler ClusterHealthHandler) *ClusterHealth {
	return &ClusterHealth{Context: ctx, Handler: handler}
}

/*
	ClusterHealth swagger:route GET /cluster_health clusterHealth

Checks the full graph. Returns a binary OK or not OK.
*/
type ClusterHealth struct {
	Context *middleware.Context
	Handler ClusterHealthHandler
}

func (o *ClusterHealth) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
	route, rCtx, _ := o.Context.RouteInfo(r)
	if rCtx != nil {
		*r = *rCtx
	}
	var Params = NewClusterHealthParams()
	if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
		o.Context.Respond(rw, r, route.Produces, route, err)
		return
	}

	res := o.Handler.Handle(Params) // actually handle the request

	o.Context.Respond(rw, r, route.Produces, route, res)

}
