zotregistry.dev/zot@v1.4.4-0.20240314164342-eec277e14d20/pkg/extensions/search/gql_generated/models_gen.go (about) 1 // Code generated by github.com/99designs/gqlgen, DO NOT EDIT. 2 3 package gql_generated 4 5 import ( 6 "fmt" 7 "io" 8 "strconv" 9 "time" 10 ) 11 12 // Annotation is Key:Value pair representing custom data which is otherwise 13 // not available in other fields. 14 type Annotation struct { 15 // Custom key 16 Key *string `json:"Key,omitempty"` 17 // Value associated with the custom key 18 Value *string `json:"Value,omitempty"` 19 } 20 21 // Contains various details about the CVE (Common Vulnerabilities and Exposures) 22 // and a list of PackageInfo about the affected packages 23 type Cve struct { 24 // CVE ID 25 ID *string `json:"Id,omitempty"` 26 // A short title describing the CVE 27 Title *string `json:"Title,omitempty"` 28 // A detailed description of the CVE 29 Description *string `json:"Description,omitempty"` 30 // Reference for the given CVE 31 Reference *string `json:"Reference,omitempty"` 32 // The impact the CVE has, one of "UNKNOWN", "LOW", "MEDIUM", "HIGH", "CRITICAL" 33 Severity *string `json:"Severity,omitempty"` 34 // Information on the packages in which the CVE was found 35 PackageList []*PackageInfo `json:"PackageList,omitempty"` 36 } 37 38 // Contains the diff results of subtracting Subtrahend's CVEs from Minuend's CVEs 39 type CVEDiffResult struct { 40 // Minuend is the image from which CVE's we subtract 41 Minuend *ImageIdentifier `json:"Minuend"` 42 // Subtrahend is the image which CVE's are subtracted 43 Subtrahend *ImageIdentifier `json:"Subtrahend"` 44 // List of CVE objects which are present in minuend but not in subtrahend 45 CVEList []*Cve `json:"CVEList,omitempty"` 46 // Summary of the findings for this image 47 Summary *ImageVulnerabilitySummary `json:"Summary,omitempty"` 48 // The CVE pagination information, see PageInfo object for more details 49 Page *PageInfo `json:"Page,omitempty"` 50 } 51 52 // Contains the tag of the image and a list of CVEs 53 type CVEResultForImage struct { 54 // Tag affected by the CVEs 55 Tag *string `json:"Tag,omitempty"` 56 // List of CVE objects which affect this specific image:tag 57 CVEList []*Cve `json:"CVEList,omitempty"` 58 // Summary of the findings for this image 59 Summary *ImageVulnerabilitySummary `json:"Summary,omitempty"` 60 // The CVE pagination information, see PageInfo object for more details 61 Page *PageInfo `json:"Page,omitempty"` 62 } 63 64 // Apply various types of filters to the queries made for repositories and images 65 // For example we only want to display repositories which contain images with 66 // a certain OS ar Architecture. 67 type Filter struct { 68 // Only return images or repositories supporting the operating systems in the list 69 // Should be values listed in the Go Language document https://go.dev/doc/install/source#environment 70 Os []*string `json:"Os,omitempty"` 71 // Only return images or repositories supporting the build architectures in the list 72 // Should be values listed in the Go Language document https://go.dev/doc/install/source#environment 73 Arch []*string `json:"Arch,omitempty"` 74 // Only return images or repositories with at least one signature 75 HasToBeSigned *bool `json:"HasToBeSigned,omitempty"` 76 // Only returns images or repositories that are bookmarked or not bookmarked 77 IsBookmarked *bool `json:"IsBookmarked,omitempty"` 78 // Only returns images or repositories that are starred or not starred 79 IsStarred *bool `json:"IsStarred,omitempty"` 80 } 81 82 // Search results, can contain images, repositories and layers 83 type GlobalSearchResult struct { 84 // Pagination information 85 Page *PageInfo `json:"Page,omitempty"` 86 // List of images matching the search criteria 87 Images []*ImageSummary `json:"Images,omitempty"` 88 // List of repositories matching the search criteria 89 Repos []*RepoSummary `json:"Repos,omitempty"` 90 // List of layers matching the search criteria 91 // NOTE: the actual search logic for layers is not implemented at the moment 92 Layers []*LayerSummary `json:"Layers,omitempty"` 93 } 94 95 // Information on how a layer was created 96 type HistoryDescription struct { 97 // Created is the time when the layer was created. 98 Created *time.Time `json:"Created,omitempty"` 99 // CreatedBy is the command which created the layer. 100 CreatedBy *string `json:"CreatedBy,omitempty"` 101 // Author is the author of the build point. 102 Author *string `json:"Author,omitempty"` 103 // Comment is a custom message set when creating the layer. 104 Comment *string `json:"Comment,omitempty"` 105 // EmptyLayer is used to mark if the history item created a filesystem diff. 106 EmptyLayer *bool `json:"EmptyLayer,omitempty"` 107 } 108 109 // ImageIdentifier 110 type ImageIdentifier struct { 111 // Repo name of the image 112 Repo string `json:"Repo"` 113 // The tag of the image 114 Tag string `json:"Tag"` 115 // The digest of the image 116 Digest *string `json:"Digest,omitempty"` 117 // The platform of the image 118 Platform *Platform `json:"Platform,omitempty"` 119 } 120 121 // ImageInput 122 type ImageInput struct { 123 // Repo name of the image 124 Repo string `json:"Repo"` 125 // The tag of the image 126 Tag string `json:"Tag"` 127 // The digest of the image 128 Digest *string `json:"Digest,omitempty"` 129 // The platform of the image 130 Platform *PlatformInput `json:"Platform,omitempty"` 131 } 132 133 // Details about a specific image, it is used by queries returning a list of images 134 // We define an image as a pairing or a repository and a tag belonging to that repository 135 type ImageSummary struct { 136 // Name of the repository where the image is found 137 RepoName *string `json:"RepoName,omitempty"` 138 // Tag identifying the image within the repository 139 Tag *string `json:"Tag,omitempty"` 140 // The digest of the descriptor of this image 141 Digest *string `json:"Digest,omitempty"` 142 // The media type of the descriptor of this image 143 MediaType *string `json:"MediaType,omitempty"` 144 // List of manifests for all supported versions of the image for different operating systems and architectures 145 Manifests []*ManifestSummary `json:"Manifests,omitempty"` 146 // Total size of the files associated with all images (manifest, config, layers) 147 Size *string `json:"Size,omitempty"` 148 // Number of downloads of the manifest of this image 149 DownloadCount *int `json:"DownloadCount,omitempty"` 150 // Timestamp of the last modification done to the image (from config or the last updated layer) 151 LastUpdated *time.Time `json:"LastUpdated,omitempty"` 152 // Human-readable description of the software packaged in the image 153 Description *string `json:"Description,omitempty"` 154 // True if the image has a signature associated with it, false otherwise 155 IsSigned *bool `json:"IsSigned,omitempty"` 156 // Info about signature validity 157 SignatureInfo []*SignatureSummary `json:"SignatureInfo,omitempty"` 158 // License(s) under which contained software is distributed as an SPDX License Expression 159 Licenses *string `json:"Licenses,omitempty"` 160 // Labels associated with this image 161 // NOTE: currently this field is unused 162 Labels *string `json:"Labels,omitempty"` 163 // Human-readable title of the image 164 Title *string `json:"Title,omitempty"` 165 // URL to get source code for building the image 166 Source *string `json:"Source,omitempty"` 167 // URL to get documentation on the image 168 Documentation *string `json:"Documentation,omitempty"` 169 // Vendor associated with this image, the distributing entity, organization or individual 170 Vendor *string `json:"Vendor,omitempty"` 171 // Contact details of the people or organization responsible for the image 172 Authors *string `json:"Authors,omitempty"` 173 // Short summary of the identified CVEs 174 Vulnerabilities *ImageVulnerabilitySummary `json:"Vulnerabilities,omitempty"` 175 // Information about objects that reference this image 176 Referrers []*Referrer `json:"Referrers,omitempty"` 177 // True if current user has delete permission on this tag. 178 IsDeletable *bool `json:"IsDeletable,omitempty"` 179 } 180 181 // Contains summary of vulnerabilities found in a specific image 182 type ImageVulnerabilitySummary struct { 183 // Maximum severity of all CVEs found in this image 184 MaxSeverity *string `json:"MaxSeverity,omitempty"` 185 // Count of all CVEs found in this image 186 Count *int `json:"Count,omitempty"` 187 // Coresponds to CVSS 3 score NONE 188 UnknownCount *int `json:"UnknownCount,omitempty"` 189 // Coresponds to CVSS 3 score LOW 190 LowCount *int `json:"LowCount,omitempty"` 191 // Coresponds to CVSS 3 score MEDIUM 192 MediumCount *int `json:"MediumCount,omitempty"` 193 // Coresponds to CVSS 3 score HIGH 194 HighCount *int `json:"HighCount,omitempty"` 195 // Coresponds to CVSS 3 score CRITICAL 196 CriticalCount *int `json:"CriticalCount,omitempty"` 197 } 198 199 // Information about how/when a layer was built 200 type LayerHistory struct { 201 // Information specific to the layer such as size and digest. 202 Layer *LayerSummary `json:"Layer,omitempty"` 203 // Additional information about how the layer was created. 204 HistoryDescription *HistoryDescription `json:"HistoryDescription,omitempty"` 205 } 206 207 // Contains details about a specific layer which is part of an image 208 type LayerSummary struct { 209 // The size of the layer in bytes 210 Size *string `json:"Size,omitempty"` 211 // Digest of the layer content 212 Digest *string `json:"Digest,omitempty"` 213 } 214 215 // Details about a specific version of an image for a certain operating system and architecture. 216 type ManifestSummary struct { 217 // Digest of the manifest file associated with this image 218 Digest *string `json:"Digest,omitempty"` 219 // Digest of the config file associated with this image 220 ConfigDigest *string `json:"ConfigDigest,omitempty"` 221 // Timestamp of the last update to an image inside this repository 222 LastUpdated *time.Time `json:"LastUpdated,omitempty"` 223 // Total size of the files associated with this manifest (manifest, config, layers) 224 Size *string `json:"Size,omitempty"` 225 // True if the manifest has a signature associated with it, false otherwise 226 IsSigned *bool `json:"IsSigned,omitempty"` 227 // Info about signature validity 228 SignatureInfo []*SignatureSummary `json:"SignatureInfo,omitempty"` 229 // OS and architecture supported by this image 230 Platform *Platform `json:"Platform,omitempty"` 231 // Total number of image manifest downloads from this repository 232 DownloadCount *int `json:"DownloadCount,omitempty"` 233 // List of layers matching the search criteria 234 // NOTE: the actual search logic for layers is not implemented at the moment 235 Layers []*LayerSummary `json:"Layers,omitempty"` 236 // Information about the history of the specific image, see LayerHistory 237 History []*LayerHistory `json:"History,omitempty"` 238 // Short summary of the identified CVEs 239 Vulnerabilities *ImageVulnerabilitySummary `json:"Vulnerabilities,omitempty"` 240 // Information about objects that reference this image 241 Referrers []*Referrer `json:"Referrers,omitempty"` 242 // Value of the artifactType field if present else the value of the config media type 243 ArtifactType *string `json:"ArtifactType,omitempty"` 244 } 245 246 // Contains the name of the package, the current installed version and the version where the CVE was fixed 247 type PackageInfo struct { 248 // Name of the package affected by a CVE 249 Name *string `json:"Name,omitempty"` 250 // Path where the vulnerable package is located 251 PackagePath *string `json:"PackagePath,omitempty"` 252 // Current version of the package, typically affected by the CVE 253 InstalledVersion *string `json:"InstalledVersion,omitempty"` 254 // Minimum version of the package in which the CVE is fixed 255 FixedVersion *string `json:"FixedVersion,omitempty"` 256 } 257 258 // Information on current page returned by the API 259 type PageInfo struct { 260 // The total number of objects on all pages 261 TotalCount int `json:"TotalCount"` 262 // The number of objects in this page 263 ItemCount int `json:"ItemCount"` 264 } 265 266 // Pagination parameters 267 // If PageInput is empty, the request should return all objects. 268 type PageInput struct { 269 // The maximum amount of results to return for this page 270 // Negative values are not allowed 271 Limit *int `json:"limit,omitempty"` 272 // The results page number you want to receive 273 // Negative values are not allowed 274 Offset *int `json:"offset,omitempty"` 275 // The criteria used to sort the results on the page 276 SortBy *SortCriteria `json:"sortBy,omitempty"` 277 } 278 279 // Paginated list of ImageSummary objects 280 type PaginatedImagesResult struct { 281 // Information on the returned page 282 Page *PageInfo `json:"Page,omitempty"` 283 // List of images 284 Results []*ImageSummary `json:"Results"` 285 } 286 287 // Paginated list of RepoSummary objects 288 type PaginatedReposResult struct { 289 // Information on the returned page 290 Page *PageInfo `json:"Page,omitempty"` 291 // List of repositories 292 Results []*RepoSummary `json:"Results"` 293 } 294 295 // Contains details about the OS and architecture of the image 296 type Platform struct { 297 // The name of the operating system which the image is built to run on, 298 // Should be values listed in the Go Language document https://go.dev/doc/install/source#environment 299 Os *string `json:"Os,omitempty"` 300 // The name of the compilation architecture which the image is built to run on, 301 // Should be values listed in the Go Language document https://go.dev/doc/install/source#environment 302 Arch *string `json:"Arch,omitempty"` 303 } 304 305 // PlatformInput contains the Os and the Arch of the input image 306 type PlatformInput struct { 307 // The os of the image 308 Os *string `json:"Os,omitempty"` 309 // The arch of the image 310 Arch *string `json:"Arch,omitempty"` 311 } 312 313 // Queries supported by the zot server 314 type Query struct { 315 } 316 317 // A referrer is an object which has a reference to a another object 318 type Referrer struct { 319 // Referrer MediaType 320 // See https://github.com/opencontainers/artifacts for more details 321 MediaType *string `json:"MediaType,omitempty"` 322 // Referrer ArtifactType 323 // See https://github.com/opencontainers/artifacts for more details 324 ArtifactType *string `json:"ArtifactType,omitempty"` 325 // Total size of the referrer files in bytes 326 Size *int `json:"Size,omitempty"` 327 // Digest of the manifest file of the referrer 328 Digest *string `json:"Digest,omitempty"` 329 // A list of annotations associated with this referrer 330 Annotations []*Annotation `json:"Annotations"` 331 } 332 333 // Contains details about the repo: both general information on the repo, and the list of images 334 type RepoInfo struct { 335 // List of images in the repo 336 Images []*ImageSummary `json:"Images,omitempty"` 337 // Details about the repository itself 338 Summary *RepoSummary `json:"Summary,omitempty"` 339 } 340 341 // Details of a specific repo, it is used by queries returning a list of repos 342 type RepoSummary struct { 343 // Name of the repository 344 Name *string `json:"Name,omitempty"` 345 // Timestamp of the last update to an image inside this repository 346 LastUpdated *time.Time `json:"LastUpdated,omitempty"` 347 // Total size of the files within this repository 348 Size *string `json:"Size,omitempty"` 349 // List of platforms supported by this repository 350 Platforms []*Platform `json:"Platforms,omitempty"` 351 // Vendors associated with this image, the distributing entities, organizations or individuals 352 Vendors []*string `json:"Vendors,omitempty"` 353 // Details of the newest image inside the repository 354 // NOTE: not the image with the `latest` tag, the one with the most recent created timestamp 355 NewestImage *ImageSummary `json:"NewestImage,omitempty"` 356 // Total number of image manifest downloads from this repository 357 DownloadCount *int `json:"DownloadCount,omitempty"` 358 // Number of stars attributed to this repository by users 359 StarCount *int `json:"StarCount,omitempty"` 360 // True if the repository is bookmarked by the current user, false otherwise 361 IsBookmarked *bool `json:"IsBookmarked,omitempty"` 362 // True if the repository is starred by the current user, false otherwise 363 IsStarred *bool `json:"IsStarred,omitempty"` 364 // Rank represents how good the match was between the queried repo name and this repo summary. 365 Rank *int `json:"Rank,omitempty"` 366 } 367 368 // Contains details about the signature 369 type SignatureSummary struct { 370 // Tool is the tool used for signing image 371 Tool *string `json:"Tool,omitempty"` 372 // True if the signature is trusted, false otherwise 373 IsTrusted *bool `json:"IsTrusted,omitempty"` 374 // Author is the author of the signature 375 Author *string `json:"Author,omitempty"` 376 } 377 378 // All sort criteria usable with pagination, some of these criteria applies only 379 // to certain queries. For example sort by severity is available for CVEs but not 380 // for repositories 381 type SortCriteria string 382 383 const ( 384 // How relevant the result is based on the user input used while searching 385 // Applies to: images and repositories 386 SortCriteriaRelevance SortCriteria = "RELEVANCE" 387 // Sort by the most recently created timestamp of the images 388 // Applies to: images and repositories 389 SortCriteriaUpdateTime SortCriteria = "UPDATE_TIME" 390 // Sort alphabetically ascending 391 // Applies to: images, repositories and CVEs 392 SortCriteriaAlphabeticAsc SortCriteria = "ALPHABETIC_ASC" 393 // Sort alphabetically descending 394 // Applies to: images, repositories and CVEs 395 SortCriteriaAlphabeticDsc SortCriteria = "ALPHABETIC_DSC" 396 // Sort from the most severe to the least severe 397 // Applies to: CVEs 398 SortCriteriaSeverity SortCriteria = "SEVERITY" 399 // Sort by the total number of stars given by users 400 // Applies to: repositories 401 SortCriteriaStars SortCriteria = "STARS" 402 // Sort by the total download count 403 // Applies to: repositories and images 404 SortCriteriaDownloads SortCriteria = "DOWNLOADS" 405 ) 406 407 var AllSortCriteria = []SortCriteria{ 408 SortCriteriaRelevance, 409 SortCriteriaUpdateTime, 410 SortCriteriaAlphabeticAsc, 411 SortCriteriaAlphabeticDsc, 412 SortCriteriaSeverity, 413 SortCriteriaStars, 414 SortCriteriaDownloads, 415 } 416 417 func (e SortCriteria) IsValid() bool { 418 switch e { 419 case SortCriteriaRelevance, SortCriteriaUpdateTime, SortCriteriaAlphabeticAsc, SortCriteriaAlphabeticDsc, SortCriteriaSeverity, SortCriteriaStars, SortCriteriaDownloads: 420 return true 421 } 422 return false 423 } 424 425 func (e SortCriteria) String() string { 426 return string(e) 427 } 428 429 func (e *SortCriteria) UnmarshalGQL(v interface{}) error { 430 str, ok := v.(string) 431 if !ok { 432 return fmt.Errorf("enums must be strings") 433 } 434 435 *e = SortCriteria(str) 436 if !e.IsValid() { 437 return fmt.Errorf("%s is not a valid SortCriteria", str) 438 } 439 return nil 440 } 441 442 func (e SortCriteria) MarshalGQL(w io.Writer) { 443 fmt.Fprint(w, strconv.Quote(e.String())) 444 }