Framework/Models/AzSdkConfig.ps1
Set-StrictMode -Version Latest class AzSdkConfig { [string] $MaintenanceMessage [Environment] $Environment [string] $AzSDKRGName [string] $AzSDKRepoURL [string] $AzSDKServerVersion [string[]] $SubscriptionMandatoryTags = @() [string] $ERvNetResourceGroupNames [string] $UpdateCompatibleCCVersion [string] $AzSDKApiBaseURL; [bool] $PublishVulnDataToApi; [string] $ControlTelemetryKey; [bool] $EnableControlTelemetry; [string] $PolicyMessage; [string] $InstallationCommand; hidden static [AzSdkConfig] $Instance = $null; static [AzSdkConfig] GetInstance([bool] $useOnlinePolicyStore, [string] $onlineStoreUri, [bool] $enableAADAuthForOnlinePolicyStore) { if ( $null -eq [AzSdkConfig]::Instance) { [AzSdkConfig]::Instance = [AzSdkConfig]::LoadRootConfiguration($useOnlinePolicyStore,$onlineStoreUri,$enableAADAuthForOnlinePolicyStore) } return [AzSdkConfig]::Instance } hidden static [AzSdkConfig] LoadRootConfiguration([bool] $useOnlinePolicyStore, [string] $onlineStoreUri, [bool] $enableAADAuthForOnlinePolicyStore) { #Filename will be static. return [AzSdkConfig] ([ConfigurationHelper]::LoadServerConfigFile("AzSdk.json", $useOnlinePolicyStore, $onlineStoreUri, $enableAADAuthForOnlinePolicyStore)); } hidden [string] GetLatestAzSDKVersion([string] $moduleName) { if([string]::IsNullOrWhiteSpace($this.AzSDKServerVersion)) { $this.AzSDKServerVersion = "0.0.0.0"; try { $moduleDetails = (Find-Module $moduleName -Repository "PSGallery") $this.AzSDKServerVersion = $moduleDetails.Version } catch { $this.AzSDKServerVersion = "0.0.0.0"; } } return $this.AzSDKServerVersion; } } |