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

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: Renamed stuff 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
« no previous file with comments | « milo/appengine/buildbot/pubsub_test.go ('k') | milo/appengine/frontend/static/common/auth » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.GET("/admin/update", basemw.Extend(gaemiddleware.RequireCron), 39 r.GET("/admin/update", basemw.Extend(gaemiddleware.RequireCron),
(...skipping 21 matching lines...) Expand all
51 // LogDog Milo Annotation Streams. 61 // LogDog Milo Annotation Streams.
52 r.GET("/logdog/build/:project/*path", basemw, settings.Wrap(&logdog.Anno tationStream{})) 62 r.GET("/logdog/build/:project/*path", basemw, settings.Wrap(&logdog.Anno tationStream{}))
53 63
54 // User settings 64 // User settings
55 r.GET("/settings", basemw, settings.Wrap(settings.Settings{})) 65 r.GET("/settings", basemw, settings.Wrap(settings.Settings{}))
56 r.POST("/settings", basemw, settings.ChangeSettings) 66 r.POST("/settings", basemw, settings.ChangeSettings)
57 67
58 // PubSub subscription endpoints. 68 // PubSub subscription endpoints.
59 r.POST("/pubsub/buildbot", basemw, buildbot.PubSubHandler) 69 r.POST("/pubsub/buildbot", basemw, buildbot.PubSubHandler)
60 70
61 » http.Handle("/", r) 71 » // pRPC style endpoints.
72 » var api prpc.Server
73 » milo.RegisterBuildbotServer(&api, &milo.DecoratedBuildbot{
74 » » Service: &buildbot.BuildbotService{},
75 » » Prelude: emptyPrelude,
76 » })
77 » discovery.Enable(&api)
78 » api.InstallHandlers(r, gaemiddleware.BaseProd())
79
80 » http.DefaultServeMux.Handle("/", r)
62 } 81 }
OLDNEW
« no previous file with comments | « milo/appengine/buildbot/pubsub_test.go ('k') | milo/appengine/frontend/static/common/auth » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698