public BackendContext(ContextType backendType, BackendConnection connectionData) { _backendType = backendType; _backendConnection = connectionData; _statusManager = AppContext.Resolve <IStatusManager>(); _runbookNameCache = new List <string>(); if (backendType == ContextType.SMA) { // SMA _backendService = new SmaService(this, connectionData); } else if (backendType == ContextType.AzureRM) { _backendService = new AzureRMService(this, connectionData); } else { // Azure _backendService = new AzureService(this, connectionData); } Runbooks = new ObservableCollection <ResourceContainer>(); Credentials = new ObservableCollection <ResourceContainer>(); Schedules = new ObservableCollection <ResourceContainer>(); Variables = new ObservableCollection <ResourceContainer>(); Tags = new ObservableCollection <ResourceContainer>(); Modules = new ObservableCollection <ResourceContainer>(); Connections = new ObservableCollection <ResourceContainer>(); IsReady = false; }
public BackendContext Load(BackendConnection connection) { var contextType = ContextType.SMA; if (connection.IsAzure) { contextType = ContextType.Azure; } else if (connection.IsAzureRM) { contextType = ContextType.AzureRM; } var existingBackend = _backendContexts.FirstOrDefault(c => c.ID == connection.Id); if (existingBackend != null) { return(existingBackend); } var environment = IoC.Get <EnvironmentExplorerViewModel>(); var backend = new BackendContext(contextType, connection); _backendContexts.Add(backend); Execute.OnUIThread(() => environment.Items.Add(backend.GetStructure())); backend.OnLoaded += OnBackendReady; return(backend); }
public SmaService(IBackendContext context, BackendConnection connectionData) { _connectionData = connectionData; _backendContext = context; _viewModelsCache = new Dictionary<object, object>(); _runbookRunningCache = new Dictionary<Guid, bool>(); }
public AzureRMService(IBackendContext context, BackendConnection connectionData) { _backendContext = context; _connectionData = connectionData; _tokens = new Dictionary<Guid, List<AccessToken>>(); _output = IoC.Get<IOutput>(); _jobCache = new Dictionary<Guid, Microsoft.Azure.Management.Automation.Models.Job>(); _testJobCache = new Dictionary<Guid, TestJob>(); }
public AzureService(IBackendContext context, BackendConnection connectionData) { _backendContext = context; _connectionData = connectionData; if (_certificate == null) { if (String.IsNullOrEmpty(_connectionData.AzureCertificateThumbprint)) { throw new ApplicationException("Azure Service is enabled but no certificate has been chosen or generated. Please correct this by editing your Azure connection."); } _certificate = CertificateManager.FindCertificate(_connectionData.AzureCertificateThumbprint); _webRequestHandler = new WebRequestHandler(); _webRequestHandler.ClientCertificates.Add(_certificate); _httpClient = new HttpClient(_webRequestHandler); } }
public BackendContext Load(BackendConnection connection) { var contextType = ContextType.SMA; if (connection.IsAzure) contextType = ContextType.Azure; else if (connection.IsAzureRM) contextType = ContextType.AzureRM; var existingBackend = _backendContexts.FirstOrDefault(c => c.ID == connection.Id); if (existingBackend != null) return existingBackend; var environment = IoC.Get<EnvironmentExplorerViewModel>(); var backend = new BackendContext(contextType, connection); _backendContexts.Add(backend); Execute.OnUIThread(() => environment.Items.Add(backend.GetStructure())); backend.OnLoaded += OnBackendReady; return backend; }