public async Task DesktopApplicationCrud() { string hostPoolName = "testDesktopApplicationCrudHP"; string applicationGroupName = "testDesktopApplicationCrudAG"; string resourceGroupName = Recording.GetVariable("DESKTOPVIRTUALIZATION_RESOURCE_GROUP", DefaultResourceGroupName); ResourceGroupResource rg = (ResourceGroupResource)await ResourceGroups.GetAsync(resourceGroupName); Assert.IsNotNull(rg); HostPoolCollection hostPoolCollection = rg.GetHostPools(); HostPoolData hostPoolData = new HostPoolData( DefaultLocation, HostPoolType.Pooled, LoadBalancerType.BreadthFirst, PreferredAppGroupType.Desktop); ArmOperation <HostPoolResource> opHostPoolCreate = await hostPoolCollection.CreateOrUpdateAsync( WaitUntil.Completed, hostPoolName, hostPoolData); VirtualApplicationGroupCollection agCollection = rg.GetVirtualApplicationGroups(); VirtualApplicationGroupData agData = new VirtualApplicationGroupData(DefaultLocation, opHostPoolCreate.Value.Data.Id, ApplicationGroupType.Desktop); ArmOperation <VirtualApplicationGroupResource> opApplicationGroupCreate = await agCollection.CreateOrUpdateAsync( WaitUntil.Completed, applicationGroupName, agData); Assert.IsNotNull(opApplicationGroupCreate); Assert.IsTrue(opApplicationGroupCreate.HasCompleted); Assert.AreEqual(opApplicationGroupCreate.Value.Data.Name, applicationGroupName); VirtualApplicationGroupResource desktopApplicationGroup = opApplicationGroupCreate.Value; VirtualDesktopCollection desktopCollection = desktopApplicationGroup.GetVirtualDesktops(); AsyncPageable <VirtualDesktopResource> desktops = desktopCollection.GetAllAsync(); Assert.IsNotNull(desktops); List <VirtualDesktopResource> desktopList = await desktops.ToEnumerableAsync(); Assert.AreEqual(1, desktopList.Count); VirtualDesktopResource desktop = desktopList[0]; await desktop.UpdateAsync(new VirtualDesktopPatch { Description = "Updated", FriendlyName = "UpdatedFriendlyName" }); Response <VirtualDesktopResource> updatedDesktop = await desktopCollection.GetAsync(desktop.Id.Name); Assert.IsNotNull(updatedDesktop); Assert.AreEqual("Updated", updatedDesktop.Value.Data.Description); Assert.AreEqual("UpdatedFriendlyName", updatedDesktop.Value.Data.FriendlyName); Response <VirtualApplicationGroupResource> getOp = await agCollection.GetAsync( applicationGroupName); Assert.AreEqual(applicationGroupName, getOp.Value.Data.Name); VirtualApplicationGroupResource applicationGroup = getOp.Value; ArmOperation deleteOp = await applicationGroup.DeleteAsync(WaitUntil.Completed); Assert.IsNotNull(deleteOp); Assert.AreEqual(200, deleteOp.GetRawResponse().Status); deleteOp = await applicationGroup.DeleteAsync(WaitUntil.Completed); Assert.IsNotNull(deleteOp); Assert.AreEqual(204, deleteOp.GetRawResponse().Status); try { getOp = await agCollection.GetAsync( applicationGroupName); } catch (RequestFailedException ex) { Assert.AreEqual(404, ex.Status); } await opHostPoolCreate.Value.DeleteAsync(WaitUntil.Completed); }
public async Task RemoteApplicationCrud() { string hostPoolName = "testRemoteApplicationCrudHP"; string applicationGroupName = "testRemoteApplicationCrudAG"; string resourceGroupName = Recording.GetVariable("DESKTOPVIRTUALIZATION_RESOURCE_GROUP", DefaultResourceGroupName); ResourceGroupResource rg = (ResourceGroupResource)await ResourceGroups.GetAsync(resourceGroupName); Assert.IsNotNull(rg); HostPoolCollection hostPoolCollection = rg.GetHostPools(); HostPoolData hostPoolData = new HostPoolData( DefaultLocation, HostPoolType.Pooled, LoadBalancerType.BreadthFirst, PreferredAppGroupType.Desktop); ArmOperation <HostPoolResource> opHostPoolCreate = await hostPoolCollection.CreateOrUpdateAsync( WaitUntil.Completed, hostPoolName, hostPoolData); VirtualApplicationGroupCollection agCollection = rg.GetVirtualApplicationGroups(); VirtualApplicationGroupData agData = new VirtualApplicationGroupData(DefaultLocation, opHostPoolCreate.Value.Data.Id, ApplicationGroupType.RemoteApp); ArmOperation <VirtualApplicationGroupResource> opApplicationGroupCreate = await agCollection.CreateOrUpdateAsync( WaitUntil.Completed, applicationGroupName, agData); Assert.IsNotNull(opApplicationGroupCreate); Assert.IsTrue(opApplicationGroupCreate.HasCompleted); Assert.AreEqual(opApplicationGroupCreate.Value.Data.Name, applicationGroupName); VirtualApplicationGroupResource railApplicationGroup = opApplicationGroupCreate.Value; VirtualApplicationCollection railApplications = railApplicationGroup.GetVirtualApplications(); AsyncPageable <VirtualApplicationResource> applications = railApplications.GetAllAsync(); Assert.IsNotNull(applications); VirtualApplicationData applicationData = new VirtualApplicationData(CommandLineSetting.DoNotAllow); applicationData.FilePath = "c:\\notepad.exe"; applicationData.IconPath = "c:\\notepad.exe"; applicationData.Description = "Note Pad"; applicationData.ShowInPortal = true; ArmOperation <VirtualApplicationResource> opCreate = await railApplications.CreateOrUpdateAsync(WaitUntil.Completed, "notepad", applicationData); Assert.IsNotNull(opCreate); Assert.AreEqual("testRemoteApplicationCrudAG/notepad", opCreate.Value.Data.Name); Assert.AreEqual("Note Pad", opCreate.Value.Data.Description); Response <VirtualApplicationResource> opGet = await railApplications.GetAsync("notepad"); Assert.IsNotNull(opGet); Assert.AreEqual("c:\\notepad.exe", opGet.Value.Data.FilePath); Assert.AreEqual("c:\\notepad.exe", opGet.Value.Data.IconPath); Assert.AreEqual("Note Pad", opGet.Value.Data.Description); applicationData.Description = "NotePad"; ArmOperation <VirtualApplicationResource> opUpdate = await railApplications.CreateOrUpdateAsync(WaitUntil.Completed, "notepad", applicationData); Assert.IsNotNull(opUpdate); Assert.AreEqual("testRemoteApplicationCrudAG/notepad", opUpdate.Value.Data.Name); Assert.AreEqual("NotePad", opUpdate.Value.Data.Description); ArmOperation opDelete = await opUpdate.Value.DeleteAsync(WaitUntil.Completed); Assert.IsNotNull(opDelete); Assert.AreEqual(200, opDelete.GetRawResponse().Status); opDelete = await opUpdate.Value.DeleteAsync(WaitUntil.Completed); Assert.IsNotNull(opDelete); Assert.AreEqual(204, opDelete.GetRawResponse().Status); try { await railApplications.GetAsync("notepad"); } catch (RequestFailedException ex) { Assert.AreEqual(404, ex.Status); } await opApplicationGroupCreate.Value.DeleteAsync(WaitUntil.Completed); await opHostPoolCreate.Value.DeleteAsync(WaitUntil.Completed); }
public async Task RemoteApplicationGroupCrud() { string hostPoolName = "testRemoteApplicationGroupCrudHP"; string applicationGroupName = "testRemoteApplicationGroupCrudAG"; string resourceGroupName = Recording.GetVariable("DESKTOPVIRTUALIZATION_RESOURCE_GROUP", DefaultResourceGroupName); ResourceGroupResource rg = (ResourceGroupResource)await ResourceGroups.GetAsync(resourceGroupName); Assert.IsNotNull(rg); HostPoolCollection hostPoolCollection = rg.GetHostPools(); HostPoolData hostPoolData = new HostPoolData( DefaultLocation, HostPoolType.Pooled, LoadBalancerType.BreadthFirst, PreferredAppGroupType.Desktop); ArmOperation <HostPoolResource> opHostPoolCreate = await hostPoolCollection.CreateOrUpdateAsync( WaitUntil.Completed, hostPoolName, hostPoolData); VirtualApplicationGroupCollection agCollection = rg.GetVirtualApplicationGroups(); VirtualApplicationGroupData agData = new VirtualApplicationGroupData(DefaultLocation, opHostPoolCreate.Value.Data.Id, ApplicationGroupType.RemoteApp); ArmOperation <VirtualApplicationGroupResource> op = await agCollection.CreateOrUpdateAsync( WaitUntil.Completed, applicationGroupName, agData); Assert.IsNotNull(op); Assert.IsTrue(op.HasCompleted); Assert.AreEqual(op.Value.Data.Name, applicationGroupName); Response <VirtualApplicationGroupResource> getOp = await agCollection.GetAsync( applicationGroupName); Assert.AreEqual(applicationGroupName, getOp.Value.Data.Name); agData.FriendlyName = "Friendly Name"; op = await agCollection.CreateOrUpdateAsync( WaitUntil.Completed, applicationGroupName, agData); Assert.IsNotNull(op); Assert.IsTrue(op.HasCompleted); Assert.AreEqual(op.Value.Data.Name, applicationGroupName); Assert.AreEqual(op.Value.Data.FriendlyName, "Friendly Name"); getOp = await agCollection.GetAsync( applicationGroupName); VirtualApplicationGroupResource applicationGroup = getOp.Value; ArmOperation deleteOp = await applicationGroup.DeleteAsync(WaitUntil.Completed); Assert.IsNotNull(deleteOp); Assert.AreEqual(200, deleteOp.GetRawResponse().Status); deleteOp = await applicationGroup.DeleteAsync(WaitUntil.Completed); Assert.IsNotNull(deleteOp); Assert.AreEqual(204, deleteOp.GetRawResponse().Status); try { getOp = await agCollection.GetAsync( applicationGroupName); } catch (RequestFailedException ex) { Assert.AreEqual(404, ex.Status); } await opHostPoolCreate.Value.DeleteAsync(WaitUntil.Completed); }
public async Task HostPoolCrud( int caseNumber, HostPoolType hostPoolType, LoadBalancerType loadBalancerType, LoadBalancerType expectedLoadBalancerType, PreferredAppGroupType preferredAppGroupType) { string hostPoolName = $"testHostPoolCrud{caseNumber}"; string resourceGroupName = Recording.GetVariable("DESKTOPVIRTUALIZATION_RESOURCE_GROUP", DefaultResourceGroupName); ResourceGroupResource rg = (ResourceGroupResource)await ResourceGroups.GetAsync(resourceGroupName); Assert.IsNotNull(rg); HostPoolCollection hostPoolCollection = rg.GetHostPools(); HostPoolData hostPoolData = new HostPoolData( DefaultLocation, hostPoolType, loadBalancerType, preferredAppGroupType); ArmOperation <HostPoolResource> op = await hostPoolCollection.CreateOrUpdateAsync( WaitUntil.Completed, hostPoolName, hostPoolData); Assert.IsNotNull(op); Assert.IsTrue(op.HasCompleted); Assert.AreEqual(op.Value.Data.Name, hostPoolName); Response <HostPoolResource> getOp = await hostPoolCollection.GetAsync( hostPoolName); Assert.AreEqual(hostPoolName, getOp.Value.Data.Name); Assert.AreEqual(hostPoolType, getOp.Value.Data.HostPoolType); Assert.AreEqual(expectedLoadBalancerType, getOp.Value.Data.LoadBalancerType); Assert.AreEqual(preferredAppGroupType, getOp.Value.Data.PreferredAppGroupType); hostPoolData.FriendlyName = "Friendly Name"; op = await hostPoolCollection.CreateOrUpdateAsync( WaitUntil.Completed, hostPoolName, hostPoolData); Assert.IsNotNull(op); Assert.IsTrue(op.HasCompleted); Assert.AreEqual(op.Value.Data.Name, hostPoolName); Assert.AreEqual(op.Value.Data.FriendlyName, "Friendly Name"); Assert.AreEqual(hostPoolName, getOp.Value.Data.Name); Assert.AreEqual(hostPoolType, getOp.Value.Data.HostPoolType); Assert.AreEqual(expectedLoadBalancerType, getOp.Value.Data.LoadBalancerType); Assert.AreEqual(preferredAppGroupType, getOp.Value.Data.PreferredAppGroupType); getOp = await hostPoolCollection.GetAsync( hostPoolName); HostPoolResource hostPool = getOp.Value; ArmOperation deleteOp = await hostPool.DeleteAsync(WaitUntil.Completed); Assert.IsNotNull(deleteOp); Assert.AreEqual(200, deleteOp.GetRawResponse().Status); deleteOp = await hostPool.DeleteAsync(WaitUntil.Completed); Assert.IsNotNull(deleteOp); Assert.AreEqual(204, deleteOp.GetRawResponse().Status); try { getOp = await hostPoolCollection.GetAsync( hostPoolName); } catch (RequestFailedException ex) { Assert.AreEqual(404, ex.Status); } }
public async Task WorkspaceCrud() { string workspaceName = "testWorkspaceCrudWS"; string resourceGroupName = Recording.GetVariable("DESKTOPVIRTUALIZATION_RESOURCE_GROUP", DefaultResourceGroupName); ResourceGroupResource rg = (ResourceGroupResource)await ResourceGroups.GetAsync(resourceGroupName); Assert.IsNotNull(rg); VirtualWorkspaceCollection workspaceCollection = rg.GetVirtualWorkspaces(); VirtualWorkspaceData workspaceData = new VirtualWorkspaceData( DefaultLocation); ArmOperation <VirtualWorkspaceResource> opWorkspaceCreate = await workspaceCollection.CreateOrUpdateAsync( WaitUntil.Completed, workspaceName, workspaceData); Assert.IsNotNull(opWorkspaceCreate); Assert.IsTrue(opWorkspaceCreate.HasCompleted); Assert.AreEqual(opWorkspaceCreate.Value.Data.Name, workspaceName); Response <VirtualWorkspaceResource> getOp = await workspaceCollection.GetAsync( workspaceName); Assert.AreEqual(workspaceName, getOp.Value.Data.Name); workspaceData.FriendlyName = "Friendly Name"; opWorkspaceCreate = await workspaceCollection.CreateOrUpdateAsync( WaitUntil.Completed, workspaceName, workspaceData); Assert.IsNotNull(opWorkspaceCreate); Assert.IsTrue(opWorkspaceCreate.HasCompleted); Assert.AreEqual(opWorkspaceCreate.Value.Data.Name, workspaceName); Assert.AreEqual(opWorkspaceCreate.Value.Data.FriendlyName, "Friendly Name"); getOp = await workspaceCollection.GetAsync( workspaceName); VirtualWorkspaceResource workspace = getOp.Value; ArmOperation deleteOp = await workspace.DeleteAsync(WaitUntil.Completed); Assert.IsNotNull(deleteOp); Assert.AreEqual(200, deleteOp.GetRawResponse().Status); deleteOp = await workspace.DeleteAsync(WaitUntil.Completed); Assert.IsNotNull(deleteOp); Assert.AreEqual(204, deleteOp.GetRawResponse().Status); try { getOp = await workspaceCollection.GetAsync( workspaceName); } catch (Azure.RequestFailedException ex) { Assert.AreEqual(404, ex.Status); } }