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