Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.0.56] - 2026-01-20

### Changed
- updated `zerops-go` sdk to the latest version with support for new API changes caused by RBAC/ACL system

## [v1.0.55] - 2025-10-08

### Added
- `vpn clear` and `vpn key` commands

## [v1.0.54] - 2025-09-17

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/zeropsio/zcli

go 1.24

require github.com/zeropsio/zerops-go v1.0.14
require github.com/zeropsio/zerops-go v1.0.16

require (
github.com/charmbracelet/bubbles v0.20.0
Expand All @@ -21,6 +21,7 @@ require (
github.com/stretchr/testify v1.10.0
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8
golang.org/x/term v0.28.0
golang.org/x/text v0.21.0
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6
gopkg.in/yaml.v3 v3.0.1
)
Expand Down Expand Up @@ -57,6 +58,5 @@ require (
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/sync v0.11.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/text v0.21.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
)
8 changes: 2 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,8 @@ github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSW
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/zeropsio/zerops-go v1.0.12 h1:tOuvxFS0vnaX7wkuVxONuhmL9WjIUzuRp4kMxqOl8PE=
github.com/zeropsio/zerops-go v1.0.12/go.mod h1:Nuqf1xWt53IRLyVoXgR4hF4ICc9jlfOfQgnN3ZhJR3E=
github.com/zeropsio/zerops-go v1.0.13 h1:uAE9VsL8N3pEwuf3F+zcZxL0R8ASlIvWJ3H7hbq0xFs=
github.com/zeropsio/zerops-go v1.0.13/go.mod h1:Nuqf1xWt53IRLyVoXgR4hF4ICc9jlfOfQgnN3ZhJR3E=
github.com/zeropsio/zerops-go v1.0.14 h1:+/qQhWoxNj3R2vYc5Y2xDQmhqI2eeSP6VWuKFiLZEFo=
github.com/zeropsio/zerops-go v1.0.14/go.mod h1:Nuqf1xWt53IRLyVoXgR4hF4ICc9jlfOfQgnN3ZhJR3E=
github.com/zeropsio/zerops-go v1.0.16 h1:9k/rdkMxbmBWHea2jENlSLLUXgJevjjoveqxz3y4qto=
github.com/zeropsio/zerops-go v1.0.16/go.mod h1:SY4o+4jAIrsDTwWACooogf1OyY1jNK8NqWBe9KFcjAA=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down
7 changes: 4 additions & 3 deletions src/cmd/projectImport.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/zeropsio/zcli/src/uxHelpers"
"github.com/zeropsio/zcli/src/yamlReader"
"github.com/zeropsio/zerops-go/dto/input/body"
"github.com/zeropsio/zerops-go/dto/input/path"
"github.com/zeropsio/zerops-go/types"
"github.com/zeropsio/zerops-go/types/uuid"
)
Expand Down Expand Up @@ -50,11 +51,11 @@ func projectImportCmd() *cmdBuilder.Cmd {
}
}

importProjectResponse, err := cmdData.RestApiClient.PostProjectImport(
importProjectResponse, err := cmdData.RestApiClient.PostClientProjectImport(
ctx,
path.ClientId{Id: orgId},
body.ProjectImport{
ClientId: orgId,
Yaml: types.Text(yamlContent),
Yaml: types.Text(yamlContent),
},
)
if err != nil {
Expand Down
7 changes: 4 additions & 3 deletions src/cmd/projectServiceImport.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/zeropsio/zcli/src/uxHelpers"
"github.com/zeropsio/zcli/src/yamlReader"
"github.com/zeropsio/zerops-go/dto/input/body"
"github.com/zeropsio/zerops-go/dto/input/path"
"github.com/zeropsio/zerops-go/types"
)

Expand Down Expand Up @@ -45,11 +46,11 @@ func projectServiceImportCmd() *cmdBuilder.Cmd {
}
}

importServiceResponse, err := cmdData.RestApiClient.PostServiceStackImport(
importServiceResponse, err := cmdData.RestApiClient.PostProjectServiceStackImport(
ctx,
path.ProjectId{Id: project.Id},
body.ServiceStackImport{
ProjectId: project.Id,
Yaml: types.Text(yamlContent),
Yaml: types.Text(yamlContent),
},
)
if err != nil {
Expand Down
7 changes: 1 addition & 6 deletions src/cmd/servicePush.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,7 @@ func servicePushCmd() *cmdBuilder.Cmd {
return err
}

guiHost := cmdData.
CliStorage.
Data().
RegionData.
GuiAddress.
OrDefault("app.zerops.io")
guiHost := cmdData.CliStorage.Data().RegionData.GuiAddress.OrDefault("app.zerops.io")

var buildPhase bool
var preparePhase bool
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/servicePushDeployShared.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ func createAppVersion(
service entity.Service,
versionName string,
) (output.PostAppVersion, error) {
appVersionResponse, err := restApiClient.PostAppVersion(
appVersionResponse, err := restApiClient.PostServiceStackAppVersion(
ctx,
path.ServiceStackId{Id: service.Id},
body.PostAppVersion{
ServiceStackId: service.Id,
Name: func() types.StringNull {
if versionName != "" {
return types.NewStringNull(versionName)
Expand Down
2 changes: 1 addition & 1 deletion src/entity/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Container struct {
OrgId uuid.ClientId
ProjectId uuid.ProjectId
ServiceId uuid.ServiceStackId
Status enum.ContainerStatusEnum
Status *enum.ContainerStatusEnum
Number types.Int
Name types.StringNull
Hostname types.StringNull
Expand Down
2 changes: 1 addition & 1 deletion src/entity/repository/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func GetOrgById(
return org, nil
}

func orgFromEsSearch(esClientUser output.ClientUserExtra) entity.Org {
func orgFromEsSearch(esClientUser output.ClientUserExtraWithClientLight) entity.Org {
return entity.Org{
Id: esClientUser.ClientId,
Name: esClientUser.Client.AccountName,
Expand Down
3 changes: 1 addition & 2 deletions src/entity/repository/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func PostProject(
post entity.PostProject,
) (entity.Project, error) {
postBody := body.PostProject{
ClientId: post.OrgId,
Name: post.Name,
Mode: &post.Mode,
TagList: post.Tags,
Expand All @@ -85,7 +84,7 @@ func PostProject(
if postBody.TagList == nil {
postBody.TagList = make(types.StringArray, 0)
}
response, err := restApiClient.PostProject(ctx, postBody)
response, err := restApiClient.PostClientProject(ctx, path.ClientId{Id: post.OrgId}, postBody)
if err != nil {
return entity.Project{}, err
}
Expand Down
8 changes: 5 additions & 3 deletions src/entity/repository/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,19 @@ func PostGenericService(
post entity.PostService,
) (entity.Process, entity.Service, error) {
postBody := body.PostStandardServiceStack{
ProjectId: post.ProjectId,
Name: post.Name,
Mode: &post.Mode,
UserDataEnvFile: post.EnvFile,
StartWithoutCode: types.NewBoolNull(post.StartWithoutCode.Native()),
EnvIsolation: post.EnvIsolation,
SshIsolation: post.SshIsolation,
}
response, err := restApiClient.PostServiceStack(
response, err := restApiClient.PostProjectServiceStack(
ctx,
path.ServiceStackServiceStackTypeVersionId{ServiceStackTypeVersionId: "runtime"},
path.ServiceStackServiceStackTypeVersionId{
Id: post.ProjectId,
ServiceStackTypeVersionId: "runtime",
},
postBody,
)
if err != nil {
Expand Down
17 changes: 3 additions & 14 deletions src/serviceLogs/handler_getServiceLogUrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ package serviceLogs

import (
"context"
"strings"
"net/http"

"github.com/pkg/errors"
"github.com/zeropsio/zerops-go/dto/input/query"
"github.com/zeropsio/zerops-go/dto/output"

"github.com/zeropsio/zcli/src/i18n"
"github.com/zeropsio/zerops-go/dto/input/path"
"github.com/zeropsio/zerops-go/dto/input/query"
"github.com/zeropsio/zerops-go/types/uuid"
)

Expand All @@ -23,14 +21,5 @@ func (h *Handler) getServiceLogResData(ctx context.Context, projectId uuid.Proje
if err != nil {
return "", "", errors.Errorf("%s %v", i18n.T(i18n.LogAccessFailed), err)
}
method, url := getLogRequestData(resOutput)
return method, url, nil
}

func getLogRequestData(resOutput output.ProjectLog) (string, string) {
outputUrl := string(resOutput.Url)
urlData := strings.Split(outputUrl, " ")
method, url := urlData[0], urlData[1]

return method, url
return http.MethodGet, resOutput.Url.String(), nil
}
4 changes: 2 additions & 2 deletions src/serviceLogs/handler_printLogs.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (h *Handler) printLogs(
query := makeQueryParams(inputs, serviceId, containerId)

if inputs.mode == RESPONSE {
err = h.getLogs(ctx, method, HTTPS+url+query, inputs.format, inputs.formatTemplate, inputs.mode)
err = h.getLogs(ctx, method, url+query, inputs.format, inputs.formatTemplate, inputs.mode)
if err != nil {
return err
}
Expand Down Expand Up @@ -67,5 +67,5 @@ func getDesc(mode string) int {
func getWsUrl(apiUrl string) string {
urlSplit := strings.Split(apiUrl, "?")
url, token := urlSplit[0], urlSplit[1]
return url + "/stream?" + token
return strings.ReplaceAll(url, HTTPS, WSS) + "/stream?" + token
}
2 changes: 1 addition & 1 deletion src/serviceLogs/handler_ws.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (h *Handler) updateUri(uri, query string) string {
if h.lastMsgId != "" {
from = fmt.Sprintf("&from=%s", h.lastMsgId)
}
return WSS + uri + query + from
return uri + query + from
}

func (h *Handler) receiveHandler(connection *websocket.Conn, format, formatTemplate string, done chan error) {
Expand Down