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] $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. #For Root config, never use online policy store [AzSdkConfig] $RootConfig = [AzSdkConfig] ([ConfigurationHelper]::LoadJsonFile("AzSdk.json",$useOnlinePolicyStore,$onlineStoreUri,$enableAADAuthForOnlinePolicyStore)); return $RootConfig; } hidden [string] GetLatestAzSDKVersion([string] $moduleName) { if([string]::IsNullOrWhiteSpace($this.AzSDKServerVersion)) { $this.AzSDKServerVersion = "0.0.0.0"; try { $moduleDetails = (Find-Module $moduleName -Repository PSGallary) $this.AzSDKServerVersion = $moduleDetails.Version } catch { $this.AzSDKServerVersion = "0.0.0.0"; } } return $this.AzSDKServerVersion; } } |