Skip to content

Commit 37aa2e5

Browse files
authored
[CDTOOL-1255] Move dictionary-entry commands under service (#1628)
### Change summary This PR moves the `dictionary-entry ` command under the service command. A alias for `fastly dictionary-entry ` 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: * [x] Does your submission pass tests? ``` make test TEST_ARGS="-run TestDictionaryItemDescribe ./pkg/commands/service/dictionaryentry" ok github.com/fastly/cli/pkg/commands/service/dictionaryentry 1.058s make test TEST_ARGS="-run TestDictionaryItemsList ./pkg/commands/service/dictionaryentry" ok github.com/fastly/cli/pkg/commands/service/dictionaryentry 1.064s make test TEST_ARGS="-run TestDictionaryItemCreate ./pkg/commands/service/dictionaryentry" ok github.com/fastly/cli/pkg/commands/service/dictionaryentry 1.056s make test TEST_ARGS="-run TestDictionaryItemUpdate ./pkg/commands/service/dictionaryentry" ok github.com/fastly/cli/pkg/commands/service/dictionaryentry 1.073s make test TEST_ARGS="-run TestDictionaryItemDelete ./pkg/commands/service/dictionaryentry" ok github.com/fastly/cli/pkg/commands/service/dictionaryentry 1.056s ``` ### Changes to Core Features: * [ ] Have you written new tests for your core changes, as applicable? * [x] Have you successfully run tests with your changes locally? ### User Impact None, an alias was added to prevent breaking changes.
1 parent 3c29604 commit 37aa2e5

19 files changed

Lines changed: 562 additions & 446 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
- 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))
1717
- 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))
1818
- 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))
19-
- feat(service/backend): moved the `acl` and `aclentry` commands under the `service` command, with a unlisted and deprecated aliases of `acl` and `aclentry` ([#1621](https://github.com/fastly/cli/pull/1624))
19+
- feat(service/acl): moved the `acl` and `aclentry` commands under the `service` command, with a unlisted and deprecated aliases of `acl` and `aclentry` ([#1621](https://github.com/fastly/cli/pull/1624))
2020
- feat(version): If the latest version is at least one major version higher than the current version, provide links to the release notes for the major version(s) so the user can review them before upgrading. ([#1623](https://github.com/fastly/cli/pull/1623))
2121
- feat(service/imageoptimizerdefaults): moved the `imageoptimizerdefaults` commands under the `service` command, with an unlisted and deprecated alias of `imageoptimizerdefaults` ([#1627](https://github.com/fastly/cli/pull/1627))
2222
- feat(service/alert): moved the `alerts` command to the `service alert` command, with an unlisted and deprecated alias of `alerts` ([#1616](https://github.com/fastly/cli/pull/1626))
23+
- feat(service/dictionary-entry): moved the `dictionary-entry` commands under the `service` command, with an unlisted and deprecated alias of `dictionary-entry` ([#1628](https://github.com/fastly/cli/pull/1628))
2324
- 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))
2425
- 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))
2526
- 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))

pkg/app/run_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ config
6666
config-store
6767
config-store-entry
6868
dashboard
69-
dictionary-entry
7069
domain
7170
install
7271
ip-list
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package dictionaryentry
2+
3+
import (
4+
"io"
5+
6+
servicedictionaryentry "github.com/fastly/cli/pkg/commands/service/dictionaryentry"
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 servicedictionaryentry package.
14+
type CreateCommand struct {
15+
*servicedictionaryentry.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{servicedictionaryentry.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+
text.Deprecated(out, "Use the 'service dictionary-entry create' command instead.")
28+
return c.CreateCommand.Exec(in, out)
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package dictionaryentry
2+
3+
import (
4+
"io"
5+
6+
servicedictionaryentry "github.com/fastly/cli/pkg/commands/service/dictionaryentry"
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 servicedictionaryentry package.
14+
type DeleteCommand struct {
15+
*servicedictionaryentry.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{servicedictionaryentry.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 dictionary-entry 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 dictionaryentry
2+
3+
import (
4+
"io"
5+
6+
servicedictionaryentry "github.com/fastly/cli/pkg/commands/service/dictionaryentry"
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 servicedictionaryentry package.
14+
type DescribeCommand struct {
15+
*servicedictionaryentry.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{servicedictionaryentry.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 dictionary-entry describe' command instead.")
29+
}
30+
return c.DescribeCommand.Exec(in, out)
31+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Package dictionaryentry contains the 'dictionary-entry' alias for the 'service dictionary-entry' command.
2+
package dictionaryentry
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package dictionaryentry
2+
3+
import (
4+
"io"
5+
6+
servicedictionaryentry "github.com/fastly/cli/pkg/commands/service/dictionaryentry"
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 servicedictionaryentry package.
14+
type ListCommand struct {
15+
*servicedictionaryentry.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{servicedictionaryentry.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 dictionary-entry 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 dictionaryentry
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 = "dictionary-entry"
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 edge dictionary items").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: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package dictionaryentry
2+
3+
import (
4+
"io"
5+
6+
servicedictionaryentry "github.com/fastly/cli/pkg/commands/service/dictionaryentry"
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 servicedictionaryentry package.
14+
type UpdateCommand struct {
15+
*servicedictionaryentry.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{servicedictionaryentry.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+
text.Deprecated(out, "Use the 'service dictionary-entry update' command instead.")
28+
return c.UpdateCommand.Exec(in, out)
29+
}

pkg/commands/commands.go

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
aliasalerts "github.com/fastly/cli/pkg/commands/alias/alerts"
1010
aliasbackend "github.com/fastly/cli/pkg/commands/alias/backend"
1111
aliasdictionary "github.com/fastly/cli/pkg/commands/alias/dictionary"
12+
aliasdictionaryentry "github.com/fastly/cli/pkg/commands/alias/dictionaryentry"
1213
aliashealthcheck "github.com/fastly/cli/pkg/commands/alias/healthcheck"
1314
aliasimageoptimizerdefaults "github.com/fastly/cli/pkg/commands/alias/imageoptimizerdefaults"
1415
aliaspurge "github.com/fastly/cli/pkg/commands/alias/purge"
@@ -27,7 +28,6 @@ import (
2728
"github.com/fastly/cli/pkg/commands/configstoreentry"
2829
"github.com/fastly/cli/pkg/commands/dashboard"
2930
dashboardItem "github.com/fastly/cli/pkg/commands/dashboard/item"
30-
"github.com/fastly/cli/pkg/commands/dictionaryentry"
3131
"github.com/fastly/cli/pkg/commands/domain"
3232
"github.com/fastly/cli/pkg/commands/install"
3333
"github.com/fastly/cli/pkg/commands/ip"
@@ -103,6 +103,7 @@ import (
103103
servicealert "github.com/fastly/cli/pkg/commands/service/alert"
104104
servicebackend "github.com/fastly/cli/pkg/commands/service/backend"
105105
servicedictionary "github.com/fastly/cli/pkg/commands/service/dictionary"
106+
servicedictionaryentry "github.com/fastly/cli/pkg/commands/service/dictionaryentry"
106107
servicedomain "github.com/fastly/cli/pkg/commands/service/domain"
107108
servicehealthcheck "github.com/fastly/cli/pkg/commands/service/healthcheck"
108109
serviceimageoptimizerdefaults "github.com/fastly/cli/pkg/commands/service/imageoptimizerdefaults"
@@ -199,12 +200,6 @@ func Define( // nolint:revive // function-length
199200
dashboardItemDescribe := dashboardItem.NewDescribeCommand(dashboardItemCmdRoot.CmdClause, data)
200201
dashboardItemUpdate := dashboardItem.NewUpdateCommand(dashboardItemCmdRoot.CmdClause, data)
201202
dashboardItemDelete := dashboardItem.NewDeleteCommand(dashboardItemCmdRoot.CmdClause, data)
202-
dictionaryEntryCmdRoot := dictionaryentry.NewRootCommand(app, data)
203-
dictionaryEntryCreate := dictionaryentry.NewCreateCommand(dictionaryEntryCmdRoot.CmdClause, data)
204-
dictionaryEntryDelete := dictionaryentry.NewDeleteCommand(dictionaryEntryCmdRoot.CmdClause, data)
205-
dictionaryEntryDescribe := dictionaryentry.NewDescribeCommand(dictionaryEntryCmdRoot.CmdClause, data)
206-
dictionaryEntryList := dictionaryentry.NewListCommand(dictionaryEntryCmdRoot.CmdClause, data)
207-
dictionaryEntryUpdate := dictionaryentry.NewUpdateCommand(dictionaryEntryCmdRoot.CmdClause, data)
208203
domainCmdRoot := domain.NewRootCommand(app, data)
209204
domainCreate := domain.NewCreateCommand(domainCmdRoot.CmdClause, data)
210205
domainDelete := domain.NewDeleteCommand(domainCmdRoot.CmdClause, data)
@@ -646,6 +641,12 @@ func Define( // nolint:revive // function-length
646641
servicedomainList := servicedomain.NewListCommand(servicedomainCmdRoot.CmdClause, data)
647642
servicedomainUpdate := servicedomain.NewUpdateCommand(servicedomainCmdRoot.CmdClause, data)
648643
servicedomainValidate := servicedomain.NewValidateCommand(servicedomainCmdRoot.CmdClause, data)
644+
servicedictionaryentryCmdRoot := servicedictionaryentry.NewRootCommand(serviceCmdRoot.CmdClause, data)
645+
servicedictionaryentryCreate := servicedictionaryentry.NewCreateCommand(servicedictionaryentryCmdRoot.CmdClause, data)
646+
servicedictionaryentryDelete := servicedictionaryentry.NewDeleteCommand(servicedictionaryentryCmdRoot.CmdClause, data)
647+
servicedictionaryentryDescribe := servicedictionaryentry.NewDescribeCommand(servicedictionaryentryCmdRoot.CmdClause, data)
648+
servicedictionaryentryList := servicedictionaryentry.NewListCommand(servicedictionaryentryCmdRoot.CmdClause, data)
649+
servicedictionaryentryUpdate := servicedictionaryentry.NewUpdateCommand(servicedictionaryentryCmdRoot.CmdClause, data)
649650
servicebackendCmdRoot := servicebackend.NewRootCommand(serviceCmdRoot.CmdClause, data)
650651
servicebackendCreate := servicebackend.NewCreateCommand(servicebackendCmdRoot.CmdClause, data)
651652
servicebackendDelete := servicebackend.NewDeleteCommand(servicebackendCmdRoot.CmdClause, data)
@@ -734,6 +735,12 @@ func Define( // nolint:revive // function-length
734735
aliasBackendDescribe := aliasbackend.NewDescribeCommand(aliasBackendRoot.CmdClause, data)
735736
aliasBackendList := aliasbackend.NewListCommand(aliasBackendRoot.CmdClause, data)
736737
aliasBackendUpdate := aliasbackend.NewUpdateCommand(aliasBackendRoot.CmdClause, data)
738+
aliasDictionaryEntryRoot := aliasdictionaryentry.NewRootCommand(app, data)
739+
aliasDictionaryEntryCreate := aliasdictionaryentry.NewCreateCommand(aliasDictionaryEntryRoot.CmdClause, data)
740+
aliasDictionaryEntryDelete := aliasdictionaryentry.NewDeleteCommand(aliasDictionaryEntryRoot.CmdClause, data)
741+
aliasDictionaryEntryDescribe := aliasdictionaryentry.NewDescribeCommand(aliasDictionaryEntryRoot.CmdClause, data)
742+
aliasDictionaryEntryList := aliasdictionaryentry.NewListCommand(aliasDictionaryEntryRoot.CmdClause, data)
743+
aliasDictionaryEntryUpdate := aliasdictionaryentry.NewUpdateCommand(aliasDictionaryEntryRoot.CmdClause, data)
737744
aliasDictionaryRoot := aliasdictionary.NewRootCommand(app, data)
738745
aliasDictionaryCreate := aliasdictionary.NewCreateCommand(aliasDictionaryRoot.CmdClause, data)
739746
aliasDictionaryDelete := aliasdictionary.NewDeleteCommand(aliasDictionaryRoot.CmdClause, data)
@@ -862,12 +869,6 @@ func Define( // nolint:revive // function-length
862869
dashboardItemDescribe,
863870
dashboardItemUpdate,
864871
dashboardItemDelete,
865-
dictionaryEntryCmdRoot,
866-
dictionaryEntryCreate,
867-
dictionaryEntryDelete,
868-
dictionaryEntryDescribe,
869-
dictionaryEntryList,
870-
dictionaryEntryUpdate,
871872
domainCmdRoot,
872873
domainCreate,
873874
domainDelete,
@@ -1293,6 +1294,12 @@ func Define( // nolint:revive // function-length
12931294
servicedomainList,
12941295
servicedomainUpdate,
12951296
servicedomainValidate,
1297+
servicedictionaryentryCmdRoot,
1298+
servicedictionaryentryCreate,
1299+
servicedictionaryentryDelete,
1300+
servicedictionaryentryDescribe,
1301+
servicedictionaryentryList,
1302+
servicedictionaryentryUpdate,
12961303
servicebackendCmdRoot,
12971304
servicebackendCreate,
12981305
servicebackendDelete,
@@ -1388,6 +1395,11 @@ func Define( // nolint:revive // function-length
13881395
aliasBackendDescribe,
13891396
aliasBackendList,
13901397
aliasBackendUpdate,
1398+
aliasDictionaryEntryCreate,
1399+
aliasDictionaryEntryDelete,
1400+
aliasDictionaryEntryDescribe,
1401+
aliasDictionaryEntryList,
1402+
aliasDictionaryEntryUpdate,
13911403
aliasDictionaryCreate,
13921404
aliasDictionaryDelete,
13931405
aliasDictionaryDescribe,

0 commit comments

Comments
 (0)