예제 #1
0
        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-");
            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);

            await afdRoute.DeleteAsync(WaitUntil.Completed);

            var ex = Assert.ThrowsAsync <RequestFailedException>(async() => await afdRoute.GetAsync());

            Assert.AreEqual(404, ex.Status);
        }
예제 #2
0
        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-");
            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);

            FrontDoorRoutePatch updateOptions = new FrontDoorRoutePatch
            {
                EnabledState = EnabledState.Disabled
            };
            var lro = await afdRoute.UpdateAsync(WaitUntil.Completed, updateOptions);

            FrontDoorRouteResource updatedAfdRoute = lro.Value;

            ResourceDataHelper.AssertAfdRouteUpdate(updatedAfdRoute, updateOptions);
        }
예제 #3
0
        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-");
            FrontDoorOriginGroupResource afdOriginGroupInstance = await CreateAfdOriginGroup(afdProfileResource, afdOriginGroupName);

            string afdOriginName = Recording.GenerateAssetName("AFDOrigin-");
            FrontDoorOriginResource afdOriginInstance = await CreateAfdOrigin(afdOriginGroupInstance, afdOriginName);

            FrontDoorOriginPatch updateOptions = new FrontDoorOriginPatch
            {
                Priority = 1,
                Weight   = 150
            };
            var lro = await afdOriginInstance.UpdateAsync(WaitUntil.Completed, updateOptions);

            FrontDoorOriginResource updatedAfdOriginInstance = lro.Value;

            ResourceDataHelper.AssertAfdOriginUpdate(updatedAfdOriginInstance, updateOptions);
        }
예제 #4
0
        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));
        }
예제 #5
0
        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-");
            FrontDoorOriginGroupResource afdOriginGroupInstance = await CreateAfdOriginGroup(afdProfileResource, afdOriginGroupName);

            string afdOriginName = Recording.GenerateAssetName("AFDOrigin-");
            FrontDoorOriginResource afdOriginInstance = await CreateAfdOrigin(afdOriginGroupInstance, afdOriginName);

            Assert.AreEqual(afdOriginName, afdOriginInstance.Data.Name);
            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdOriginGroupInstance.GetFrontDoorOrigins().CreateOrUpdateAsync(WaitUntil.Completed, null, afdOriginInstance.Data));
            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdOriginGroupInstance.GetFrontDoorOrigins().CreateOrUpdateAsync(WaitUntil.Completed, afdOriginName, null));
        }
예제 #6
0
 public static void AssertValidAfdOrigin(FrontDoorOriginResource model, FrontDoorOriginResource 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.Origin != null || getResult.Data.Origin != null)
     {
         Assert.NotNull(model.Data.Origin);
         Assert.NotNull(getResult.Data.Origin);
         Assert.AreEqual(model.Data.Origin.Id, getResult.Data.Origin.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
 }
예제 #7
0
 public static void AssertAfdOriginUpdate(FrontDoorOriginResource updatedAfdOrigin, FrontDoorOriginPatch updateOptions)
 {
     Assert.AreEqual(updatedAfdOrigin.Data.Priority, updateOptions.Priority);
     Assert.AreEqual(updatedAfdOrigin.Data.Weight, updateOptions.Weight);
 }