Skip to content

Commit

Permalink
Update govultr to v3.0.1 (#301)
Browse files Browse the repository at this point in the history
* Update Go to v1.20

* Remove vendored dependencies

* Ignore vendor directory

* Bump go version in github releaser workflow

* Update builds to Go 1.20 and remove vendor

* Update to govultr v3.0.1
  • Loading branch information
optik-aper authored Mar 20, 2023
1 parent b8656af commit cf376a5
Show file tree
Hide file tree
Showing 938 changed files with 191 additions and 375,408 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
go-version: 1.20
-
name: Docker Login
env:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
.vscode/
.idea
builds/
dist/
dist/
vendor/
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19-alpine as builder
FROM golang:1.20-alpine as builder

RUN apk add --update \
make
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: remove format

export CGO=0
export GOFLAGS=-mod=vendor -trimpath
export GOFLAGS=-trimpath

DIR?=builds

Expand Down
2 changes: 1 addition & 1 deletion cmd/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var accountCmd = &cobra.Command{
Short: "Retrieve information about your account",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
account, err := client.Account.Get(context.Background())
account, _, err := client.Account.Get(context.Background())
if err != nil {
fmt.Printf("Error getting account information : %v\n", err)
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion cmd/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var appsList = &cobra.Command{
Aliases: []string{"l"},
Run: func(cmd *cobra.Command, args []string) {
options := getPaging(cmd)
apps, meta, err := client.Application.List(context.Background(), options)
apps, meta, _, err := client.Application.List(context.Background(), options)
if err != nil {
fmt.Printf("error getting available applications : %v\n", err)
os.Exit(1)
Expand Down
4 changes: 2 additions & 2 deletions cmd/backups.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var backupsList = &cobra.Command{
Aliases: []string{"l"},
Run: func(cmd *cobra.Command, args []string) {
options := getPaging(cmd)
backups, meta, err := client.Backup.List(context.TODO(), options)
backups, meta, _, err := client.Backup.List(context.TODO(), options)
if err != nil {
fmt.Printf("error getting backups : %v\n", err)
os.Exit(1)
Expand All @@ -66,7 +66,7 @@ var backupsGet = &cobra.Command{
return nil
},
Run: func(cmd *cobra.Command, args []string) {
backup, err := client.Backup.Get(context.TODO(), args[0])
backup, _, err := client.Backup.Get(context.TODO(), args[0])
if err != nil {
fmt.Printf("error getting backup : %v\n", err)
os.Exit(1)
Expand Down
20 changes: 10 additions & 10 deletions cmd/bareMetal.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"os"

"github.com/spf13/cobra"
"github.com/vultr/govultr/v2"
"github.com/vultr/govultr/v3"
"github.com/vultr/vultr-cli/v2/cmd/printer"
)

Expand Down Expand Up @@ -184,7 +184,7 @@ var bareMetalCreate = &cobra.Command{
os.Exit(1)
}

bm, err := client.BareMetalServer.Create(context.TODO(), options)
bm, _, err := client.BareMetalServer.Create(context.TODO(), options)
if err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
Expand Down Expand Up @@ -220,7 +220,7 @@ var bareMetalList = &cobra.Command{
Aliases: []string{"l"},
Run: func(cmd *cobra.Command, args []string) {
options := getPaging(cmd)
list, meta, err := client.BareMetalServer.List(context.TODO(), options)
list, meta, _, err := client.BareMetalServer.List(context.TODO(), options)
if err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
Expand All @@ -240,7 +240,7 @@ var bareMetalGet = &cobra.Command{
return nil
},
Run: func(cmd *cobra.Command, args []string) {
srv, err := client.BareMetalServer.Get(context.TODO(), args[0])
srv, _, err := client.BareMetalServer.Get(context.TODO(), args[0])
if err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
Expand All @@ -260,7 +260,7 @@ var bareMetalGetVNCUrl = &cobra.Command{
return nil
},
Run: func(cmd *cobra.Command, args []string) {
vnc, err := client.BareMetalServer.GetVNCUrl(context.TODO(), args[0])
vnc, _, err := client.BareMetalServer.GetVNCUrl(context.TODO(), args[0])
if err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
Expand All @@ -281,7 +281,7 @@ var bareMetalBandwidth = &cobra.Command{
return nil
},
Run: func(cmd *cobra.Command, args []string) {
bw, err := client.BareMetalServer.GetBandwidth(context.TODO(), args[0])
bw, _, err := client.BareMetalServer.GetBandwidth(context.TODO(), args[0])
if err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
Expand Down Expand Up @@ -346,7 +346,7 @@ var bareMetalListIPV4 = &cobra.Command{
},
Run: func(cmd *cobra.Command, args []string) {
options := getPaging(cmd)
info, meta, err := client.BareMetalServer.ListIPv4s(context.TODO(), args[0], options)
info, meta, _, err := client.BareMetalServer.ListIPv4s(context.TODO(), args[0], options)
if err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
Expand All @@ -368,7 +368,7 @@ var bareMetalListIPV6 = &cobra.Command{
},
Run: func(cmd *cobra.Command, args []string) {
options := getPaging(cmd)
info, meta, err := client.BareMetalServer.ListIPv6s(context.TODO(), args[0], options)
info, meta, _, err := client.BareMetalServer.ListIPv6s(context.TODO(), args[0], options)
if err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
Expand Down Expand Up @@ -410,7 +410,7 @@ var bareMetalReinstall = &cobra.Command{
return nil
},
Run: func(cmd *cobra.Command, args []string) {
if _, err := client.BareMetalServer.Reinstall(context.TODO(), args[0]); err != nil {
if _, _, err := client.BareMetalServer.Reinstall(context.TODO(), args[0]); err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
}
Expand All @@ -437,7 +437,7 @@ var bareMetalTags = &cobra.Command{
Tags: tags,
}

if _, err := client.BareMetalServer.Update(context.Background(), id, options); err != nil {
if _, _, err := client.BareMetalServer.Update(context.Background(), id, options); err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
}
Expand Down
7 changes: 3 additions & 4 deletions cmd/bareMetalApp.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"strconv"

"github.com/spf13/cobra"
"github.com/vultr/govultr/v2"
"github.com/vultr/govultr/v3"
"github.com/vultr/vultr-cli/v2/cmd/printer"
)

Expand Down Expand Up @@ -55,8 +55,7 @@ var bareMetalAppChange = &cobra.Command{
AppID: appID,
}

_, err := client.BareMetalServer.Update(context.TODO(), args[0], options)
if err != nil {
if _, _, err := client.BareMetalServer.Update(context.TODO(), args[0], options); err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
}
Expand All @@ -77,7 +76,7 @@ var bareMetalAppChangeList = &cobra.Command{
},
Run: func(cmd *cobra.Command, args []string) {
id := args[0]
list, err := client.BareMetalServer.GetUpgrades(context.TODO(), id)
list, _, err := client.BareMetalServer.GetUpgrades(context.TODO(), id)

if err != nil {
fmt.Printf("error listing available applications : %v\n", err)
Expand Down
5 changes: 2 additions & 3 deletions cmd/bareMetalImage.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"os"

"github.com/spf13/cobra"
"github.com/vultr/govultr/v2"
"github.com/vultr/govultr/v3"
)

// BareMetalImage represents the baremetal image commands
Expand Down Expand Up @@ -53,8 +53,7 @@ var bareMetalImageChange = &cobra.Command{
ImageID: imageID,
}

_, err := client.BareMetalServer.Update(context.TODO(), args[0], options)
if err != nil {
if _, _, err := client.BareMetalServer.Update(context.TODO(), args[0], options); err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/bareMetalOS.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"strconv"

"github.com/spf13/cobra"
"github.com/vultr/govultr/v2"
"github.com/vultr/govultr/v3"
"github.com/vultr/vultr-cli/v2/cmd/printer"
)

Expand Down Expand Up @@ -55,7 +55,7 @@ var bareMetalOSChange = &cobra.Command{
OsID: osid,
}

if _, err := client.BareMetalServer.Update(context.TODO(), args[0], options); err != nil {
if _, _, err := client.BareMetalServer.Update(context.TODO(), args[0], options); err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
}
Expand All @@ -76,7 +76,7 @@ var bareMetalOSChangeList = &cobra.Command{
},
Run: func(cmd *cobra.Command, args []string) {
id := args[0]
list, err := client.BareMetalServer.GetUpgrades(context.TODO(), id)
list, _, err := client.BareMetalServer.GetUpgrades(context.TODO(), id)

if err != nil {
fmt.Printf("error listing available os : %v\n", err)
Expand Down
6 changes: 3 additions & 3 deletions cmd/bareMetalUserData.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"os"

"github.com/spf13/cobra"
"github.com/vultr/govultr/v2"
"github.com/vultr/govultr/v3"
"github.com/vultr/vultr-cli/v2/cmd/printer"
)

Expand Down Expand Up @@ -51,7 +51,7 @@ var bareMetalGetUserData = &cobra.Command{
return nil
},
Run: func(cmd *cobra.Command, args []string) {
u, err := client.BareMetalServer.GetUserData(context.Background(), args[0])
u, _, err := client.BareMetalServer.GetUserData(context.Background(), args[0])
if err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
Expand Down Expand Up @@ -83,7 +83,7 @@ var bareMetalSetUserData = &cobra.Command{
UserData: base64.StdEncoding.EncodeToString(rawData),
}

_, err = client.BareMetalServer.Update(context.TODO(), args[0], options)
_, _, err = client.BareMetalServer.Update(context.TODO(), args[0], options)
if err != nil {
fmt.Printf("error setting user-data : %v\n", err)
os.Exit(1)
Expand Down
16 changes: 8 additions & 8 deletions cmd/billing.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var (
vultr-cli billing history list
# Shortened with alias commands
vultr-cli billing h l
vultr-cli billing h l
`

invoicesLong = `Get all available commands for billing invoices`
Expand All @@ -65,7 +65,7 @@ var (
vultr-cli billing invoice list
# Shortened with alias commands
vultr-cli billing i l
vultr-cli billing i l
`

invoiceGetLong = `Get a specific invoice on your account`
Expand All @@ -74,7 +74,7 @@ var (
vultr-cli billing invoice get 123456
# Shortened with alias commands
vultr-cli billing i g 123456
vultr-cli billing i g 123456
`

invoiceItemsListLong = `Retrieve a list of invoice items from a specific invoice on your account`
Expand All @@ -83,7 +83,7 @@ var (
vultr-cli billing invoice items 123456
# Shortened with alias commands
vultr-cli billing i i 123456
vultr-cli billing i i 123456
`
)

Expand Down Expand Up @@ -138,7 +138,7 @@ var billingHistoryList = &cobra.Command{
Example: historyListExample,
Run: func(cmd *cobra.Command, args []string) {
options := getPaging(cmd)
history, meta, err := client.Billing.ListHistory(context.Background(), options)
history, meta, _, err := client.Billing.ListHistory(context.Background(), options)
if err != nil {
fmt.Printf("error getting billing history : %v\n", err)
os.Exit(1)
Expand All @@ -156,7 +156,7 @@ var invoicesList = &cobra.Command{
Example: invoiceListExample,
Run: func(cmd *cobra.Command, args []string) {
options := getPaging(cmd)
history, meta, err := client.Billing.ListInvoices(context.Background(), options)
history, meta, _, err := client.Billing.ListInvoices(context.Background(), options)
if err != nil {
fmt.Printf("error getting invoices : %v\n", err)
os.Exit(1)
Expand All @@ -181,7 +181,7 @@ var invoiceItemsList = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
id, _ := strconv.Atoi(args[0])
options := getPaging(cmd)
items, meta, err := client.Billing.ListInvoiceItems(context.Background(), id, options)
items, meta, _, err := client.Billing.ListInvoiceItems(context.Background(), id, options)
if err != nil {
fmt.Printf("error getting invoice items : %v\n", err)
os.Exit(1)
Expand All @@ -204,7 +204,7 @@ var invoiceGet = &cobra.Command{
return nil
},
Run: func(cmd *cobra.Command, args []string) {
invoice, err := client.Billing.GetInvoice(context.Background(), args[0])
invoice, _, err := client.Billing.GetInvoice(context.Background(), args[0])
if err != nil {
fmt.Printf("error getting invoice : %v\n", err)
os.Exit(1)
Expand Down
8 changes: 4 additions & 4 deletions cmd/blockStorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"os"

"github.com/spf13/cobra"
"github.com/vultr/govultr/v2"
"github.com/vultr/govultr/v3"
"github.com/vultr/vultr-cli/v2/cmd/printer"
)

Expand Down Expand Up @@ -215,7 +215,7 @@ var bsCreate = &cobra.Command{
BlockType: blockType,
}

bs, err := client.BlockStorage.Create(context.Background(), bsCreate)
bs, _, err := client.BlockStorage.Create(context.Background(), bsCreate)
if err != nil {
fmt.Printf("error creating block storage : %v\n", err)
os.Exit(1)
Expand Down Expand Up @@ -314,7 +314,7 @@ var bsList = &cobra.Command{
Example: listBlockStorageExample,
Run: func(cmd *cobra.Command, args []string) {
options := getPaging(cmd)
bs, meta, err := client.BlockStorage.List(context.Background(), options)
bs, meta, _, err := client.BlockStorage.List(context.Background(), options)
if err != nil {
fmt.Printf("error getting block storage : %v\n", err)
os.Exit(1)
Expand All @@ -339,7 +339,7 @@ var bsGet = &cobra.Command{
},
Run: func(cmd *cobra.Command, args []string) {
id := args[0]
bs, err := client.BlockStorage.Get(context.Background(), id)
bs, _, err := client.BlockStorage.Get(context.Background(), id)
if err != nil {
fmt.Printf("error getting block storage : %v\n", err)
os.Exit(1)
Expand Down
Loading

0 comments on commit cf376a5

Please sign in to comment.