MMCTL: Add import delete cmd for removing the import files (#29764)

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
Harsh Aulakh
2025-06-10 15:36:38 +05:30
коммит произвёл GitHub
родитель 0cf6361139
Коммит 09a2037b61
17 изменённых файлов: 348 добавлений и 35 удалений

Просмотреть файл

@@ -37,6 +37,14 @@ var ImportUploadCmd = &cobra.Command{
RunE: withClient(importUploadCmdF),
}
var ImportDeleteCmd = &cobra.Command{
Use: "delete [importname]",
Short: "Delete an import file",
Example: " import delete import_file.zip",
Args: cobra.ExactArgs(1),
RunE: withClient(importDeleteCmdF),
}
var ImportListCmd = &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
@@ -130,6 +138,7 @@ func init() {
ImportProcessCmd,
ImportJobCmd,
ImportValidateCmd,
ImportDeleteCmd,
)
RootCmd.AddCommand(ImportCmd)
}
@@ -250,6 +259,17 @@ func importUploadCmdF(c client.Client, command *cobra.Command, args []string) er
return nil
}
func importDeleteCmdF(c client.Client, command *cobra.Command, args []string) error {
importName := args[0]
if _, err := c.DeleteImport(context.TODO(), importName); err != nil {
return fmt.Errorf("failed to delete import: %w", err)
}
printer.Print(fmt.Sprintf("Import file %q has been deleted", importName))
return nil
}
func importProcessCmdF(c client.Client, command *cobra.Command, args []string) error {
importFile := args[0]