Skip to content

Commit db2ab55

Browse files
chore: bump to github.com/vultr/govultr/v3 (#2235)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent 13b5cb5 commit db2ab55

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ require (
7575
github.com/ultradns/ultradns-go-sdk v1.6.1-20231103022937-8589b6a
7676
github.com/urfave/cli/v2 v2.27.2
7777
github.com/vinyldns/go-vinyldns v0.9.16
78-
github.com/vultr/govultr/v2 v2.17.2
78+
github.com/vultr/govultr/v3 v3.9.0
7979
github.com/yandex-cloud/go-genproto v0.0.0-20240318083951-4fe6125f286e
8080
github.com/yandex-cloud/go-sdk v0.0.0-20240318084659-dfa50323a0b4
8181
golang.org/x/crypto v0.24.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,8 +669,8 @@ github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyC
669669
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
670670
github.com/vinyldns/go-vinyldns v0.9.16 h1:GZJStDkcCk1F1AcRc64LuuMh+ENL8pHA0CVd4ulRMcQ=
671671
github.com/vinyldns/go-vinyldns v0.9.16/go.mod h1:5qIJOdmzAnatKjurI+Tl4uTus7GJKJxb+zitufjHs3Q=
672-
github.com/vultr/govultr/v2 v2.17.2 h1:gej/rwr91Puc/tgh+j33p/BLR16UrIPnSr+AIwYWZQs=
673-
github.com/vultr/govultr/v2 v2.17.2/go.mod h1:ZFOKGWmgjytfyjeyAdhQlSWwTjh2ig+X49cAp50dzXI=
672+
github.com/vultr/govultr/v3 v3.9.0 h1:63V/22mpfquRA5DenJ9EF0VozHg0k+X4dhUWcDXHPyc=
673+
github.com/vultr/govultr/v3 v3.9.0/go.mod h1:Rd8ebpXm7jxH3MDmhnEs+zrlYW212ouhx+HeUMfHm2o=
674674
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
675675
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
676676
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=

providers/dns/vultr/vultr.go

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
"github.com/go-acme/lego/v4/challenge/dns01"
1414
"github.com/go-acme/lego/v4/platform/config/env"
15-
"github.com/vultr/govultr/v2"
15+
"github.com/vultr/govultr/v3"
1616
"golang.org/x/oauth2"
1717
)
1818

@@ -110,9 +110,10 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
110110
TTL: d.config.TTL,
111111
Priority: func(v int) *int { return &v }(0),
112112
}
113-
_, err = d.client.DomainRecord.Create(ctx, zoneDomain, &req)
113+
114+
_, resp, err := d.client.DomainRecord.Create(ctx, zoneDomain, &req)
114115
if err != nil {
115-
return fmt.Errorf("vultr: API call failed: %w", err)
116+
return fmt.Errorf("vultr: %w", extendError(resp, err))
116117
}
117118

118119
return nil
@@ -157,9 +158,9 @@ func (d *DNSProvider) getHostedZone(ctx context.Context, domain string) (string,
157158
var hostedDomain govultr.Domain
158159

159160
for {
160-
domains, meta, err := d.client.Domain.List(ctx, listOptions)
161+
domains, meta, resp, err := d.client.Domain.List(ctx, listOptions)
161162
if err != nil {
162-
return "", fmt.Errorf("API call failed: %w", err)
163+
return "", extendError(resp, err)
163164
}
164165

165166
for _, dom := range domains {
@@ -201,9 +202,9 @@ func (d *DNSProvider) findTxtRecords(ctx context.Context, domain, fqdn string) (
201202

202203
var records []govultr.DomainRecord
203204
for {
204-
result, meta, err := d.client.DomainRecord.List(ctx, zoneDomain, listOptions)
205+
result, meta, resp, err := d.client.DomainRecord.List(ctx, zoneDomain, listOptions)
205206
if err != nil {
206-
return "", records, fmt.Errorf("API call has failed: %w", err)
207+
return "", records, extendError(resp, err)
207208
}
208209

209210
for _, record := range result {
@@ -234,3 +235,12 @@ func OAuthStaticAccessToken(client *http.Client, accessToken string) *http.Clien
234235

235236
return client
236237
}
238+
239+
func extendError(resp *http.Response, err error) error {
240+
msg := "API call failed"
241+
if resp != nil {
242+
msg += fmt.Sprintf(" (%d)", resp.StatusCode)
243+
}
244+
245+
return fmt.Errorf("%s: %w", msg, err)
246+
}

providers/dns/vultr/vultr_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/go-acme/lego/v4/platform/tester"
1414
"github.com/stretchr/testify/assert"
1515
"github.com/stretchr/testify/require"
16-
"github.com/vultr/govultr/v2"
16+
"github.com/vultr/govultr/v3"
1717
)
1818

1919
const envDomain = envNamespace + "TEST_DOMAIN"

0 commit comments

Comments
 (0)