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, SkuName.StandardMicrosoft); string cdnEndpointName = Recording.GenerateAssetName("endpoint-"); CdnEndpoint cdnEndpoint = await CreateCdnEndpoint(cdnProfile, cdnEndpointName); string cdnOriginGroupName = Recording.GenerateAssetName("origingroup-"); _ = await CreateCdnOriginGroup(cdnEndpoint, cdnOriginGroupName, cdnEndpoint.Data.Origins[0].Name); int count = 0; await foreach (var tempOriginGroup in cdnEndpoint.GetCdnOriginGroups().GetAllAsync()) { count++; } Assert.AreEqual(count, 1); }
public async Task Update() { 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); EndpointUpdateOptions updateOptions = new EndpointUpdateOptions { IsHttpAllowed = false, OriginPath = "/path/valid", OriginHostHeader = "www.bing.com" }; var lro = await cdnEndpoint.UpdateAsync(true, updateOptions); CdnEndpoint updatedCdnEndpoint = lro.Value; ResourceDataHelper.AssertEndpointUpdate(updatedCdnEndpoint, updateOptions); }
public static void AssertEndpointUpdate(CdnEndpoint updatedEndpoint, EndpointUpdateOptions updateOptions) { Assert.AreEqual(updatedEndpoint.Data.IsHttpAllowed, updateOptions.IsHttpAllowed); Assert.AreEqual(updatedEndpoint.Data.OriginPath, updateOptions.OriginPath); Assert.AreEqual(updatedEndpoint.Data.OriginHostHeader, updateOptions.OriginHostHeader); }