Пример #1
0
        public async Task DeleteAfdRules()
        {
            #region Snippet:Managing_AfdRules_DeleteAnAzureFrontDoorRule
            // First we need to get the azure front door rule collection from the specific rule set
            ProfileResource AfdProfileResource = await resourceGroup.GetProfiles().GetAsync("myAfdProfile");

            FrontDoorRuleSetResource ruleSet = await AfdProfileResource.GetFrontDoorRuleSets().GetAsync("myAfdRuleSet");

            FrontDoorRuleCollection ruleCollection = ruleSet.GetFrontDoorRules();
            // Now we can get the rule with GetAsync()
            FrontDoorRuleResource rule = await ruleCollection.GetAsync("myAfdRule");

            // With DeleteAsync(), we can delete the rule
            await rule.DeleteAsync(WaitUntil.Completed);

            #endregion Snippet:Managing_AfdRules_DeleteAnAzureFrontDoorRule
        }
Пример #2
0
        public async Task Delete()
        {
            SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync();

            ResourceGroupResource rg = await CreateResourceGroup(subscription, "testRg-");

            string          afdProfileName = Recording.GenerateAssetName("AFDProfile-");
            ProfileResource afdProfile     = await CreateAfdProfile(rg, afdProfileName, CdnSkuName.StandardAzureFrontDoor);

            string afdRuleSetName = Recording.GenerateAssetName("AFDRuleSet");
            FrontDoorRuleSetResource afdRuleSet = await CreateAfdRuleSet(afdProfile, afdRuleSetName);

            string afdRuleName            = Recording.GenerateAssetName("AFDRule");
            FrontDoorRuleResource afdRule = await CreateAfdRule(afdRuleSet, afdRuleName);

            await afdRule.DeleteAsync(WaitUntil.Completed);

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

            Assert.AreEqual(404, ex.Status);
        }