Skip to content

Commit dcf083b

Browse files
committed
rename to delete
1 parent 2cbbeab commit dcf083b

File tree

18 files changed

+345
-413
lines changed

18 files changed

+345
-413
lines changed

internal/cli/serverless/migration/cancel.go

Lines changed: 0 additions & 149 deletions
This file was deleted.

internal/cli/serverless/migration/create.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func CreateCmd(h *internal.Helper) *cobra.Command {
105105
Mode: mode,
106106
}
107107

108-
resp, err := d.CreateMigrationTask(ctx, clusterID, createBody)
108+
resp, err := d.CreateMigration(ctx, clusterID, createBody)
109109
if err != nil {
110110
return errors.Trace(err)
111111
}
@@ -117,7 +117,7 @@ func CreateCmd(h *internal.Helper) *cobra.Command {
117117
}
118118

119119
cmd.Flags().StringP(flag.ClusterID, flag.ClusterIDShort, "", "The ID of the target cluster.")
120-
cmd.Flags().String(flag.DisplayName, "", "Display name for the migration.")
120+
cmd.Flags().StringP(flag.DisplayName, flag.DisplayNameShort, "", "Display name for the migration.")
121121
cmd.Flags().String(flag.MigrationConfigFile, "", "Path to a migration config JSON file. Use \"ticloud serverless migration template --modetype <mode>\" to print templates.")
122122
cmd.Flags().Bool(flag.MigrationDryRun, false, "Run a migration precheck (dry run) with the provided inputs without creating a task.")
123123

@@ -153,7 +153,7 @@ func runMigrationPrecheck(ctx context.Context, client cloud.TiDBCloudClient, clu
153153
defer ticker.Stop()
154154
pollCtx, cancel := context.WithTimeout(ctx, precheckPollTimeout)
155155
defer cancel()
156-
156+
157157
for {
158158
select {
159159
case <-pollCtx.Done():
@@ -301,4 +301,4 @@ func taskModeValues() []string {
301301
values = append(values, string(mode))
302302
}
303303
return values
304-
}
304+
}

internal/cli/serverless/migration/delete.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ func DeleteCmd(h *internal.Helper) *cobra.Command {
6565

6666
var cmd = &cobra.Command{
6767
Use: "delete",
68-
Short: "Cancel a migration task",
68+
Short: "Delete a migration task",
6969
Aliases: []string{"rm"},
7070
Args: cobra.NoArgs,
71-
Example: fmt.Sprintf(` Cancel a migration task in interactive mode:
72-
$ %[1]s serverless migration delete
71+
Example: fmt.Sprintf(` Delete a migration task in interactive mode:
72+
$ %[1]s serverless migration delete
7373
74-
Cancel a migration task in non-interactive mode:
75-
$ %[1]s serverless migration delete -c <cluster-id> --migration-id <task-id>`, config.CliName),
74+
Delete a migration task in non-interactive mode:
75+
$ %[1]s serverless migration delete -c <cluster-id> --migration-id <task-id>`, config.CliName),
7676
PreRunE: func(cmd *cobra.Command, args []string) error {
7777
return opts.MarkInteractive(cmd)
7878
},
@@ -116,7 +116,7 @@ func DeleteCmd(h *internal.Helper) *cobra.Command {
116116

117117
if !force {
118118
if !h.IOStreams.CanPrompt {
119-
return errors.New("The terminal doesn't support prompt, please run with --force to cancel the migration task")
119+
return errors.New("The terminal doesn't support prompt, please run with --force to delete the migration task")
120120
}
121121
prompt := &survey.Input{
122122
Message: fmt.Sprintf("%s %s %s", color.BlueString("Please type"), color.HiBlueString("yes"), color.BlueString("to confirm:")),
@@ -129,21 +129,21 @@ func DeleteCmd(h *internal.Helper) *cobra.Command {
129129
return err
130130
}
131131
if confirmation != "yes" {
132-
return errors.New("Incorrect confirm string entered, skipping migration task cancellation")
132+
return errors.New("Incorrect confirm string entered, skipping migration task deletion")
133133
}
134134
}
135135

136-
if _, err := d.CancelMigrationTask(ctx, clusterID, taskID); err != nil {
136+
if _, err := d.DeleteMigration(ctx, clusterID, taskID); err != nil {
137137
return errors.Trace(err)
138138
}
139139

140-
fmt.Fprintln(h.IOStreams.Out, color.GreenString("migration task %s canceled", taskID))
140+
fmt.Fprintln(h.IOStreams.Out, color.GreenString("migration task %s deleted", taskID))
141141
return nil
142142
},
143143
}
144144

145-
cmd.Flags().BoolVar(&force, flag.Force, false, "Cancel without confirmation.")
145+
cmd.Flags().BoolVar(&force, flag.Force, false, "Delete without confirmation.")
146146
cmd.Flags().StringP(flag.ClusterID, flag.ClusterIDShort, "", "Cluster ID that owns the migration task.")
147-
cmd.Flags().StringP(flag.MigrationTaskID, flag.MigrationTaskIDShort, "", "ID of the migration task to cancel.")
147+
cmd.Flags().StringP(flag.MigrationTaskID, flag.MigrationTaskIDShort, "", "ID of the migration task to delete.")
148148
return cmd
149149
}

internal/cli/serverless/migration/describe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func DescribeCmd(h *internal.Helper) *cobra.Command {
111111
}
112112
}
113113

114-
resp, err := d.GetMigrationTask(ctx, clusterID, taskID)
114+
resp, err := d.GetMigration(ctx, clusterID, taskID)
115115
if err != nil {
116116
return errors.Trace(err)
117117
}

internal/cli/serverless/migration/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func ListCmd(h *internal.Helper) *cobra.Command {
100100
}
101101

102102
pageSize := int32(h.QueryPageSize)
103-
resp, err := d.ListMigrationTasks(ctx, clusterID, &pageSize, nil, nil)
103+
resp, err := d.ListMigrations(ctx, clusterID, &pageSize, nil, nil)
104104
if err != nil {
105105
return errors.Trace(err)
106106
}

internal/cli/serverless/migration/migration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func MigrationCmd(h *internal.Helper) *cobra.Command {
3030
cmd.AddCommand(CreateCmd(h))
3131
cmd.AddCommand(DescribeCmd(h))
3232
cmd.AddCommand(ListCmd(h))
33-
cmd.AddCommand(CancelCmd(h))
33+
cmd.AddCommand(DeleteCmd(h))
3434
cmd.AddCommand(TemplateCmd(h))
3535
cmd.AddCommand(PauseCmd(h))
3636
cmd.AddCommand(ResumeCmd(h))

internal/cli/serverless/migration/pause.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func PauseCmd(h *internal.Helper) *cobra.Command {
109109
}
110110

111111
emptyBody := map[string]interface{}{}
112-
if _, err := d.PauseMigrationTask(ctx, clusterID, taskID, &emptyBody); err != nil {
112+
if _, err := d.PauseMigration(ctx, clusterID, taskID, &emptyBody); err != nil {
113113
return errors.Trace(err)
114114
}
115115

internal/cli/serverless/migration/resume.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func ResumeCmd(h *internal.Helper) *cobra.Command {
109109
}
110110

111111
emptyBody := map[string]interface{}{}
112-
if _, err := d.ResumeMigrationTask(ctx, clusterID, taskID, &emptyBody); err != nil {
112+
if _, err := d.ResumeMigration(ctx, clusterID, taskID, &emptyBody); err != nil {
113113
return errors.Trace(err)
114114
}
115115

0 commit comments

Comments
 (0)