Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: milo/appengine/frontend/milo.go

Issue 2275123002: Milo: pRPC endpoint for getting Buildbot master data (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: Update config tests Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package frontend 5 package frontend
6 6
7 import ( 7 import (
8 "net/http" 8 "net/http"
9 9
10 "golang.org/x/net/context"
11
12 "github.com/golang/protobuf/proto"
10 "github.com/luci/luci-go/appengine/gaemiddleware" 13 "github.com/luci/luci-go/appengine/gaemiddleware"
14 "github.com/luci/luci-go/grpc/discovery"
15 "github.com/luci/luci-go/grpc/prpc"
16 milo "github.com/luci/luci-go/milo/api/proto"
11 "github.com/luci/luci-go/milo/appengine/buildbot" 17 "github.com/luci/luci-go/milo/appengine/buildbot"
12 "github.com/luci/luci-go/milo/appengine/buildbucket" 18 "github.com/luci/luci-go/milo/appengine/buildbucket"
13 "github.com/luci/luci-go/milo/appengine/console" 19 "github.com/luci/luci-go/milo/appengine/console"
14 "github.com/luci/luci-go/milo/appengine/logdog" 20 "github.com/luci/luci-go/milo/appengine/logdog"
15 "github.com/luci/luci-go/milo/appengine/settings" 21 "github.com/luci/luci-go/milo/appengine/settings"
16 "github.com/luci/luci-go/milo/appengine/swarming" 22 "github.com/luci/luci-go/milo/appengine/swarming"
17 "github.com/luci/luci-go/server/router" 23 "github.com/luci/luci-go/server/router"
18 ) 24 )
19 25
26 func emptyPrelude(c context.Context, methodName string, req proto.Message) (cont ext.Context, error) {
27 return c, nil
28 }
29
20 // Where it all begins!!! 30 // Where it all begins!!!
21 func init() { 31 func init() {
22 // Register plain ol' http handlers. 32 // Register plain ol' http handlers.
23 r := router.New() 33 r := router.New()
24 basemw := settings.Base() 34 basemw := settings.Base()
25 gaemiddleware.InstallHandlers(r, basemw) 35 gaemiddleware.InstallHandlers(r, basemw)
26 r.GET("/", basemw, settings.Wrap(frontpage{})) 36 r.GET("/", basemw, settings.Wrap(frontpage{}))
27 37
28 // Admin and cron endpoints. 38 // Admin and cron endpoints.
29 r.POST("/admin/update", basemw, settings.UpdateHandler) 39 r.POST("/admin/update", basemw, settings.UpdateHandler)
(...skipping 19 matching lines...) Expand all
49 // LogDog Milo Annotation Streams. 59 // LogDog Milo Annotation Streams.
50 r.GET("/logdog/build/:project/*path", basemw, settings.Wrap(&logdog.Anno tationStream{})) 60 r.GET("/logdog/build/:project/*path", basemw, settings.Wrap(&logdog.Anno tationStream{}))
51 61
52 // User settings 62 // User settings
53 r.GET("/settings", basemw, settings.Wrap(settings.Settings{})) 63 r.GET("/settings", basemw, settings.Wrap(settings.Settings{}))
54 r.POST("/settings", basemw, settings.ChangeSettings) 64 r.POST("/settings", basemw, settings.ChangeSettings)
55 65
56 // PubSub subscription endpoints. 66 // PubSub subscription endpoints.
57 r.POST("/pubsub/buildbot", basemw, buildbot.PubSubHandler) 67 r.POST("/pubsub/buildbot", basemw, buildbot.PubSubHandler)
58 68
59 » http.Handle("/", r) 69 » // pRPC style endpoints.
70 » var api prpc.Server
71 » milo.RegisterBuildbotServer(&api, &milo.DecoratedBuildbot{
72 » » Service: &buildbot.BuildbotService{},
73 » » Prelude: emptyPrelude,
74 » })
75 » discovery.Enable(&api)
76 » api.InstallHandlers(r, gaemiddleware.BaseProd())
77
78 » http.DefaultServeMux.Handle("/", r)
60 } 79 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698