public virtual AsyncPageable <GenericResource> GetAllAsGenericResourcesAsync(string nameFilter, string expand = null, int?top = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("VirtualMachineExtensionImageCollection.GetAllAsGenericResources"); scope.Start(); try { var filters = new ResourceFilterCollection(VirtualMachineExtensionImage.ResourceType); filters.SubstringFilter = nameFilter; return(ResourceListOperations.GetAtContextAsync(Parent as Subscription, filters, expand, top, cancellationToken)); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Pageable <GenericResource> GetAllAsGenericResources(string nameFilter, string expand = null, int?top = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("CommunicationServiceCollection.GetAllAsGenericResources"); scope.Start(); try { var filters = new ResourceFilterCollection(CommunicationService.ResourceType); filters.SubstringFilter = nameFilter; return(ResourceListOperations.GetAtContext(Parent as ResourceGroup, filters, expand, top, cancellationToken)); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual AsyncPageable <GenericResource> GetAllAsGenericResourcesAsync(string nameFilter, string expand = null, int?top = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ResourceGroupLongTermRetentionManagedInstanceBackupCollection.GetAllAsGenericResources"); scope.Start(); try { var filters = new ResourceFilterCollection(ResourceGroupLongTermRetentionManagedInstanceBackup.ResourceType); filters.SubstringFilter = nameFilter; return(ResourceListOperations.GetAtContextAsync(Parent as ResourceGroup, filters, expand, top, cancellationToken)); } catch (Exception e) { scope.Failed(e); throw; } }
public async Task ListAtContext() { ResourceGroup rg = await Client.DefaultSubscription.GetResourceGroups().Construct(Location.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testrg")); _ = await CreateGenericAvailabilitySetAsync(rg.Id); ResourceGroupOperations rgOp = Client.GetResourceGroupOperations(rg.Id); var result = 0; var pageable = ResourceListOperations.ListAtContextAsync(rgOp); await foreach (var resource in pageable) { result++; } Assert.AreEqual(1, result); result = 0; pageable = ResourceListOperations.ListAtContextAsync(Client.DefaultSubscription); await foreach (var resource in pageable) { result++; } Assert.GreaterOrEqual(result, 1); }