Ejemplo n.º 1
0
        protected async Task <CdnOrigin> CreateCdnOrigin(CdnEndpoint endpoint, string originName)
        {
            CdnOriginData input = ResourceDataHelper.CreateOriginData();
            var           lro   = await endpoint.GetCdnOrigins().CreateOrUpdateAsync(true, originName, input);

            return(lro.Value);
        }
Ejemplo n.º 2
0
        public async Task CreateOrUpdate()
        {
            Subscription subscription = await Client.GetDefaultSubscriptionAsync();

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

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

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

            string    cdnOriginName = Recording.GenerateAssetName("origin-");
            CdnOrigin cdnOrigin     = await CreateCdnOrigin(cdnEndpoint, cdnOriginName);

            Assert.AreEqual(cdnOriginName, cdnOrigin.Data.Name);
            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await cdnEndpoint.GetCdnOrigins().CreateOrUpdateAsync(WaitUntil.Completed, null, cdnOrigin.Data));
            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await cdnEndpoint.GetCdnOrigins().CreateOrUpdateAsync(WaitUntil.Completed, cdnOriginName, null));
        }
Ejemplo n.º 3
0
        public async Task Get()
        {
            Subscription subscription = await Client.GetDefaultSubscriptionAsync();

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

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

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

            string    cdnOriginName = Recording.GenerateAssetName("origin-");
            CdnOrigin cdnOrigin     = await CreateCdnOrigin(cdnEndpoint, cdnOriginName);

            CdnOrigin getCdnOrigin = await cdnEndpoint.GetCdnOrigins().GetAsync(cdnOriginName);

            ResourceDataHelper.AssertValidOrigin(cdnOrigin, getCdnOrigin);
            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await cdnEndpoint.GetCdnOrigins().GetAsync(null));
        }
Ejemplo n.º 4
0
        public async Task List()
        {
            Subscription subscription = await Client.GetDefaultSubscriptionAsync();

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

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

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

            string cdnOriginName = Recording.GenerateAssetName("origin-");

            _ = await CreateCdnOrigin(cdnEndpoint, cdnOriginName);

            int count = 0;

            await foreach (var tempOrigin in cdnEndpoint.GetCdnOrigins().GetAllAsync())
            {
                count++;
            }
            Assert.AreEqual(count, 2);
        }