Skip to content

Commit aae4e12

Browse files
authored
[CDTOOL-1257] Move healthcheck command under service (#1619)
### Change summary <!-- Briefly describe the changes introduced in this pull request. Include context or reasoning behind the changes, even if they seem minor. If relevant, link to any related discussions (e.g. Slack threads, tickets, documents). --> 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 TestHealthCheckCreate ./pkg/commands/service/healthcheck" ok github.com/fastly/cli/pkg/commands/service/healthcheck 1.048s make test TEST_ARGS="-run TestHealthCheckList ./pkg/commands/service/healthcheck" ok github.com/fastly/cli/pkg/commands/service/healthcheck 1.067s make test TEST_ARGS="-run TestHealthCheckDescribe ./pkg/commands/service/healthcheck" ok github.com/fastly/cli/pkg/commands/service/healthcheck 1.052s make test TEST_ARGS="-run TestHealthCheckUpdate ./pkg/commands/service/healthcheck" ok github.com/fastly/cli/pkg/commands/service/healthcheck 1.064s make test TEST_ARGS="-run TestHealthChecDelete ./pkg/commands/service/healthcheck" ok github.com/fastly/cli/pkg/commands/service/healthcheck 1.023s [no tests to run] ``` ### 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 as alias' have been implemented.
1 parent b13bb8e commit aae4e12

18 files changed

Lines changed: 260 additions & 171 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
- 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))
1414
- feat(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))
1515
- 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))
16-
- feat(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))
16+
- 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))
17+
- 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))
1718

1819
### Bug fixes:
1920

pkg/app/run_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ dashboard
7373
dictionary
7474
dictionary-entry
7575
domain
76-
healthcheck
7776
imageoptimizer
7877
install
7978
ip-list
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package healthcheck
2+
3+
import (
4+
"io"
5+
6+
servicehealthcheck "github.com/fastly/cli/pkg/commands/service/healthcheck"
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 servicehealthcheck package.
14+
type CreateCommand struct {
15+
*servicehealthcheck.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{servicehealthcheck.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 healthcheck 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 healthcheck
2+
3+
import (
4+
"io"
5+
6+
servicehealthcheck "github.com/fastly/cli/pkg/commands/service/healthcheck"
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 servicehealthcheck package.
14+
type DeleteCommand struct {
15+
*servicehealthcheck.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{servicehealthcheck.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 healthcheck delete' command instead.")
28+
return c.DeleteCommand.Exec(in, out)
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package healthcheck
2+
3+
import (
4+
"io"
5+
6+
servicehealthcheck "github.com/fastly/cli/pkg/commands/service/healthcheck"
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 servicehealthcheck package.
14+
type DescribeCommand struct {
15+
*servicehealthcheck.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{servicehealthcheck.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+
text.Deprecated(out, "Use the 'service healthcheck describe' command instead.")
28+
return c.DescribeCommand.Exec(in, out)
29+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Package healthcheck contains the 'healthcheck' alias for the 'service healthcheck' command.
2+
package healthcheck
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package healthcheck
2+
3+
import (
4+
"io"
5+
6+
servicehealthcheck "github.com/fastly/cli/pkg/commands/service/healthcheck"
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 servicehealthcheck package.
14+
type ListCommand struct {
15+
*servicehealthcheck.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{servicehealthcheck.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+
text.Deprecated(out, "Use the 'service healthcheck list' command instead.")
28+
return c.ListCommand.Exec(in, out)
29+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package healthcheck
2+
3+
import (
4+
"io"
5+
6+
servicehealthcheck "github.com/fastly/cli/pkg/commands/service/healthcheck"
7+
8+
"github.com/fastly/cli/pkg/argparser"
9+
"github.com/fastly/cli/pkg/global"
10+
)
11+
12+
// RootCommand wraps the RootCommand from the servicehealthcheck package.
13+
type RootCommand struct {
14+
*servicehealthcheck.RootCommand
15+
}
16+
17+
// NewRootCommand returns a usable command registered under the parent.
18+
func NewRootCommand(parent argparser.Registerer, g *global.Data) *RootCommand {
19+
c := RootCommand{servicehealthcheck.NewRootCommand(parent, g)}
20+
c.CmdClause.Hidden()
21+
return &c
22+
}
23+
24+
// Exec implements the command interface.
25+
func (c *RootCommand) Exec(in io.Reader, out io.Writer) error {
26+
return c.RootCommand.Exec(in, out)
27+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package healthcheck
2+
3+
import (
4+
"io"
5+
6+
servicehealthcheck "github.com/fastly/cli/pkg/commands/service/healthcheck"
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 servicehealthcheck package.
14+
type UpdateCommand struct {
15+
*servicehealthcheck.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{servicehealthcheck.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 healthcheck update' command instead.")
28+
return c.UpdateCommand.Exec(in, out)
29+
}

pkg/commands/commands.go

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/fastly/cli/pkg/commands/acl"
88
"github.com/fastly/cli/pkg/commands/aclentry"
99
"github.com/fastly/cli/pkg/commands/alerts"
10+
aliashealthcheck "github.com/fastly/cli/pkg/commands/alias/healthcheck"
1011
aliaspurge "github.com/fastly/cli/pkg/commands/alias/purge"
1112
aliasvcl "github.com/fastly/cli/pkg/commands/alias/vcl"
1213
aliasvclcondition "github.com/fastly/cli/pkg/commands/alias/vcl/condition"
@@ -25,7 +26,6 @@ import (
2526
"github.com/fastly/cli/pkg/commands/dictionary"
2627
"github.com/fastly/cli/pkg/commands/dictionaryentry"
2728
"github.com/fastly/cli/pkg/commands/domain"
28-
"github.com/fastly/cli/pkg/commands/healthcheck"
2929
"github.com/fastly/cli/pkg/commands/imageoptimizerdefaults"
3030
"github.com/fastly/cli/pkg/commands/install"
3131
"github.com/fastly/cli/pkg/commands/ip"
@@ -99,6 +99,7 @@ import (
9999
"github.com/fastly/cli/pkg/commands/secretstoreentry"
100100
"github.com/fastly/cli/pkg/commands/service"
101101
servicedomain "github.com/fastly/cli/pkg/commands/service/domain"
102+
servicehealthcheck "github.com/fastly/cli/pkg/commands/service/healthcheck"
102103
servicepurge "github.com/fastly/cli/pkg/commands/service/purge"
103104
servicevcl "github.com/fastly/cli/pkg/commands/service/vcl"
104105
servicevclcondition "github.com/fastly/cli/pkg/commands/service/vcl/condition"
@@ -233,12 +234,12 @@ func Define( // nolint:revive // function-length
233234
domainDescribe := domain.NewDescribeCommand(domainCmdRoot.CmdClause, data)
234235
domainList := domain.NewListCommand(domainCmdRoot.CmdClause, data)
235236
domainUpdate := domain.NewUpdateCommand(domainCmdRoot.CmdClause, data)
236-
healthcheckCmdRoot := healthcheck.NewRootCommand(app, data)
237-
healthcheckCreate := healthcheck.NewCreateCommand(healthcheckCmdRoot.CmdClause, data)
238-
healthcheckDelete := healthcheck.NewDeleteCommand(healthcheckCmdRoot.CmdClause, data)
239-
healthcheckDescribe := healthcheck.NewDescribeCommand(healthcheckCmdRoot.CmdClause, data)
240-
healthcheckList := healthcheck.NewListCommand(healthcheckCmdRoot.CmdClause, data)
241-
healthcheckUpdate := healthcheck.NewUpdateCommand(healthcheckCmdRoot.CmdClause, data)
237+
healthcheckCmdRoot := aliashealthcheck.NewRootCommand(app, data)
238+
healthcheckCreate := aliashealthcheck.NewCreateCommand(healthcheckCmdRoot.CmdClause, data)
239+
healthcheckDelete := aliashealthcheck.NewDeleteCommand(healthcheckCmdRoot.CmdClause, data)
240+
healthcheckDescribe := aliashealthcheck.NewDescribeCommand(healthcheckCmdRoot.CmdClause, data)
241+
healthcheckList := aliashealthcheck.NewListCommand(healthcheckCmdRoot.CmdClause, data)
242+
healthcheckUpdate := aliashealthcheck.NewUpdateCommand(healthcheckCmdRoot.CmdClause, data)
242243
imageoptimizerdefaultsCmdRoot := imageoptimizerdefaults.NewRootCommand(app, data)
243244
imageoptimizerdefaultsGet := imageoptimizerdefaults.NewGetCommand(imageoptimizerdefaultsCmdRoot.CmdClause, data)
244245
imageoptimizerdefaultsUpdate := imageoptimizerdefaults.NewUpdateCommand(imageoptimizerdefaultsCmdRoot.CmdClause, data)
@@ -664,6 +665,12 @@ func Define( // nolint:revive // function-length
664665
servicedomainList := servicedomain.NewListCommand(servicedomainCmdRoot.CmdClause, data)
665666
servicedomainUpdate := servicedomain.NewUpdateCommand(servicedomainCmdRoot.CmdClause, data)
666667
servicedomainValidate := servicedomain.NewValidateCommand(servicedomainCmdRoot.CmdClause, data)
668+
servicehealthcheckCmdRoot := servicehealthcheck.NewRootCommand(serviceCmdRoot.CmdClause, data)
669+
servicehealthcheckCreate := servicehealthcheck.NewCreateCommand(servicehealthcheckCmdRoot.CmdClause, data)
670+
servicehealthcheckDelete := servicehealthcheck.NewDeleteCommand(servicehealthcheckCmdRoot.CmdClause, data)
671+
servicehealthcheckDescribe := servicehealthcheck.NewDescribeCommand(servicehealthcheckCmdRoot.CmdClause, data)
672+
servicehealthcheckList := servicehealthcheck.NewListCommand(servicehealthcheckCmdRoot.CmdClause, data)
673+
servicehealthcheckUpdate := servicehealthcheck.NewUpdateCommand(servicehealthcheckCmdRoot.CmdClause, data)
667674
statsCmdRoot := stats.NewRootCommand(app, data)
668675
statsHistorical := stats.NewHistoricalCommand(statsCmdRoot.CmdClause, data)
669676
statsRealtime := stats.NewRealtimeCommand(statsCmdRoot.CmdClause, data)
@@ -843,7 +850,6 @@ func Define( // nolint:revive // function-length
843850
domainDescribe,
844851
domainList,
845852
domainUpdate,
846-
healthcheckCmdRoot,
847853
healthcheckCreate,
848854
healthcheckDelete,
849855
healthcheckDescribe,
@@ -1259,6 +1265,12 @@ func Define( // nolint:revive // function-length
12591265
servicedomainList,
12601266
servicedomainUpdate,
12611267
servicedomainValidate,
1268+
servicehealthcheckCmdRoot,
1269+
servicehealthcheckCreate,
1270+
servicehealthcheckDelete,
1271+
servicehealthcheckDescribe,
1272+
servicehealthcheckList,
1273+
servicehealthcheckUpdate,
12621274
serviceVersionActivate,
12631275
serviceVersionClone,
12641276
serviceVersionCmdRoot,

0 commit comments

Comments
 (0)