public virtual async Task EnsureUserEnterprise(EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr, SecurityManagerClient secMgr, string parentEntLookup, string username) { if (State.UserEnterpriseLookup.IsNullOrEmpty()) { var hostLookup = $"{parentEntLookup}|{username}"; var getResp = await entMgr.ResolveHost(hostLookup, false); if (!getResp.Status || getResp.Model == null) { var createResp = await entArch.CreateEnterprise(new CreateEnterpriseRequest() { Name = username, Description = username, Host = hostLookup }, parentEntLookup, username); if (createResp.Status) { State.UserEnterpriseLookup = createResp.Model.EnterpriseLookup; } } else { State.UserEnterpriseLookup = getResp.Model.EnterpriseLookup; } } if (State.UserEnterpriseLookup.IsNullOrEmpty()) { throw new Exception("Unable to establish the user's enterprise, please try again."); } }
public virtual async Task <Status> EnsureAPISubscription(EnterpriseArchitectClient entArch, string entLookup, string username) { await DesignOutline.Instance.Retry() .SetActionAsync(async() => { try { var resp = await entArch.EnsureAPISubscription(new EnsureAPISubscriptionRequset() { SubscriptionType = buildSubscriptionType() }, entLookup, username); // TODO: Handle API error return(!resp.Status); } catch (Exception ex) { log.LogError(ex, "Failed ensuring API subscription"); return(true); } }) .SetCycles(5) .SetThrottle(25) .SetThrottleScale(2) .Run(); return(await LoadAPIKeys(entArch, entLookup, username)); }
public Refresh(EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr, SecurityManagerClient secMgr) { billingEntApiKey = Environment.GetEnvironmentVariable("LCU-BILLING-ENTERPRISE-API-KEY"); this.entArch = entArch; this.entMgr = entMgr; this.secMgr = secMgr; }
public virtual async Task EnsureUserEnterprise(EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr, SecurityManagerClient secMgr, string parentEntLookup, string username) { if (State.UserEnterpriseLookup.IsNullOrEmpty()) { await DesignOutline.Instance.Retry() .SetActionAsync(async() => { try { var hostLookup = $"{parentEntLookup}|{username}"; log.LogInformation($"Ensuring user enterprise for {hostLookup}..."); var getResp = await entMgr.ResolveHost(hostLookup, false); if (!getResp.Status || getResp.Model == null) { var createResp = await entArch.CreateEnterprise(new CreateEnterpriseRequest() { Name = username, Description = username, Host = hostLookup }, parentEntLookup, username); if (createResp.Status) { State.UserEnterpriseLookup = createResp.Model.EnterpriseLookup; } } else { State.UserEnterpriseLookup = getResp.Model.EnterpriseLookup; } return(State.UserEnterpriseLookup.IsNullOrEmpty()); } catch (Exception ex) { log.LogError(ex, "Failed ensuring user enterprise"); return(true); } }) .SetCycles(5) .SetThrottle(25) .SetThrottleScale(2) .Run(); } if (State.UserEnterpriseLookup.IsNullOrEmpty()) { throw new Exception("Unable to establish the user's enterprise, please try again."); } }
public Refresh(EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr, IdentityManagerClient idMgr, SecurityManagerClient secMgr) { this.entArch = entArch; this.entMgr = entMgr; this.idMgr = idMgr; this.secMgr = secMgr; }
public BootOrganizationOrchestration(ApplicationDeveloperClient appDev, DevOpsArchitectClient devOpsArch, EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr) { this.appDev = appDev; this.devOpsArch = devOpsArch; this.entArch = entArch; this.entMgr = entMgr; }
public NapkinIDESetupStateHarness(HttpRequest req, ILogger logger, NapkinIDESetupState state) : base(req, logger, state) { devOpsArch = req.ResolveClient <DevOpsArchitectClient>(logger); entArch = req.ResolveClient <EnterpriseArchitectClient>(logger); entMgr = req.ResolveClient <EnterpriseManagerClient>(logger); idMgr = req.ResolveClient <IdentityManagerClient>(logger); }
public virtual async Task Refresh(IDurableOrchestrationClient starter, StateDetails stateDetails, ExecuteActionRequest exActReq, ApplicationArchitectClient appArch, EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr, IdentityManagerClient idMgr, SecurityManagerClient secMgr, DocumentClient client) { // await EnsureUserEnterprise(entArch, entMgr, secMgr, stateDetails.EnterpriseLookup, stateDetails.Username); State.Loading = false; State.HomePage.Loading = false; State.SSL.Loading = false; }
public virtual async Task <Status> BootMicroAppsRuntime(EnterpriseArchitectClient entArch) { if (!State.NewEnterpriseAPIKey.IsNullOrEmpty() && !State.EnvironmentLookup.IsNullOrEmpty()) { var resp = await entArch.EnsureLCURuntime(State.NewEnterpriseAPIKey, State.EnvironmentLookup); return(resp.Status); } else { return(Status.GeneralError.Clone("Boot not properly configured.")); } }
public DataFlowManagerStateHarness(HttpRequest req, ILogger logger, DataFlowManagerState state) : base(req, logger, state) { appMgr = req.ResolveClient <ApplicationManagerClient>(logger); devOpsArch = req.ResolveClient <DevOpsArchitectClient>(logger); entArch = req.ResolveClient <EnterpriseArchitectClient>(logger); entMgr = req.ResolveClient <EnterpriseManagerClient>(logger); idMgr = req.ResolveClient <IdentityManagerClient>(logger); }
public virtual async Task <Status> CreateAPISubscription(EnterpriseArchitectClient entArch, string entApiKey, string username) { if (State.HasAccess) { var response = await entArch.EnsureForecastAPISubscription(new EnsureForecastAPISubscriptionRequset() { SubscriptionType = $"{State.AccessLicenseType}-{State.AccessPlanGroup}".ToLower() }, forecastEntLookup, username); // TODO: Handle API error } return(await LoadAPIKeys(entArch, entApiKey, username)); }
public virtual async Task <Status> GenerateAPIKeys(EnterpriseArchitectClient entArch, string entApiKey, string username, string keyType) { if (State.HasAccess) { var response = await entArch.GenerateForecastAPIKeys(new GenerateForecastAPIKeysRequset() { KeyType = keyType }, forecastEntLookup, username); // TODO: Handle API error } return(await LoadAPIKeys(entArch, forecastEntLookup, username)); }
public virtual async Task <Status> LoadAPIKeys(EnterpriseArchitectClient entArch, string entApiKey, string username) { State.APIKeys = new Dictionary <string, string>(); if (State.HasAccess) { var response = await entArch.LoadForecastAPIKeys(forecastEntLookup, username); // TODO: Handle API error State.APIKeys = response.Model?.Metadata.ToDictionary(m => m.Key, m => m.Value.ToString()); } return(Status.Success); }
public virtual async Task <Status> BootHost(EnterpriseArchitectClient entArch, string parentEntApiKey) { if (!State.NewEnterpriseAPIKey.IsNullOrEmpty() && !State.EnvironmentLookup.IsNullOrEmpty()) { var response = await entArch.EnsureHost(new EnsureHostRequest() { EnviromentLookup = State.EnvironmentLookup }, State.NewEnterpriseAPIKey, State.Host, State.EnvironmentLookup, parentEntApiKey); return(response.Status); } else { return(Status.GeneralError.Clone("Boot not properly configured.")); } }
public virtual async Task <Status> Refresh(EnterpriseArchitectClient entArch, IdentityManagerClient idMgr, string entApiKey, string username) { Status status = await HasAccess(idMgr, entApiKey, username); if (status) { status = await LoadAPIKeys(entArch, entApiKey, username); if (State.APIKeys.IsNullOrEmpty()) { status = await CreateAPISubscription(entArch, entApiKey, username); } } return(status); }
public virtual async Task <Status> Refresh(EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr, IdentityManagerClient idMgr, SecurityManagerClient secMgr, StateDetails stateDetails) { await EnsureUserEnterprise(entArch, entMgr, secMgr, stateDetails.EnterpriseLookup, stateDetails.Username); await Task.WhenAll( HasLicenseAccess(idMgr, stateDetails.EnterpriseLookup, stateDetails.Username) ); await Task.WhenAll( EnsureAPISubscription(entArch, stateDetails.EnterpriseLookup, stateDetails.Username), LoadAPIOptions() ); State.Loading = false; return(Status.Success); }
public virtual async Task <Status> BootOrganizationEnvironment(EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr, DevOpsArchitectClient devOpsArch, string parentEntApiKey, string username) { var status = Status.Success; if (State.NewEnterpriseAPIKey.IsNullOrEmpty()) { var entRes = await entArch.CreateEnterprise(new CreateEnterpriseRequest() { Description = State.OrganizationDescription ?? State.OrganizationName, Host = State.Host, Name = State.OrganizationName }, parentEntApiKey, username); State.NewEnterpriseAPIKey = entRes.Model?.PrimaryAPIKey; status = entRes.Status; } if (status && !State.NewEnterpriseAPIKey.IsNullOrEmpty() && State.EnvironmentLookup.IsNullOrEmpty()) { var envResp = await devOpsArch.EnsureEnvironment(new Personas.DevOps.EnsureEnvironmentRequest() { EnvSettings = State.EnvSettings, OrganizationLookup = State.OrganizationLookup, }, State.NewEnterpriseAPIKey); State.EnvironmentLookup = envResp.Model?.Lookup; status = envResp.Status; } else if (!State.NewEnterpriseAPIKey.IsNullOrEmpty() && !State.EnvironmentLookup.IsNullOrEmpty()) { await entMgr.SaveEnvironmentSettings(State.EnvSettings, State.NewEnterpriseAPIKey, State.EnvironmentLookup); } UpdateStatus(status); return(status); }
public virtual async Task <Status> LoadAPIKeys(EnterpriseArchitectClient entArch, string entLookup, string username) { State.APIKeys = new List <APIAccessKeyData>(); await DesignOutline.Instance.Retry() .SetActionAsync(async() => { try { var resp = await entArch.LoadAPIKeys(entLookup, buildSubscriptionType(), username); // TODO: Handle API error log.LogInformation($"Load API Keys response: {resp.ToJSON()}"); State.APIKeys = resp.Model?.Metadata.Select(m => new APIAccessKeyData() { Key = m.Value.ToString(), KeyName = m.Key }).ToList(); return(!resp.Status); } catch (Exception ex) { log.LogError(ex, "Failed loading API Keys"); return(true); } }) .SetCycles(5) .SetThrottle(25) .SetThrottleScale(2) .Run(); return(Status.Success); }
public virtual async Task ConfigureInfrastructure(EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr, string infraType, bool useDefaultSettings, MetadataModel settings, string template, bool shouldStep) { var envLookup = $"{State.OrganizationLookup}-prd"; State.Booted = false; State.EnvSettings = settings; State.Template = template; await AreAzureEnvSettingsValid(entMgr); if (State.AzureInfrastructureValid) { if (shouldStep) { SetNapkinIDESetupStep(NapkinIDESetupStepTypes.Review); } else { await ConfigureAzureLocationOptions(entArch); } State.Status = null; } else { State.Status = new Status() { Code = (int)UserManagementErrorCodes.AzureEnvSettingsInvalid, Message = State.AzureInfrastructureValid.Message, Metadata = State.AzureInfrastructureValid.Metadata } }; }
public CreateAPISubscription(EnterpriseArchitectClient entArch) { this.entArch = entArch; }
public RenewCertificatesOrchestration(EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr) { this.entArch = entArch; this.entMgr = entMgr; }
public ValidatePointQueryLimitsOrchestration(EnterpriseArchitectClient entArch, IdentityManagerClient idMgr) { this.entArch = entArch; this.idMgr = idMgr; }
public virtual async Task ConfigureAzureLocationOptions(EnterpriseArchitectClient entArch) { var azureRegions = await entArch.ListAzureRegions(State.EnvSettings.JSONConvert <AzureInfrastructureConfig>(), new List <string>() { "Microsoft.SignalRService/SignalR" }); State.AzureLocationOptions = azureRegions.Model; }
public ConfigureInfrastructure(EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr) { this.entArch = entArch; this.entMgr = entMgr; }
public Refresh(EnterpriseArchitectClient entArch, IdentityManagerClient idMgr) { this.entArch = entArch; this.idMgr = idMgr; }
public GenerateAPIKeys(EnterpriseArchitectClient entArch) { this.entArch = entArch; }
public ConfigureInfrastructure(EnterpriseArchitectClient entArch, IEnterprisesBillingManagerService entMgr) { this.entArch = entArch; this.entMgr = entMgr; }