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;
     }
 }
예제 #2
0
 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;
     }
 }
예제 #3
0
 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;
     }
 }
예제 #4
0
        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);
        }