mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 14:34:18 +02:00
add ilm forecast show
This commit is contained in:
@@ -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)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user