Esempio n. 1
0
        public static PSValidateCustomDomainOutput ToPsValidateCustomDomainOutput(
            this ValidateCustomDomainOutput validateCustomDomainOutput)
        {
            Debug.Assert(validateCustomDomainOutput.CustomDomainValidated != null, "validateCustomDomainOutput.CustomDomainValidated != null");

            return(new PSValidateCustomDomainOutput
            {
                CustomDomainValidated = validateCustomDomainOutput.CustomDomainValidated.Value,
                Message = validateCustomDomainOutput.Message,
                Reason = validateCustomDomainOutput.Reason
            });
        }
        public async Task ValidateCustomDomain()
        {
            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      afdEndpointName     = Recording.GenerateAssetName("AFDEndpoint-");
            AfdEndpoint afdEndpointInstance = await CreateAfdEndpoint(afdProfile, afdEndpointName);

            ValidateCustomDomainInput  validateCustomDomainInput  = new ValidateCustomDomainInput("customdomain4afd.azuretest.net");
            ValidateCustomDomainOutput validateCustomDomainOutput = await afdEndpointInstance.ValidateCustomDomainAsync(validateCustomDomainInput);

            Assert.False(validateCustomDomainOutput.CustomDomainValidated);
        }
        public async Task ValidateCustomDomain()
        {
            //A CName mapping needs to be created in advance to validate custom domain.
            //In this test is "customdomainrecord.azuretest.net" maps to "testEndpoint4dotnetsdk.azureedge.net"
            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");

            ValidateCustomDomainInput  validateCustomDomainInput1 = new ValidateCustomDomainInput("customdomainrecord.azuretest.net");
            ValidateCustomDomainOutput validateResult             = await cdnEndpoint.ValidateCustomDomainAsync(validateCustomDomainInput1);

            Assert.True(validateResult.CustomDomainValidated);
            ValidateCustomDomainInput validateCustomDomainInput2 = new ValidateCustomDomainInput("customdomainvirtual.azuretest.net");

            validateResult = await cdnEndpoint.ValidateCustomDomainAsync(validateCustomDomainInput2);

            Assert.False(validateResult.CustomDomainValidated);
        }