public static void AssertValidAfdCustomDomain(AfdCustomDomainResource model, AfdCustomDomainResource 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);
     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 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");

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

            PatchableAfdCustomDomainData updateOptions = new PatchableAfdCustomDomainData
            {
                TlsSettings = new AfdCustomDomainHttpsParameters(AfdCertificateType.ManagedCertificate)
                {
                    MinimumTlsVersion = AfdMinimumTlsVersion.Tls10
                },
            };
            var lro = await afdCustomDomain.UpdateAsync(WaitUntil.Completed, updateOptions);

            ;
            AfdCustomDomainResource updatedAfdCustomDomain = lro.Value;

            ResourceDataHelper.AssertAfdDomainUpdate(updatedAfdCustomDomain, updateOptions);
        }
示例#3
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");

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

            Assert.DoesNotThrowAsync(async() => await afdCustomDomain.RefreshValidationTokenAsync(WaitUntil.Completed));
        }
        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";
            AfdCustomDomainResource afdCustomDomain = await CreateAfdCustomDomain(afdProfileResource, afdCustomDomainName, afdHostName);

            Assert.AreEqual(afdCustomDomainName, afdCustomDomain.Data.Name);
            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfileResource.GetAfdCustomDomains().CreateOrUpdateAsync(WaitUntil.Completed, null, afdCustomDomain.Data));
            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfileResource.GetAfdCustomDomains().CreateOrUpdateAsync(WaitUntil.Completed, afdCustomDomainName, null));
        }
        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";
            AfdCustomDomainResource AfdCustomDomain = await CreateAfdCustomDomain(afdProfileResource, afdCustomDomainName, afdHostName);

            AfdCustomDomainResource getAfdCustomDomain = await afdProfileResource.GetAfdCustomDomains().GetAsync(afdCustomDomainName);

            ResourceDataHelper.AssertValidAfdCustomDomain(AfdCustomDomain, getAfdCustomDomain);
            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfileResource.GetAfdCustomDomains().GetAsync(null));
        }
示例#6
0
        public async Task Delete()
        {
            SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync();

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

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

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

            await afdCustomDomain.DeleteAsync(WaitUntil.Completed);

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

            Assert.AreEqual(404, ex.Status);
        }
 public static void AssertAfdDomainUpdate(AfdCustomDomainResource updatedAfdDomain, AfdCustomDomainPatch updateOptions)
 {
     Assert.AreEqual(updatedAfdDomain.Data.TlsSettings.CertificateType, updateOptions.TlsSettings.CertificateType);
     Assert.AreEqual(updatedAfdDomain.Data.TlsSettings.MinimumTlsVersion, updateOptions.TlsSettings.MinimumTlsVersion);
 }