Skip to content

Commit

Permalink
Rename variable from ID -> UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
dannymidnight committed Aug 28, 2024
1 parent a27c4b4 commit debec2a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions api/builds.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
)

type Build struct {
ID string `json:"id"`
UUID string `json:"uuid"`
}

// CancelBuild cancels a build with the given ID
func (c *Client) CancelBuild(ctx context.Context, id string) (*Build, *Response, error) {
u := fmt.Sprintf("builds/%s/cancel", railsPathEscape(id))
// CancelBuild cancels a build with the given UUID
func (c *Client) CancelBuild(ctx context.Context, uuid string) (*Build, *Response, error) {
u := fmt.Sprintf("builds/%s/cancel", railsPathEscape(uuid))

req, err := c.newRequest(ctx, "POST", u, nil)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion clicommand/build_cancel.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func cancelBuild(ctx context.Context, cfg BuildCancelConfig, l logger.Logger) er
return err
}

l.Info("Successfully cancelled build %s", build.ID)
l.Info("Successfully cancelled build %s", build.UUID)
return nil
}); err != nil {
return fmt.Errorf("failed to cancel build: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion clicommand/build_cancel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestBuildCancel(t *testing.T) {
t.Run("success", func(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
rw.WriteHeader(http.StatusOK)
rw.Write([]byte(`{"status": "canceled", "id": "1"}`))
rw.Write([]byte(`{"status": "canceled", "uuid": "1"}`))
}))

cfg := BuildCancelConfig{
Expand Down

0 comments on commit debec2a

Please sign in to comment.