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

Side by Side Diff: milo/appengine/logdog/http.go

Issue 2626433004: Move "common/config" common types into cfgtypes. (Closed)
Patch Set: Created 3 years, 11 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/logdog/build.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 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 logdog 5 package logdog
6 6
7 import ( 7 import (
8 "net/http" 8 "net/http"
9 "strings" 9 "strings"
10 10
11 "github.com/julienschmidt/httprouter" 11 "github.com/julienschmidt/httprouter"
12 "github.com/luci/luci-go/common/config"
13 log "github.com/luci/luci-go/common/logging" 12 log "github.com/luci/luci-go/common/logging"
14 "github.com/luci/luci-go/grpc/prpc" 13 "github.com/luci/luci-go/grpc/prpc"
15 "github.com/luci/luci-go/logdog/client/coordinator" 14 "github.com/luci/luci-go/logdog/client/coordinator"
16 "github.com/luci/luci-go/logdog/common/types" 15 "github.com/luci/luci-go/logdog/common/types"
16 "github.com/luci/luci-go/luci_config/common/cfgtypes"
17 "github.com/luci/luci-go/milo/appengine/settings" 17 "github.com/luci/luci-go/milo/appengine/settings"
18 "github.com/luci/luci-go/milo/common/miloerror" 18 "github.com/luci/luci-go/milo/common/miloerror"
19 "github.com/luci/luci-go/server/auth" 19 "github.com/luci/luci-go/server/auth"
20 "github.com/luci/luci-go/server/templates" 20 "github.com/luci/luci-go/server/templates"
21 21
22 "golang.org/x/net/context" 22 "golang.org/x/net/context"
23 ) 23 )
24 24
25 // AnnotationStream is a ThemedHandler that renders a LogDog Milo annotation 25 // AnnotationStream is a ThemedHandler that renders a LogDog Milo annotation
26 // protobuf stream. 26 // protobuf stream.
(...skipping 17 matching lines...) Expand all
44 if err != nil { 44 if err != nil {
45 log.WithError(err).Errorf(c, "Failed to get transport for LogDog server.") 45 log.WithError(err).Errorf(c, "Failed to get transport for LogDog server.")
46 return nil, &miloerror.Error{ 46 return nil, &miloerror.Error{
47 Code: http.StatusInternalServerError, 47 Code: http.StatusInternalServerError,
48 } 48 }
49 } 49 }
50 50
51 as := annotationStreamRequest{ 51 as := annotationStreamRequest{
52 AnnotationStream: s, 52 AnnotationStream: s,
53 53
54 » » project: config.ProjectName(p.ByName("project")), 54 » » project: cfgtypes.ProjectName(p.ByName("project")),
55 path: types.StreamPath(strings.Trim(p.ByName("path"), "/")), 55 path: types.StreamPath(strings.Trim(p.ByName("path"), "/")),
56 host: req.FormValue("host"), 56 host: req.FormValue("host"),
57 } 57 }
58 if err := as.normalize(); err != nil { 58 if err := as.normalize(); err != nil {
59 return nil, err 59 return nil, err
60 } 60 }
61 61
62 // Setup our LogDog client. 62 // Setup our LogDog client.
63 as.logDogClient = coordinator.NewClient(&prpc.Client{ 63 as.logDogClient = coordinator.NewClient(&prpc.Client{
64 C: &http.Client{ 64 C: &http.Client{
65 Transport: t, 65 Transport: t,
66 }, 66 },
67 Host: as.host, 67 Host: as.host,
68 }) 68 })
69 69
70 // Load the Milo annotation protobuf from the annotation stream. 70 // Load the Milo annotation protobuf from the annotation stream.
71 if err := as.load(c); err != nil { 71 if err := as.load(c); err != nil {
72 return nil, err 72 return nil, err
73 } 73 }
74 74
75 // Convert the Milo Annotation protobuf to Milo objects. 75 // Convert the Milo Annotation protobuf to Milo objects.
76 return &templates.Args{ 76 return &templates.Args{
77 "Build": as.toMiloBuild(c), 77 "Build": as.toMiloBuild(c),
78 }, nil 78 }, nil
79 } 79 }
OLDNEW
« no previous file with comments | « milo/appengine/logdog/build.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698