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 @@ -15,6 +15,7 @@
- feat(service/version): Add 'service version ...' commands as replacements for 'service-version ...', with unlisted and deprecated aliases of 'service-version ...'. ([#1614](https://github.com/fastly/cli/pull/1614))
- feat(service/vcl): moved the `vcl` command under the `service` command, with an unlisted and deprecated alias of `vcl` ([#1616](https://github.com/fastly/cli/pull/1616))
- feat(service/healthcheck): moved the `healthcheck` command under the `service` command, with an unlisted and deprecated alias of `healthcheck` ([#1619](https://github.com/fastly/cli/pull/1619))
- feat(service/backend): moved the `backend` command under the `service` command, with an unlisted and deprecated alias of `backend` ([#1621](https://github.com/fastly/cli/pull/1621))

### Bug fixes:

Expand Down
1 change: 0 additions & 1 deletion pkg/app/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ acl
acl-entry
alerts
auth-token
backend
compute
config
config-store
Expand Down
29 changes: 29 additions & 0 deletions pkg/commands/alias/backend/create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package backend

import (
"io"

servicebackend "github.com/fastly/cli/pkg/commands/service/backend"

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

// CreateCommand wraps the CreateCommand from the servicebackend package.
type CreateCommand struct {
*servicebackend.CreateCommand
}

// NewCreateCommand returns a usable command registered under the parent.
func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateCommand {
c := CreateCommand{servicebackend.NewCreateCommand(parent, g)}
c.CmdClause.Hidden()
return &c
}

// Exec implements the command interface.
func (c *CreateCommand) Exec(in io.Reader, out io.Writer) error {
text.Deprecated(out, "Use the 'service backend create' command instead.")
return c.CreateCommand.Exec(in, out)
}
29 changes: 29 additions & 0 deletions pkg/commands/alias/backend/delete.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package backend

import (
"io"

servicebackend "github.com/fastly/cli/pkg/commands/service/backend"

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

// DeleteCommand wraps the DeleteCommand from the servicebackend package.
type DeleteCommand struct {
*servicebackend.DeleteCommand
}

// NewDeleteCommand returns a usable command registered under the parent.
func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteCommand {
c := DeleteCommand{servicebackend.NewDeleteCommand(parent, g)}
c.CmdClause.Hidden()
return &c
}

// Exec implements the command interface.
func (c *DeleteCommand) Exec(in io.Reader, out io.Writer) error {
text.Deprecated(out, "Use the 'service backend delete' command instead.")
return c.DeleteCommand.Exec(in, out)
}
29 changes: 29 additions & 0 deletions pkg/commands/alias/backend/describe.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package backend

import (
"io"

servicebackend "github.com/fastly/cli/pkg/commands/service/backend"

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

// DescribeCommand wraps the DescribeCommand from the servicebackend package.
type DescribeCommand struct {
*servicebackend.DescribeCommand
}

// NewDescribeCommand returns a usable command registered under the parent.
func NewDescribeCommand(parent argparser.Registerer, g *global.Data) *DescribeCommand {
c := DescribeCommand{servicebackend.NewDescribeCommand(parent, g)}
c.CmdClause.Hidden()
return &c
}

// Exec implements the command interface.
func (c *DescribeCommand) Exec(in io.Reader, out io.Writer) error {
text.Deprecated(out, "Use the 'service backend describe' command instead.")
return c.DescribeCommand.Exec(in, out)
}
2 changes: 2 additions & 0 deletions pkg/commands/alias/backend/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package backend contains the 'backend' alias for the 'service backend' command.
package backend
29 changes: 29 additions & 0 deletions pkg/commands/alias/backend/list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package backend

import (
"io"

servicebackend "github.com/fastly/cli/pkg/commands/service/backend"

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

// ListCommand wraps the ListCommand from the servicebackend package.
type ListCommand struct {
*servicebackend.ListCommand
}

// NewListCommand returns a usable command registered under the parent.
func NewListCommand(parent argparser.Registerer, g *global.Data) *ListCommand {
c := ListCommand{servicebackend.NewListCommand(parent, g)}
c.CmdClause.Hidden()
return &c
}

// Exec implements the command interface.
func (c *ListCommand) Exec(in io.Reader, out io.Writer) error {
text.Deprecated(out, "Use the 'service backend list' command instead.")
return c.ListCommand.Exec(in, out)
}
27 changes: 27 additions & 0 deletions pkg/commands/alias/backend/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package backend

import (
"io"

servicebackend "github.com/fastly/cli/pkg/commands/service/backend"

"github.com/fastly/cli/pkg/argparser"
"github.com/fastly/cli/pkg/global"
)

// RootCommand wraps the RootCommand from the servicebackend package.
type RootCommand struct {
*servicebackend.RootCommand
}

// NewRootCommand returns a usable command registered under the parent.
func NewRootCommand(parent argparser.Registerer, g *global.Data) *RootCommand {
c := RootCommand{servicebackend.NewRootCommand(parent, g)}
c.CmdClause.Hidden()
return &c
}

// Exec implements the command interface.
func (c *RootCommand) Exec(in io.Reader, out io.Writer) error {
return c.RootCommand.Exec(in, out)
}
29 changes: 29 additions & 0 deletions pkg/commands/alias/backend/update.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package backend

import (
"io"

servicebackend "github.com/fastly/cli/pkg/commands/service/backend"

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

// UpdateCommand wraps the UpdateCommand from the servicebackend package.
type UpdateCommand struct {
*servicebackend.UpdateCommand
}

// NewUpdateCommand returns a usable command registered under the parent.
func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateCommand {
c := UpdateCommand{servicebackend.NewUpdateCommand(parent, g)}
c.CmdClause.Hidden()
return &c
}

// Exec implements the command interface.
func (c *UpdateCommand) Exec(in io.Reader, out io.Writer) error {
text.Deprecated(out, "Use the 'service backend update' command instead.")
return c.UpdateCommand.Exec(in, out)
}
38 changes: 25 additions & 13 deletions pkg/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/fastly/cli/pkg/commands/acl"
"github.com/fastly/cli/pkg/commands/aclentry"
"github.com/fastly/cli/pkg/commands/alerts"
aliasbackend "github.com/fastly/cli/pkg/commands/alias/backend"
aliashealthcheck "github.com/fastly/cli/pkg/commands/alias/healthcheck"
aliaspurge "github.com/fastly/cli/pkg/commands/alias/purge"
aliasvcl "github.com/fastly/cli/pkg/commands/alias/vcl"
Expand All @@ -15,7 +16,6 @@ import (
aliasvclsnippet "github.com/fastly/cli/pkg/commands/alias/vcl/snippet"
aliasserviceversion "github.com/fastly/cli/pkg/commands/alias/serviceversion"
"github.com/fastly/cli/pkg/commands/authtoken"
"github.com/fastly/cli/pkg/commands/backend"
"github.com/fastly/cli/pkg/commands/compute"
"github.com/fastly/cli/pkg/commands/compute/computeacl"
"github.com/fastly/cli/pkg/commands/config"
Expand Down Expand Up @@ -98,6 +98,7 @@ import (
"github.com/fastly/cli/pkg/commands/secretstore"
"github.com/fastly/cli/pkg/commands/secretstoreentry"
"github.com/fastly/cli/pkg/commands/service"
servicebackend "github.com/fastly/cli/pkg/commands/service/backend"
servicedomain "github.com/fastly/cli/pkg/commands/service/domain"
servicehealthcheck "github.com/fastly/cli/pkg/commands/service/healthcheck"
servicepurge "github.com/fastly/cli/pkg/commands/service/purge"
Expand Down Expand Up @@ -166,12 +167,6 @@ func Define( // nolint:revive // function-length
authtokenDelete := authtoken.NewDeleteCommand(authtokenCmdRoot.CmdClause, data)
authtokenDescribe := authtoken.NewDescribeCommand(authtokenCmdRoot.CmdClause, data)
authtokenList := authtoken.NewListCommand(authtokenCmdRoot.CmdClause, data)
backendCmdRoot := backend.NewRootCommand(app, data)
backendCreate := backend.NewCreateCommand(backendCmdRoot.CmdClause, data)
backendDelete := backend.NewDeleteCommand(backendCmdRoot.CmdClause, data)
backendDescribe := backend.NewDescribeCommand(backendCmdRoot.CmdClause, data)
backendList := backend.NewListCommand(backendCmdRoot.CmdClause, data)
backendUpdate := backend.NewUpdateCommand(backendCmdRoot.CmdClause, data)
computeCmdRoot := compute.NewRootCommand(app, data)
computeACLCmdRoot := computeacl.NewRootCommand(computeCmdRoot.CmdClause, data)
computeACLCreate := computeacl.NewCreateCommand(computeACLCmdRoot.CmdClause, data)
Expand Down Expand Up @@ -665,6 +660,12 @@ func Define( // nolint:revive // function-length
servicedomainList := servicedomain.NewListCommand(servicedomainCmdRoot.CmdClause, data)
servicedomainUpdate := servicedomain.NewUpdateCommand(servicedomainCmdRoot.CmdClause, data)
servicedomainValidate := servicedomain.NewValidateCommand(servicedomainCmdRoot.CmdClause, data)
servicebackendCmdRoot := servicebackend.NewRootCommand(serviceCmdRoot.CmdClause, data)
servicebackendCreate := servicebackend.NewCreateCommand(servicebackendCmdRoot.CmdClause, data)
servicebackendDelete := servicebackend.NewDeleteCommand(servicebackendCmdRoot.CmdClause, data)
servicebackendDescribe := servicebackend.NewDescribeCommand(servicebackendCmdRoot.CmdClause, data)
servicebackendList := servicebackend.NewListCommand(servicebackendCmdRoot.CmdClause, data)
servicebackendUpdate := servicebackend.NewUpdateCommand(servicebackendCmdRoot.CmdClause, data)
servicehealthcheckCmdRoot := servicehealthcheck.NewRootCommand(serviceCmdRoot.CmdClause, data)
servicehealthcheckCreate := servicehealthcheck.NewCreateCommand(servicehealthcheckCmdRoot.CmdClause, data)
servicehealthcheckDelete := servicehealthcheck.NewDeleteCommand(servicehealthcheckCmdRoot.CmdClause, data)
Expand Down Expand Up @@ -726,6 +727,12 @@ func Define( // nolint:revive // function-length
whoamiCmdRoot := whoami.NewRootCommand(app, data)

// Aliases for deprecated commands
aliasBackendRoot := aliasbackend.NewRootCommand(app, data)
aliasBackendCreate := aliasbackend.NewCreateCommand(aliasBackendRoot.CmdClause, data)
aliasBackendDelete := aliasbackend.NewDeleteCommand(aliasBackendRoot.CmdClause, data)
aliasBackendDescribe := aliasbackend.NewDescribeCommand(aliasBackendRoot.CmdClause, data)
aliasBackendList := aliasbackend.NewListCommand(aliasBackendRoot.CmdClause, data)
aliasBackendUpdate := aliasbackend.NewUpdateCommand(aliasBackendRoot.CmdClause, data)
aliasPurge := aliaspurge.NewCommand(app, data)
aliasVclRoot := aliasvcl.NewRootCommand(app, data)
aliasVclDescribe := aliasvcl.NewDescribeCommand(aliasVclRoot.CmdClause, data)
Expand Down Expand Up @@ -782,12 +789,6 @@ func Define( // nolint:revive // function-length
authtokenDelete,
authtokenDescribe,
authtokenList,
backendCmdRoot,
backendCreate,
backendDelete,
backendDescribe,
backendList,
backendUpdate,
computeCmdRoot,
computeACLCmdRoot,
computeACLCreate,
Expand Down Expand Up @@ -1265,6 +1266,12 @@ func Define( // nolint:revive // function-length
servicedomainList,
servicedomainUpdate,
servicedomainValidate,
servicebackendCmdRoot,
servicebackendCreate,
servicebackendDelete,
servicebackendDescribe,
servicebackendList,
servicebackendUpdate,
servicehealthcheckCmdRoot,
servicehealthcheckCreate,
servicehealthcheckDelete,
Expand Down Expand Up @@ -1334,6 +1341,11 @@ func Define( // nolint:revive // function-length
userUpdate,
versionCmdRoot,
whoamiCmdRoot,
aliasBackendCreate,
aliasBackendDelete,
aliasBackendDescribe,
aliasBackendList,
aliasBackendUpdate,
aliasPurge,
aliasVclDescribe,
aliasVclConditionCreate,
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/compute/setup/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/fastly/go-fastly/v12/fastly"

"github.com/fastly/cli/pkg/api"
"github.com/fastly/cli/pkg/commands/backend"
"github.com/fastly/cli/pkg/commands/service/backend"
"github.com/fastly/cli/pkg/errors"
"github.com/fastly/cli/pkg/manifest"
"github.com/fastly/cli/pkg/text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (

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

root "github.com/fastly/cli/pkg/commands/backend"
root "github.com/fastly/cli/pkg/commands/service"
sub "github.com/fastly/cli/pkg/commands/service/backend"
fsterr "github.com/fastly/cli/pkg/errors"
"github.com/fastly/cli/pkg/mock"
"github.com/fastly/cli/pkg/testutil"
Expand Down Expand Up @@ -206,7 +207,7 @@ func TestBackendCreate(t *testing.T) {
WantError: "'prefer-ipv6' flag must be one of the following [true, false]",
},
}
testutil.RunCLIScenarios(t, []string{root.CommandName, "create"}, scenarios)
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "create"}, scenarios)
}

func TestBackendList(t *testing.T) {
Expand Down Expand Up @@ -276,7 +277,7 @@ func TestBackendList(t *testing.T) {
WantError: errTest.Error(),
},
}
testutil.RunCLIScenarios(t, []string{root.CommandName, "list"}, scenarios)
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "list"}, scenarios)
}

func TestBackendDescribe(t *testing.T) {
Expand All @@ -302,7 +303,7 @@ func TestBackendDescribe(t *testing.T) {
WantOutput: describeBackendOutput,
},
}
testutil.RunCLIScenarios(t, []string{root.CommandName, "describe"}, scenarios)
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "describe"}, scenarios)
}

func TestBackendUpdate(t *testing.T) {
Expand Down Expand Up @@ -394,7 +395,7 @@ func TestBackendUpdate(t *testing.T) {
WantError: "'prefer-ipv6' flag must be one of the following [true, false]",
},
}
testutil.RunCLIScenarios(t, []string{root.CommandName, "update"}, scenarios)
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "update"}, scenarios)
}

func TestBackendDelete(t *testing.T) {
Expand Down Expand Up @@ -422,7 +423,7 @@ func TestBackendDelete(t *testing.T) {
WantOutput: "Deleted backend www.test.com (service 123 version 4)",
},
}
testutil.RunCLIScenarios(t, []string{root.CommandName, "delete"}, scenarios)
testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "delete"}, scenarios)
}

var errTest = errors.New("fixture error")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.