Пример #1
0
        protected async Task <FrontDoorCustomDomainResource> CreateAfdCustomDomain(ProfileResource profile, string customDomainName, string hostName)
        {
            FrontDoorCustomDomainData input = ResourceDataHelper.CreateAfdCustomDomainData(hostName);
            var lro = await profile.GetFrontDoorCustomDomains().CreateOrUpdateAsync(WaitUntil.Completed, customDomainName, input);

            return(lro.Value);
        }
Пример #2
0
        public async Task Update()
        {
            //This test doesn't create a new afd custom domain bucause the update actoin needs to manualy add dns txt record and validate.
            SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync();

            ResourceGroupResource rg = await subscription.GetResourceGroups().GetAsync("CdnTest");

            ProfileResource afdProfile = await rg.GetProfiles().GetAsync("testAFDProfile");

            FrontDoorCustomDomainResource afdCustomDomain = await afdProfile.GetFrontDoorCustomDomains().GetAsync("customdomain4afd-azuretest-net");

            FrontDoorCustomDomainPatch updateOptions = new FrontDoorCustomDomainPatch
            {
                TlsSettings = new FrontDoorCustomDomainHttpsContent(FrontDoorCertificateType.ManagedCertificate)
                {
                    MinimumTlsVersion = FrontDoorMinimumTlsVersion.Tls1_0
                },
            };
            var lro = await afdCustomDomain.UpdateAsync(WaitUntil.Completed, updateOptions);

            ;
            FrontDoorCustomDomainResource updatedAfdCustomDomain = lro.Value;

            ResourceDataHelper.AssertAfdDomainUpdate(updatedAfdCustomDomain, updateOptions);
        }
Пример #3
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 afdCustomDomainName = Recording.GenerateAssetName("AFDCustomDomain-");
            string afdHostName         = "customdomain4afd-1.azuretest.net";
            FrontDoorCustomDomainResource afdCustomDomain = await CreateAfdCustomDomain(afdProfileResource, afdCustomDomainName, afdHostName);

            Assert.AreEqual(afdCustomDomainName, afdCustomDomain.Data.Name);
            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfileResource.GetFrontDoorCustomDomains().CreateOrUpdateAsync(WaitUntil.Completed, null, afdCustomDomain.Data));
            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfileResource.GetFrontDoorCustomDomains().CreateOrUpdateAsync(WaitUntil.Completed, afdCustomDomainName, null));
        }
Пример #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 afdCustomDomainName = Recording.GenerateAssetName("AFDCustomDomain-");
            string afdHostName         = "customdomain4afd-3.azuretest.net";
            FrontDoorCustomDomainResource AfdCustomDomain = await CreateAfdCustomDomain(afdProfileResource, afdCustomDomainName, afdHostName);

            FrontDoorCustomDomainResource getAfdCustomDomain = await afdProfileResource.GetFrontDoorCustomDomains().GetAsync(afdCustomDomainName);

            ResourceDataHelper.AssertValidAfdCustomDomain(AfdCustomDomain, getAfdCustomDomain);
            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfileResource.GetFrontDoorCustomDomains().GetAsync(null));
        }
Пример #5
0
        public async Task RefreshVlidationToken()
        {
            //This test doesn't create a new afd custom domain bucause the refresh validation token actoin needs to manualy add dns txt record and validate.
            SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync();

            ResourceGroupResource rg = await subscription.GetResourceGroups().GetAsync("CdnTest");

            ProfileResource afdProfile = await rg.GetProfiles().GetAsync("testAFDProfile");

            FrontDoorCustomDomainResource afdCustomDomain = await afdProfile.GetFrontDoorCustomDomains().GetAsync("customdomain4afd-azuretest-net");

            Assert.DoesNotThrowAsync(async() => await afdCustomDomain.RefreshValidationTokenAsync(WaitUntil.Completed));
        }
Пример #6
0
        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 afdCustomDomainName = Recording.GenerateAssetName("AFDCustomDomain-");
            string afdHostName         = "customdomain4afd-2.azuretest.net";

            _ = await CreateAfdCustomDomain(afdProfileResource, afdCustomDomainName, afdHostName);

            int count = 0;

            await foreach (var tempAfdCustomDomain in afdProfileResource.GetFrontDoorCustomDomains().GetAllAsync())
            {
                count++;
            }
            Assert.AreEqual(count, 1);
        }