Exemple #1
0
        public async Task LoadAndPurge()
        {
            SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync();

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

            string          cdnProfileName = Recording.GenerateAssetName("profile-");
            ProfileResource cdnProfile     = await CreateCdnProfile(rg, cdnProfileName, CdnSkuName.StandardVerizon);

            string            cdnEndpointName   = Recording.GenerateAssetName("endpoint-");
            CdnEndpointData   cdnEndpointData   = ResourceDataHelper.CreateEndpointData();
            DeepCreatedOrigin deepCreatedOrigin = new DeepCreatedOrigin("testOrigin")
            {
                HostName = "testsa4dotnetsdk.blob.core.windows.net"
            };

            cdnEndpointData.Origins.Add(deepCreatedOrigin);
            var lro = await cdnProfile.GetCdnEndpoints().CreateOrUpdateAsync(WaitUntil.Completed, cdnEndpointName, cdnEndpointData);

            CdnEndpointResource cdnEndpoint     = lro.Value;
            PurgeContent        purgeParameters = new PurgeContent(new List <string>
            {
                "/*"
            });

            Assert.DoesNotThrowAsync(async() => await cdnEndpoint.PurgeContentAsync(WaitUntil.Completed, purgeParameters));
            LoadContent loadParameters = new LoadContent(new List <string>
            {
                "/testfile/file1.txt"
            });

            Assert.DoesNotThrowAsync(async() => await cdnEndpoint.LoadContentAsync(WaitUntil.Completed, loadParameters));
        }
Exemple #2
0
        protected void DoPurge(object sender, EventArgs args)
        {
            string status;

            //get edgecast settings from app config
            string token  = ConfigurationManager.AppSettings["edgecast.token"];
            string custId = ConfigurationManager.AppSettings["edgecast.custid"];
            string api    = ConfigurationManager.AppSettings["edgecast.api"];

            //if input path has starting /, remove it
            string path = Path.Text;

            if (path.StartsWith("/"))
            {
                path = path.Remove(0, 1);
            }

            //create purge request url
            string purgePath = ConfigurationManager.AppSettings["edgecast.hostname"] + "/" + path;

            PurgeContent.Execute(api, custId, token, purgePath, 8, out status);

            StatusLit.Text = status;
        }