public static void AssertValidAfdCustomDomain(AfdCustomDomain model, AfdCustomDomain getResult)
 {
     Assert.AreEqual(model.Data.Name, getResult.Data.Name);
     Assert.AreEqual(model.Data.Id, getResult.Data.Id);
     Assert.AreEqual(model.Data.Type, getResult.Data.Type);
     Assert.AreEqual(model.Data.TlsSettings.CertificateType, getResult.Data.TlsSettings.CertificateType);
     Assert.AreEqual(model.Data.TlsSettings.MinimumTlsVersion, getResult.Data.TlsSettings.MinimumTlsVersion);
     if (model.Data.TlsSettings.Secret != null || getResult.Data.TlsSettings.Secret != null)
     {
         Assert.NotNull(model.Data.TlsSettings.Secret);
         Assert.NotNull(getResult.Data.TlsSettings.Secret);
         Assert.AreEqual(model.Data.TlsSettings.Secret.Id, getResult.Data.TlsSettings.Secret.Id);
     }
     if (model.Data.AzureDnsZone != null || getResult.Data.AzureDnsZone != null)
     {
         Assert.NotNull(model.Data.AzureDnsZone);
         Assert.NotNull(getResult.Data.AzureDnsZone);
         Assert.AreEqual(model.Data.AzureDnsZone.Id, getResult.Data.AzureDnsZone.Id);
     }
     Assert.AreEqual(model.Data.ProvisioningState, getResult.Data.ProvisioningState);
     Assert.AreEqual(model.Data.DeploymentStatus, getResult.Data.DeploymentStatus);
     Assert.AreEqual(model.Data.DomainValidationState, getResult.Data.DomainValidationState);
     Assert.AreEqual(model.Data.HostName, getResult.Data.HostName);
     if (model.Data.ValidationProperties != null || getResult.Data.ValidationProperties != null)
     {
         Assert.NotNull(model.Data.ValidationProperties);
         Assert.NotNull(getResult.Data.ValidationProperties);
         Assert.AreEqual(model.Data.ValidationProperties.ValidationToken, getResult.Data.ValidationProperties.ValidationToken);
         Assert.AreEqual(model.Data.ValidationProperties.ExpirationDate, getResult.Data.ValidationProperties.ExpirationDate);
     }
 }
예제 #2
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.
            Subscription subscription = await Client.GetDefaultSubscriptionAsync();

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

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

            AfdCustomDomain afdCustomDomain = await afdProfile.GetAfdCustomDomains().GetAsync("customdomain4afd-azuretest-net");

            Assert.ThrowsAsync <RequestFailedException>(async() => await afdCustomDomain.RefreshValidationTokenAsync(true));
        }
예제 #3
0
        public async Task CreateOrUpdate()
        {
            Subscription subscription = await Client.GetDefaultSubscriptionAsync();

            ResourceGroup rg = await CreateResourceGroup(subscription, "testRg-");

            string  afdProfileName = Recording.GenerateAssetName("AFDProfile-");
            Profile afdProfile     = await CreateAfdProfile(rg, afdProfileName, SkuName.StandardAzureFrontDoor);

            string          afdCustomDomainName = Recording.GenerateAssetName("AFDCustomDomain-");
            string          afdHostName         = "customdomain4afd-1.azuretest.net";
            AfdCustomDomain afdCustomDomain     = await CreateAfdCustomDomain(afdProfile, afdCustomDomainName, afdHostName);

            Assert.AreEqual(afdCustomDomainName, afdCustomDomain.Data.Name);
            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfile.GetAfdCustomDomains().CreateOrUpdateAsync(null, afdCustomDomain.Data));
            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfile.GetAfdCustomDomains().CreateOrUpdateAsync(afdCustomDomainName, null));
        }
예제 #4
0
        public async Task Get()
        {
            Subscription subscription = await Client.GetDefaultSubscriptionAsync();

            ResourceGroup rg = await CreateResourceGroup(subscription, "testRg-");

            string  afdProfileName = Recording.GenerateAssetName("AFDProfile-");
            Profile afdProfile     = await CreateAfdProfile(rg, afdProfileName, SkuName.StandardAzureFrontDoor);

            string          afdCustomDomainName = Recording.GenerateAssetName("AFDCustomDomain-");
            string          afdHostName         = "customdomain4afd-3.azuretest.net";
            AfdCustomDomain AfdCustomDomain     = await CreateAfdCustomDomain(afdProfile, afdCustomDomainName, afdHostName);

            AfdCustomDomain getAfdCustomDomain = await afdProfile.GetAfdCustomDomains().GetAsync(afdCustomDomainName);

            ResourceDataHelper.AssertValidAfdCustomDomain(AfdCustomDomain, getAfdCustomDomain);
            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfile.GetAfdCustomDomains().GetAsync(null));
        }
예제 #5
0
        public async Task Delete()
        {
            Subscription subscription = await Client.GetDefaultSubscriptionAsync();

            ResourceGroup rg = await CreateResourceGroup(subscription, "testRg-");

            string  afdProfileName = Recording.GenerateAssetName("AFDProfile-");
            Profile afdProfile     = await CreateAfdProfile(rg, afdProfileName, SkuName.StandardAzureFrontDoor);

            string          afdCustomDomainName = Recording.GenerateAssetName("AFDCustomDomain-");
            string          afdHostName         = "customdomain4afd-4.azuretest.net";
            AfdCustomDomain afdCustomDomain     = await CreateAfdCustomDomain(afdProfile, afdCustomDomainName, afdHostName);

            await afdCustomDomain.DeleteAsync(true);

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

            Assert.AreEqual(404, ex.Status);
        }
예제 #6
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.
            Subscription subscription = await Client.GetDefaultSubscriptionAsync();

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

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

            AfdCustomDomain afdCustomDomain = await afdProfile.GetAfdCustomDomains().GetAsync("customdomain4afd-azuretest-net");

            AfdCustomDomainUpdateOptions updateOptions = new AfdCustomDomainUpdateOptions
            {
                TlsSettings = new AfdCustomDomainHttpsParameters(AfdCertificateType.ManagedCertificate)
                {
                    MinimumTlsVersion = AfdMinimumTlsVersion.TLS12
                },
            };
            var lro = await afdCustomDomain.UpdateAsync(true, updateOptions);

            AfdCustomDomain updatedAfdCustomDomain = lro.Value;

            ResourceDataHelper.AssertAfdDomainUpdate(updatedAfdCustomDomain, updateOptions);
        }
 public static void AssertAfdDomainUpdate(AfdCustomDomain updatedAfdDomain, AfdCustomDomainUpdateOptions updateOptions)
 {
     Assert.AreEqual(updatedAfdDomain.Data.TlsSettings.CertificateType, updateOptions.TlsSettings.CertificateType);
     Assert.AreEqual(updatedAfdDomain.Data.TlsSettings.MinimumTlsVersion, updateOptions.TlsSettings.MinimumTlsVersion);
 }