public virtual Response <IReadOnlyList <VirtualMachineExtension> > GetAll(string expand = null, CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("VirtualMachineExtensionCollection.GetAll");
     scope.Start();
     try
     {
         var response = _virtualMachineExtensionsRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken);
         return(Response.FromValue(response.Value.Value.Select(value => new VirtualMachineExtension(Parent, value)).ToArray() as IReadOnlyList <VirtualMachineExtension>, response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
Esempio n. 2
0
        public virtual Pageable <VirtualMachineExtension> GetAll(string expand = null, CancellationToken cancellationToken = default)
        {
            Page <VirtualMachineExtension> FirstPageFunc(int?pageSizeHint)
            {
                using var scope = _virtualMachineExtensionClientDiagnostics.CreateScope("VirtualMachineExtensionCollection.GetAll");
                scope.Start();
                try
                {
                    var response = _virtualMachineExtensionRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken: cancellationToken);
                    return(Page.FromValues(response.Value.Value.Select(value => new VirtualMachineExtension(Client, value)), null, response.GetRawResponse()));
                }
                catch (Exception e)
                {
                    scope.Failed(e);
                    throw;
                }
            }

            return(PageableHelpers.CreateEnumerable(FirstPageFunc, null));
        }