func buildFeed()

in findings/main.go [132:167]


func buildFeed(scanspec ScanSpec) (string, error) {

	findings, err := describeScan(scanspec)
	if err != nil {
		return "", err
	}
	ecrlink := fmt.Sprintf("https://%v.console.aws.amazon.com/ecr/repositories/%v/", scanspec.Region, scanspec.Repository)
	feed := &feeds.Feed{
		Title:       fmt.Sprintf("ECR repository %v in %v", scanspec.Repository, scanspec.Region),
		Link:        &feeds.Link{Href: ecrlink},
		Description: "Details of the image scan findings across the tags: ",
		Author:      &feeds.Author{Name: "ECR"},
	}
	for tag, isfindings := range findings {
		for _, finding := range isfindings.Findings {
			title := fmt.Sprintf("[%v] in image %v:%v found %v", *finding.Severity, scanspec.Repository, tag, *finding.Name)
			link := *finding.Uri
			desc := *finding.Description
			item := &feeds.Item{
				Title:       title,
				Link:        &feeds.Link{Href: link},
				Description: desc,
				Id:          tag,
				Created:     *isfindings.ImageScanCompletedAt,
			}
			feed.Items = append(feed.Items, item)
		}
		feed.Description += "[" + tag + "] "
	}

	findingsfeed, err := feed.ToAtom()
	if err != nil {
		return "", err
	}
	return findingsfeed, nil
}