public async Task <ListImagesResponse[]> GetListImages(ListImagesCommand command) { var response = await _client.ExecuteAsync(new ListImagesRequest { All = command.All, Filters = command.Filters, Digests = command.Digests }); return(await response.GetContentOrThrow <ListImagesResponse[]>()); }
/// <summary> /// Lists all of the OS images assoiated with Linux that are public within the subscription /// </summary> public List <ImageProperties> ListImages(string filter = "") { var command = new ListImagesCommand() { SubscriptionId = SubscriptionId, Certificate = ManagementCertificate }; command.Execute(); // groups the response back from the image list // and takes the most recent publication of the image from the group var list = command.Properties.Where(image => image.OperatingSystem == PlatformType.Linux).ToList(); if (!String.IsNullOrEmpty(filter)) { var newImageList = new List <ImageProperties>(); var imageList = list.Where(image => !String.IsNullOrEmpty(image.ImageFamily) && image.ImageFamily.Contains(filter)) .GroupBy(image => image.ImageFamily); foreach (var group in imageList) { ImageProperties lImageProperties = null; foreach (var image in group) { if (lImageProperties == null) { lImageProperties = image; } if (image.PublishedDate > lImageProperties.PublishedDate) { lImageProperties = image; } } newImageList.Add(lImageProperties); } return(newImageList); } return(list); }
public async Task <ActionResult <ListImagesResponseDto[]> > GetListImages([FromQuery] ListImagesCommand command) { return(await Mediator.Send(command)); }