AzureMonitor: fix Azure Resource Graph queries in Azure China (#35235)

* Optimize Azure Monitor routes

* Update API version compatible with Azure China
This commit is contained in:
Sergey Kostrukov
2021-06-04 04:29:18 -07:00
committed by GitHub
parent bfcc6a2248
commit 412bcf1fb0
5 changed files with 30 additions and 162 deletions

View File

@@ -226,7 +226,7 @@ func (e *AzureResourceGraphDatasource) getPluginRoute(plugin *plugins.DataSource
return nil, "", err
}
routeName, err := getResourceGraphApiRoute(cloud)
routeName, err := getManagementApiRoute(cloud)
if err != nil {
return nil, "", err
}

View File

@@ -43,19 +43,3 @@ func getAppInsightsApiRoute(azureCloud string) (string, error) {
return "", err
}
}
func getResourceGraphApiRoute(azureCloud string) (string, error) {
switch azureCloud {
case azureMonitorPublic:
return "azureresourcegraph", nil
case azureMonitorChina:
return "chinaazureresourcegraph", nil
case azureMonitorUSGovernment:
return "govazureresourcegraph", nil
case azureMonitorGermany:
return "germanyazureresourcegraph", nil
default:
err := fmt.Errorf("the cloud '%s' not supported", azureCloud)
return "", err
}
}