Skip to content

Commit c926d87

Browse files
committed
chore(api): add uid for app and workspace
1 parent e4df66b commit c926d87

6 files changed

Lines changed: 13 additions & 8 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.26
55
require (
66
github.com/chai2010/gettext-go v1.0.3
77
github.com/containerd/console v1.0.4
8-
github.com/drycc/controller-sdk-go v0.0.0-20260514025542-6560840c76da
8+
github.com/drycc/controller-sdk-go v0.0.0-20260527062908-7d751e6440b0
99
github.com/drycc/pkg v0.0.0-20250917064731-345368da3dbf
1010
github.com/minio/selfupdate v0.6.0
1111
github.com/olekukonko/tablewriter v0.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6N
99
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
1010
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
1111
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
12-
github.com/drycc/controller-sdk-go v0.0.0-20260514025542-6560840c76da h1:5sTsFmVRiMZBWaO1+N8a5kZyQAADY/P3i9oEXyXC674=
13-
github.com/drycc/controller-sdk-go v0.0.0-20260514025542-6560840c76da/go.mod h1:jV1AUDHtY8aPMF95evHQGXZOX6tUXaf7wgqzUEnD5SM=
12+
github.com/drycc/controller-sdk-go v0.0.0-20260527062908-7d751e6440b0 h1:LBGTmWRopu4y0i8DIgRaTnr9oycPlRVo7905yOJSPWw=
13+
github.com/drycc/controller-sdk-go v0.0.0-20260527062908-7d751e6440b0/go.mod h1:jV1AUDHtY8aPMF95evHQGXZOX6tUXaf7wgqzUEnD5SM=
1414
github.com/drycc/pkg v0.0.0-20250917064731-345368da3dbf h1:CYy3NoPhfFhkGAbEppTOQfY/HC2s0FJDcBgbtRKeweg=
1515
github.com/drycc/pkg v0.0.0-20250917064731-345368da3dbf/go.mod h1:BrrNrNskHKm+nJYhXfGuI114w8nupi0AMo8QZHID7CM=
1616
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=

internal/commands/apps.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ func (d *DryccCmd) AppInfo(appID string) error {
111111
table.Append([]string{"App:", app.ID})
112112
table.Append([]string{"URL:", url})
113113
table.Append([]string{"UUID:", app.UUID})
114+
if app.UID != 0 {
115+
table.Append([]string{"UID:", fmt.Sprintf("%d", app.UID)})
116+
}
114117
table.Append([]string{"Workspace:", app.Workspace})
115118
table.Append([]string{"Created:", d.formatTime(app.Created)})
116119
table.Append([]string{"Updated:", d.formatTime(app.Updated)})

internal/commands/apps_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ func TestAppsInfo(t *testing.T) {
148148
fmt.Fprintf(w, `{
149149
"uuid": "c4aed81c-d1ca-4ff1-ab89-d2151264e1a3",
150150
"id": "lorem-ipsum",
151+
"uid": 1001,
151152
"workspace": "dolar-sit-amet",
152153
"structure": {
153154
"cmd": 1
@@ -217,6 +218,7 @@ func TestAppsInfo(t *testing.T) {
217218
testutil.AssertOutput(t, b.String(), `App: lorem-ipsum
218219
URL: `+url+`
219220
UUID: c4aed81c-d1ca-4ff1-ab89-d2151264e1a3
221+
UID: 1001
220222
Workspace: dolar-sit-amet
221223
Created: 2016-08-22T17:40:16Z
222224
Updated: 2016-08-22T17:40:16Z

internal/commands/workspaces.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (d *DryccCmd) WorkspacesList(results int) error {
2828
table := d.getDefaultFormatTable([]string{"NAME", "EMAIL", "CREATED", "UPDATED"})
2929
for _, ws := range wkspaces {
3030
table.Append([]string{
31-
ws.Name,
31+
ws.ID,
3232
ws.Email,
3333
d.formatTime(ws.Created),
3434
d.formatTime(ws.Updated),
@@ -57,7 +57,7 @@ func (d *DryccCmd) WorkspacesCreate(name, email string) error {
5757
return err
5858
}
5959

60-
d.Printf("done, created %s\n", ws.Name)
60+
d.Printf("done, created %s\n", ws.ID)
6161
return nil
6262
}
6363

@@ -74,7 +74,7 @@ func (d *DryccCmd) WorkspacesInfo(name string, results int) error {
7474
}
7575

7676
table := d.getDefaultFormatTable([]string{})
77-
table.Append([]string{"Name:", ws.Name})
77+
table.Append([]string{"Name:", ws.ID})
7878
table.Append([]string{"Email:", ws.Email})
7979
table.Append([]string{"Created:", d.formatTime(ws.Created)})
8080
table.Append([]string{"Updated:", d.formatTime(ws.Updated)})

internal/completion/completion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,8 @@ func (c *WorkspaceCompletion) CompletionFunc(_ *cobra.Command, args []string, to
495495
if wkspaces, _, err := workspaces.List(s.Client, -1); err == nil {
496496
var results []string
497497
for _, ws := range wkspaces {
498-
if strings.HasPrefix(ws.Name, toComplete) {
499-
results = append(results, ws.Name)
498+
if strings.HasPrefix(ws.ID, toComplete) {
499+
results = append(results, ws.ID)
500500
}
501501
}
502502
return results, cobra.ShellCompDirectiveNoFileComp

0 commit comments

Comments
 (0)