ResourceProvisioningResult CreateCRUDResult(IVirtualMachine vm)
        {
            var crudResult = ResourceProvisioningResultUtil.CreateFromIResource(vm);

            crudResult.CurrentProvisioningState = vm.Inner.ProvisioningState.ToString();
            return(crudResult);
        }
        ResourceProvisioningResult CreateResult(IStorageAccount storageAccount = null)
        {
            var result = ResourceProvisioningResultUtil.CreateFromIResource(storageAccount);

            result.CurrentProvisioningState = storageAccount.ProvisioningState.ToString();
            return(result);
        }
Пример #3
0
        ResourceProvisioningResult CreateResult(BastionHost bastion)
        {
            var crudResult = ResourceProvisioningResultUtil.CreateFromIResource(bastion);

            crudResult.CurrentProvisioningState = bastion.ProvisioningState.ToString();
            return(crudResult);
        }
        public async Task <ResourceProvisioningResult> EnsureDeleted(ResourceProvisioningParameters parameters)
        {
            await DeleteInternalAsync(parameters.ResourceGroupName, parameters.Name, parameters.NetworkSecurityGroupName, parameters.ConfigurationString);

            var provisioningState = await GetProvisioningState(parameters.ResourceGroupName, parameters.Name);

            return(ResourceProvisioningResultUtil.CreateFromProvisioningState(provisioningState));
        }
        ResourceProvisioningResult CreateResult(INetworkSecurityGroup nsg)
        {
            var crudResult = ResourceProvisioningResultUtil.CreateFromIResource(nsg);

            crudResult.CurrentProvisioningState = nsg.Inner.ProvisioningState.ToString();
            crudResult.NewSharedVariables.Add(AzureCrudSharedVariable.NETWORK_SECURITY_GROUP_NAME, nsg.Name);
            return(crudResult);
        }
Пример #6
0
        ResourceProvisioningResult CreateResult(INetwork network)
        {
            var crudResult = ResourceProvisioningResultUtil.CreateFromIResource(network);

            crudResult.CurrentProvisioningState = network.Inner.ProvisioningState.ToString();
            crudResult.NewSharedVariables.Add(AzureCrudSharedVariable.BASTION_SUBNET_ID, AzureVNetUtil.GetBastionSubnetId(network));
            return(crudResult);
        }
Пример #7
0
        public async Task <ResourceProvisioningResult> GetSharedVariables(ResourceProvisioningParameters parameters)
        {
            var resourceGroup = await GetResourceGroupAsync(parameters.Name);

            var crudResult = ResourceProvisioningResultUtil.CreateFromIResource(resourceGroup);

            crudResult.CurrentProvisioningState = resourceGroup.ProvisioningState.ToString();
            return(crudResult);
        }
Пример #8
0
        public async Task <ResourceProvisioningResult> EnsureDeleted(ResourceProvisioningParameters parameters)
        {
            await DeleteInternal(parameters.ResourceGroupName, parameters.Name);

            var provisioningState = await GetProvisioningState(parameters.ResourceGroupName, parameters.Name);

            var crudResult = ResourceProvisioningResultUtil.CreateFromProvisioningState(provisioningState);

            return(crudResult);
        }
        public async Task <ResourceProvisioningResult> EnsureDeleted(ResourceProvisioningParameters parameters)
        {
            try
            {
                await Delete(parameters.ResourceGroupName, parameters.Name);

                var provisioningState = await GetProvisioningState(parameters.ResourceGroupName, parameters.Name);

                return(ResourceProvisioningResultUtil.CreateFromProvisioningState(provisioningState));
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #10
0
        public async Task <ResourceProvisioningResult> EnsureCreated(ResourceProvisioningParameters parameters, CancellationToken cancellationToken = default)
        {
            _logger.LogInformation($"Creating Resource Group for sandbox with Name: {parameters.SandboxName}! Resource Group: {parameters.ResourceGroupName}");

            var resourceGroup = await GetResourceGroupAsync(parameters.ResourceGroupName, false);

            if (resourceGroup == null)
            {
                _logger.LogInformation($"Resource group not found, creating");
                resourceGroup = await CreateInternal(parameters.ResourceGroupName, GetRegionFromString(parameters.Region), parameters.Tags);
            }
            else
            {
                _logger.LogInformation($"Resource group allready exists");
            }

            var crudResult = ResourceProvisioningResultUtil.CreateFromIResource(resourceGroup);

            crudResult.CurrentProvisioningState = resourceGroup.ProvisioningState.ToString();

            _logger.LogInformation($"Done ensuring Resource Group for sandbox with Id: {parameters.SandboxName}! Resource Group Id: {resourceGroup.Id}");
            return(crudResult);
        }