types.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package registry
  2. type SearchResult struct {
  3. StarCount int `json:"star_count"`
  4. IsOfficial bool `json:"is_official"`
  5. Name string `json:"name"`
  6. IsTrusted bool `json:"is_trusted"`
  7. Description string `json:"description"`
  8. }
  9. type SearchResults struct {
  10. Query string `json:"query"`
  11. NumResults int `json:"num_results"`
  12. Results []SearchResult `json:"results"`
  13. }
  14. type RepositoryData struct {
  15. ImgList map[string]*ImgData
  16. Endpoints []string
  17. Tokens []string
  18. }
  19. type ImgData struct {
  20. ID string `json:"id"`
  21. Checksum string `json:"checksum,omitempty"`
  22. ChecksumPayload string `json:"-"`
  23. Tag string `json:",omitempty"`
  24. }
  25. type RegistryInfo struct {
  26. Version string `json:"version"`
  27. Standalone bool `json:"standalone"`
  28. }
  29. type ManifestData struct {
  30. Name string `json:"name"`
  31. Tag string `json:"tag"`
  32. Architecture string `json:"architecture"`
  33. BlobSums []string `json:"blobSums"`
  34. History []string `json:"history"`
  35. SchemaVersion int `json:"schemaVersion"`
  36. }
  37. type APIVersion int
  38. func (av APIVersion) String() string {
  39. return apiVersions[av]
  40. }
  41. var DefaultAPIVersion APIVersion = APIVersion1
  42. var apiVersions = map[APIVersion]string{
  43. 1: "v1",
  44. 2: "v2",
  45. }
  46. const (
  47. APIVersion1 = iota + 1
  48. APIVersion2
  49. )