Example #1
0
        public async Task DeleteOriginGroups()
        {
            #region Snippet:Managing_OriginGroups_DeleteAnOriginGroup
            // First we need to get the cdn origin group collection from the specific endpoint
            Profile profile = await resourceGroup.GetProfiles().GetAsync("myProfile");

            CdnEndpoint endpoint = await profile.GetCdnEndpoints().GetAsync("myEndpoint");

            CdnOriginGroupCollection originGroupCollection = endpoint.GetCdnOriginGroups();
            // Now we can get the origin group with GetAsync()
            CdnOriginGroup originGroup = await originGroupCollection.GetAsync("myOriginGroup");

            // With DeleteAsync(), we can delete the origin group
            await originGroup.DeleteAsync();

            #endregion Snippet:Managing_OriginGroups_DeleteAnOriginGroup
        }
Example #2
0
        public async Task Delete()
        {
            Subscription subscription = await Client.GetDefaultSubscriptionAsync();

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

            string  cdnProfileName = Recording.GenerateAssetName("profile-");
            Profile cdnProfile     = await CreateCdnProfile(rg, cdnProfileName, SkuName.StandardMicrosoft);

            string      cdnEndpointName = Recording.GenerateAssetName("endpoint-");
            CdnEndpoint cdnEndpoint     = await CreateCdnEndpoint(cdnProfile, cdnEndpointName);

            string         cdnOriginGroupName = Recording.GenerateAssetName("origingroup-");
            CdnOriginGroup cdnOriginGroup     = await CreateCdnOriginGroup(cdnEndpoint, cdnOriginGroupName, cdnEndpoint.Data.Origins[0].Name);

            await cdnOriginGroup.DeleteAsync();

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

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