0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-30 22:34:13 -05:00
zot/pkg/cli/client/gql_queries.go
LaurentiuNiculae 5039128723
feat(cve): cli cve diff (#2242)
* feat(gql): add new query for diff of cves for 2 images

Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>

* feat(cli): add cli for cve diff

Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>

---------

Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
2024-03-06 10:40:29 +02:00

130 lines
2.6 KiB
Go

//go:build search
// +build search
package client
type GQLField struct {
Name string
Type GQLType
}
type GQLType struct {
Name string
Fields []GQLField
}
type GQLQuery struct {
Name string
Args []string
ReturnType GQLType
}
func CVEResultForImage() GQLType {
return GQLType{
Name: "CVEResultForImage",
}
}
func CVEDiffResult() GQLType {
return GQLType{
Name: "CVEDiffResult",
}
}
func PaginatedImagesResult() GQLType {
return GQLType{
Name: "PaginatedImagesResult",
}
}
func Referrer() GQLType {
return GQLType{
Name: "Referrer",
}
}
func GlobalSearchResult() GQLType {
return GQLType{
Name: "GlobalSearchResult",
}
}
func ImageListQuery() GQLQuery {
return GQLQuery{
Name: "ImageList",
Args: []string{"repo", "requestedPage"},
ReturnType: PaginatedImagesResult(),
}
}
func CVEDiffListForImagesQuery() GQLQuery {
return GQLQuery{
Name: "CVEDiffListForImages",
Args: []string{"minuend", "subtrahend", "requestedPage", "searchedCVE", "excludedCVE"},
ReturnType: CVEDiffResult(),
}
}
func ImageListForDigestQuery() GQLQuery {
return GQLQuery{
Name: "ImageListForDigest",
Args: []string{"id", "requestedPage"},
ReturnType: PaginatedImagesResult(),
}
}
func BaseImageListQuery() GQLQuery {
return GQLQuery{
Name: "BaseImageList",
Args: []string{"image", "digest", "requestedPage"},
ReturnType: PaginatedImagesResult(),
}
}
func DerivedImageListQuery() GQLQuery {
return GQLQuery{
Name: "DerivedImageList",
Args: []string{"image", "digest", "requestedPage"},
ReturnType: PaginatedImagesResult(),
}
}
func CVEListForImageQuery() GQLQuery {
return GQLQuery{
Name: "CVEListForImage",
Args: []string{"image", "requestedPage", "searchedCVE", "excludedCVE", "severity"},
ReturnType: CVEResultForImage(),
}
}
func ImageListForCVEQuery() GQLQuery {
return GQLQuery{
Name: "ImageListForCVE",
Args: []string{"id", "filter", "requestedPage"},
ReturnType: PaginatedImagesResult(),
}
}
func ImageListWithCVEFixedQuery() GQLQuery {
return GQLQuery{
Name: "ImageListWithCVEFixed",
Args: []string{"id", "image", "filter", "requestedPage"},
ReturnType: PaginatedImagesResult(),
}
}
func ReferrersQuery() GQLQuery {
return GQLQuery{
Name: "Referrers",
Args: []string{"repo", "digest", "type"},
ReturnType: Referrer(),
}
}
func GlobalSearchQuery() GQLQuery {
return GQLQuery{
Name: "GlobalSearch",
Args: []string{"query", "filter", "requestedPage"},
ReturnType: GlobalSearchResult(),
}
}