static List <CloudResource> SandboxResourcesFailing(string region, string studyName, string sandboxName, int resourcesSucceeded = 0, string statusOfFailedResource = CloudResourceOperationState.FAILED, int tryCount = CloudResourceConstants.RESOURCE_MAX_TRY_COUNT, int maxTryCount = CloudResourceConstants.RESOURCE_MAX_TRY_COUNT) { var resourceCreationIndex = 0;//number of resources created var resourceGroupName = AzureResourceNameUtil.SandboxResourceGroup(studyName, sandboxName); CloudResource resourceGroup; if (resourceCreationIndex++ < resourcesSucceeded) { resourceGroup = CloudResourceFactory.CreateResourceGroup(region, resourceGroupName, purpose: CloudResourcePurpose.SandboxResourceGroup, sandboxControlled: true); } else { resourceGroup = CloudResourceFactory.CreateResourceGroupFailing(region, resourceGroupName, purpose: CloudResourcePurpose.SandboxResourceGroup, sandboxControlled: true, statusOfFailedResource: statusOfFailedResource, tryCount: tryCount, maxTryCount: maxTryCount); } var result = new List <CloudResource>() { resourceGroup }; result.Add(CreateSucceedingOrFailing(resourcesSucceeded, resourceCreationIndex++, statusOfFailedResource, tryCount, maxTryCount, region, AzureResourceType.StorageAccount, resourceGroupName, AzureResourceNameUtil.DiagnosticsStorageAccount(studyName, sandboxName), parentResource: resourceGroup, sandboxControlled: true)); result.Add(CreateSucceedingOrFailing(resourcesSucceeded, resourceCreationIndex++, statusOfFailedResource, tryCount, maxTryCount, region, AzureResourceType.NetworkSecurityGroup, resourceGroupName, AzureResourceNameUtil.NetworkSecGroup(studyName, sandboxName), parentResource: resourceGroup, sandboxControlled: true)); result.Add(CreateSucceedingOrFailing(resourcesSucceeded, resourceCreationIndex++, statusOfFailedResource, tryCount, maxTryCount, region, AzureResourceType.VirtualNetwork, resourceGroupName, AzureResourceNameUtil.VNet(studyName, sandboxName), parentResource: resourceGroup, sandboxControlled: true)); result.Add(CreateSucceedingOrFailing(resourcesSucceeded, resourceCreationIndex++, statusOfFailedResource, tryCount, maxTryCount, region, AzureResourceType.Bastion, resourceGroupName, AzureResourceNameUtil.Bastion(studyName, sandboxName), parentResource: resourceGroup, sandboxControlled: true)); return(result); }
static List <CloudResource> SandboxResources(string region, string studyName, string sandboxName) { var resourceGroupName = AzureResourceNameUtil.SandboxResourceGroup(studyName, sandboxName); var resourceGroup = CloudResourceFactory.CreateResourceGroup(region, resourceGroupName, purpose: CloudResourcePurpose.SandboxResourceGroup, sandboxControlled: true); var result = new List <CloudResource>() { resourceGroup }; result.Add(CloudResourceFactory.Create(region, AzureResourceType.StorageAccount, resourceGroupName, AzureResourceNameUtil.DiagnosticsStorageAccount(studyName, sandboxName), parentResource: resourceGroup, sandboxControlled: true)); result.Add(CloudResourceFactory.Create(region, AzureResourceType.NetworkSecurityGroup, resourceGroupName, AzureResourceNameUtil.NetworkSecGroup(studyName, sandboxName), parentResource: resourceGroup, sandboxControlled: true)); result.Add(CloudResourceFactory.Create(region, AzureResourceType.VirtualNetwork, resourceGroupName, AzureResourceNameUtil.VNet(studyName, sandboxName), parentResource: resourceGroup, sandboxControlled: true)); result.Add(CloudResourceFactory.Create(region, AzureResourceType.Bastion, resourceGroupName, AzureResourceNameUtil.Bastion(studyName, sandboxName), parentResource: resourceGroup, sandboxControlled: true)); return(result); }
static CloudResource StudySpecificDatasetResourceGroup(string studyName) { var resourceGroupName = AzureResourceNameUtil.StudySpecificDatasetResourceGroup(studyName); return(CloudResourceFactory.CreateResourceGroup(TestConstants.REGION, resourceGroupName, purpose: CloudResourcePurpose.StudySpecificDatasetContainer)); }