github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/vulnerabilities/request/vulnerabilities.go (about) 1 package request 2 3 type Ingredient struct { 4 Namespace string `json:"namespace"` 5 Name string `json:"name"` 6 Version string `json:"version"` 7 } 8 9 type vulnerabilities struct { 10 vars map[string]interface{} 11 } 12 13 func VulnerabilitiesByIngredients(ingredients []*Ingredient) *vulnerabilities { 14 return &vulnerabilities{vars: map[string]interface{}{ 15 "ingredients": ingredients, 16 }} 17 } 18 19 func (p *vulnerabilities) Query() string { 20 return `query q($ingredients: jsonb) { 21 vulnerabilities: vulnerable_ingredients_filter( 22 args: {ingredient_versions: $ingredients} 23 ) { 24 name 25 primary_namespace 26 version 27 vulnerability { 28 severity 29 cve_identifier 30 source 31 } 32 vulnerability_id 33 } 34 }` 35 } 36 37 func (p *vulnerabilities) Vars() (map[string]interface{}, error) { 38 return p.vars, nil 39 }