Skip to content

Commit e07f6fc

Browse files
committed
fix(service): Use correct service status
1 parent 3523a64 commit e07f6fc

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/google/go-cmp v0.5.6 // indirect
1111
github.com/gorilla/websocket v1.4.1
1212
github.com/iancoleman/strcase v0.1.3
13-
github.com/koyeb/koyeb-api-client-go v0.0.0-20220112085253-fecd904ef385
13+
github.com/koyeb/koyeb-api-client-go v0.0.0-20220202142608-40af05d1a354
1414
github.com/kr/pretty v0.2.0 // indirect
1515
github.com/logrusorgru/aurora v2.0.3+incompatible
1616
github.com/manifoldco/promptui v0.7.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI
263263
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
264264
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
265265
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
266-
github.com/koyeb/koyeb-api-client-go v0.0.0-20220112085253-fecd904ef385 h1:ASLNTq0aWpwvBcuVgjLWmcsezlFng+COs4GlxQvtlLc=
267-
github.com/koyeb/koyeb-api-client-go v0.0.0-20220112085253-fecd904ef385/go.mod h1:+oQfFj2WL3gi9Pb+UHbob4D7xaT52mPfKyH1UvWa4PQ=
266+
github.com/koyeb/koyeb-api-client-go v0.0.0-20220202142608-40af05d1a354 h1:I4QkW/+0nxJL1B/9KbugCPPmfu2cb92mx0OqpzK5ack=
267+
github.com/koyeb/koyeb-api-client-go v0.0.0-20220202142608-40af05d1a354/go.mod h1:+oQfFj2WL3gi9Pb+UHbob4D7xaT52mPfKyH1UvWa4PQ=
268268
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
269269
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
270270
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=

pkg/koyeb/apps_delete.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package koyeb
33
import (
44
"time"
55

6+
"github.com/koyeb/koyeb-api-client-go/api/v1/koyeb"
67
log "github.com/sirupsen/logrus"
78
"github.com/spf13/cobra"
89
)
@@ -25,7 +26,7 @@ func (h *AppHandler) Delete(cmd *cobra.Command, args []string) error {
2526
break
2627
}
2728
for _, svc := range res.GetServices() {
28-
if svc.State.GetStatus() == "STOPPING" || svc.State.GetStatus() == "STOPPED" {
29+
if svc.GetStatus() == koyeb.SERVICESTATUS_DELETING || svc.GetStatus() == koyeb.SERVICESTATUS_DELETED {
2930
continue
3031
}
3132
log.Infof("Deleting service %s", svc.GetName())

pkg/koyeb/services_describe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func (r *DescribeServiceReply) Fields() []map[string]string {
7575
"app": renderer.FormatAppName(r.mapper, item.GetAppId(), r.full),
7676
"name": item.GetName(),
7777
"version": item.GetVersion(),
78-
"status": formatStatus(item.State.GetStatus()),
78+
"status": formatServiceStatus(item.GetStatus()),
7979
"created_at": renderer.FormatTime(item.GetCreatedAt()),
8080
"updated_at": renderer.FormatTime(item.GetUpdatedAt()),
8181
}

pkg/koyeb/services_get.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package koyeb
22

33
import (
4-
"fmt"
5-
64
"github.com/koyeb/koyeb-api-client-go/api/v1/koyeb"
75
"github.com/koyeb/koyeb-cli/pkg/koyeb/idmapper"
86
"github.com/koyeb/koyeb-cli/pkg/koyeb/renderer"
@@ -55,14 +53,14 @@ func (r *GetServiceReply) Fields() []map[string]string {
5553
"app": renderer.FormatAppName(r.mapper, item.GetAppId(), r.full),
5654
"name": item.GetName(),
5755
"version": item.GetVersion(),
58-
"status": formatStatus(item.State.GetStatus()),
56+
"status": formatServiceStatus(item.GetStatus()),
5957
"created_at": renderer.FormatTime(item.GetCreatedAt()),
6058
}
6159

6260
resp := []map[string]string{fields}
6361
return resp
6462
}
6563

66-
func formatStatus(status koyeb.ServiceStateStatus) string {
67-
return fmt.Sprintf("%s", status)
64+
func formatServiceStatus(status koyeb.ServiceStatus) string {
65+
return string(status)
6866
}

pkg/koyeb/services_list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (r *ListServicesReply) Fields() []map[string]string {
8181
"id": renderer.FormatServiceID(r.mapper, item.GetId(), r.full),
8282
"app": renderer.FormatAppName(r.mapper, item.GetAppId(), r.full),
8383
"name": item.GetName(),
84-
"status": formatStatus(item.State.GetStatus()),
84+
"status": formatServiceStatus(item.GetStatus()),
8585
"created_at": renderer.FormatTime(item.GetCreatedAt()),
8686
}
8787
resp = append(resp, fields)

0 commit comments

Comments
 (0)