protected async Task <AfdCustomDomainResource> CreateAfdCustomDomain(ProfileResource profile, string customDomainName, string hostName) { AfdCustomDomainData input = ResourceDataHelper.CreateAfdCustomDomainData(hostName); var lro = await profile.GetAfdCustomDomains().CreateOrUpdateAsync(WaitUntil.Completed, customDomainName, input); return(lro.Value); }
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); }
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)); }
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 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.GetAfdCustomDomains().GetAllAsync()) { count++; } Assert.AreEqual(count, 1); }