コード例 #1
0
        public async Task DeleteApplicationDefinitions()
        {
            #region Snippet:Managing_ApplicationDefinitions_DeleteAnApplicationDefinition
            // First we need to get the application definition collection from the resource group
            ApplicationDefinitionCollection applicationDefinitionCollection = resourceGroup.GetApplicationDefinitions();
            // Now we can get the application definition with GetAsync()
            ApplicationDefinition applicationDefinition = await applicationDefinitionCollection.GetAsync("myApplicationDefinition");

            // With DeleteAsync(), we can delete the application definition
            await applicationDefinition.DeleteAsync(WaitUntil.Completed);

            #endregion Snippet:Managing_ApplicationDefinitions_DeleteAnApplicationDefinition
        }
コード例 #2
0
        public async Task Delete()
        {
            string            rgName = Recording.GenerateAssetName("testRg-4-");
            ResourceGroupData rgData = new ResourceGroupData(Location.WestUS2);
            var lro = await Client.DefaultSubscription.GetResourceGroups().CreateOrUpdateAsync(rgName, rgData);

            ResourceGroup             rg = lro.Value;
            string                    applicationDefinitionName = Recording.GenerateAssetName("appDef-C-");
            ApplicationDefinitionData applicationDefinitionData = CreateApplicationDefinitionData(applicationDefinitionName);
            ApplicationDefinition     applicationDefinition     = (await rg.GetApplicationDefinitions().CreateOrUpdateAsync(applicationDefinitionName, applicationDefinitionData)).Value;
            await applicationDefinition.DeleteAsync();

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

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