public virtual AsyncPageable <VirtualMachineExtensionImage> GetAllAsync(string type, string filter = null, int?top = null, string orderby = null, CancellationToken cancellationToken = default) { if (type == null) { throw new ArgumentNullException(nameof(type)); } async Task <Page <VirtualMachineExtensionImage> > FirstPageFunc(int?pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("VirtualMachineExtensionImageCollection.GetAll"); scope.Start(); try { var response = await _virtualMachineExtensionImagesRestClient.ListVersionsAsync(Id.SubscriptionId, _location, _publisherName, type, filter, top, orderby, cancellationToken : cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Select(value => new VirtualMachineExtensionImage(this, value)), null, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null)); }
public async virtual Task <Response <IReadOnlyList <VirtualMachineExtensionImage> > > GetAllAsync(string location, string publisherName, string type, string filter = null, int?top = null, string orderby = null, CancellationToken cancellationToken = default) { if (location == null) { throw new ArgumentNullException(nameof(location)); } if (publisherName == null) { throw new ArgumentNullException(nameof(publisherName)); } if (type == null) { throw new ArgumentNullException(nameof(type)); } using var scope = _clientDiagnostics.CreateScope("VirtualMachineExtensionImageCollection.GetAll"); scope.Start(); try { var response = await _virtualMachineExtensionImagesRestClient.ListVersionsAsync(Id.SubscriptionId, location, publisherName, type, filter, top, orderby, cancellationToken).ConfigureAwait(false); return(Response.FromValue(response.Value.Select(value => new VirtualMachineExtensionImage(Parent, value)).ToArray() as IReadOnlyList <VirtualMachineExtensionImage>, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }