Skip to content

Commit 23e9f9a

Browse files
committed
refactor(domainv1,tools) to use domainmanagement imports and types
1 parent c31f83d commit 23e9f9a

File tree

14 files changed

+43
-47
lines changed

14 files changed

+43
-47
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- feat(vcl): Allow showing of generated VCL for a service version [#1498](https://github.com/fastly/cli/pull/1498)
99
- Add experimental "enable Pushpin" mode ([#1509](https://github.com/fastly/cli/pull/1509))
1010
- feat(object-storage): improve access-keys list output ([#1513](https://github.com/fastly/cli/pull/1513))
11+
- refactor(domainv1,tools): use updated go-fastly domainmanagement imports and types ([#1517](https://github.com/fastly/cli/pull/1517))
1112

1213
### Bug fixes:
1314

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require (
2727
)
2828

2929
require (
30-
github.com/fastly/go-fastly/v11 v11.2.0
30+
github.com/fastly/go-fastly/v11 v11.3.0
3131
github.com/hashicorp/cap v0.10.0
3232
github.com/kennygrant/sanitize v1.2.4
3333
github.com/otiai10/copy v1.14.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5/go.mod h1:qssHWj6
2525
github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY=
2626
github.com/dustinkirkland/golang-petname v0.0.0-20240428194347-eebcea082ee0 h1:aYo8nnk3ojoQkP5iErif5Xxv0Mo0Ga/FR5+ffl/7+Nk=
2727
github.com/dustinkirkland/golang-petname v0.0.0-20240428194347-eebcea082ee0/go.mod h1:8AuBTZBRSFqEYBPYULd+NN474/zZBLP+6WeT5S9xlAc=
28-
github.com/fastly/go-fastly/v11 v11.2.0 h1:4gFhs6dZ0HzNGpZ6XiCi1dwESCMD4je3+OENIcD7wJk=
29-
github.com/fastly/go-fastly/v11 v11.2.0/go.mod h1:yv1Tvz457kNCxyNaPi3J8Z3xUxeU8m1XN7O4a8OFLgc=
28+
github.com/fastly/go-fastly/v11 v11.3.0 h1:S0Md/3Tkja+H1X+hBnlQUiCet0N9XB2YzSVtVcNjwPc=
29+
github.com/fastly/go-fastly/v11 v11.3.0/go.mod h1:yv1Tvz457kNCxyNaPi3J8Z3xUxeU8m1XN7O4a8OFLgc=
3030
github.com/fastly/kingpin v2.1.12-0.20191105091915-95d230a53780+incompatible h1:FhrXlfhgGCS+uc6YwyiFUt04alnjpoX7vgDKJxS6Qbk=
3131
github.com/fastly/kingpin v2.1.12-0.20191105091915-95d230a53780+incompatible/go.mod h1:U8UynVoU1SQaqD2I4ZqgYd5lx3A1ipQYn4aSt2Y5h6c=
3232
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=

pkg/commands/domainv1/common.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import (
44
"fmt"
55
"io"
66

7-
v1 "github.com/fastly/go-fastly/v11/fastly/domains/v1"
7+
"github.com/fastly/go-fastly/v11/fastly/domainmanagement/v1/domains"
88

99
"github.com/fastly/cli/pkg/text"
1010
)
1111

1212
// printSummary displays the information returned from the API in a summarised
1313
// format.
14-
func printSummary(out io.Writer, data []v1.Data) {
14+
func printSummary(out io.Writer, data []domains.Data) {
1515
t := text.NewTable(out)
1616
t.AddHeader("FQDN", "DOMAIN ID", "SERVICE ID", "CREATED AT", "UPDATED AT", "DESCRIPTION")
1717
for _, d := range data {
@@ -26,7 +26,7 @@ func printSummary(out io.Writer, data []v1.Data) {
2626

2727
// printSummary displays the information returned from the API in a verbose
2828
// format.
29-
func printVerbose(out io.Writer, data []v1.Data) {
29+
func printVerbose(out io.Writer, data []domains.Data) {
3030
for _, d := range data {
3131
fmt.Fprintf(out, "FQDN: %s\n", d.FQDN)
3232
fmt.Fprintf(out, "Domain ID: %s\n", d.DomainID)

pkg/commands/domainv1/create.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import (
77
"io"
88

99
"github.com/fastly/go-fastly/v11/fastly"
10-
11-
v1 "github.com/fastly/go-fastly/v11/fastly/domains/v1"
10+
"github.com/fastly/go-fastly/v11/fastly/domainmanagement/v1/domains"
1211

1312
"github.com/fastly/cli/pkg/argparser"
1413
"github.com/fastly/cli/pkg/global"
@@ -50,7 +49,7 @@ func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateComman
5049

5150
// Exec invokes the application logic for the command.
5251
func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error {
53-
input := &v1.CreateInput{
52+
input := &domains.CreateInput{
5453
FQDN: &c.fqdn,
5554
}
5655
if c.serviceID != "" {
@@ -66,7 +65,7 @@ func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error {
6665
return errors.New("failed to convert interface to a fastly client")
6766
}
6867

69-
d, err := v1.Create(context.TODO(), fc, input)
68+
d, err := domains.Create(context.TODO(), fc, input)
7069
if err != nil {
7170
c.Globals.ErrLog.AddWithContext(err, map[string]any{
7271
"FQDN": c.fqdn,

pkg/commands/domainv1/delete.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import (
66
"io"
77

88
"github.com/fastly/go-fastly/v11/fastly"
9-
10-
v1 "github.com/fastly/go-fastly/v11/fastly/domains/v1"
9+
"github.com/fastly/go-fastly/v11/fastly/domainmanagement/v1/domains"
1110

1211
"github.com/fastly/cli/pkg/argparser"
1312
"github.com/fastly/cli/pkg/global"
@@ -42,11 +41,11 @@ func (c *DeleteCommand) Exec(_ io.Reader, out io.Writer) error {
4241
return errors.New("failed to convert interface to a fastly client")
4342
}
4443

45-
input := &v1.DeleteInput{
44+
input := &domains.DeleteInput{
4645
DomainID: &c.domainID,
4746
}
4847

49-
err := v1.Delete(context.TODO(), fc, input)
48+
err := domains.Delete(context.TODO(), fc, input)
5049
if err != nil {
5150
c.Globals.ErrLog.AddWithContext(err, map[string]any{
5251
"Domain ID": c.domainID,

pkg/commands/domainv1/describe.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import (
66
"io"
77

88
"github.com/fastly/go-fastly/v11/fastly"
9-
10-
v1 "github.com/fastly/go-fastly/v11/fastly/domains/v1"
9+
"github.com/fastly/go-fastly/v11/fastly/domainmanagement/v1/domains"
1110

1211
"github.com/fastly/cli/pkg/argparser"
1312
fsterr "github.com/fastly/cli/pkg/errors"
@@ -49,11 +48,11 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error {
4948
return errors.New("failed to convert interface to a fastly client")
5049
}
5150

52-
input := &v1.GetInput{
51+
input := &domains.GetInput{
5352
DomainID: &c.domainID,
5453
}
5554

56-
d, err := v1.Get(context.TODO(), fc, input)
55+
d, err := domains.Get(context.TODO(), fc, input)
5756
if err != nil {
5857
c.Globals.ErrLog.AddWithContext(err, map[string]any{
5958
"Domain ID": c.domainID,
@@ -66,7 +65,7 @@ func (c *DescribeCommand) Exec(_ io.Reader, out io.Writer) error {
6665
}
6766

6867
if d != nil {
69-
cl := []v1.Data{*d}
68+
cl := []domains.Data{*d}
7069
if c.Globals.Verbose() {
7170
printVerbose(out, cl)
7271
} else {

pkg/commands/domainv1/domain_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"strings"
99
"testing"
1010

11-
v1 "github.com/fastly/go-fastly/v11/fastly/domains/v1"
11+
"github.com/fastly/go-fastly/v11/fastly/domainmanagement/v1/domains"
1212

1313
root "github.com/fastly/cli/pkg/commands/domainv1"
1414
"github.com/fastly/cli/pkg/testutil"
@@ -31,7 +31,7 @@ func TestDomainV1Create(t *testing.T) {
3131
Response: &http.Response{
3232
StatusCode: http.StatusOK,
3333
Status: http.StatusText(http.StatusOK),
34-
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(v1.Data{
34+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(domains.Data{
3535
DomainID: did,
3636
FQDN: fqdn,
3737
ServiceID: &sid,
@@ -48,7 +48,7 @@ func TestDomainV1Create(t *testing.T) {
4848
Response: &http.Response{
4949
StatusCode: http.StatusOK,
5050
Status: http.StatusText(http.StatusOK),
51-
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(v1.Data{
51+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(domains.Data{
5252
DomainID: did,
5353
FQDN: fqdn,
5454
}))),
@@ -89,8 +89,8 @@ func TestDomainV1List(t *testing.T) {
8989
did := "domain-id"
9090
description := "domain description"
9191

92-
resp := testutil.GenJSON(v1.Collection{
93-
Data: []v1.Data{
92+
resp := testutil.GenJSON(domains.Collection{
93+
Data: []domains.Data{
9494
{
9595
DomainID: did,
9696
FQDN: fqdn,
@@ -141,7 +141,7 @@ func TestDomainV1Describe(t *testing.T) {
141141
did := "domain-id"
142142
description := "domain description"
143143

144-
resp := testutil.GenJSON(v1.Data{
144+
resp := testutil.GenJSON(domains.Data{
145145
DomainID: did,
146146
FQDN: fqdn,
147147
ServiceID: &sid,
@@ -200,7 +200,7 @@ func TestDomainV1Update(t *testing.T) {
200200
Response: &http.Response{
201201
StatusCode: http.StatusOK,
202202
Status: http.StatusText(http.StatusOK),
203-
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(v1.Data{
203+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(domains.Data{
204204
DomainID: did,
205205
FQDN: fqdn,
206206
ServiceID: &sid,
@@ -217,7 +217,7 @@ func TestDomainV1Update(t *testing.T) {
217217
Response: &http.Response{
218218
StatusCode: http.StatusOK,
219219
Status: http.StatusText(http.StatusOK),
220-
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(v1.Data{
220+
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(domains.Data{
221221
DomainID: did,
222222
FQDN: fqdn,
223223
}))),

pkg/commands/domainv1/list.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import (
66
"io"
77

88
"github.com/fastly/go-fastly/v11/fastly"
9-
10-
v1 "github.com/fastly/go-fastly/v11/fastly/domains/v1"
9+
"github.com/fastly/go-fastly/v11/fastly/domainmanagement/v1/domains"
1110

1211
"github.com/fastly/cli/pkg/argparser"
1312
fsterr "github.com/fastly/cli/pkg/errors"
@@ -58,7 +57,7 @@ func (c *ListCommand) Exec(in io.Reader, out io.Writer) error {
5857
return fsterr.ErrInvalidVerboseJSONCombo
5958
}
6059

61-
input := &v1.ListInput{}
60+
input := &domains.ListInput{}
6261

6362
if c.serviceID.WasSet {
6463
input.ServiceID = &c.serviceID.Value
@@ -82,7 +81,7 @@ func (c *ListCommand) Exec(in io.Reader, out io.Writer) error {
8281
}
8382

8483
for {
85-
cl, err := v1.List(context.TODO(), fc, input)
84+
cl, err := domains.List(context.TODO(), fc, input)
8685
if err != nil {
8786
c.Globals.ErrLog.AddWithContext(err, map[string]any{
8887
"Cursor": c.cursor.Value,

pkg/commands/domainv1/update.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import (
77
"io"
88

99
"github.com/fastly/go-fastly/v11/fastly"
10-
11-
v1 "github.com/fastly/go-fastly/v11/fastly/domains/v1"
10+
"github.com/fastly/go-fastly/v11/fastly/domainmanagement/v1/domains"
1211

1312
"github.com/fastly/cli/pkg/argparser"
1413
"github.com/fastly/cli/pkg/global"
@@ -44,7 +43,7 @@ func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateComman
4443

4544
// Exec invokes the application logic for the command.
4645
func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error {
47-
input := &v1.UpdateInput{
46+
input := &domains.UpdateInput{
4847
DomainID: &c.domainID,
4948
}
5049
if c.serviceID != "" {
@@ -60,7 +59,7 @@ func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error {
6059
return errors.New("failed to convert interface to a fastly client")
6160
}
6261

63-
d, err := v1.Update(context.TODO(), fc, input)
62+
d, err := domains.Update(context.TODO(), fc, input)
6463
if err != nil {
6564
c.Globals.ErrLog.AddWithContext(err, map[string]any{
6665
"Domain ID": c.domainID,

0 commit comments

Comments
 (0)