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

Unified Diff: client/cmd/buildbucket/put.go

Issue 2227113002: Update bulidbucket client (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: rebase Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/cmd/buildbucket/main.go ('k') | common/lhttp/utils.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/cmd/buildbucket/put.go
diff --git a/client/cmd/buildbucket/put.go b/client/cmd/buildbucket/put.go
deleted file mode 100644
index e05be3c3111be933a29b207304720a8018920b66..0000000000000000000000000000000000000000
--- a/client/cmd/buildbucket/put.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2016 The LUCI Authors. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-package main
-
-import (
- "encoding/json"
- "fmt"
-
- "github.com/maruel/subcommands"
-
- "github.com/luci/luci-go/common/api/buildbucket/buildbucket/v1"
- "github.com/luci/luci-go/common/cli"
- "github.com/luci/luci-go/common/logging"
-)
-
-var cmdPutBatch = &subcommands.Command{
- UsageLine: `put [flags] <JSON request>...`,
- ShortDesc: "schedule builds",
- LongDesc: "Schedule builds. \n" +
- "See https://godoc.org/github.com/luci/luci-go/common/api/" +
- "buildbucket/buildbucket/v1#ApiPutBatchRequestMessage " +
- "for JSON request message schema.",
- CommandRun: func() subcommands.CommandRun {
- c := &putBatchRun{}
- c.SetDefaultFlags()
- return c
- },
-}
-
-type putBatchRun struct {
- baseCommandRun
-}
-
-func (r *putBatchRun) Run(a subcommands.Application, args []string) int {
- ctx := cli.GetContext(a, r)
- if len(args) < 1 {
- logging.Errorf(ctx, "missing parameter: <JSON Request>")
- return 1
- }
-
- reqMessage := &buildbucket.ApiPutBatchRequestMessage{}
-
- for i := range args {
- build := &buildbucket.ApiPutRequestMessage{}
- if err := json.Unmarshal([]byte(args[i]), build); err != nil {
- logging.Errorf(ctx, "could not unmarshal %s: %s", args[i], err)
- return 1
- }
- reqMessage.Builds = append(reqMessage.Builds, build)
- }
-
- service, err := r.makeService(ctx, a)
- if err != nil {
- return 1
- }
-
- response, err := service.PutBatch(reqMessage).Do()
- if err != nil {
- logging.Errorf(ctx, "buildbucket.PutBatch failed: %s", err)
- return 1
- }
-
- responseJSON, err := response.MarshalJSON()
- if err != nil {
- logging.Errorf(ctx, "could not marshal response: %s", err)
- return 1
- }
- fmt.Println(string(responseJSON))
- return 0
-}
« no previous file with comments | « client/cmd/buildbucket/main.go ('k') | common/lhttp/utils.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698