public async Task <InvokeResult <DataStream> > LoadFullDataStreamConfigurationAsync(String id, EntityHeader org, EntityHeader user) { try { var stream = await _dataStreamRepo.GetDataStreamAsync(id); await AuthorizeAsync(stream, AuthorizeResult.AuthorizeActions.Read, user, org, "LoadWithSecrets"); if (!EntityHeader.IsNullOrEmpty(stream.SharedConnection)) { return(await PopulateSharedConnectionAsync(stream, org, user)); } else { return(await PopulateCredentialsAsync(stream, org, user)); } } catch (RecordNotFoundException) { return(InvokeResult <DataStream> .FromErrors(ErrorCodes.CouldNotLoadDataStreamModule.ToErrorMessage($"ModuleId={id}"))); } }
public async Task <InvokeResult <DeploymentInstance> > LoadFullInstanceAsync(string id, EntityHeader org, EntityHeader user) { var instance = await _instanceRepo.GetInstanceAsync(id); await AuthorizeAsync(instance, AuthorizeResult.AuthorizeActions.Read, user, org); instance.DeviceRepository.Value = await _deviceRepoManager.GetDeviceRepositoryAsync(instance.DeviceRepository.Id, org, user); var solutionResult = await _solutionManager.LoadFullSolutionAsync(instance.Solution.Id, org, user); if (solutionResult.Successful) { instance.Solution.Value = solutionResult.Result; instance.Solution.Id = instance.Solution.Value.Id; instance.Solution.Text = instance.Solution.Value.Name; return(InvokeResult <DeploymentInstance> .Create(instance)); } else { return(InvokeResult <DeploymentInstance> .FromErrors(solutionResult.Errors.ToArray())); } }