Migrate to Wire for dependency injection (#32289)
Fixes #30144 Co-authored-by: dsotirakis <sotirakis.dim@gmail.com> Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com> Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com> Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com> Co-authored-by: Will Browne <wbrowne@users.noreply.github.com> Co-authored-by: Leon Sorokin <leeoniya@gmail.com> Co-authored-by: Andrej Ocenas <mr.ocenas@gmail.com> Co-authored-by: spinillos <selenepinillos@gmail.com> Co-authored-by: Karl Persson <kalle.persson@grafana.com> Co-authored-by: Leonard Gram <leo@xlson.com>
This commit is contained in:
co-authored by
dsotirakis
Marcus Efraimsson
Ida Furjesova
Jack Westbrook
Will Browne
Leon Sorokin
Andrej Ocenas
spinillos
Karl Persson
Leonard Gram
parent
e61bc33163
commit
78596a6756
@@ -15,7 +15,7 @@ import (
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/resource/httpadapter"
|
||||
)
|
||||
|
||||
func (p *testDataPlugin) registerRoutes(mux *http.ServeMux) {
|
||||
func (p *TestDataPlugin) registerRoutes(mux *http.ServeMux) {
|
||||
mux.HandleFunc("/", p.testGetHandler)
|
||||
mux.HandleFunc("/scenarios", p.getScenariosHandler)
|
||||
mux.HandleFunc("/stream", p.testStreamHandler)
|
||||
@@ -24,7 +24,7 @@ func (p *testDataPlugin) registerRoutes(mux *http.ServeMux) {
|
||||
mux.HandleFunc("/boom", p.testPanicHandler)
|
||||
}
|
||||
|
||||
func (p *testDataPlugin) testGetHandler(rw http.ResponseWriter, req *http.Request) {
|
||||
func (p *TestDataPlugin) testGetHandler(rw http.ResponseWriter, req *http.Request) {
|
||||
p.logger.Debug("Received resource call", "url", req.URL.String(), "method", req.Method)
|
||||
|
||||
if req.Method != http.MethodGet {
|
||||
@@ -38,7 +38,7 @@ func (p *testDataPlugin) testGetHandler(rw http.ResponseWriter, req *http.Reques
|
||||
rw.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
func (p *testDataPlugin) getScenariosHandler(rw http.ResponseWriter, req *http.Request) {
|
||||
func (p *TestDataPlugin) getScenariosHandler(rw http.ResponseWriter, req *http.Request) {
|
||||
result := make([]interface{}, 0)
|
||||
|
||||
scenarioIds := make([]string, 0)
|
||||
@@ -69,7 +69,7 @@ func (p *testDataPlugin) getScenariosHandler(rw http.ResponseWriter, req *http.R
|
||||
}
|
||||
}
|
||||
|
||||
func (p *testDataPlugin) testStreamHandler(rw http.ResponseWriter, req *http.Request) {
|
||||
func (p *TestDataPlugin) testStreamHandler(rw http.ResponseWriter, req *http.Request) {
|
||||
p.logger.Debug("Received resource call", "url", req.URL.String(), "method", req.Method)
|
||||
|
||||
if req.Method != http.MethodGet {
|
||||
@@ -152,6 +152,6 @@ func createJSONHandler(logger log.Logger) http.Handler {
|
||||
})
|
||||
}
|
||||
|
||||
func (p *testDataPlugin) testPanicHandler(rw http.ResponseWriter, req *http.Request) {
|
||||
func (p *TestDataPlugin) testPanicHandler(rw http.ResponseWriter, req *http.Request) {
|
||||
panic("BOOM")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user