refactor(names): refactor handler fetching methods' names
This commit is contained in:
parent
ec53b2851f
commit
373c803c00
@ -82,8 +82,8 @@ kp, _ := kubeprobes.New(
|
|||||||
// ...
|
// ...
|
||||||
)
|
)
|
||||||
|
|
||||||
livenessHandler := kp.GetLivenessHandler()
|
livenessHandler := kp.LivenessHandler()
|
||||||
readinessHandler := kp.GetReadinessHandler()
|
readinessHandler := kp.ReadinessHandler()
|
||||||
```
|
```
|
||||||
|
|
||||||
Those handler can be used for manually mounting them on other servers/routers/muxes (eg. `go-chi/chi`, `gorilla/mux`, `http`'s `ServeMux` etc.).
|
Those handler can be used for manually mounting them on other servers/routers/muxes (eg. `go-chi/chi`, `gorilla/mux`, `http`'s `ServeMux` etc.).
|
||||||
|
@ -93,13 +93,13 @@ func (kp *kubeprobes) handleReadiness(w http.ResponseWriter, _ *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLivenessHandler implements Kubeprobes.
|
// LivenessHandler implements Kubeprobes.
|
||||||
func (kp *kubeprobes) GetLivenessHandler() http.Handler {
|
func (kp *kubeprobes) LivenessHandler() http.Handler {
|
||||||
return http.HandlerFunc(kp.handleLiveness)
|
return http.HandlerFunc(kp.handleLiveness)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetReadinessHandler implements Kubeprobes.
|
// ReadinessHandler implements Kubeprobes.
|
||||||
func (kp *kubeprobes) GetReadinessHandler() http.Handler {
|
func (kp *kubeprobes) ReadinessHandler() http.Handler {
|
||||||
return http.HandlerFunc(kp.handleReadiness)
|
return http.HandlerFunc(kp.handleReadiness)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
types.go
8
types.go
@ -6,10 +6,10 @@ import "net/http"
|
|||||||
type Kubeprobes interface {
|
type Kubeprobes interface {
|
||||||
http.Handler
|
http.Handler
|
||||||
|
|
||||||
// GetLivenessHandler returns [http.Handler] for liveness probes.
|
// LivenessHandler returns [http.Handler] for liveness probes.
|
||||||
GetLivenessHandler() http.Handler
|
LivenessHandler() http.Handler
|
||||||
// GetReadinessHandler returns [http.Handler] for readiness probes.
|
// ReadinessHandler returns [http.Handler] for readiness probes.
|
||||||
GetReadinessHandler() http.Handler
|
ReadinessHandler() http.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
// Option represents a [Kubeprobes] constructor option.
|
// Option represents a [Kubeprobes] constructor option.
|
||||||
|
Loading…
Reference in New Issue
Block a user