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 afdOriginGroupName = Recording.GenerateAssetName("AFDOriginGroup-"); FrontDoorOriginGroupResource afdOriginGroupInstance = await CreateAfdOriginGroup(afdProfileResource, afdOriginGroupName); Assert.AreEqual(afdOriginGroupName, afdOriginGroupInstance.Data.Name); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfileResource.GetFrontDoorOriginGroups().CreateOrUpdateAsync(WaitUntil.Completed, null, afdOriginGroupInstance.Data)); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfileResource.GetFrontDoorOriginGroups().CreateOrUpdateAsync(WaitUntil.Completed, afdOriginGroupName, null)); }
protected async Task <FrontDoorOriginGroupResource> CreateAfdOriginGroup(ProfileResource profile, string originGroupName) { FrontDoorOriginGroupData input = ResourceDataHelper.CreateAfdOriginGroupData(); var lro = await profile.GetFrontDoorOriginGroups().CreateOrUpdateAsync(WaitUntil.Completed, originGroupName, input); return(lro.Value); }
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 afdOriginGroupName = Recording.GenerateAssetName("AFDOriginGroup-"); FrontDoorOriginGroupResource afdOriginGroupInstance = await CreateAfdOriginGroup(afdProfileResource, afdOriginGroupName); FrontDoorOriginGroupResource getAfdOriginGroupInstance = await afdProfileResource.GetFrontDoorOriginGroups().GetAsync(afdOriginGroupName); ResourceDataHelper.AssertValidAfdOriginGroup(afdOriginGroupInstance, getAfdOriginGroupInstance); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfileResource.GetFrontDoorOriginGroups().GetAsync(null)); }
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 afdOriginGroupName = Recording.GenerateAssetName("AFDOriginGroup-"); _ = await CreateAfdOriginGroup(afdProfileResource, afdOriginGroupName); int count = 0; await foreach (var tempAfdOriginGroup in afdProfileResource.GetFrontDoorOriginGroups().GetAllAsync()) { count++; } Assert.AreEqual(count, 1); }