zotregistry.io/zot@v1.4.4-0.20231124084042-02a8ed785457/pkg/common/model.go (about)

     1  package common
     2  
     3  import (
     4  	"time"
     5  )
     6  
     7  type PageInfo struct {
     8  	TotalCount int
     9  	ItemCount  int
    10  }
    11  
    12  type RepoInfo struct {
    13  	Summary        RepoSummary
    14  	ImageSummaries []ImageSummary `json:"images"`
    15  }
    16  
    17  type RepoSummary struct {
    18  	Name          string       `json:"name"`
    19  	LastUpdated   time.Time    `json:"lastUpdated"`
    20  	Size          string       `json:"size"`
    21  	Platforms     []Platform   `json:"platforms"`
    22  	Vendors       []string     `json:"vendors"`
    23  	IsStarred     bool         `json:"isStarred"`
    24  	IsBookmarked  bool         `json:"isBookmarked"`
    25  	StarCount     int          `json:"starCount"`
    26  	DownloadCount int          `json:"downloadCount"`
    27  	NewestImage   ImageSummary `json:"newestImage"`
    28  }
    29  
    30  type PaginatedImagesResult struct {
    31  	Results []ImageSummary `json:"results"`
    32  	Page    PageInfo       `json:"page"`
    33  }
    34  
    35  type ImageSummary struct {
    36  	RepoName        string                    `json:"repoName"`
    37  	Tag             string                    `json:"tag"`
    38  	Digest          string                    `json:"digest"`
    39  	MediaType       string                    `json:"mediaType"`
    40  	Manifests       []ManifestSummary         `json:"manifests"`
    41  	Size            string                    `json:"size"`
    42  	DownloadCount   int                       `json:"downloadCount"`
    43  	LastUpdated     time.Time                 `json:"lastUpdated"`
    44  	Description     string                    `json:"description"`
    45  	IsSigned        bool                      `json:"isSigned"`
    46  	Licenses        string                    `json:"licenses"`
    47  	Labels          string                    `json:"labels"`
    48  	Title           string                    `json:"title"`
    49  	Source          string                    `json:"source"`
    50  	Documentation   string                    `json:"documentation"`
    51  	Authors         string                    `json:"authors"`
    52  	Vendor          string                    `json:"vendor"`
    53  	Vulnerabilities ImageVulnerabilitySummary `json:"vulnerabilities"`
    54  	Referrers       []Referrer                `json:"referrers"`
    55  	SignatureInfo   []SignatureSummary        `json:"signatureInfo"`
    56  }
    57  
    58  type ManifestSummary struct {
    59  	Digest          string                    `json:"digest"`
    60  	ConfigDigest    string                    `json:"configDigest"`
    61  	LastUpdated     time.Time                 `json:"lastUpdated"`
    62  	Size            string                    `json:"size"`
    63  	Platform        Platform                  `json:"platform"`
    64  	IsSigned        bool                      `json:"isSigned"`
    65  	DownloadCount   int                       `json:"downloadCount"`
    66  	Layers          []LayerSummary            `json:"layers"`
    67  	History         []LayerHistory            `json:"history"`
    68  	Vulnerabilities ImageVulnerabilitySummary `json:"vulnerabilities"`
    69  	Referrers       []Referrer                `json:"referrers"`
    70  	ArtifactType    string                    `json:"artifactType"`
    71  	SignatureInfo   []SignatureSummary        `json:"signatureInfo"`
    72  }
    73  
    74  type SignatureSummary struct {
    75  	Tool      string `json:"tool"`
    76  	IsTrusted bool   `json:"isTrusted"`
    77  	Author    string `json:"author"`
    78  }
    79  
    80  type Platform struct {
    81  	Os      string `json:"os"`
    82  	Arch    string `json:"arch"`
    83  	Variant string `json:"variant"`
    84  }
    85  
    86  type ImageVulnerabilitySummary struct {
    87  	MaxSeverity string `json:"maxSeverity"`
    88  	Count       int    `json:"count"`
    89  }
    90  
    91  type LayerSummary struct {
    92  	Size   string `json:"size"`
    93  	Digest string `json:"digest"`
    94  	Score  int    `json:"score"`
    95  }
    96  
    97  type LayerHistory struct {
    98  	Layer              LayerSummary       `json:"layer"`
    99  	HistoryDescription HistoryDescription `json:"historyDescription"`
   100  }
   101  
   102  type HistoryDescription struct {
   103  	Created    time.Time `json:"created"`
   104  	CreatedBy  string    `json:"createdBy"`
   105  	Author     string    `json:"author"`
   106  	Comment    string    `json:"comment"`
   107  	EmptyLayer bool      `json:"emptyLayer"`
   108  }
   109  
   110  type Referrer struct {
   111  	MediaType    string       `json:"mediatype"`
   112  	ArtifactType string       `json:"artifacttype"`
   113  	Size         int          `json:"size"`
   114  	Digest       string       `json:"digest"`
   115  	Annotations  []Annotation `json:"annotations"`
   116  }
   117  
   118  type Annotation struct {
   119  	Key   string `json:"key"`
   120  	Value string `json:"value"`
   121  }
   122  
   123  type ImageListWithCVEFixedResponse struct {
   124  	Errors                []ErrorGQL `json:"errors"`
   125  	ImageListWithCVEFixed `json:"data"`
   126  }
   127  
   128  type ImageListWithCVEFixed struct {
   129  	PaginatedImagesResult `json:"ImageListWithCVEFixed"` //nolint:tagliatelle // graphQL schema
   130  }
   131  
   132  type ImagesForCve struct {
   133  	Errors           []ErrorGQL `json:"errors"`
   134  	ImagesForCVEList `json:"data"`
   135  }
   136  
   137  type ImagesForCVEList struct {
   138  	PaginatedImagesResult `json:"ImageListForCVE"` //nolint:tagliatelle // graphQL schema
   139  }
   140  
   141  type ImagesForDigest struct {
   142  	Errors              []ErrorGQL `json:"errors"`
   143  	ImagesForDigestList `json:"data"`
   144  }
   145  
   146  type ImagesForDigestList struct {
   147  	PaginatedImagesResult `json:"ImageListForDigest"` //nolint:tagliatelle // graphQL schema
   148  }
   149  
   150  type RepoWithNewestImageResponse struct {
   151  	RepoListWithNewestImage `json:"data"`
   152  	Errors                  []ErrorGQL `json:"errors"`
   153  }
   154  
   155  type DerivedImageListResponse struct {
   156  	DerivedImageList `json:"data"`
   157  	Errors           []ErrorGQL `json:"errors"`
   158  }
   159  
   160  type BaseImageListResponse struct {
   161  	BaseImageList `json:"data"`
   162  	Errors        []ErrorGQL `json:"errors"`
   163  }
   164  
   165  type DerivedImageList struct {
   166  	PaginatedImagesResult `json:"derivedImageList"`
   167  }
   168  
   169  type BaseImageList struct {
   170  	PaginatedImagesResult `json:"baseImageList"`
   171  }
   172  
   173  type ImageListResponse struct {
   174  	ImageList `json:"data"`
   175  	Errors    []ErrorGQL `json:"errors"`
   176  }
   177  
   178  type ImageList struct {
   179  	PaginatedImagesResult `json:"imageList"`
   180  }
   181  
   182  type ExpandedRepoInfoResp struct {
   183  	ExpandedRepoInfo `json:"data"`
   184  	Errors           []ErrorGQL `json:"errors"`
   185  }
   186  
   187  type ReferrersResp struct {
   188  	ReferrersResult `json:"data"`
   189  	Errors          []ErrorGQL `json:"errors"`
   190  }
   191  
   192  type ReferrersResult struct {
   193  	Referrers []Referrer `json:"referrers"`
   194  }
   195  type GlobalSearchResultResp struct {
   196  	GlobalSearchResult `json:"data"`
   197  	Errors             []ErrorGQL `json:"errors"`
   198  }
   199  
   200  type GlobalSearchResult struct {
   201  	GlobalSearch `json:"globalSearch"`
   202  }
   203  
   204  type GlobalSearch struct {
   205  	Images []ImageSummary `json:"images"`
   206  	Repos  []RepoSummary  `json:"repos"`
   207  	Layers []LayerSummary `json:"layers"`
   208  	Page   PageInfo       `json:"page"`
   209  }
   210  
   211  type ExpandedRepoInfo struct {
   212  	RepoInfo `json:"expandedRepoInfo"`
   213  }
   214  
   215  type PaginatedReposResult struct {
   216  	Results []RepoSummary `json:"results"`
   217  	Page    PageInfo      `json:"page"`
   218  }
   219  
   220  //nolint:tagliatelle // graphQL schema
   221  type RepoListWithNewestImage struct {
   222  	PaginatedReposResult `json:"RepoListWithNewestImage"`
   223  }
   224  
   225  type ErrorGQL struct {
   226  	Message string   `json:"message"`
   227  	Path    []string `json:"path"`
   228  }
   229  
   230  type SingleImageSummary struct {
   231  	ImageSummary `json:"Image"` //nolint:tagliatelle
   232  }
   233  type ImageSummaryResult struct {
   234  	SingleImageSummary `json:"data"`
   235  	Errors             []ErrorGQL `json:"errors"`
   236  }
   237  
   238  //nolint:tagliatelle // graphQL schema
   239  type StarredRepos struct {
   240  	PaginatedReposResult `json:"StarredRepos"`
   241  }
   242  
   243  //nolint:tagliatelle // graphQL schema
   244  type BookmarkedRepos struct {
   245  	PaginatedReposResult `json:"BookmarkedRepos"`
   246  }
   247  
   248  type StarredReposResponse struct {
   249  	StarredRepos `json:"data"`
   250  	Errors       []ErrorGQL `json:"errors"`
   251  }
   252  
   253  type BookmarkedReposResponse struct {
   254  	BookmarkedRepos `json:"data"`
   255  	Errors          []ErrorGQL `json:"errors"`
   256  }
   257  
   258  type ImageTags struct {
   259  	Name string   `json:"name"`
   260  	Tags []string `json:"tags"`
   261  }