Azure: get custom cloud list from grafana-azure-sdk-go package (#86717)

* Get custom cloud list from grafana-azure-sdk-go for frontend settings

* Remove getAzureClouds() and call CustomClouds() directly

* remove unused type
This commit is contained in:
Jon Cole
2024-05-04 03:17:51 -07:00
committed by GitHub
parent 5e4722fe2e
commit 8e96821c16
2 changed files with 8 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package dtos package dtos
import ( import (
"github.com/grafana/grafana-azure-sdk-go/v2/azsettings"
"github.com/grafana/grafana/pkg/plugins" "github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
) )
@@ -65,11 +66,12 @@ type FrontendSettingsLicenseInfoDTO struct {
} }
type FrontendSettingsAzureDTO struct { type FrontendSettingsAzureDTO struct {
Cloud string `json:"cloud"` Cloud string `json:"cloud"`
ManagedIdentityEnabled bool `json:"managedIdentityEnabled"` Clouds []azsettings.AzureCloudInfo `json:"clouds"`
WorkloadIdentityEnabled bool `json:"workloadIdentityEnabled"` ManagedIdentityEnabled bool `json:"managedIdentityEnabled"`
UserIdentityEnabled bool `json:"userIdentityEnabled"` WorkloadIdentityEnabled bool `json:"workloadIdentityEnabled"`
UserIdentityFallbackCredentialsEnabled bool `json:"userIdentityFallbackCredentialsEnabled"` UserIdentityEnabled bool `json:"userIdentityEnabled"`
UserIdentityFallbackCredentialsEnabled bool `json:"userIdentityFallbackCredentialsEnabled"`
} }
type FrontendSettingsCachingDTO struct { type FrontendSettingsCachingDTO struct {

View File

@@ -270,6 +270,7 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro
Azure: dtos.FrontendSettingsAzureDTO{ Azure: dtos.FrontendSettingsAzureDTO{
Cloud: hs.Cfg.Azure.Cloud, Cloud: hs.Cfg.Azure.Cloud,
Clouds: hs.Cfg.Azure.CustomClouds(),
ManagedIdentityEnabled: hs.Cfg.Azure.ManagedIdentityEnabled, ManagedIdentityEnabled: hs.Cfg.Azure.ManagedIdentityEnabled,
WorkloadIdentityEnabled: hs.Cfg.Azure.WorkloadIdentityEnabled, WorkloadIdentityEnabled: hs.Cfg.Azure.WorkloadIdentityEnabled,
UserIdentityEnabled: hs.Cfg.Azure.UserIdentityEnabled, UserIdentityEnabled: hs.Cfg.Azure.UserIdentityEnabled,