enhance/ilm-forecast (#51)

This commit is contained in:
T. von Dein
2026-06-26 09:08:14 +02:00
parent b1b701303c
commit 6200b5e7b0
4 changed files with 198 additions and 53 deletions

View File

@@ -39,11 +39,28 @@ func IlmForecast(conf *cfg.Config) *cli.Command {
}
}
const IlmForeCastListReference = `<duration> must be a string which consists one or more of these elements:
d - days
h - hours
m - minutes
s - seconds
Examples:
58d12h - 58 days and 12 hours
122h30m - 122 hours and 30 minutes
Specs may be mixed:
8h12d - 12 days and 8 hours`
func IlmForecastList(conf *cfg.Config) *cli.Command {
return &cli.Command{
Name: "list",
Aliases: []string{"ls"},
Usage: "list index rollover config",
Name: "list",
Aliases: []string{"ls"},
Usage: "list index rollover config",
UsageText: "list [options] [<filter>]",
CustomHelpTemplate: addReference(IlmForeCastListReference),
Flags: []cli.Flag{
&cli.StringFlag{
@@ -54,10 +71,22 @@ func IlmForecastList(conf *cfg.Config) *cli.Command {
},
&cli.StringFlag{
Name: "within",
Usage: "duration withing which to forecast",
Usage: "<duration> withing which to forecast",
Destination: &conf.Ilm.Within,
Aliases: []string{"w"},
},
&cli.StringFlag{
Name: "min-age",
Usage: "show only indices older than <duration>",
Destination: &conf.Ilm.MinAge,
Aliases: []string{"m"},
},
&cli.BoolFlag{
Name: "verbose",
Usage: "show ilm policy as well",
Destination: &conf.Verbose,
Aliases: []string{"v"},
},
},
Action: func(ctx context.Context, cmd *cli.Command) error {
@@ -66,7 +95,7 @@ func IlmForecastList(conf *cfg.Config) *cli.Command {
return errors.New("invalid from phase, allowed: hot, warm, cold, frozen")
}
return es.IlmForecastList(conf)
return es.IlmForecastList(conf, cmd.Args().Get(0))
},
}
}