From c32a5208cdf5c8c8fe5fe196e059b3f39d40ade3 Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Fri, 27 Sep 2024 16:11:50 +0200 Subject: [PATCH] Remove unsused fields in Snapshot struct - feature_states and failures are not []string, which caused parsing errors. We don't need them at the moment thus removed them. --- cmd/snapshot_test.go | 2 +- internal/elasticsearch/api.go | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cmd/snapshot_test.go b/cmd/snapshot_test.go index ace1a9e..ad62b6d 100644 --- a/cmd/snapshot_test.go +++ b/cmd/snapshot_test.go @@ -59,7 +59,7 @@ func TestSnapshotCmd(t *testing.T) { server: httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("X-Elastic-Product", "Elasticsearch") w.WriteHeader(http.StatusOK) - w.Write([]byte(`{"snapshots":[{"snapshot":"snapshot_1","uuid":"dKb54xw67gvdRctLCxSket","repository":"my_repository","version_id":1.1,"version":1,"indices":[],"data_streams":[],"feature_states":[],"include_global_state":true,"state":"SUCCESS","start_time":"2020-07-06T21:55:18.129Z","start_time_in_millis":1593093628850,"end_time":"2020-07-06T21:55:18.129Z","end_time_in_millis":1593094752018,"duration_in_millis":0,"failures":[],"shards":{"total":0,"failed":0,"successful":0}},{"snapshot":"snapshot_2","uuid":"vdRctLCxSketdKb54xw67g","repository":"my_repository","version_id":2,"version":2,"indices":[],"data_streams":[],"feature_states":[],"include_global_state":true,"state":"SUCCESS","start_time":"2020-07-06T21:55:18.130Z","start_time_in_millis":1593093628851,"end_time":"2020-07-06T21:55:18.130Z","end_time_in_millis":1593094752019,"duration_in_millis":1,"failures":[],"shards":{"total":0,"failed":0,"successful":0}}],"next":"c25hcHNob3RfMixteV9yZXBvc2l0b3J5LHNuYXBzaG90XzI=","total":3,"remaining":1} + w.Write([]byte(`{"snapshots":[{"snapshot":"snapshot_1","uuid":"dKb54xw67gvdRctLCxSket","repository":"my_repository","version_id":1.1,"version":1,"indices":[],"data_streams":[],"feature_states":[],"include_global_state":true,"state":"SUCCESS","start_time":"2020-07-06T21:55:18.129Z","start_time_in_millis":1593093628850,"end_time":"2020-07-06T21:55:18.129Z","end_time_in_millis":1593094752018,"duration_in_millis":0,"failures":[{"fail": "didnotfindapidocsforfailures"}],"shards":{"total":0,"failed":0,"successful":0}},{"snapshot":"snapshot_2","uuid":"vdRctLCxSketdKb54xw67g","repository":"my_repository","version_id":2,"version":2,"indices":[],"data_streams":[],"feature_states":[],"include_global_state":true,"state":"SUCCESS","start_time":"2020-07-06T21:55:18.130Z","start_time_in_millis":1593093628851,"end_time":"2020-07-06T21:55:18.130Z","end_time_in_millis":1593094752019,"duration_in_millis":1,"failures":[],"shards":{"total":0,"failed":0,"successful":0}}],"next":"c25hcHNob3RfMixteV9yZXBvc2l0b3J5LHNuYXBzaG90XzI=","total":3,"remaining":1} `)) })), args: []string{"run", "../main.go", "snapshot"}, diff --git a/internal/elasticsearch/api.go b/internal/elasticsearch/api.go index 27ac37b..60772ae 100644 --- a/internal/elasticsearch/api.go +++ b/internal/elasticsearch/api.go @@ -86,13 +86,11 @@ type Snapshot struct { Repository string `json:"repository"` Indices []string `json:"indices"` DataStreams []string `json:"data_streams"` - FeatureStates []string `json:"feature_states"` IncludeGlobalState bool `json:"include_global_state"` State string `json:"state"` StartTimeInMillis int `json:"start_time_in_millis"` EndTimeInMillis int `json:"end_time_in_millis"` DurationInMillis int `json:"duration_in_millis"` - Failures []string `json:"failures"` Shards struct { Total int `json:"total"` Failed int `json:"failed"`