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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- feat(vcl): Allow showing of generated VCL for a service version [#1498](https://github.com/fastly/cli/pull/1498)
- Add experimental "enable Pushpin" mode ([#1509](https://github.com/fastly/cli/pull/1509))
- feat(object-storage): improve access-keys list output ([#1513](https://github.com/fastly/cli/pull/1513))
- refactor(domainv1,tools): use updated go-fastly domainmanagement imports and types ([#1517](https://github.com/fastly/cli/pull/1517))

### Bug fixes:

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
)

require (
github.com/fastly/go-fastly/v11 v11.2.0
github.com/fastly/go-fastly/v11 v11.3.0
github.com/hashicorp/cap v0.10.0
github.com/kennygrant/sanitize v1.2.4
github.com/otiai10/copy v1.14.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5/go.mod h1:qssHWj6
github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY=
github.com/dustinkirkland/golang-petname v0.0.0-20240428194347-eebcea082ee0 h1:aYo8nnk3ojoQkP5iErif5Xxv0Mo0Ga/FR5+ffl/7+Nk=
github.com/dustinkirkland/golang-petname v0.0.0-20240428194347-eebcea082ee0/go.mod h1:8AuBTZBRSFqEYBPYULd+NN474/zZBLP+6WeT5S9xlAc=
github.com/fastly/go-fastly/v11 v11.2.0 h1:4gFhs6dZ0HzNGpZ6XiCi1dwESCMD4je3+OENIcD7wJk=
github.com/fastly/go-fastly/v11 v11.2.0/go.mod h1:yv1Tvz457kNCxyNaPi3J8Z3xUxeU8m1XN7O4a8OFLgc=
github.com/fastly/go-fastly/v11 v11.3.0 h1:S0Md/3Tkja+H1X+hBnlQUiCet0N9XB2YzSVtVcNjwPc=
github.com/fastly/go-fastly/v11 v11.3.0/go.mod h1:yv1Tvz457kNCxyNaPi3J8Z3xUxeU8m1XN7O4a8OFLgc=
github.com/fastly/kingpin v2.1.12-0.20191105091915-95d230a53780+incompatible h1:FhrXlfhgGCS+uc6YwyiFUt04alnjpoX7vgDKJxS6Qbk=
github.com/fastly/kingpin v2.1.12-0.20191105091915-95d230a53780+incompatible/go.mod h1:U8UynVoU1SQaqD2I4ZqgYd5lx3A1ipQYn4aSt2Y5h6c=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/domainv1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import (
"fmt"
"io"

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

"github.com/fastly/cli/pkg/text"
)

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

// printSummary displays the information returned from the API in a verbose
// format.
func printVerbose(out io.Writer, data []v1.Data) {
func printVerbose(out io.Writer, data []domains.Data) {
for _, d := range data {
fmt.Fprintf(out, "FQDN: %s\n", d.FQDN)
fmt.Fprintf(out, "Domain ID: %s\n", d.DomainID)
Expand Down
7 changes: 3 additions & 4 deletions pkg/commands/domainv1/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import (
"io"

"github.com/fastly/go-fastly/v11/fastly"

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

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

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

d, err := v1.Create(context.TODO(), fc, input)
d, err := domains.Create(context.TODO(), fc, input)
if err != nil {
c.Globals.ErrLog.AddWithContext(err, map[string]any{
"FQDN": c.fqdn,
Expand Down
7 changes: 3 additions & 4 deletions pkg/commands/domainv1/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import (
"io"

"github.com/fastly/go-fastly/v11/fastly"

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

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

input := &v1.DeleteInput{
input := &domains.DeleteInput{
DomainID: &c.domainID,
}

err := v1.Delete(context.TODO(), fc, input)
err := domains.Delete(context.TODO(), fc, input)
if err != nil {
c.Globals.ErrLog.AddWithContext(err, map[string]any{
"Domain ID": c.domainID,
Expand Down
9 changes: 4 additions & 5 deletions pkg/commands/domainv1/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import (
"io"

"github.com/fastly/go-fastly/v11/fastly"

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

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

input := &v1.GetInput{
input := &domains.GetInput{
DomainID: &c.domainID,
}

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

if d != nil {
cl := []v1.Data{*d}
cl := []domains.Data{*d}
if c.Globals.Verbose() {
printVerbose(out, cl)
} else {
Expand Down
16 changes: 8 additions & 8 deletions pkg/commands/domainv1/domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"testing"

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

root "github.com/fastly/cli/pkg/commands/domainv1"
"github.com/fastly/cli/pkg/testutil"
Expand All @@ -31,7 +31,7 @@ func TestDomainV1Create(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(v1.Data{
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(domains.Data{
DomainID: did,
FQDN: fqdn,
ServiceID: &sid,
Expand All @@ -48,7 +48,7 @@ func TestDomainV1Create(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(v1.Data{
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(domains.Data{
DomainID: did,
FQDN: fqdn,
}))),
Expand Down Expand Up @@ -89,8 +89,8 @@ func TestDomainV1List(t *testing.T) {
did := "domain-id"
description := "domain description"

resp := testutil.GenJSON(v1.Collection{
Data: []v1.Data{
resp := testutil.GenJSON(domains.Collection{
Data: []domains.Data{
{
DomainID: did,
FQDN: fqdn,
Expand Down Expand Up @@ -141,7 +141,7 @@ func TestDomainV1Describe(t *testing.T) {
did := "domain-id"
description := "domain description"

resp := testutil.GenJSON(v1.Data{
resp := testutil.GenJSON(domains.Data{
DomainID: did,
FQDN: fqdn,
ServiceID: &sid,
Expand Down Expand Up @@ -200,7 +200,7 @@ func TestDomainV1Update(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(v1.Data{
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(domains.Data{
DomainID: did,
FQDN: fqdn,
ServiceID: &sid,
Expand All @@ -217,7 +217,7 @@ func TestDomainV1Update(t *testing.T) {
Response: &http.Response{
StatusCode: http.StatusOK,
Status: http.StatusText(http.StatusOK),
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(v1.Data{
Body: io.NopCloser(bytes.NewReader(testutil.GenJSON(domains.Data{
DomainID: did,
FQDN: fqdn,
}))),
Expand Down
7 changes: 3 additions & 4 deletions pkg/commands/domainv1/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import (
"io"

"github.com/fastly/go-fastly/v11/fastly"

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

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

input := &v1.ListInput{}
input := &domains.ListInput{}

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

for {
cl, err := v1.List(context.TODO(), fc, input)
cl, err := domains.List(context.TODO(), fc, input)
if err != nil {
c.Globals.ErrLog.AddWithContext(err, map[string]any{
"Cursor": c.cursor.Value,
Expand Down
7 changes: 3 additions & 4 deletions pkg/commands/domainv1/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import (
"io"

"github.com/fastly/go-fastly/v11/fastly"

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

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

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

d, err := v1.Update(context.TODO(), fc, input)
d, err := domains.Update(context.TODO(), fc, input)
if err != nil {
c.Globals.ErrLog.AddWithContext(err, map[string]any{
"Domain ID": c.domainID,
Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/tools/domain/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"fmt"
"io"

"github.com/fastly/go-fastly/v11/fastly"
"github.com/fastly/go-fastly/v11/fastly/domainmanagement/v1/tools/status"

"github.com/fastly/cli/pkg/argparser"
fsterr "github.com/fastly/cli/pkg/errors"
"github.com/fastly/cli/pkg/global"
"github.com/fastly/go-fastly/v11/fastly"

"github.com/fastly/go-fastly/v11/fastly/domains/v1/tools/status"
)

// GetDomainStatusCommand calls the Fastly API to check the availability of a domain name.
Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/tools/domain/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"net/http"
"testing"

"github.com/fastly/go-fastly/v11/fastly"
"github.com/fastly/go-fastly/v11/fastly/domainmanagement/v1/tools/status"

"github.com/fastly/cli/pkg/commands/tools"
"github.com/fastly/cli/pkg/commands/tools/domain"
"github.com/fastly/cli/pkg/testutil"
"github.com/fastly/go-fastly/v11/fastly"

"github.com/fastly/go-fastly/v11/fastly/domains/v1/tools/status"
)

func TestNewDomainsV1ToolsStatusCommand(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/tools/domain/suggest.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
"io"
"strings"

"github.com/fastly/go-fastly/v11/fastly"
"github.com/fastly/go-fastly/v11/fastly/domainmanagement/v1/tools/suggest"

"github.com/fastly/cli/pkg/argparser"
fsterr "github.com/fastly/cli/pkg/errors"
"github.com/fastly/cli/pkg/global"
"github.com/fastly/cli/pkg/text"
"github.com/fastly/go-fastly/v11/fastly"

"github.com/fastly/go-fastly/v11/fastly/domains/v1/tools/suggest"
)

// GetDomainSuggestionsCommand calls the Fastly API and results domain search results for a given query.
Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/tools/domain/suggest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"net/http"
"testing"

"github.com/fastly/go-fastly/v11/fastly"
"github.com/fastly/go-fastly/v11/fastly/domainmanagement/v1/tools/suggest"

"github.com/fastly/cli/pkg/commands/tools"
"github.com/fastly/cli/pkg/commands/tools/domain"
"github.com/fastly/cli/pkg/testutil"
"github.com/fastly/go-fastly/v11/fastly"

"github.com/fastly/go-fastly/v11/fastly/domains/v1/tools/suggest"
)

func TestNewDomainsV1ToolsSuggestCommand(t *testing.T) {
Expand Down
Loading