github.com/slowteetoe/docker@v1.7.1-rc3/registry/types.go (about)

     1  package registry
     2  
     3  type SearchResult struct {
     4  	StarCount   int    `json:"star_count"`
     5  	IsOfficial  bool   `json:"is_official"`
     6  	Name        string `json:"name"`
     7  	IsTrusted   bool   `json:"is_trusted"`
     8  	IsAutomated bool   `json:"is_automated"`
     9  	Description string `json:"description"`
    10  }
    11  
    12  type SearchResults struct {
    13  	Query      string         `json:"query"`
    14  	NumResults int            `json:"num_results"`
    15  	Results    []SearchResult `json:"results"`
    16  }
    17  
    18  type RepositoryData struct {
    19  	ImgList   map[string]*ImgData
    20  	Endpoints []string
    21  	Tokens    []string
    22  }
    23  
    24  type ImgData struct {
    25  	ID              string `json:"id"`
    26  	Checksum        string `json:"checksum,omitempty"`
    27  	ChecksumPayload string `json:"-"`
    28  	Tag             string `json:",omitempty"`
    29  }
    30  
    31  type RegistryInfo struct {
    32  	Version    string `json:"version"`
    33  	Standalone bool   `json:"standalone"`
    34  }
    35  
    36  type FSLayer struct {
    37  	BlobSum string `json:"blobSum"`
    38  }
    39  
    40  type ManifestHistory struct {
    41  	V1Compatibility string `json:"v1Compatibility"`
    42  }
    43  
    44  type ManifestData struct {
    45  	Name          string             `json:"name"`
    46  	Tag           string             `json:"tag"`
    47  	Architecture  string             `json:"architecture"`
    48  	FSLayers      []*FSLayer         `json:"fsLayers"`
    49  	History       []*ManifestHistory `json:"history"`
    50  	SchemaVersion int                `json:"schemaVersion"`
    51  }
    52  
    53  type APIVersion int
    54  
    55  func (av APIVersion) String() string {
    56  	return apiVersions[av]
    57  }
    58  
    59  var apiVersions = map[APIVersion]string{
    60  	1: "v1",
    61  	2: "v2",
    62  }
    63  
    64  // API Version identifiers.
    65  const (
    66  	APIVersionUnknown = iota
    67  	APIVersion1
    68  	APIVersion2
    69  )
    70  
    71  // RepositoryInfo Examples:
    72  // {
    73  //   "Index" : {
    74  //     "Name" : "docker.io",
    75  //     "Mirrors" : ["https://registry-2.docker.io/v1/", "https://registry-3.docker.io/v1/"],
    76  //     "Secure" : true,
    77  //     "Official" : true,
    78  //   },
    79  //   "RemoteName" : "library/debian",
    80  //   "LocalName" : "debian",
    81  //   "CanonicalName" : "docker.io/debian"
    82  //   "Official" : true,
    83  // }
    84  
    85  // {
    86  //   "Index" : {
    87  //     "Name" : "127.0.0.1:5000",
    88  //     "Mirrors" : [],
    89  //     "Secure" : false,
    90  //     "Official" : false,
    91  //   },
    92  //   "RemoteName" : "user/repo",
    93  //   "LocalName" : "127.0.0.1:5000/user/repo",
    94  //   "CanonicalName" : "127.0.0.1:5000/user/repo",
    95  //   "Official" : false,
    96  // }
    97  type IndexInfo struct {
    98  	Name     string
    99  	Mirrors  []string
   100  	Secure   bool
   101  	Official bool
   102  }
   103  
   104  type RepositoryInfo struct {
   105  	Index         *IndexInfo
   106  	RemoteName    string
   107  	LocalName     string
   108  	CanonicalName string
   109  	Official      bool
   110  }