Skip to content

Commit d0ea103

Browse files
authored
Merge branch 'main' into rcaril/CDTOOL-1265-move-fastly-vcl-commands-under-service
2 parents 02ad36a + 9c1f02f commit d0ea103

25 files changed

Lines changed: 313 additions & 24 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- 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))
1414
- 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))
1515
- 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))
16+
- 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))
1617

1718
### Bug fixes:
1819

pkg/app/run_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ secret-store
9292
secret-store-entry
9393
service
9494
service-auth
95-
service-version
9695
stats
9796
tls-config
9897
tls-custom
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package serviceversion
2+
3+
import (
4+
"io"
5+
6+
newcmd "github.com/fastly/cli/pkg/commands/service/version"
7+
8+
"github.com/fastly/cli/pkg/argparser"
9+
"github.com/fastly/cli/pkg/global"
10+
"github.com/fastly/cli/pkg/text"
11+
)
12+
13+
// ActivateCommand wraps the ActivateCommand from the newcmd package.
14+
type ActivateCommand struct {
15+
*newcmd.ActivateCommand
16+
}
17+
18+
// NewActivateCommand returns a usable command registered under the parent.
19+
func NewActivateCommand(parent argparser.Registerer, g *global.Data) *ActivateCommand {
20+
c := ActivateCommand{newcmd.NewActivateCommand(parent, g)}
21+
c.CmdClause.Hidden()
22+
return &c
23+
}
24+
25+
// Exec implements the command interface.
26+
func (c *ActivateCommand) Exec(in io.Reader, out io.Writer) error {
27+
text.Deprecated(out, "Use the 'service version activate' command instead.")
28+
return c.ActivateCommand.Exec(in, out)
29+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package serviceversion
2+
3+
import (
4+
"io"
5+
6+
newcmd "github.com/fastly/cli/pkg/commands/service/version"
7+
8+
"github.com/fastly/cli/pkg/argparser"
9+
"github.com/fastly/cli/pkg/global"
10+
"github.com/fastly/cli/pkg/text"
11+
)
12+
13+
// CloneCommand wraps the CloneCommand from the newcmd package.
14+
type CloneCommand struct {
15+
*newcmd.CloneCommand
16+
}
17+
18+
// NewCloneCommand returns a usable command registered under the parent.
19+
func NewCloneCommand(parent argparser.Registerer, g *global.Data) *CloneCommand {
20+
c := CloneCommand{newcmd.NewCloneCommand(parent, g)}
21+
c.CmdClause.Hidden()
22+
return &c
23+
}
24+
25+
// Exec implements the command interface.
26+
func (c *CloneCommand) Exec(in io.Reader, out io.Writer) error {
27+
if !c.JSONOutput.Enabled {
28+
text.Deprecated(out, "Use the 'service version clone' command instead.")
29+
}
30+
return c.CloneCommand.Exec(in, out)
31+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package serviceversion
2+
3+
import (
4+
"io"
5+
6+
newcmd "github.com/fastly/cli/pkg/commands/service/version"
7+
8+
"github.com/fastly/cli/pkg/argparser"
9+
"github.com/fastly/cli/pkg/global"
10+
"github.com/fastly/cli/pkg/text"
11+
)
12+
13+
// DeactivateCommand wraps the DeactivateCommand from the newcmd package.
14+
type DeactivateCommand struct {
15+
*newcmd.DeactivateCommand
16+
}
17+
18+
// NewDeactivateCommand returns a usable command registered under the parent.
19+
func NewDeactivateCommand(parent argparser.Registerer, g *global.Data) *DeactivateCommand {
20+
c := DeactivateCommand{newcmd.NewDeactivateCommand(parent, g)}
21+
c.CmdClause.Hidden()
22+
return &c
23+
}
24+
25+
// Exec implements the command interface.
26+
func (c *DeactivateCommand) Exec(in io.Reader, out io.Writer) error {
27+
text.Deprecated(out, "Use the 'service version deactivate' command instead.")
28+
return c.DeactivateCommand.Exec(in, out)
29+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Package serviceversion contains the 'service-version' aliases for the 'service version' commands.
2+
package serviceversion
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package serviceversion
2+
3+
import (
4+
"io"
5+
6+
newcmd "github.com/fastly/cli/pkg/commands/service/version"
7+
8+
"github.com/fastly/cli/pkg/argparser"
9+
"github.com/fastly/cli/pkg/global"
10+
"github.com/fastly/cli/pkg/text"
11+
)
12+
13+
// ListCommand wraps the ListCommand from the newcmd package.
14+
type ListCommand struct {
15+
*newcmd.ListCommand
16+
}
17+
18+
// NewListCommand returns a usable command registered under the parent.
19+
func NewListCommand(parent argparser.Registerer, g *global.Data) *ListCommand {
20+
c := ListCommand{newcmd.NewListCommand(parent, g)}
21+
c.CmdClause.Hidden()
22+
return &c
23+
}
24+
25+
// Exec implements the command interface.
26+
func (c *ListCommand) Exec(in io.Reader, out io.Writer) error {
27+
if !c.JSONOutput.Enabled {
28+
text.Deprecated(out, "Use the 'service version list' command instead.")
29+
}
30+
return c.ListCommand.Exec(in, out)
31+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package serviceversion
2+
3+
import (
4+
"io"
5+
6+
newcmd "github.com/fastly/cli/pkg/commands/service/version"
7+
8+
"github.com/fastly/cli/pkg/argparser"
9+
"github.com/fastly/cli/pkg/global"
10+
"github.com/fastly/cli/pkg/text"
11+
)
12+
13+
// LockCommand wraps the LockCommand from the newcmd package.
14+
type LockCommand struct {
15+
*newcmd.LockCommand
16+
}
17+
18+
// NewLockCommand returns a usable command registered under the parent.
19+
func NewLockCommand(parent argparser.Registerer, g *global.Data) *LockCommand {
20+
c := LockCommand{newcmd.NewLockCommand(parent, g)}
21+
c.CmdClause.Hidden()
22+
return &c
23+
}
24+
25+
// Exec implements the command interface.
26+
func (c *LockCommand) Exec(in io.Reader, out io.Writer) error {
27+
text.Deprecated(out, "Use the 'service version lock' command instead.")
28+
return c.LockCommand.Exec(in, out)
29+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const CommandName = "service-version"
2121
func NewRootCommand(parent argparser.Registerer, g *global.Data) *RootCommand {
2222
var c RootCommand
2323
c.Globals = g
24-
c.CmdClause = parent.Command(CommandName, "Manipulate Fastly service versions")
24+
c.CmdClause = parent.Command(CommandName, "Manipulate Fastly service versions").Hidden()
2525
return &c
2626
}
2727

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package serviceversion
2+
3+
import (
4+
"io"
5+
6+
newcmd "github.com/fastly/cli/pkg/commands/service/version"
7+
8+
"github.com/fastly/cli/pkg/argparser"
9+
"github.com/fastly/cli/pkg/global"
10+
"github.com/fastly/cli/pkg/text"
11+
)
12+
13+
// StageCommand wraps the StageCommand from the newcmd package.
14+
type StageCommand struct {
15+
*newcmd.StageCommand
16+
}
17+
18+
// NewStageCommand returns a usable command registered under the parent.
19+
func NewStageCommand(parent argparser.Registerer, g *global.Data) *StageCommand {
20+
c := StageCommand{newcmd.NewStageCommand(parent, g)}
21+
c.CmdClause.Hidden()
22+
return &c
23+
}
24+
25+
// Exec implements the command interface.
26+
func (c *StageCommand) Exec(in io.Reader, out io.Writer) error {
27+
text.Deprecated(out, "Use the 'service version stage' command instead.")
28+
return c.StageCommand.Exec(in, out)
29+
}

0 commit comments

Comments
 (0)