Skip to content

Commit a1642b7

Browse files
committed
add alias'
1 parent 3c05f4b commit a1642b7

8 files changed

Lines changed: 187 additions & 0 deletions

File tree

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: 13 additions & 0 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
"github.com/fastly/cli/pkg/commands/authtoken"
1213
"github.com/fastly/cli/pkg/commands/backend"
@@ -228,6 +229,12 @@ func Define( // nolint:revive // function-length
228229
domainDescribe := domain.NewDescribeCommand(domainCmdRoot.CmdClause, data)
229230
domainList := domain.NewListCommand(domainCmdRoot.CmdClause, data)
230231
domainUpdate := domain.NewUpdateCommand(domainCmdRoot.CmdClause, data)
232+
healthcheckCmdRoot := aliashealthcheck.NewRootCommand(app, data)
233+
healthcheckCreate := aliashealthcheck.NewCreateCommand(healthcheckCmdRoot.CmdClause, data)
234+
healthcheckDelete := aliashealthcheck.NewDeleteCommand(healthcheckCmdRoot.CmdClause, data)
235+
healthcheckDescribe := aliashealthcheck.NewDescribeCommand(healthcheckCmdRoot.CmdClause, data)
236+
healthcheckList := aliashealthcheck.NewListCommand(healthcheckCmdRoot.CmdClause, data)
237+
healthcheckUpdate := aliashealthcheck.NewUpdateCommand(healthcheckCmdRoot.CmdClause, data)
231238
imageoptimizerdefaultsCmdRoot := imageoptimizerdefaults.NewRootCommand(app, data)
232239
imageoptimizerdefaultsGet := imageoptimizerdefaults.NewGetCommand(imageoptimizerdefaultsCmdRoot.CmdClause, data)
233240
imageoptimizerdefaultsUpdate := imageoptimizerdefaults.NewUpdateCommand(imageoptimizerdefaultsCmdRoot.CmdClause, data)
@@ -809,6 +816,12 @@ func Define( // nolint:revive // function-length
809816
domainDescribe,
810817
domainList,
811818
domainUpdate,
819+
healthcheckCmdRoot,
820+
healthcheckCreate,
821+
healthcheckDelete,
822+
healthcheckDescribe,
823+
healthcheckList,
824+
healthcheckUpdate,
812825
imageoptimizerdefaultsCmdRoot,
813826
imageoptimizerdefaultsGet,
814827
imageoptimizerdefaultsUpdate,

0 commit comments

Comments
 (0)