protected async Task <VirtualMachineCollection> GetVirtualMachineCollectionAsync() { _genericResourceCollection = DefaultSubscription.GetGenericResources(); _resourceGroup = await CreateResourceGroupAsync(); return(_resourceGroup.GetVirtualMachines()); }
public async Task GetAllInSubscription() { var collection = await GetAvailabilitySetCollectionAsync(); var setName1 = Recording.GenerateAssetName("testAS-"); var setName2 = Recording.GenerateAssetName("testAS-"); var input = ResourceDataHelper.GetBasicAvailabilitySetData(DefaultLocation); input.Tags.ReplaceWith(new Dictionary <string, string> { { "key", "value" } }); _ = await collection.CreateOrUpdateAsync(WaitUntil.Completed, setName1, input); _ = await collection.CreateOrUpdateAsync(WaitUntil.Completed, setName2, input); AvailabilitySetResource set1 = null, set2 = null; await foreach (var availabilitySet in DefaultSubscription.GetAvailabilitySetsAsync()) { if (availabilitySet.Data.Name == setName1) { set1 = availabilitySet; } if (availabilitySet.Data.Name == setName2) { set2 = availabilitySet; } } Assert.NotNull(set1); Assert.NotNull(set2); }
public async Task GetAllInSubscription() { var collection = await GetDiskCollectionAsync(); var diskName1 = Recording.GenerateAssetName("testDisk-"); var diskName2 = Recording.GenerateAssetName("testDisk-"); var input = ResourceDataHelper.GetEmptyDiskData(DefaultLocation, new Dictionary <string, string>() { { "key", "value" } }); _ = await collection.CreateOrUpdateAsync(WaitUntil.Completed, diskName1, input); _ = await collection.CreateOrUpdateAsync(WaitUntil.Completed, diskName2, input); Disk disk1 = null, disk2 = null; await foreach (var disk in DefaultSubscription.GetDisksAsync()) { if (disk.Data.Name == diskName1) { disk1 = disk; } if (disk.Data.Name == diskName2) { disk2 = disk; } } Assert.NotNull(disk1); Assert.NotNull(disk2); }
protected async Task <VirtualMachineScaleSetContainer> GetVirtualMachineScaleSetContainerAsync() { _genericResourceContainer = DefaultSubscription.GetGenericResources(); _resourceGroup = await CreateResourceGroupAsync(); return(_resourceGroup.GetVirtualMachineScaleSets()); }
public async Task GetAllInSubscription() { var clusterName = Recording.GenerateAssetName("testcluster"); var _clusterCollection = await GetVMwareClusterCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, ExtendedLocationType = EXTENDED_LOCATION_TYPE }; var clusterBody = new VMwareClusterData(DefaultLocation); clusterBody.MoRefId = "domain-c7"; clusterBody.VCenterId = VcenterId; clusterBody.ExtendedLocation = _extendedLocation; // create cluster VMwareCluster cluster1 = (await _clusterCollection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, clusterBody)).Value; Assert.IsNotNull(cluster1); Assert.AreEqual(cluster1.Id.Name, clusterName); cluster1 = null; await foreach (var cluster in DefaultSubscription.GetVMwareClustersAsync()) { if (cluster.Data.Name == clusterName) { cluster1 = cluster; } } Assert.NotNull(cluster1); }
public async Task GetAllInSubscription() { var vnetName = Recording.GenerateAssetName("testvnet"); var _virtualNetworkCollection = await GetVirtualNetworkCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, Type = EXTENDED_LOCATION_TYPE }; var vnetBody = new VirtualNetworkData(DefaultLocation); vnetBody.MoRefId = "network-o85628"; vnetBody.VCenterId = VcenterId; vnetBody.ExtendedLocation = _extendedLocation; // create virtual network VirtualNetwork vnet1 = (await _virtualNetworkCollection.CreateOrUpdateAsync(true, vnetName, vnetBody)).Value; Assert.IsNotNull(vnet1); Assert.AreEqual(vnet1.Id.Name, vnetName); vnet1 = null; await foreach (var vnet in DefaultSubscription.GetVirtualNetworksAsync()) { if (vnet.Data.Name == vnetName) { vnet1 = vnet; } } Assert.NotNull(vnet1); }
public async Task GetAllInSubscription() { var hostName = Recording.GenerateAssetName("testhost"); var _hostCollection = await GetVMwareHostCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, ExtendedLocationType = EXTENDED_LOCATION_TYPE }; var hostBody = new VMwareHostData(DefaultLocation); hostBody.MoRefId = "host-111900"; hostBody.VCenterId = VcenterId; hostBody.ExtendedLocation = _extendedLocation; // create host VMwareHost host1 = (await _hostCollection.CreateOrUpdateAsync(WaitUntil.Completed, hostName, hostBody)).Value; Assert.IsNotNull(host1); Assert.AreEqual(host1.Id.Name, hostName); host1 = null; await foreach (var host in DefaultSubscription.GetVMwareHostsAsync()) { if (host.Data.Name == hostName) { host1 = host; } } Assert.NotNull(host1); }
public async Task GetAllInSubscription() { var collection = await GetVirtualMachineCollectionAsync(); var vmName1 = Recording.GenerateAssetName("testVM-"); var vmName2 = Recording.GenerateAssetName("testVM-"); var nic1 = await CreateBasicDependenciesOfVirtualMachineAsync(); var nic2 = await CreateBasicDependenciesOfVirtualMachineAsync(); var input1 = ResourceDataHelper.GetBasicLinuxVirtualMachineData(DefaultLocation, vmName1, nic1.Id); var input2 = ResourceDataHelper.GetBasicLinuxVirtualMachineData(DefaultLocation, vmName2, nic2.Id); _ = await collection.CreateOrUpdateAsync(WaitUntil.Completed, vmName1, input1); _ = await collection.CreateOrUpdateAsync(WaitUntil.Completed, vmName2, input2); VirtualMachine vm1 = null, vm2 = null; await foreach (var vm in DefaultSubscription.GetVirtualMachinesAsync()) { if (vm.Data.Name == vmName1) { vm1 = vm; } if (vm.Data.Name == vmName2) { vm2 = vm; } } Assert.NotNull(vm1); Assert.NotNull(vm2); }
public async Task GetDeletedAccounts() { //get all deleted accounts List <DeletedAccount> deletedAccounts = await DefaultSubscription.GetDeletedAccountsAsync().ToEnumerableAsync(); Assert.NotNull(deletedAccounts); }
public async Task GetAllInSubscription() { var container = await GetGalleryContainerAsync(); var name1 = Recording.GenerateAssetName("testGallery_"); var name2 = Recording.GenerateAssetName("testGallery_"); var input1 = ResourceDataHelper.GetBasicGalleryData(DefaultLocation); var input2 = ResourceDataHelper.GetBasicGalleryData(DefaultLocation); _ = await container.CreateOrUpdateAsync(name1, input1); _ = await container.CreateOrUpdateAsync(name2, input2); Gallery gallery1 = null, gallery2 = null; await foreach (var gallery in DefaultSubscription.GetGalleriesAsync()) { if (gallery.Data.Name == name1) { gallery1 = gallery; } if (gallery.Data.Name == name2) { gallery2 = gallery; } } Assert.NotNull(gallery1); Assert.NotNull(gallery2); }
public async Task GetAllInSubscription() { var collection = await GetDedicatedHostGroupCollectionAsync(); var groupName1 = Recording.GenerateAssetName("testDHG-"); var groupName2 = Recording.GenerateAssetName("testDHG-"); var input = ResourceDataHelper.GetBasicDedicatedHostGroup(DefaultLocation, 2); _ = await collection.CreateOrUpdateAsync(groupName1, input); _ = await collection.CreateOrUpdateAsync(groupName2, input); DedicatedHostGroup group1 = null, group2 = null; await foreach (var group in DefaultSubscription.GetDedicatedHostGroupsAsync()) { if (group.Data.Name == groupName1) { group1 = group; } if (group.Data.Name == groupName2) { group2 = group; } } Assert.NotNull(group1); Assert.NotNull(group2); }
public async Task GetAllInSubscription() { var collection = await GetVirtualMachineScaleSetCollectionAsync(); var vmssName1 = Recording.GenerateAssetName("testVMSS-"); var vmssName2 = Recording.GenerateAssetName("testVMSS-"); var vnet1 = await CreateBasicDependenciesOfVirtualMachineScaleSetAsync(); var vnet2 = await CreateBasicDependenciesOfVirtualMachineScaleSetAsync(); var input1 = ResourceDataHelper.GetBasicLinuxVirtualMachineScaleSetData(DefaultLocation, vmssName1, GetSubnetId(vnet1)); var input2 = ResourceDataHelper.GetBasicLinuxVirtualMachineScaleSetData(DefaultLocation, vmssName2, GetSubnetId(vnet2)); _ = await collection.CreateOrUpdateAsync(true, vmssName1, input1); _ = await collection.CreateOrUpdateAsync(true, vmssName2, input2); VirtualMachineScaleSet vmss1 = null, vmss2 = null; await foreach (var vmss in DefaultSubscription.GetVirtualMachineScaleSetsAsync()) { if (vmss.Data.Name == vmssName1) { vmss1 = vmss; } if (vmss.Data.Name == vmssName2) { vmss2 = vmss; } } Assert.NotNull(vmss1); Assert.NotNull(vmss2); }
public async Task GetAllInSubscription() { var datastoreName = Recording.GenerateAssetName("testdatastore"); var _datastoreCollection = await GetVMwareDatastoreCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, Type = EXTENDED_LOCATION_TYPE }; var datastoreBody = new VMwareDatastoreData(DefaultLocation); datastoreBody.MoRefId = "datastore-11"; datastoreBody.VCenterId = VcenterId; datastoreBody.ExtendedLocation = _extendedLocation; // create datastore VMwareDatastore datastore1 = (await _datastoreCollection.CreateOrUpdateAsync(true, datastoreName, datastoreBody)).Value; Assert.IsNotNull(datastore1); Assert.AreEqual(datastore1.Id.Name, datastoreName); datastore1 = null; await foreach (var datastore in DefaultSubscription.GetVMwareDatastoresAsync()) { if (datastore.Data.Name == datastoreName) { datastore1 = datastore; } } Assert.NotNull(datastore1); }
public async Task GetAllInSubscription() { var vmtemplateName = Recording.GenerateAssetName("testvmtemplate"); var _virtualMachineTemplateCollection = await GetVirtualMachineTemplateCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, ExtendedLocationType = EXTENDED_LOCATION_TYPE }; var virtualMachineTemplateBody = new VirtualMachineTemplateData(DefaultLocation); virtualMachineTemplateBody.MoRefId = "vm-75"; virtualMachineTemplateBody.VCenterId = VcenterId; virtualMachineTemplateBody.ExtendedLocation = _extendedLocation; // create virtual machine template VirtualMachineTemplate vmtemplate1 = (await _virtualMachineTemplateCollection.CreateOrUpdateAsync(WaitUntil.Completed, vmtemplateName, virtualMachineTemplateBody)).Value; Assert.IsNotNull(vmtemplate1); Assert.AreEqual(vmtemplate1.Id.Name, vmtemplateName); vmtemplate1 = null; await foreach (var vmtemplate in DefaultSubscription.GetVirtualMachineTemplatesAsync()) { if (vmtemplate.Data.Name == vmtemplateName) { vmtemplate1 = vmtemplate; } } Assert.NotNull(vmtemplate1); }
public async Task GetAllInSubscription() { var collection = await GetDiskAccessCollectionAsync(); var name1 = Recording.GenerateAssetName("testDA"); var name2 = Recording.GenerateAssetName("testDA"); var input = ResourceDataHelper.GetEmptyDiskAccess(DefaultLocation); _ = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name1, input); _ = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name2, input); DiskAccessResource access1 = null, access2 = null; await foreach (var access in DefaultSubscription.GetDiskAccessesAsync()) { if (access.Data.Name == name1) { access1 = access; } if (access.Data.Name == name2) { access2 = access; } } Assert.NotNull(access1); Assert.NotNull(access2); }
public async Task GetAllInSubscription() { var resourcePoolName = Recording.GenerateAssetName("testresourcepool"); var _resourcePoolCollection = await GetResourcePoolCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, ExtendedLocationType = EXTENDED_LOCATION_TYPE }; var resourcePoolBody = new ResourcePoolData(DefaultLocation); resourcePoolBody.MoRefId = "resgroup-89261"; resourcePoolBody.VCenterId = VcenterId; resourcePoolBody.ExtendedLocation = _extendedLocation; // create resource pool ResourcePool resourcePool1 = (await _resourcePoolCollection.CreateOrUpdateAsync(WaitUntil.Completed, resourcePoolName, resourcePoolBody)).Value; Assert.IsNotNull(resourcePool1); Assert.AreEqual(resourcePool1.Id.Name, resourcePoolName); resourcePool1 = null; await foreach (var resourcePool in DefaultSubscription.GetResourcePoolsAsync()) { if (resourcePool.Data.Name == resourcePoolName) { resourcePool1 = resourcePool; } } Assert.NotNull(resourcePool1); }
private async Task <LogProfileResource> CreateLogProfileAsync(string logProfileName) { var collection = DefaultSubscription.GetLogProfiles(); var input = ResourceDataHelper.GetBasicLogProfileData("Global"); var lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, logProfileName, input); return(lro.Value); }
public async Task GetAvailableClusterRegions() { await foreach (var _ in DefaultSubscription.GetAvailableClusterRegionClustersAsync()) { return; } Assert.Fail($"{nameof(EventHubsExtensions)}.{nameof(EventHubsExtensions.GetAvailableClusterRegionClustersAsync)} has returned an empty collection of AvailableClusters."); }
private async Task CleanUpAsync() { var collection = DefaultSubscription.GetLogProfiles(); var list = await collection.GetAllAsync().ToEnumerableAsync(); foreach (var item in list) { await item.DeleteAsync(WaitUntil.Completed); } }
public async Task GetNamespacesInSubscription() { //create two namespaces in two resourcegroups string namespaceName1 = await CreateValidNamespaceName("testnamespacemgmt1"); string namespaceName2 = await CreateValidNamespaceName("testnamespacemgmt2"); _resourceGroup = await CreateResourceGroupAsync(); ResourceGroupResource resourceGroup = await CreateResourceGroupAsync(); EventHubNamespaceCollection namespaceCollection1 = _resourceGroup.GetEventHubNamespaces(); EventHubNamespaceCollection namespaceCollection2 = resourceGroup.GetEventHubNamespaces(); _ = (await namespaceCollection1.CreateOrUpdateAsync(WaitUntil.Completed, namespaceName1, new EventHubNamespaceData(DefaultLocation))).Value; _ = (await namespaceCollection2.CreateOrUpdateAsync(WaitUntil.Completed, namespaceName2, new EventHubNamespaceData(DefaultLocation))).Value; int count = 0; EventHubNamespaceResource namespace1 = null; EventHubNamespaceResource namespace2 = null; //validate await foreach (EventHubNamespaceResource eventHubNamespace in DefaultSubscription.GetEventHubNamespacesAsync()) { count++; if (eventHubNamespace.Id.Name == namespaceName1) { namespace1 = eventHubNamespace; } if (eventHubNamespace.Id.Name == namespaceName2) { namespace2 = eventHubNamespace; } } VerifyNamespaceProperties(namespace1, true); VerifyNamespaceProperties(namespace2, true); Assert.AreEqual(namespace1.Id.ResourceGroupName, _resourceGroup.Id.Name); Assert.AreEqual(namespace2.Id.ResourceGroupName, resourceGroup.Id.Name); await namespace2.DeleteAsync(WaitUntil.Completed); }
public async Task GetNamespacesInSubscription() { IgnoreTestInLiveMode(); //create two namespaces in two resourcegroups string namespaceName1 = await CreateValidNamespaceName(namespacePrefix); _resourceGroup = await CreateResourceGroupAsync(); ResourceGroupResource resourceGroup = await CreateResourceGroupAsync(); ServiceBusNamespaceCollection namespaceCollection1 = _resourceGroup.GetServiceBusNamespaces(); ServiceBusNamespaceCollection namespaceCollection2 = resourceGroup.GetServiceBusNamespaces(); _ = (await namespaceCollection1.CreateOrUpdateAsync(WaitUntil.Completed, namespaceName1, new ServiceBusNamespaceData(DefaultLocation))).Value; string namespaceName2 = await CreateValidNamespaceName(namespacePrefix); _ = (await namespaceCollection2.CreateOrUpdateAsync(WaitUntil.Completed, namespaceName2, new ServiceBusNamespaceData(DefaultLocation))).Value; int count = 0; ServiceBusNamespaceResource namespace1 = null; ServiceBusNamespaceResource namespace2 = null; //validate await foreach (ServiceBusNamespaceResource serviceBusNamespace in DefaultSubscription.GetServiceBusNamespacesAsync()) { count++; if (serviceBusNamespace.Id.Name == namespaceName1) { namespace1 = serviceBusNamespace; } if (serviceBusNamespace.Id.Name == namespaceName2) { namespace2 = serviceBusNamespace; } } VerifyNamespaceProperties(namespace1, true); VerifyNamespaceProperties(namespace2, true); Assert.AreEqual(namespace1.Id.ResourceGroupName, _resourceGroup.Id.Name); Assert.AreEqual(namespace2.Id.ResourceGroupName, resourceGroup.Id.Name); }
private async Task <LogProfileCollection> GetLogProfileCollectionAsync() { var resourceGroup = await CreateResourceGroupAsync(); return(DefaultSubscription.GetLogProfiles()); }
public async Task GetAvailableClusterRegions() { IReadOnlyList <AvailableCluster> availableClusters = (await DefaultSubscription.GetAvailableClusterRegionClustersAsync()).Value; Assert.NotNull(availableClusters); }
private async Task <DiagnosticSettingsCollection> GetDiagnosticSettingsCollectionAsync() { var resourceGroup = await CreateResourceGroupAsync(); return(DefaultSubscription.GetDiagnosticSettings()); }