public async Task <CloudResource> CreateStudySpecificDatasetEntryAsync(int datasetId, int resourceGroupEntryId, string region, string resourceGroupName, string resourceName, Dictionary <string, string> tags) { var currentUser = await _userService.GetCurrentUserAsync(); var sessionId = _requestIdService.GetRequestId(); var resourceGroupEntry = await GetInternalWithoutAccessCheckAsync(resourceGroupEntryId); if (resourceGroupEntry == null) { throw new Exception("Could not find Resource Group entry"); } var resourceGroupCreateOperation = CloudResourceOperationUtil.GetCreateOperation(resourceGroupEntry); if (resourceGroupCreateOperation == null) { throw new Exception("Could not find Resource Group create operation entry"); } var resourceEntry = CloudResourceFactory.CreateStudySpecificDatasetStorageAccountEntry( currentUser, sessionId, datasetId, region, resourceGroupEntryId, resourceGroupName, resourceName, tags, resourceGroupCreateOperation.Id); await SaveToDb(resourceEntry); return(resourceEntry); }
public async Task <CloudResource> CreateVmEntryAsync(int sandboxId, CloudResource resourceGroup, string region, Dictionary <string, string> tags, string vmName, int operationDependsOn, string configString) { try { await ValidateThatNameDoesNotExistThrowIfInvalid(vmName); var currentUser = await _userService.GetCurrentUserAsync(); var sessionId = _requestIdService.GetRequestId(); var resourceEntry = CloudResourceFactory.CreateSandboxResourceEntry( currentUser, sessionId, sandboxId, region, AzureResourceType.VirtualMachine, resourceGroup.Id, resourceName: vmName, tags: tags, configString: configString, dependsOn: operationDependsOn, resourceGroupName: resourceGroup.ResourceGroupName, sandboxControlled: false ); await SaveToDb(resourceEntry); return(resourceEntry); } catch (Exception ex) { throw new Exception($"Unable to create database resource entry for Virtual Machine for Sandbox {sandboxId}. See inner Exception for details", ex); } }
public async Task <CloudResource> CreateStudySpecificResourceGroupEntryAsync(int studyId, string resourceGroupName, string region, Dictionary <string, string> tags) { var currentUser = await _userService.GetCurrentUserAsync(); var sessionId = _requestIdService.GetRequestId(); var resourceGroupEntry = CloudResourceFactory.CreateStudyResourceGroupEntry(currentUser, sessionId, studyId, region, resourceGroupName, tags); await SaveToDb(resourceGroupEntry); return(resourceGroupEntry); }
public async Task <CloudResource> CreateSandboxResourceGroupEntryAsync(SandboxResourceCreationAndSchedulingDto dto, string resourceGroupName) { await ValidateThatNameDoesNotExistThrowIfInvalid(resourceGroupName); var currentUser = await _userService.GetCurrentUserAsync(); var sessionId = _requestIdService.GetRequestId(); var resourceGroupEntry = CloudResourceFactory.CreateSandboxResourceGroupEntry(currentUser, sessionId, dto.SandboxId, dto.Region, resourceGroupName, dto.Tags, dto.BatchId); await SaveToDb(resourceGroupEntry); return(resourceGroupEntry); }