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

Unified Diff: client/cmd/buildbucket/cancel.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/base_command.go ('k') | client/cmd/buildbucket/get.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/cmd/buildbucket/cancel.go
diff --git a/client/cmd/buildbucket/cancel.go b/client/cmd/buildbucket/cancel.go
deleted file mode 100644
index daf3ef0055e5954bec4a34623b4be5c3a2935027..0000000000000000000000000000000000000000
--- a/client/cmd/buildbucket/cancel.go
+++ /dev/null
@@ -1,66 +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 (
- "fmt"
- "strconv"
-
- "github.com/maruel/subcommands"
-
- "github.com/luci/luci-go/common/cli"
- "github.com/luci/luci-go/common/logging"
-)
-
-var cmdCancel = &subcommands.Command{
- UsageLine: `cancel [flags] <build id>`,
- ShortDesc: "Cancel a build",
- LongDesc: "Attempt to cancel an existing build.",
- CommandRun: func() subcommands.CommandRun {
- c := &cancelRun{}
- c.SetDefaultFlags()
- return c
- },
-}
-
-type cancelRun struct {
- baseCommandRun
-}
-
-func (r *cancelRun) Run(a subcommands.Application, args []string) int {
- ctx := cli.GetContext(a, r)
- if len(args) < 1 {
- logging.Errorf(ctx, "missing parameter: <Build ID>")
- return 1
- } else if len(args) > 1 {
- logging.Errorf(ctx, "unexpected arguments: %s", args[1:])
- }
-
- buildId, err := strconv.ParseInt(args[0], 10, 64)
- if err != nil {
- logging.Errorf(ctx, "expected a build id (int64): %s", err)
- return 1
- }
-
- service, err := r.makeService(ctx, a)
- if err != nil {
- return 1
- }
-
- response, err := service.Cancel(buildId).Do()
- if err != nil {
- logging.Errorf(ctx, "buildbucket.Cancel failed: %s", err)
- return 1
- }
-
- responseJSON, err := response.MarshalJSON()
- if err != nil {
- logging.Errorf(ctx, "could not unmarshal response: %s", err)
- return 1
- }
-
- fmt.Println(string(responseJSON))
- return 0
-}
« no previous file with comments | « client/cmd/buildbucket/base_command.go ('k') | client/cmd/buildbucket/get.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698