public async Task Update() { 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 afdOriginGroupName = Recording.GenerateAssetName("AFDOriginGroup-"); AfdOriginGroupResource afdOriginGroupInstance = await CreateAfdOriginGroup(afdProfileResource, afdOriginGroupName); string afdOriginName = Recording.GenerateAssetName("AFDOrigin-"); AfdOriginResource afdOriginInstance = await CreateAfdOrigin(afdOriginGroupInstance, afdOriginName); AfdOriginPatch updateOptions = new AfdOriginPatch { Priority = 1, Weight = 150 }; var lro = await afdOriginInstance.UpdateAsync(WaitUntil.Completed, updateOptions); AfdOriginResource updatedAfdOriginInstance = lro.Value; ResourceDataHelper.AssertAfdOriginUpdate(updatedAfdOriginInstance, updateOptions); }
public async Task Update() { 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-"); AfdEndpointResource afdEndpointInstance = await CreateAfdEndpoint(afdProfileResource, afdEndpointName); string afdOriginGroupName = Recording.GenerateAssetName("AFDOriginGroup-"); AfdOriginGroupResource afdOriginGroupInstance = await CreateAfdOriginGroup(afdProfileResource, afdOriginGroupName); string afdOriginName = Recording.GenerateAssetName("AFDOrigin-"); AfdOriginResource afdOriginInstance = await CreateAfdOrigin(afdOriginGroupInstance, afdOriginName); string afdRuleSetName = Recording.GenerateAssetName("AFDRuleSet"); AfdRuleSetResource afdRuleSet = await CreateAfdRuleSet(afdProfileResource, afdRuleSetName); string afdRouteName = Recording.GenerateAssetName("AFDRoute"); AfdRouteResource afdRoute = await CreateAfdRoute(afdEndpointInstance, afdRouteName, afdOriginGroupInstance, afdRuleSet); AfdRoutePatch updateOptions = new AfdRoutePatch { EnabledState = EnabledState.Disabled }; var lro = await afdRoute.UpdateAsync(WaitUntil.Completed, updateOptions); AfdRouteResource updatedAfdRoute = lro.Value; ResourceDataHelper.AssertAfdRouteUpdate(updatedAfdRoute, updateOptions); }
public async Task Delete() { 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-"); AfdEndpointResource afdEndpointInstance = await CreateAfdEndpoint(afdProfileResource, afdEndpointName); string afdOriginGroupName = Recording.GenerateAssetName("AFDOriginGroup-"); AfdOriginGroupResource afdOriginGroupInstance = await CreateAfdOriginGroup(afdProfileResource, afdOriginGroupName); string afdOriginName = Recording.GenerateAssetName("AFDOrigin-"); AfdOriginResource afdOriginInstance = await CreateAfdOrigin(afdOriginGroupInstance, afdOriginName); string afdRuleSetName = Recording.GenerateAssetName("AFDRuleSet"); AfdRuleSetResource afdRuleSet = await CreateAfdRuleSet(afdProfileResource, afdRuleSetName); string afdRouteName = Recording.GenerateAssetName("AFDRoute"); AfdRouteResource afdRoute = await CreateAfdRoute(afdEndpointInstance, afdRouteName, afdOriginGroupInstance, afdRuleSet); await afdRoute.DeleteAsync(WaitUntil.Completed); var ex = Assert.ThrowsAsync <RequestFailedException>(async() => await afdRoute.GetAsync()); Assert.AreEqual(404, ex.Status); }
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-"); AfdEndpointResource afdEndpointInstance = await CreateAfdEndpoint(afdProfileResource, afdEndpointName); string afdOriginGroupName = Recording.GenerateAssetName("AFDOriginGroup-"); AfdOriginGroupResource afdOriginGroupInstance = await CreateAfdOriginGroup(afdProfileResource, afdOriginGroupName); string afdOriginName = Recording.GenerateAssetName("AFDOrigin-"); AfdOriginResource afdOriginInstance = await CreateAfdOrigin(afdOriginGroupInstance, afdOriginName); string afdRuleSetName = Recording.GenerateAssetName("AFDRuleSet"); AfdRuleSetResource afdRuleSet = await CreateAfdRuleSet(afdProfileResource, afdRuleSetName); string afdRouteName = Recording.GenerateAssetName("AFDRoute"); AfdRouteResource afdRoute = await CreateAfdRoute(afdEndpointInstance, afdRouteName, afdOriginGroupInstance, afdRuleSet); AfdRouteResource getAfdRoute = await afdEndpointInstance.GetAfdRoutes().GetAsync(afdRouteName); ResourceDataHelper.AssertValidAfdRoute(afdRoute, getAfdRoute); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdEndpointInstance.GetAfdRoutes().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 afdOriginGroupName = Recording.GenerateAssetName("AFDOriginGroup-"); AfdOriginGroupResource afdOriginGroupInstance = await CreateAfdOriginGroup(afdProfileResource, afdOriginGroupName); string afdOriginName = Recording.GenerateAssetName("AFDOrigin-"); AfdOriginResource afdOriginInstance = await CreateAfdOrigin(afdOriginGroupInstance, afdOriginName); Assert.AreEqual(afdOriginName, afdOriginInstance.Data.Name); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdOriginGroupInstance.GetAfdOrigins().CreateOrUpdateAsync(WaitUntil.Completed, null, afdOriginInstance.Data)); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdOriginGroupInstance.GetAfdOrigins().CreateOrUpdateAsync(WaitUntil.Completed, afdOriginName, null)); }
public static void AssertValidAfdOrigin(AfdOriginResource model, AfdOriginResource getResult) { Assert.AreEqual(model.Data.Name, getResult.Data.Name); Assert.AreEqual(model.Data.Id, getResult.Data.Id); Assert.AreEqual(model.Data.ResourceType, getResult.Data.ResourceType); if (model.Data.AzureOrigin != null || getResult.Data.AzureOrigin != null) { Assert.NotNull(model.Data.AzureOrigin); Assert.NotNull(getResult.Data.AzureOrigin); Assert.AreEqual(model.Data.AzureOrigin.Id, getResult.Data.AzureOrigin.Id); } Assert.AreEqual(model.Data.HostName, getResult.Data.HostName); Assert.AreEqual(model.Data.HttpPort, getResult.Data.HttpPort); Assert.AreEqual(model.Data.HttpsPort, getResult.Data.HttpsPort); Assert.AreEqual(model.Data.OriginHostHeader, getResult.Data.OriginHostHeader); Assert.AreEqual(model.Data.Priority, getResult.Data.Priority); Assert.AreEqual(model.Data.Weight, getResult.Data.Weight); Assert.AreEqual(model.Data.EnabledState, getResult.Data.EnabledState); Assert.AreEqual(model.Data.ProvisioningState, getResult.Data.ProvisioningState); Assert.AreEqual(model.Data.DeploymentStatus, getResult.Data.DeploymentStatus); //Todo:SharedPrivateLinkResource }
public static void AssertAfdOriginUpdate(AfdOriginResource updatedAfdOrigin, AfdOriginPatch updateOptions) { Assert.AreEqual(updatedAfdOrigin.Data.Priority, updateOptions.Priority); Assert.AreEqual(updatedAfdOrigin.Data.Weight, updateOptions.Weight); }