@@ -174,10 +174,8 @@ func GetElasticClient(kc kubernetes.Interface, dc cs.Interface, db *dbapi.Elasti
174174 return nil , - 1 , errors .Wrap (err , "failed to parse version" )
175175 }
176176
177- switch {
178- case esVersion .Spec .AuthPlugin == catalog .ElasticsearchAuthPluginXpack ||
179- esVersion .Spec .AuthPlugin == catalog .ElasticsearchAuthPluginSearchGuard ||
180- esVersion .Spec .AuthPlugin == catalog .ElasticsearchAuthPluginOpenDistro :
177+ switch esVersion .Spec .AuthPlugin {
178+ case catalog .ElasticsearchAuthPluginXpack , catalog .ElasticsearchAuthPluginSearchGuard , catalog .ElasticsearchAuthPluginOpenDistro :
181179 switch {
182180 case version .Major () == 6 :
183181 client , err := esv6 .NewClient (esv6.Config {
@@ -208,7 +206,7 @@ func GetElasticClient(kc kubernetes.Interface, dc cs.Interface, db *dbapi.Elasti
208206 if err != nil {
209207 return nil , - 1 , errors .Wrap (err , "failed to perform health check" )
210208 }
211- defer res .Body .Close ()
209+ defer res .Body .Close () // nolint:errcheck
212210
213211 if res .IsError () {
214212 return & ESClientV6 {client : client }, res .StatusCode , fmt .Errorf ("health check failed with status code: %d" , res .StatusCode )
@@ -244,7 +242,7 @@ func GetElasticClient(kc kubernetes.Interface, dc cs.Interface, db *dbapi.Elasti
244242 if err != nil {
245243 return nil , - 1 , errors .Wrap (err , "failed to perform health check" )
246244 }
247- defer res .Body .Close ()
245+ defer res .Body .Close () // nolint:errcheck
248246
249247 if res .IsError () {
250248 return & ESClientV7 {client : client }, res .StatusCode , fmt .Errorf ("health check failed with status code: %d" , res .StatusCode )
@@ -280,7 +278,7 @@ func GetElasticClient(kc kubernetes.Interface, dc cs.Interface, db *dbapi.Elasti
280278 if err != nil {
281279 return nil , - 1 , errors .Wrap (err , "failed to perform health check" )
282280 }
283- defer res .Body .Close ()
281+ defer res .Body .Close () // nolint:errcheck
284282
285283 if res .IsError () {
286284 return & ESClientV8 {client : client }, res .StatusCode , fmt .Errorf ("health check failed with status code: %d" , res .StatusCode )
@@ -316,15 +314,15 @@ func GetElasticClient(kc kubernetes.Interface, dc cs.Interface, db *dbapi.Elasti
316314 if err != nil {
317315 return nil , - 1 , errors .Wrap (err , "failed to perform health check" )
318316 }
319- defer res .Body .Close ()
317+ defer res .Body .Close () // nolint:errcheck
320318
321319 if res .IsError () {
322320 return & ESClientV9 {client : client }, res .StatusCode , fmt .Errorf ("health check failed with status code: %d" , res .StatusCode )
323321 }
324322 return & ESClientV9 {client : client }, res .StatusCode , nil
325323 }
326324
327- case esVersion . Spec . AuthPlugin == catalog .ElasticsearchAuthPluginOpenSearch :
325+ case catalog .ElasticsearchAuthPluginOpenSearch :
328326 switch {
329327 case version .Major () == 1 :
330328 client , err := opensearchv1 .NewClient (opensearchv1.Config {
@@ -355,7 +353,7 @@ func GetElasticClient(kc kubernetes.Interface, dc cs.Interface, db *dbapi.Elasti
355353 if err != nil {
356354 return nil , - 1 , errors .Wrap (err , "failed to perform health check" )
357355 }
358- defer res .Body .Close ()
356+ defer res .Body .Close () // nolint:errcheck
359357
360358 if res .IsError () {
361359 return & OSClientV1 {client : client }, res .StatusCode , fmt .Errorf ("health check failed with status code: %d" , res .StatusCode )
@@ -390,10 +388,10 @@ func GetElasticClient(kc kubernetes.Interface, dc cs.Interface, db *dbapi.Elasti
390388 if err != nil {
391389 return nil , - 1 , errors .Wrap (err , "Failed to perform health check" )
392390 }
393- defer res .Body .Close ()
391+ defer res .Body .Close () // nolint:errcheck
394392
395393 if res .IsError () {
396- return & OSClientV2 {client : client }, res .StatusCode , fmt .Errorf ("Health check failed with status code: %d" , res .StatusCode )
394+ return & OSClientV2 {client : client }, res .StatusCode , fmt .Errorf ("health check failed with status code: %d" , res .StatusCode )
397395 }
398396 return & OSClientV2 {client : client }, res .StatusCode , nil
399397 }
@@ -453,28 +451,28 @@ type WriteRequestIndexBody struct {
453451}
454452
455453type ESClient interface {
456- ClusterHealthInfo () (map [string ]interface {} , error )
454+ ClusterHealthInfo () (map [string ]any , error )
457455 ClusterStatus () (string , error )
458456 CountData (index string ) (int , error )
459457 CreateDBUserRole (ctx context.Context ) error
460458 CreateIndex (index string ) error
461459 DeleteIndex (index string ) error
462- GetIndicesInfo () ([]interface {} , error )
460+ GetIndicesInfo () ([]any , error )
463461 GetClusterWriteStatus (ctx context.Context , db * dbapi.Elasticsearch ) error
464462 GetClusterReadStatus (ctx context.Context , db * dbapi.Elasticsearch ) error
465463 GetTotalDiskUsage (ctx context.Context ) (string , error )
466464 GetDBUserRole (ctx context.Context ) (error , bool )
467465 IndexExistsOrNot (index string ) error
468- NodesStats () (map [string ]interface {} , error )
466+ NodesStats () (map [string ]any , error )
469467 ShardStats () ([]ShardInfo , error )
470- PutData (index , id string , data map [string ]interface {} ) error
468+ PutData (index , id string , data map [string ]any ) error
471469 SyncCredentialFromSecret (secret * core.Secret ) error
472470 DisableShardAllocation () error
473471 ReEnableShardAllocation () error
474472 CheckVersion () (string , error )
475473 GetClusterStatus () (string , error )
476474 CountIndex () (int , error )
477- GetData (_index , _type , _id string ) (map [string ]interface {} , error )
475+ GetData (_index , _type , _id string ) (map [string ]any , error )
478476 CountNodes () (int64 , error )
479477 AddVotingConfigExclusions (nodes []string ) error
480478 DeleteVotingConfigExclusions () error
0 commit comments