public async Task Get() { SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); ResourceGroupResource rg = await CreateResourceGroup(subscription, "testRg-"); string afdProfileName = Recording.GenerateAssetName("AFDProfile-"); ProfileResource afdProfileResource = await CreateAfdProfile(rg, afdProfileName, CdnSkuName.StandardAzureFrontDoor); string afdEndpointName = Recording.GenerateAssetName("AFDEndpoint-"); FrontDoorEndpointResource afdEndpointInstance = await CreateAfdEndpoint(afdProfileResource, afdEndpointName); string afdOriginGroupName = Recording.GenerateAssetName("AFDOriginGroup-"); FrontDoorOriginGroupResource afdOriginGroupInstance = await CreateAfdOriginGroup(afdProfileResource, afdOriginGroupName); string afdOriginName = Recording.GenerateAssetName("AFDOrigin-"); FrontDoorOriginResource afdOriginInstance = await CreateAfdOrigin(afdOriginGroupInstance, afdOriginName); string afdRuleSetName = Recording.GenerateAssetName("AFDRuleSet"); FrontDoorRuleSetResource afdRuleSet = await CreateAfdRuleSet(afdProfileResource, afdRuleSetName); string afdRouteName = Recording.GenerateAssetName("AFDRoute"); FrontDoorRouteResource afdRoute = await CreateAfdRoute(afdEndpointInstance, afdRouteName, afdOriginGroupInstance, afdRuleSet); FrontDoorRouteResource getAfdRoute = await afdEndpointInstance.GetFrontDoorRoutes().GetAsync(afdRouteName); ResourceDataHelper.AssertValidAfdRoute(afdRoute, getAfdRoute); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdEndpointInstance.GetFrontDoorRoutes().GetAsync(null)); }
public async Task CreateOrUpdate() { SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); ResourceGroupResource rg = await CreateResourceGroup(subscription, "testRg-"); string afdProfileName = Recording.GenerateAssetName("AFDProfile-"); ProfileResource afdProfileResource = await CreateAfdProfile(rg, afdProfileName, CdnSkuName.StandardAzureFrontDoor); string afdEndpointName = Recording.GenerateAssetName("AFDEndpoint-"); FrontDoorEndpointResource afdEndpointInstance = await CreateAfdEndpoint(afdProfileResource, afdEndpointName); string afdOriginGroupName = Recording.GenerateAssetName("AFDOriginGroup-"); FrontDoorOriginGroupResource afdOriginGroupInstance = await CreateAfdOriginGroup(afdProfileResource, afdOriginGroupName); string afdOriginName = Recording.GenerateAssetName("AFDOrigin-"); _ = await CreateAfdOrigin(afdOriginGroupInstance, afdOriginName); string afdRuleSetName = Recording.GenerateAssetName("AFDRuleSet"); FrontDoorRuleSetResource afdRuleSet = await CreateAfdRuleSet(afdProfileResource, afdRuleSetName); string afdRouteName = Recording.GenerateAssetName("AFDRoute"); FrontDoorRouteResource afdRoute = await CreateAfdRoute(afdEndpointInstance, afdRouteName, afdOriginGroupInstance, afdRuleSet); Assert.AreEqual(afdRouteName, afdRoute.Data.Name); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdEndpointInstance.GetFrontDoorRoutes().CreateOrUpdateAsync(WaitUntil.Completed, null, afdRoute.Data)); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdEndpointInstance.GetFrontDoorRoutes().CreateOrUpdateAsync(WaitUntil.Completed, afdRouteName, null)); }
public async Task List() { SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); ResourceGroupResource rg = await CreateResourceGroup(subscription, "testRg-"); string afdProfileName = Recording.GenerateAssetName("AFDProfile-"); ProfileResource afdProfileResource = await CreateAfdProfile(rg, afdProfileName, CdnSkuName.StandardAzureFrontDoor); string afdEndpointName = Recording.GenerateAssetName("AFDEndpoint-"); FrontDoorEndpointResource afdEndpointInstance = await CreateAfdEndpoint(afdProfileResource, afdEndpointName); string afdOriginGroupName = Recording.GenerateAssetName("AFDOriginGroup-"); FrontDoorOriginGroupResource afdOriginGroupInstance = await CreateAfdOriginGroup(afdProfileResource, afdOriginGroupName); string afdOriginName = Recording.GenerateAssetName("AFDOrigin-"); _ = await CreateAfdOrigin(afdOriginGroupInstance, afdOriginName); string afdRuleSetName = Recording.GenerateAssetName("AFDRuleSet"); FrontDoorRuleSetResource afdRuleSet = await CreateAfdRuleSet(afdProfileResource, afdRuleSetName); string afdRouteName = Recording.GenerateAssetName("AFDRoute"); _ = await CreateAfdRoute(afdEndpointInstance, afdRouteName, afdOriginGroupInstance, afdRuleSet); int count = 0; await foreach (var tempRoute in afdEndpointInstance.GetFrontDoorRoutes().GetAllAsync()) { count++; } Assert.AreEqual(count, 1); }
protected async Task <FrontDoorRouteResource> CreateAfdRoute(FrontDoorEndpointResource endpoint, string routeName, FrontDoorOriginGroupResource originGroup, FrontDoorRuleSetResource ruleSet) { FrontDoorRouteData input = ResourceDataHelper.CreateAfdRouteData(originGroup); input.RuleSets.Add(new WritableSubResource { Id = ruleSet.Id }); input.PatternsToMatch.Add("/*"); var lro = await endpoint.GetFrontDoorRoutes().CreateOrUpdateAsync(WaitUntil.Completed, routeName, input); return(lro.Value); }