enhanced default cluster selection, add 'cluster switch', overhaul json header setting (#47)

This commit is contained in:
T. von Dein
2026-06-24 09:25:50 +02:00
parent 3c6819151f
commit ffcb8adb70
26 changed files with 393 additions and 320 deletions

View File

@@ -32,7 +32,7 @@ import (
)
func IlmRetry(conf *cfg.Config, index string) error {
_, err := conf.DefaultCluster.ES.Ilm.Retry(index).
_, err := conf.DefaultCluster.ES().Ilm.Retry(index).
Do(context.Background())
if err != nil {
return fmt.Errorf("failed to retry ilm: %s", esErrorString(err))
@@ -42,7 +42,7 @@ func IlmRetry(conf *cfg.Config, index string) error {
}
func IlmStatus(conf *cfg.Config) error {
res, err := conf.DefaultCluster.ES.Ilm.GetStatus().
res, err := conf.DefaultCluster.ES().Ilm.GetStatus().
Do(context.Background())
if err != nil {
return fmt.Errorf("failed to get ilm status: %s", esErrorString(err))
@@ -54,7 +54,7 @@ func IlmStatus(conf *cfg.Config) error {
}
func IlmNames(conf *cfg.Config) ([]string, error) {
res, err := conf.DefaultCluster.ES.Ilm.GetLifecycle().
res, err := conf.DefaultCluster.ES().Ilm.GetLifecycle().
Do(context.Background())
if err != nil {
return nil, fmt.Errorf("failed to get ilm policies: %s", esErrorString(err))
@@ -71,7 +71,7 @@ func IlmNames(conf *cfg.Config) ([]string, error) {
}
func IlmList(conf *cfg.Config, pattern string) error {
ilm := conf.DefaultCluster.ES.Ilm.GetLifecycle()
ilm := conf.DefaultCluster.ES().Ilm.GetLifecycle()
if pattern != "" {
ilm.FilterPath(pattern)
@@ -103,7 +103,7 @@ func IlmList(conf *cfg.Config, pattern string) error {
}
func IlmShow(conf *cfg.Config, policy string) error {
res, err := conf.DefaultCluster.ES.Ilm.GetLifecycle().
res, err := conf.DefaultCluster.ES().Ilm.GetLifecycle().
Policy(policy).
Do(context.Background())
if err != nil {
@@ -165,7 +165,7 @@ func ilmPhaseString(phase *types.Phase, short bool) string {
}
func IlmExplain(conf *cfg.Config, index string) error {
res, err := conf.DefaultCluster.ES.Ilm.ExplainLifecycle(index).
res, err := conf.DefaultCluster.ES().Ilm.ExplainLifecycle(index).
Do(context.Background())
if err != nil {
return fmt.Errorf("failed to get ilm state: %s", esErrorString(err))
@@ -198,7 +198,7 @@ func IlmExplain(conf *cfg.Config, index string) error {
}
func IlmCreate(conf *cfg.Config, policyname string) error {
ilm := conf.DefaultCluster.ES.Ilm.PutLifecycle(policyname)
ilm := conf.DefaultCluster.ES().Ilm.PutLifecycle(policyname)
cfg := conf.Ilm
var phases types.PhasesVariant = esdsl.NewPhases()