Skip to content

Commit

Permalink
refactor(zones): Update zone list to egoscale v3
Browse files Browse the repository at this point in the history
  • Loading branch information
mlec1 committed Sep 20, 2024
1 parent 3868b32 commit 59a5b63
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cmd/zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ import (

"github.com/spf13/cobra"

"github.com/exoscale/cli/pkg/account"
"github.com/exoscale/cli/pkg/globalstate"
"github.com/exoscale/cli/pkg/output"
exoapi "github.com/exoscale/egoscale/v2/api"
)

type zoneListItemOutput struct {
Expand Down Expand Up @@ -44,19 +42,20 @@ Supported output template annotations: %s`,

func listZones() (output.Outputter, error) {

ctx := exoapi.WithEndpoint(gContext, exoapi.NewReqEndpoint(account.CurrentAccount.Environment, account.CurrentAccount.DefaultZone))
ctx := gContext
client := globalstate.EgoscaleV3Client

zones, err := globalstate.EgoscaleClient.ListZones(ctx)
zones, err := client.ListZones(ctx)
if err != nil {
return nil, err
}

out := zoneListOutput{}

for _, zone := range zones {
for _, zone := range zones.Zones {

out = append(out, zoneListItemOutput{
Name: zone,
Name: string(zone.Name),
})
}

Expand Down

0 comments on commit 59a5b63

Please sign in to comment.