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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.26
require (
github.com/charmbracelet/fang v1.0.0
github.com/charmbracelet/huh v1.0.0
github.com/sanchpet/sweb-go-sdk v0.16.1
github.com/sanchpet/sweb-go-sdk v0.16.2
github.com/spf13/cobra v1.10.2
github.com/spf13/viper v1.21.0
github.com/zalando/go-keyring v0.2.8
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc=
github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik=
github.com/sanchpet/sweb-go-sdk v0.16.1 h1:Lf/fE97+nBKvG28CmCfve8NVAYEKtgAWNlpebouOGqI=
github.com/sanchpet/sweb-go-sdk v0.16.1/go.mod h1:eu5yxEZRTcObiBSGEvZ6yJ3m4M4Rj399lIxAuZ7OzyM=
github.com/sanchpet/sweb-go-sdk v0.16.2 h1:Wm9qvYiCWVl0hukw1uh6iiAIPRKu7Cl1aklBiepv+FA=
github.com/sanchpet/sweb-go-sdk v0.16.2/go.mod h1:eu5yxEZRTcObiBSGEvZ6yJ3m4M4Rj399lIxAuZ7OzyM=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=
github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
Expand Down
19 changes: 13 additions & 6 deletions internal/cmd/balancer_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,24 @@ reports whether ordering a new balancer is currently available (isCreateEnable).
if err != nil {
return err
}
enabled, err := c.Balancer.IsCreateEnable(cmd.Context())
if err != nil {
return err
// isCreateEnable answers -32602 for some account types (doc-vs-reality: the spec
// documents it param-less, but the live API rejects the call). The catalog is still
// useful, so report availability as "unknown" rather than failing the whole command.
var createEnabled *bool
if enabled, err := c.Balancer.IsCreateEnable(cmd.Context()); err == nil {
createEnabled = &enabled
}
// Carry both the catalog and the availability flag on the json path.
data := struct {
CreateEnabled bool `json:"createEnabled"`
CreateEnabled *bool `json:"createEnabled"`
*balancerConfig
}{enabled, (*balancerConfig)(cfg)}
}{createEnabled, (*balancerConfig)(cfg)}
return render(cmd, data, func(w io.Writer) {
fmt.Fprintf(w, "CREATE AVAILABLE\t%t\n\n", enabled)
avail := "unknown"
if createEnabled != nil {
avail = fmt.Sprintf("%t", *createEnabled)
}
fmt.Fprintf(w, "CREATE AVAILABLE\t%s\n\n", avail)
fmt.Fprintln(w, "PLANS")
fmt.Fprintln(w, "ID\tTAG\tTITLE\tPRICE/mo")
for _, p := range cfg.Plans {
Expand Down
Loading