Rename admin replicate subcommands (#4383)
This commit is contained in:
@@ -40,12 +40,14 @@ var adminReplicateRemoveFlags = []cli.Flag{
|
||||
}
|
||||
|
||||
var adminReplicateRemoveCmd = cli.Command{
|
||||
Name: "remove",
|
||||
Usage: "remove one or more sites from site replication",
|
||||
Action: mainAdminReplicationRemoveStatus,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(globalFlags, adminReplicateRemoveFlags...),
|
||||
Name: "rm",
|
||||
Aliases: []string{"remove"},
|
||||
Usage: "remove one or more sites from site replication",
|
||||
Action: mainAdminReplicationRemoveStatus,
|
||||
OnUsageError: onUsageError,
|
||||
HiddenAliases: true,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(globalFlags, adminReplicateRemoveFlags...),
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
@@ -29,7 +29,7 @@ import (
|
||||
"github.com/minio/pkg/console"
|
||||
)
|
||||
|
||||
var adminReplicateEditFlags = []cli.Flag{
|
||||
var adminReplicateUpdateFlags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "deployment-id",
|
||||
Usage: "deployment id of the site, should be a unique value",
|
||||
@@ -40,13 +40,15 @@ var adminReplicateEditFlags = []cli.Flag{
|
||||
},
|
||||
}
|
||||
|
||||
var adminReplicateEditCmd = cli.Command{
|
||||
Name: "edit",
|
||||
Usage: "edit endpoint of site participating in cluster replication",
|
||||
Action: mainAdminReplicateEdit,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(globalFlags, adminReplicateEditFlags...),
|
||||
var adminReplicateUpdateCmd = cli.Command{
|
||||
Name: "update",
|
||||
Aliases: []string{"edit"},
|
||||
HiddenAliases: true,
|
||||
Usage: "modify endpoint of site participating in site replication",
|
||||
Action: mainAdminReplicateUpdate,
|
||||
OnUsageError: onUsageError,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(globalFlags, adminReplicateUpdateFlags...),
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
@@ -63,15 +65,15 @@ EXAMPLES:
|
||||
`,
|
||||
}
|
||||
|
||||
type editSuccessMessage madmin.ReplicateEditStatus
|
||||
type updateSuccessMessage madmin.ReplicateEditStatus
|
||||
|
||||
func (m editSuccessMessage) JSON() string {
|
||||
func (m updateSuccessMessage) JSON() string {
|
||||
bs, e := json.MarshalIndent(madmin.ReplicateEditStatus(m), "", " ")
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
func (m editSuccessMessage) String() string {
|
||||
func (m updateSuccessMessage) String() string {
|
||||
v := madmin.ReplicateEditStatus(m)
|
||||
messages := []string{v.Status}
|
||||
|
||||
@@ -81,7 +83,7 @@ func (m editSuccessMessage) String() string {
|
||||
return console.Colorize("UserMessage", strings.Join(messages, "\n"))
|
||||
}
|
||||
|
||||
func checkAdminReplicateEditSyntax(ctx *cli.Context) {
|
||||
func checkAdminReplicateUpdateSyntax(ctx *cli.Context) {
|
||||
// Check argument count
|
||||
argsNr := len(ctx.Args())
|
||||
if argsNr < 1 {
|
||||
@@ -93,8 +95,8 @@ func checkAdminReplicateEditSyntax(ctx *cli.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
func mainAdminReplicateEdit(ctx *cli.Context) error {
|
||||
checkAdminReplicateEditSyntax(ctx)
|
||||
func mainAdminReplicateUpdate(ctx *cli.Context) error {
|
||||
checkAdminReplicateUpdateSyntax(ctx)
|
||||
console.SetColor("UserMessage", color.New(color.FgGreen))
|
||||
|
||||
// Get the alias parameter from cli
|
||||
@@ -122,7 +124,7 @@ func mainAdminReplicateEdit(ctx *cli.Context) error {
|
||||
})
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Unable to edit cluster replication site endpoint")
|
||||
|
||||
printMsg(editSuccessMessage(res))
|
||||
printMsg(updateSuccessMessage(res))
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -21,7 +21,7 @@ import "github.com/minio/cli"
|
||||
|
||||
var adminReplicateSubcommands = []cli.Command{
|
||||
adminReplicateAddCmd,
|
||||
adminReplicateEditCmd,
|
||||
adminReplicateUpdateCmd,
|
||||
adminReplicateRemoveCmd,
|
||||
adminReplicateInfoCmd,
|
||||
adminReplicateStatusCmd,
|
||||
|
||||
@@ -447,9 +447,11 @@ var completeCmds = map[string]complete.Predictor{
|
||||
"/ilm/tier/rm": nil,
|
||||
|
||||
"/admin/replicate/add": aliasCompleter,
|
||||
"/admin/replicate/update": aliasCompleter,
|
||||
"/admin/replicate/edit": aliasCompleter,
|
||||
"/admin/replicate/info": aliasCompleter,
|
||||
"/admin/replicate/status": aliasCompleter,
|
||||
"/admin/replicate/rm": aliasCompleter,
|
||||
"/admin/replicate/remove": aliasCompleter,
|
||||
"/admin/replicate/resync/start": aliasCompleter,
|
||||
"/admin/replicate/resync/cancel": aliasCompleter,
|
||||
|
||||
Reference in New Issue
Block a user