Skip to content
Open
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 @@ -11,6 +11,7 @@
- feat(compute/deploy): added the `--no-default-domain` flag to allow for the skipping of automatic domain creation when deploying a Compute service([#1610](https://github.com/fastly/cli/pull/1610))
- refactor(argparser/flags.go): add flag conversion utilities for converting string flags to bools and checking ascending and desecnding flags ([#1611](https://github.com/fastly/cli/pull/1611))
- feat(commands/service/purge): Add 'service purge' command as replacement for 'purge', with an unlisted and deprecated alias of 'purge'. ([#1612](https://github.com/fastly/cli/pull/1612))
- feat(commands/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))

### 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 @@ -93,7 +93,6 @@ secret-store
secret-store-entry
service
service-auth
service-version
stats
tls-config
tls-custom
Expand Down
29 changes: 29 additions & 0 deletions pkg/commands/alias/serviceversion/activate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package serviceversion

import (
"io"

newcmd "github.com/fastly/cli/pkg/commands/service/version"

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

// ActivateCommand wraps the ActivateCommand from the newcmd package.
type ActivateCommand struct {
*newcmd.ActivateCommand
}

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

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

import (
"io"

newcmd "github.com/fastly/cli/pkg/commands/service/version"

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

// CloneCommand wraps the CloneCommand from the newcmd package.
type CloneCommand struct {
*newcmd.CloneCommand
}

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

// Exec implements the command interface.
func (c *CloneCommand) Exec(in io.Reader, out io.Writer) error {
if !c.JSONOutput.Enabled {
text.Deprecated(out, "Use the 'service version clone' command instead.")
}
return c.CloneCommand.Exec(in, out)
}
29 changes: 29 additions & 0 deletions pkg/commands/alias/serviceversion/deactivate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package serviceversion

import (
"io"

newcmd "github.com/fastly/cli/pkg/commands/service/version"

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

// DeactivateCommand wraps the DeactivateCommand from the newcmd package.
type DeactivateCommand struct {
*newcmd.DeactivateCommand
}

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

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

import (
"io"

newcmd "github.com/fastly/cli/pkg/commands/service/version"

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

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

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

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

import (
"io"

newcmd "github.com/fastly/cli/pkg/commands/service/version"

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

// LockCommand wraps the LockCommand from the newcmd package.
type LockCommand struct {
*newcmd.LockCommand
}

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

// Exec implements the command interface.
func (c *LockCommand) Exec(in io.Reader, out io.Writer) error {
text.Deprecated(out, "Use the 'service version lock' command instead.")
return c.LockCommand.Exec(in, out)
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const CommandName = "service-version"
func NewRootCommand(parent argparser.Registerer, g *global.Data) *RootCommand {
var c RootCommand
c.Globals = g
c.CmdClause = parent.Command(CommandName, "Manipulate Fastly service versions")
c.CmdClause = parent.Command(CommandName, "Manipulate Fastly service versions").Hidden()
return &c
}

Expand Down
29 changes: 29 additions & 0 deletions pkg/commands/alias/serviceversion/stage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package serviceversion

import (
"io"

newcmd "github.com/fastly/cli/pkg/commands/service/version"

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

// StageCommand wraps the StageCommand from the newcmd package.
type StageCommand struct {
*newcmd.StageCommand
}

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

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

import (
"io"

newcmd "github.com/fastly/cli/pkg/commands/service/version"

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

// UnstageCommand wraps the UnstageCommand from the newcmd package.
type UnstageCommand struct {
*newcmd.UnstageCommand
}

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

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

import (
"io"

newcmd "github.com/fastly/cli/pkg/commands/service/version"

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

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

// NewUpdateCommand returns a usable command registered under the parent.
func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateCommand {
c := UpdateCommand{newcmd.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 version update' command instead.")
return c.UpdateCommand.Exec(in, out)
}
22 changes: 20 additions & 2 deletions pkg/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/fastly/cli/pkg/commands/aclentry"
"github.com/fastly/cli/pkg/commands/alerts"
aliaspurge "github.com/fastly/cli/pkg/commands/alias/purge"
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"
Expand Down Expand Up @@ -95,8 +96,8 @@ import (
"github.com/fastly/cli/pkg/commands/secretstoreentry"
"github.com/fastly/cli/pkg/commands/service"
servicepurge "github.com/fastly/cli/pkg/commands/service/purge"
serviceversion "github.com/fastly/cli/pkg/commands/service/version"
"github.com/fastly/cli/pkg/commands/serviceauth"
"github.com/fastly/cli/pkg/commands/serviceversion"
"github.com/fastly/cli/pkg/commands/shellcomplete"
"github.com/fastly/cli/pkg/commands/sso"
"github.com/fastly/cli/pkg/commands/stats"
Expand Down Expand Up @@ -630,7 +631,7 @@ func Define( // nolint:revive // function-length
serviceauthDescribe := serviceauth.NewDescribeCommand(serviceauthCmdRoot.CmdClause, data)
serviceauthList := serviceauth.NewListCommand(serviceauthCmdRoot.CmdClause, data)
serviceauthUpdate := serviceauth.NewUpdateCommand(serviceauthCmdRoot.CmdClause, data)
serviceVersionCmdRoot := serviceversion.NewRootCommand(app, data)
serviceVersionCmdRoot := serviceversion.NewRootCommand(serviceCmdRoot.CmdClause, data)
serviceVersionActivate := serviceversion.NewActivateCommand(serviceVersionCmdRoot.CmdClause, data)
serviceVersionClone := serviceversion.NewCloneCommand(serviceVersionCmdRoot.CmdClause, data)
serviceVersionDeactivate := serviceversion.NewDeactivateCommand(serviceVersionCmdRoot.CmdClause, data)
Expand Down Expand Up @@ -715,6 +716,15 @@ func Define( // nolint:revive // function-length

// Aliases for deprecated commands
aliasPurge := aliaspurge.NewCommand(app, data)
aliasServiceVersionRoot := aliasserviceversion.NewRootCommand(app, data)
aliasServiceVersionActivate := aliasserviceversion.NewActivateCommand(aliasServiceVersionRoot.CmdClause, data)
aliasServiceVersionClone := aliasserviceversion.NewCloneCommand(aliasServiceVersionRoot.CmdClause, data)
aliasServiceVersionDeactivate := aliasserviceversion.NewDeactivateCommand(aliasServiceVersionRoot.CmdClause, data)
aliasServiceVersionList := aliasserviceversion.NewListCommand(aliasServiceVersionRoot.CmdClause, data)
aliasServiceVersionLock := aliasserviceversion.NewLockCommand(aliasServiceVersionRoot.CmdClause, data)
aliasServiceVersionStage := aliasserviceversion.NewStageCommand(aliasServiceVersionRoot.CmdClause, data)
aliasServiceVersionUnstage := aliasserviceversion.NewUnstageCommand(aliasServiceVersionRoot.CmdClause, data)
aliasServiceVersionUpdate := aliasserviceversion.NewUpdateCommand(aliasServiceVersionRoot.CmdClause, data)

return []argparser.Command{
shellcompleteCmdRoot,
Expand Down Expand Up @@ -1289,5 +1299,13 @@ func Define( // nolint:revive // function-length
versionCmdRoot,
whoamiCmdRoot,
aliasPurge,
aliasServiceVersionActivate,
aliasServiceVersionClone,
aliasServiceVersionDeactivate,
aliasServiceVersionList,
aliasServiceVersionLock,
aliasServiceVersionStage,
aliasServiceVersionUnstage,
aliasServiceVersionUpdate,
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package serviceversion
package version

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package serviceversion
package version

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package serviceversion
package version

import (
"context"
Expand Down
3 changes: 3 additions & 0 deletions pkg/commands/service/version/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Package version contains commands to inspect and manipulate Fastly
// service versions.
package version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package serviceversion
package version

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package serviceversion
package version

import (
"context"
Expand Down
31 changes: 31 additions & 0 deletions pkg/commands/service/version/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package version

import (
"io"

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

// RootCommand is the parent command for all subcommands in this package.
// It should be installed under the primary root command.
type RootCommand struct {
argparser.Base
// no flags
}

// CommandName is the string to be used to invoke this command.
const CommandName = "version"

// NewRootCommand returns a new command registered in the parent.
func NewRootCommand(parent argparser.Registerer, g *global.Data) *RootCommand {
var c RootCommand
c.Globals = g
c.CmdClause = parent.Command(CommandName, "Manipulate Fastly service versions")
return &c
}

// Exec implements the command interface.
func (c *RootCommand) Exec(_ io.Reader, _ io.Writer) error {
panic("unreachable")
}
Loading
Loading