public async Task EnableAndDisable() { //In this test, the CName mapping from custom domain "customdomaintest-5.azuretest.net" to endpoint "testEndpoint4dotnetsdk.azureedge.net" is created in advance. SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); ResourceGroupResource rg = await subscription.GetResourceGroups().GetAsync("CdnTest"); ProfileResource cdnProfile = await rg.GetProfiles().GetAsync("testProfile"); CdnEndpointResource cdnEndpoint = await cdnProfile.GetCdnEndpoints().GetAsync("testEndpoint4dotnetsdk"); string cdnCustomDomainName = Recording.GenerateAssetName("customDomain-"); string hostName = "customdomaintest-5.azuretest.net"; CdnCustomDomainResource cdnCustomDomain = await CreateCdnCustomDomain(cdnEndpoint, cdnCustomDomainName, hostName); Assert.ThrowsAsync <RequestFailedException>(async() => await cdnCustomDomain.DisableCustomHttpsAsync(WaitUntil.Completed)); CdnManagedHttpsOptions customDomainHttpsOptions = new CdnManagedHttpsOptions(ProtocolType.ServerNameIndication, new CdnCertificateSourceParameters(CdnCertificateSourceParametersOdataType.MicrosoftAzureCdnModelsCdnCertificateSourceParameters, CertificateType.Dedicated)); Assert.DoesNotThrowAsync(async() => await cdnCustomDomain.EnableCustomHttpsAsync(WaitUntil.Completed, customDomainHttpsOptions)); Assert.DoesNotThrowAsync(async() => await cdnCustomDomain.DisableCustomHttpsAsync(WaitUntil.Completed)); }
public async Task Disable() { //In this test, the CName mapping from custom domain "customdomaintest5.azuretest.net" to endpoint "testEndpoint4dotnetsdk.azureedge.net" is created in advance. SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); ResourceGroupResource rg = await subscription.GetResourceGroups().GetAsync("CdnTest"); ProfileResource cdnProfile = await rg.GetProfiles().GetAsync("testProfile"); CdnEndpointResource cdnEndpoint = await cdnProfile.GetCdnEndpoints().GetAsync("testEndpoint4dotnetsdk"); string cdnCustomDomainName = "customdomaintest5-azuretest-net"; CdnCustomDomainResource cdnCustomDomain = await cdnEndpoint.GetCdnCustomDomains().GetAsync(cdnCustomDomainName); var lro = await cdnCustomDomain.DisableCustomHttpsAsync(WaitUntil.Completed); CdnCustomDomainResource disabledCdnCustomDomain = lro.Value; Assert.AreEqual(disabledCdnCustomDomain.Data.CustomHttpsProvisioningState, CustomHttpsProvisioningState.Disabled); }
public async Task EnableAndDisable() { //In this test, the CName mapping from custom domain "customdomaintest5.azuretest.net" to endpoint "testEndpoint4dotnetsdk.azureedge.net" is created in advance. SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); ResourceGroupResource rg = await subscription.GetResourceGroups().GetAsync("CdnTest"); ProfileResource cdnProfile = await rg.GetProfiles().GetAsync("testProfile"); CdnEndpointResource cdnEndpoint = await cdnProfile.GetCdnEndpoints().GetAsync("testEndpoint4dotnetsdk"); string cdnCustomDomainName = "customdomaintest5-azuretest-net"; var lro = await cdnEndpoint.GetCdnCustomDomains().GetAsync(cdnCustomDomainName); CdnCustomDomainResource cdnCustomDomain = lro.Value; Assert.ThrowsAsync <RequestFailedException>(async() => await cdnCustomDomain.DisableCustomHttpsAsync()); CdnManagedHttpsOptions customDomainHttpsOptions = new CdnManagedHttpsOptions(ProtocolType.ServerNameIndication, new CdnCertificateSourceParameters(CdnCertificateSourceParametersTypeName.CdnCertificateSourceParameters, CertificateType.Dedicated)); CdnCustomDomainResource enabledCdnCustomDomain = await cdnCustomDomain.EnableCustomHttpsAsync(customDomainHttpsOptions); Assert.AreEqual(enabledCdnCustomDomain.Data.CustomHttpsProvisioningState, CustomHttpsProvisioningState.Enabling); }