Documentation
¶
Index ¶
- type ActionType
- type Dim
- func (d *Dim) AddLabel(parent string, labels []string, tag string) error
- func (d *Dim) AsIndexImage(image string) (*IndexImage, error)
- func (d *Dim) GetImageInfo(image string) (string, []string, error)
- func (d *Dim) GetImageLabels(image string) (map[string]string, error)
- func (d *Dim) PrintImageInfo(w io.Writer, image string, tpl *template.Template) error
- func (d *Dim) Pull(image string) error
- func (d *Dim) Push(image string) error
- func (d *Dim) Remove(image string) error
- func (d *Dim) RemoveLabel(parent string, labels []string, tag string) error
- type IndexImage
- type IndexResults
- type Info
- type NotificationJob
- type RegistryClient
- type RegistryImage
- type RegistryIndex
- type RegistryProxy
- type Repository
- type SearchResult
- type SearchResults
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
type ActionType string
ActionType indicates the kind of a NotificationJob
const DeleteAction ActionType = "delete"
DeleteAction indicates a NotificationJob should delete an image from the index
const PushAction ActionType = "push"
PushAction indicates a NotificationJob should add or update an image in the index
type Dim ¶
type Dim struct {
Docker dockerClient.Docker
}
Dim is the client type that handle all client side interaction with docker daemon
func (*Dim) AddLabel ¶
AddLabel applies the given labels to the parent and tag the new created image with the given tag
func (*Dim) AsIndexImage ¶
func (d *Dim) AsIndexImage(image string) (*IndexImage, error)
AsIndexImage returns the IndexImage representation of an image metadata
func (*Dim) GetImageInfo ¶
GetImageInfo returns the imageID and tags of an image
func (*Dim) GetImageLabels ¶
GetImageLabels returns all the labels of a given image
func (*Dim) PrintImageInfo ¶
PrintImageInfo writes image information to the writer
func (*Dim) RemoveLabel ¶
RemoveLabel clear the given labels to image parent and applies the fiven tag to the newly bulit image. Labels cannot be deleted so their value is only reset to an empty string TODO Implement remove labels by pattern
type IndexImage ¶
type IndexImage struct {
ID string
Name string
FullName string
Tag string
Comment string
Created time.Time
Author string
Label map[string]string
Labels []string
Volumes []string
ExposedPorts []int
Env map[string]string
Envs []string
Size int64
}
IndexImage is an Image modeling for indexation
func (IndexImage) Type ¶
func (im IndexImage) Type() string
Type implementation of bleve.Classifier interface
type IndexResults ¶
type IndexResults struct {
Total uint64
Images []*IndexImage
}
IndexResults contains all results of a given index search
type Info ¶
type Info struct {
// Version returns the version of dim running server side
Version string `json:"version"`
// Uptime returns the server uptime in nanoseconds
Uptime string `json:"uptime"`
}
Info represents the server version endpoint payload
type NotificationJob ¶
type NotificationJob struct {
Action ActionType
Repository string
Tag string
Digest digest.Digest
}
NotificationJob stores info to reindex an image after a push or deletion
type RegistryClient ¶
type RegistryClient interface {
client.Registry
NewRepository(parsedName reference.Named) (Repository, error)
Search(query, advanced string, offset, maxResults int) (*SearchResults, error)
WalkRepositories() <-chan Repository
PrintImageInfo(out io.Writer, parsedName reference.Named, tpl *template.Template) error
DeleteImage(parsedName reference.Named) error
ServerVersion() (*Info, error)
}
RegistryClient defines method to interact with a docker registry
type RegistryImage ¶
RegistryImage is an Image representation from the registry
type RegistryIndex ¶
type RegistryIndex interface {
Build() <-chan bool
GetImage(repository, tag string, dg digest.Digest) (*IndexImage, error)
IndexImage(image *IndexImage)
DeleteImage(id string)
SearchImages(q, a string, fields []string, offset, maxResults int) (*IndexResults, error)
Submit(job *NotificationJob)
FindImage(id string) (*IndexImage, error)
}
RegistryIndex defines method to manage the indexation of a docker registry
type RegistryProxy ¶
type RegistryProxy interface {
Forwards(w http.ResponseWriter, r *http.Request)
}
RegistryProxy forwards request to a docker registry if user is granted
type Repository ¶
type Repository interface {
distribution.Repository
AllTags() ([]string, error)
Image(tag string) (img *RegistryImage, err error)
ImageFromManifest(tagDigest digest.Digest, tag string) (img *RegistryImage, err error)
DeleteImage(tag string) error
WalkImages() <-chan *RegistryImage
}
Repository interface defines methods exposed by a registry repository
type SearchResult ¶
type SearchResult struct {
// StarCount indicates the number of stars this repository has (not supported in private registry)
StarCount int `json:"star_count"`
// IsOfficial is true if the result is from an official repository. (not supported in private registry)
IsOfficial bool `json:"is_official"`
// Name is the name of the repository
Name string `json:"name"`
// IsAutomated indicates whether the result is automated (not supported in private registry)
IsAutomated bool `json:"is_automated"`
// Description is a textual description of the repository (filled with the tag of the repo)
Description string `json:"description"`
// Tag identifie one version of the image
Tag string `json:"tag"`
// FullName stores the fully qualified name of the image
FullName string `json:"full_name"`
// Created is the time when the image was created
Created time.Time `json:"created"`
// Label is an array holding all the labels applied to an image
Label map[string]string `json:"label"`
// Volumes is an array holding all volumes declared by the image
Volumes []string `json:"volumes"`
// Exposed port is an array containing all the ports exposed by an image
ExposedPorts []int `json:"exposed_ports"`
// Env is a map of all environment variables
Env map[string]string `json:"env"`
// Size is the size of the image
Size int64 `json:"size"`
}
SearchResult describes a search result returned from a registry
type SearchResults ¶
type SearchResults struct {
// Query contains the query string that generated the search results
Query string `json:"query"`
// NumResults indicates the number of results the query returned
NumResults int `json:"num_results"`
// Results is a slice containing the actual results for the search
Results []SearchResult `json:"results"`
}
SearchResults lists a collection search results returned from a registry