Skip to content

Commit 3c29604

Browse files
authored
[CDTOOL-1262] Move resource-link under service command (#1635)
### Change summary This PR moves the `resource-link` command under the `service` command. A alias for `fastly resource-link` is added here to prevent breaking changes. All Submissions: * [x] Have you followed the guidelines in our Contributing document? * [x] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/fastly/cli/pulls) for the same update/change? <!-- You can erase any parts of this template not applicable to your Pull Request. --> ### New Feature Submissions: * [ ] Does your submission pass tests? ### User Impact None, an alias was created to prevent breaking changes.
1 parent 477a0e5 commit 3c29604

18 files changed

Lines changed: 16477 additions & 272 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- feat(service/dictionary): moved the `dictionary` command under the `service` command, with an unlisted and deprecated alias of `dictionary` ([#1621](https://github.com/fastly/cli/pull/1630))
2424
- feat(service/ratelimit): moved the `rate-limit` commands under the `service` command, with an unlisted and deprecated alias of `rate-limit` ([#1632](https://github.com/fastly/cli/pull/1632))
2525
- feat(compute/build): Remove Rust version restriction, allowing 1.93.0 and later versions to be used. ([#1633](https://github.com/fastly/cli/pull/1633))
26+
- feat(service/resourcelink): moved the `resource-link` commands under the `service` command, with an unlisted and deprecated alias of `resource-link` ([#1635](https://github.com/fastly/cli/pull/1635))
2627

2728
### Bug fixes:
2829
- fix(compute/serve): ensure hostname has a port nubmer when building pushpin routes ([#1631](https://github.com/fastly/cli/pull/1631))

errors.csv

Lines changed: 16197 additions & 0 deletions
Large diffs are not rendered by default.

pkg/app/run_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ object-storage
7979
pops
8080
products
8181
profile
82-
resource-link
8382
secret-store
8483
secret-store-entry
8584
service
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package resourcelink
2+
3+
import (
4+
"io"
5+
6+
newcmd "github.com/fastly/cli/pkg/commands/service/resourcelink"
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+
// CreateCommand wraps the CreateCommand from the newcmd package.
14+
type CreateCommand struct {
15+
*newcmd.CreateCommand
16+
}
17+
18+
// NewCreateCommand returns a usable command registered under the parent.
19+
func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateCommand {
20+
c := CreateCommand{newcmd.NewCreateCommand(parent, g)}
21+
c.CmdClause.Hidden()
22+
return &c
23+
}
24+
25+
// Exec implements the command interface.
26+
func (c *CreateCommand) Exec(in io.Reader, out io.Writer) error {
27+
if !c.JSONOutput.Enabled {
28+
text.Deprecated(out, "Use the 'service resource-link create' command instead.")
29+
}
30+
return c.CreateCommand.Exec(in, out)
31+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package resourcelink
2+
3+
import (
4+
"io"
5+
6+
newcmd "github.com/fastly/cli/pkg/commands/service/resourcelink"
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+
// DeleteCommand wraps the DeleteCommand from the newcmd package.
14+
type DeleteCommand struct {
15+
*newcmd.DeleteCommand
16+
}
17+
18+
// NewDeleteCommand returns a usable command registered under the parent.
19+
func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteCommand {
20+
c := DeleteCommand{newcmd.NewDeleteCommand(parent, g)}
21+
c.CmdClause.Hidden()
22+
return &c
23+
}
24+
25+
// Exec implements the command interface.
26+
func (c *DeleteCommand) Exec(in io.Reader, out io.Writer) error {
27+
text.Deprecated(out, "Use the 'service resource-link delete' command instead.")
28+
return c.DeleteCommand.Exec(in, out)
29+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package resourcelink
2+
3+
import (
4+
"io"
5+
6+
newcmd "github.com/fastly/cli/pkg/commands/service/resourcelink"
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+
// DescribeCommand wraps the DescribeCommand from the newcmd package.
14+
type DescribeCommand struct {
15+
*newcmd.DescribeCommand
16+
}
17+
18+
// NewDescribeCommand returns a usable command registered under the parent.
19+
func NewDescribeCommand(parent argparser.Registerer, g *global.Data) *DescribeCommand {
20+
c := DescribeCommand{newcmd.NewDescribeCommand(parent, g)}
21+
c.CmdClause.Hidden()
22+
return &c
23+
}
24+
25+
// Exec implements the command interface.
26+
func (c *DescribeCommand) Exec(in io.Reader, out io.Writer) error {
27+
if !c.JSONOutput.Enabled {
28+
text.Deprecated(out, "Use the 'service resource-link describe' command instead.")
29+
}
30+
return c.DescribeCommand.Exec(in, out)
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package resourcelink
2+
3+
import (
4+
"io"
5+
6+
newcmd "github.com/fastly/cli/pkg/commands/service/resourcelink"
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 resource-link list' command instead.")
29+
}
30+
return c.ListCommand.Exec(in, out)
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package resourcelink
2+
3+
import (
4+
"io"
5+
6+
"github.com/fastly/cli/pkg/argparser"
7+
"github.com/fastly/cli/pkg/global"
8+
)
9+
10+
// RootCommand is the parent command for all subcommands in this package.
11+
// It should be installed under the primary root command.
12+
type RootCommand struct {
13+
argparser.Base
14+
// no flags
15+
}
16+
17+
// CommandName is the string to be used to invoke this command.
18+
const CommandName = "resource-link"
19+
20+
// NewRootCommand returns a new command registered in the parent.
21+
func NewRootCommand(parent argparser.Registerer, g *global.Data) *RootCommand {
22+
var c RootCommand
23+
c.Globals = g
24+
c.CmdClause = parent.Command(CommandName, "Manipulate Fastly service resource links").Hidden()
25+
return &c
26+
}
27+
28+
// Exec implements the command interface.
29+
func (c *RootCommand) Exec(_ io.Reader, _ io.Writer) error {
30+
panic("unreachable")
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package resourcelink
2+
3+
import (
4+
"io"
5+
6+
newcmd "github.com/fastly/cli/pkg/commands/service/resourcelink"
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+
// UpdateCommand wraps the UpdateCommand from the newcmd package.
14+
type UpdateCommand struct {
15+
*newcmd.UpdateCommand
16+
}
17+
18+
// NewUpdateCommand returns a usable command registered under the parent.
19+
func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateCommand {
20+
c := UpdateCommand{newcmd.NewUpdateCommand(parent, g)}
21+
c.CmdClause.Hidden()
22+
return &c
23+
}
24+
25+
// Exec implements the command interface.
26+
func (c *UpdateCommand) Exec(in io.Reader, out io.Writer) error {
27+
if !c.JSONOutput.Enabled {
28+
text.Deprecated(out, "Use the 'service resource-link update' command instead.")
29+
}
30+
return c.UpdateCommand.Exec(in, out)
31+
}

pkg/commands/commands.go

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
aliasimageoptimizerdefaults "github.com/fastly/cli/pkg/commands/alias/imageoptimizerdefaults"
1414
aliaspurge "github.com/fastly/cli/pkg/commands/alias/purge"
1515
aliasratelimit "github.com/fastly/cli/pkg/commands/alias/ratelimit"
16+
aliasresourcelink "github.com/fastly/cli/pkg/commands/alias/resourcelink"
1617
aliasserviceversion "github.com/fastly/cli/pkg/commands/alias/serviceversion"
1718
aliasvcl "github.com/fastly/cli/pkg/commands/alias/vcl"
1819
aliasvclcondition "github.com/fastly/cli/pkg/commands/alias/vcl/condition"
@@ -94,7 +95,6 @@ import (
9495
"github.com/fastly/cli/pkg/commands/pop"
9596
"github.com/fastly/cli/pkg/commands/products"
9697
"github.com/fastly/cli/pkg/commands/profile"
97-
"github.com/fastly/cli/pkg/commands/resourcelink"
9898
"github.com/fastly/cli/pkg/commands/secretstore"
9999
"github.com/fastly/cli/pkg/commands/secretstoreentry"
100100
"github.com/fastly/cli/pkg/commands/service"
@@ -108,6 +108,7 @@ import (
108108
serviceimageoptimizerdefaults "github.com/fastly/cli/pkg/commands/service/imageoptimizerdefaults"
109109
servicepurge "github.com/fastly/cli/pkg/commands/service/purge"
110110
serviceratelimit "github.com/fastly/cli/pkg/commands/service/ratelimit"
111+
serviceresourcelink "github.com/fastly/cli/pkg/commands/service/resourcelink"
111112
servicevcl "github.com/fastly/cli/pkg/commands/service/vcl"
112113
servicevclcondition "github.com/fastly/cli/pkg/commands/service/vcl/condition"
113114
servicevclcustom "github.com/fastly/cli/pkg/commands/service/vcl/custom"
@@ -560,12 +561,6 @@ func Define( // nolint:revive // function-length
560561
profileSwitch := profile.NewSwitchCommand(profileCmdRoot.CmdClause, data, ssoCmdRoot)
561562
profileToken := profile.NewTokenCommand(profileCmdRoot.CmdClause, data)
562563
profileUpdate := profile.NewUpdateCommand(profileCmdRoot.CmdClause, data, ssoCmdRoot)
563-
resourcelinkCmdRoot := resourcelink.NewRootCommand(app, data)
564-
resourcelinkCreate := resourcelink.NewCreateCommand(resourcelinkCmdRoot.CmdClause, data)
565-
resourcelinkDelete := resourcelink.NewDeleteCommand(resourcelinkCmdRoot.CmdClause, data)
566-
resourcelinkDescribe := resourcelink.NewDescribeCommand(resourcelinkCmdRoot.CmdClause, data)
567-
resourcelinkList := resourcelink.NewListCommand(resourcelinkCmdRoot.CmdClause, data)
568-
resourcelinkUpdate := resourcelink.NewUpdateCommand(resourcelinkCmdRoot.CmdClause, data)
569564
secretstoreCmdRoot := secretstore.NewRootCommand(app, data)
570565
secretstoreCreate := secretstore.NewCreateCommand(secretstoreCmdRoot.CmdClause, data)
571566
secretstoreDescribe := secretstore.NewDescribeCommand(secretstoreCmdRoot.CmdClause, data)
@@ -672,6 +667,12 @@ func Define( // nolint:revive // function-length
672667
serviceratelimitDescribe := serviceratelimit.NewDescribeCommand(serviceratelimitCmdRoot.CmdClause, data)
673668
serviceratelimitList := serviceratelimit.NewListCommand(serviceratelimitCmdRoot.CmdClause, data)
674669
serviceratelimitUpdate := serviceratelimit.NewUpdateCommand(serviceratelimitCmdRoot.CmdClause, data)
670+
serviceresourcelinkCmdRoot := serviceresourcelink.NewRootCommand(serviceCmdRoot.CmdClause, data)
671+
serviceresourcelinkCreate := serviceresourcelink.NewCreateCommand(serviceresourcelinkCmdRoot.CmdClause, data)
672+
serviceresourcelinkDelete := serviceresourcelink.NewDeleteCommand(serviceresourcelinkCmdRoot.CmdClause, data)
673+
serviceresourcelinkDescribe := serviceresourcelink.NewDescribeCommand(serviceresourcelinkCmdRoot.CmdClause, data)
674+
serviceresourcelinkList := serviceresourcelink.NewListCommand(serviceresourcelinkCmdRoot.CmdClause, data)
675+
serviceresourcelinkUpdate := serviceresourcelink.NewUpdateCommand(serviceresourcelinkCmdRoot.CmdClause, data)
675676
statsCmdRoot := stats.NewRootCommand(app, data)
676677
statsHistorical := stats.NewHistoricalCommand(statsCmdRoot.CmdClause, data)
677678
statsRealtime := stats.NewRealtimeCommand(statsCmdRoot.CmdClause, data)
@@ -774,6 +775,12 @@ func Define( // nolint:revive // function-length
774775
aliasRateLimitDescribe := aliasratelimit.NewDescribeCommand(aliasRateLimitRoot.CmdClause, data)
775776
aliasRateLimitList := aliasratelimit.NewListCommand(aliasRateLimitRoot.CmdClause, data)
776777
aliasRateLimitUpdate := aliasratelimit.NewUpdateCommand(aliasRateLimitRoot.CmdClause, data)
778+
aliasResourceLinkRoot := aliasresourcelink.NewRootCommand(app, data)
779+
aliasResourceLinkCreate := aliasresourcelink.NewCreateCommand(aliasResourceLinkRoot.CmdClause, data)
780+
aliasResourceLinkDelete := aliasresourcelink.NewDeleteCommand(aliasResourceLinkRoot.CmdClause, data)
781+
aliasResourceLinkDescribe := aliasresourcelink.NewDescribeCommand(aliasResourceLinkRoot.CmdClause, data)
782+
aliasResourceLinkList := aliasresourcelink.NewListCommand(aliasResourceLinkRoot.CmdClause, data)
783+
aliasResourceLinkUpdate := aliasresourcelink.NewUpdateCommand(aliasResourceLinkRoot.CmdClause, data)
777784
aliasVclRoot := aliasvcl.NewRootCommand(app, data)
778785
aliasVclDescribe := aliasvcl.NewDescribeCommand(aliasVclRoot.CmdClause, data)
779786
aliasVclConditionRoot := aliasvclcondition.NewRootCommand(aliasVclRoot.CmdClause, data)
@@ -1213,12 +1220,6 @@ func Define( // nolint:revive // function-length
12131220
profileSwitch,
12141221
profileToken,
12151222
profileUpdate,
1216-
resourcelinkCmdRoot,
1217-
resourcelinkCreate,
1218-
resourcelinkDelete,
1219-
resourcelinkDescribe,
1220-
resourcelinkList,
1221-
resourcelinkUpdate,
12221223
secretstoreCreate,
12231224
secretstoreDescribe,
12241225
secretstoreDelete,
@@ -1313,6 +1314,12 @@ func Define( // nolint:revive // function-length
13131314
serviceratelimitDescribe,
13141315
serviceratelimitList,
13151316
serviceratelimitUpdate,
1317+
serviceresourcelinkCmdRoot,
1318+
serviceresourcelinkCreate,
1319+
serviceresourcelinkDelete,
1320+
serviceresourcelinkDescribe,
1321+
serviceresourcelinkList,
1322+
serviceresourcelinkUpdate,
13161323
serviceVersionActivate,
13171324
serviceVersionClone,
13181325
serviceVersionCmdRoot,
@@ -1416,6 +1423,11 @@ func Define( // nolint:revive // function-length
14161423
aliasRateLimitDescribe,
14171424
aliasRateLimitList,
14181425
aliasRateLimitUpdate,
1426+
aliasResourceLinkCreate,
1427+
aliasResourceLinkDelete,
1428+
aliasResourceLinkDescribe,
1429+
aliasResourceLinkList,
1430+
aliasResourceLinkUpdate,
14191431
aliasVclDescribe,
14201432
aliasVclConditionCreate,
14211433
aliasVclConditionDelete,

0 commit comments

Comments
 (0)