1
1
// This file is part of MinIO Console Server
2
- // Copyright (c) 2021 MinIO, Inc.
2
+ // Copyright (c) 2023 MinIO, Inc.
3
3
//
4
4
// This program is free software: you can redistribute it and/or modify
5
5
// it under the terms of the GNU Affero General Public License as published by
@@ -245,7 +245,7 @@ func getDriveSpaceInfo(admInfo madmin.InfoMessage) (uint64, uint64) {
245
245
}
246
246
247
247
func GetSubnetAPIKeyUsingLicense (lic string ) (string , error ) {
248
- return getSubnetAPIKeyUsingAuthHeaders (subnetLicenseAuthHeaders ( lic ) )
248
+ return getSubnetAPIKeyUsingAuthHeaders (map [ string ] string { "x-subnet-license" : lic } )
249
249
}
250
250
251
251
func getSubnetAPIKeyUsingAuthHeaders (authHeaders map [string ]string ) (string , error ) {
@@ -264,10 +264,6 @@ func extractSubnetCred(key string, resp gjson.Result) (string, error) {
264
264
return result .String (), nil
265
265
}
266
266
267
- func subnetLicenseAuthHeaders (lic string ) map [string ]string {
268
- return map [string ]string {"x-subnet-license" : lic }
269
- }
270
-
271
267
func subnetGetReqMC (reqURL string , headers map [string ]string ) (string , error ) {
272
268
r , e := http .NewRequest (http .MethodGet , reqURL , nil )
273
269
if e != nil {
@@ -286,7 +282,7 @@ func subnetReqDoMC(r *http.Request, headers map[string]string) (string, error) {
286
282
r .Header .Add ("Content-Type" , "application/json" )
287
283
}
288
284
289
- resp , e := subnetHTTPDo (r )
285
+ resp , e := httpClientSubnet ( 0 ). Do (r )
290
286
if e != nil {
291
287
return "" , e
292
288
}
@@ -304,15 +300,6 @@ func subnetReqDoMC(r *http.Request, headers map[string]string) (string, error) {
304
300
return respStr , fmt .Errorf ("Request failed with code %d with error: %s" , resp .StatusCode , respStr )
305
301
}
306
302
307
- func subnetHTTPDo (req * http.Request ) (* http.Response , error ) {
308
- return getSubnetClient ().Do (req )
309
- }
310
-
311
- func getSubnetClient () * http.Client {
312
- client := httpClientSubnet (0 )
313
- return client
314
- }
315
-
316
303
func httpClientSubnet (reqTimeout time.Duration ) * http.Client {
317
304
return & http.Client {
318
305
Timeout : reqTimeout ,
0 commit comments