add ilm forecast show

This commit is contained in:
2026-06-25 13:29:24 +02:00
parent 5f60696b01
commit e1291d1d92
3 changed files with 116 additions and 33 deletions

View File

@@ -34,6 +34,7 @@ func IlmForecast(conf *cfg.Config) *cli.Command {
Commands: []*cli.Command{
IlmForecastList(conf),
IlmForecastShow(conf),
},
}
}
@@ -69,3 +70,35 @@ func IlmForecastList(conf *cfg.Config) *cli.Command {
},
}
}
func IlmForecastShow(conf *cfg.Config) *cli.Command {
return &cli.Command{
Name: "show",
Aliases: []string{"sh"},
Usage: "show rollover forecast over all indices",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "from-phase",
Usage: "which ilm phase to forecast from",
Destination: &conf.Ilm.FromPhase,
Aliases: []string{"f"},
},
&cli.StringFlag{
Name: "within",
Usage: "duration withing which to forecast",
Destination: &conf.Ilm.Within,
Aliases: []string{"w"},
},
},
Action: func(ctx context.Context, cmd *cli.Command) error {
valid := []string{"hot", "warm", "cold", "frozen"}
if !slices.Contains(valid, conf.Ilm.FromPhase) {
return errors.New("invalid from phase, allowed: hot, warm, cold, frozen")
}
return es.IlmForecastShow(conf)
},
}
}