Add endpoint to get api key from subnet (#2175)
This commit is contained in:
@@ -165,3 +165,13 @@ func ParseLicense(client http.ClientI, license string) (*licverifier.LicenseInfo
|
||||
|
||||
return licenseInfo, nil
|
||||
}
|
||||
|
||||
func GetAPIKey(client http.ClientI, token string) (string, error) {
|
||||
resp, err := subnetGetReq(client, subnetAPIKeyURL(), subnetAuthHeaders(token))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
respJSON := gjson.Parse(resp)
|
||||
apiKey := respJSON.Get("api_key").String()
|
||||
return apiKey, nil
|
||||
}
|
||||
|
||||
@@ -56,6 +56,10 @@ func subnetMFAURL() string {
|
||||
return subnetBaseURL() + "/api/auth/mfa-login"
|
||||
}
|
||||
|
||||
func subnetAPIKeyURL() string {
|
||||
return subnetBaseURL() + "/api/auth/api-key"
|
||||
}
|
||||
|
||||
func GenerateRegToken(clusterRegInfo mc.ClusterRegistrationInfo) (string, error) {
|
||||
token, e := json.Marshal(clusterRegInfo)
|
||||
if e != nil {
|
||||
|
||||
Reference in New Issue
Block a user