private Task ProcessImageScanRequest(ImageScanRequestMessage msg) { return(this.scanner.Scan(new ScanRequest { Image = ContainerImage.FromFullName(msg.Payload.ImageFullName), ScanId = msg.Payload.ImageScanId, })); }
public async Task <ObjectResult> ScanImages([FromRoute] string imageTag) { try { var unescapedTag = HttpUtility.UrlDecode(imageTag); var image = ContainerImage.FromFullName(unescapedTag); var result = await this.scanner.Scan(new ScanRequest { Image = image, ScanId = Guid.NewGuid().ToString(), }); return(this.StatusCode(201, result)); } catch (Exception ex) { Logger.Warning(ex, "Failed to scan the image {Image}", imageTag); return(this.StatusCode(500, $"Failed to scan an image because of exception: {ex.Message}")); } }