コード例 #1
0
        public async Task DeleteDeployments()
        {
            #region Snippet:Managing_Deployments_DeleteADeployment
            // First we need to get the deployment collection from the resource group
            DeploymentCollection deploymentCollection = resourceGroup.GetDeployments();
            // Now we can get the deployment with GetAsync()
            Deployment deployment = await deploymentCollection.GetAsync("myDeployment");

            // With DeleteAsync(), we can delete the deployment
            await deployment.DeleteAsync();

            #endregion Snippet:Managing_Deployments_DeleteADeployment
        }
コード例 #2
0
        public async Task Delete()
        {
            Subscription subscription = await Client.GetDefaultSubscriptionAsync();

            string            rgName = Recording.GenerateAssetName("testRg-4-");
            ResourceGroupData rgData = new ResourceGroupData(AzureLocation.WestUS2);
            var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, rgData);

            ResourceGroup   rg             = lro.Value;
            string          deployName     = Recording.GenerateAssetName("deployEx-D-");
            DeploymentInput deploymentData = CreateDeploymentData(CreateDeploymentProperties());
            Deployment      deployment     = (await rg.GetDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployName, deploymentData)).Value;
            await deployment.DeleteAsync(WaitUntil.Completed);

            var ex = Assert.ThrowsAsync <RequestFailedException>(async() => await deployment.GetAsync());

            Assert.AreEqual(404, ex.Status);
        }
コード例 #3
0
        public virtual void Dispose()
        {
            bool verifyDeletion = Production.Parent != null || Staging.Parent != null;

            if (Production.Parent != null)
            {
                Debug.WriteLine("Deleting test production deployment");
                Production.DeleteAsync().Wait();
            }
            if (Staging.Parent != null)
            {
                Debug.WriteLine("Deleting test staging deployment");
                Staging.DeleteAsync().Wait();
            }

            if (verifyDeletion && GetType() == typeof(DeploymentTests))
            {
                VerifyDeletion();
            }

            Parent.Dispose();
        }
コード例 #4
0
        private async Task CanDelete()
        {
            await _retrievedProduction.DeleteAsync();

            await _retrievedStaging.DeleteAsync();
        }