registry

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ActiveRegistries map[string]Registry

ActiveRegistries contains a map of all active registries identified by their name

Functions

func DeleteTag

func DeleteTag(registryName string, repositoryName string, tag string) (bool, error)

DeleteTag deletes the tag by first getting its docker-content-digest, and then using the digest received the function deletes the manifest

Documentation: DELETE /v2/<name>/manifests/<reference> Manifest Delete the manifest identified by name and reference. Note that a manifest can only be deleted by digest.

func GetRegistryStatus

func GetRegistryStatus(registryURI string) error

GetRegistryStatus takes in a registry URL and checks for communication errors

Create and execute basic GET request to test if each registry can be reached To determine registry status we test the base registry route of /v2/ and check the HTTP response code for a 200 response (200 is a successful request)

Types

type History

type History struct {
	V1CompatibilityStr string `json:"V1Compatibility"`
	V1Compatibility    V1Compatibility
}

History contains the v1 compatibility string and marshaled json

type Image

type Image struct {
	Name          string
	Tag           string
	SchemaVersion int
	Architecture  string
	TagID         uint
	History       []History `json:"history"`
	FsLayers      []struct {
		BlobSum string `json:"blobSum"`
	} `json:"fsLayers"`
}

Image contains all information related to the image

func GetImage

func GetImage(registryName string, repositoryName string, tagName string) (Image, error)

GetImage returns the image information for a given tag HEAD /v2/<name>/manifests/<reference>

"name": <name>,
"tag": <tag>,
"fsLayers": [
	 {
			"blobSum": "<digest>"
	 },
	 ...
 ]
],
"history": <v1 images>,
"signature": <JWS>

type Registry

type Registry struct {
	Name    string
	IP      string
	Scheme  string
	Port    string
	Version string
}

Registry contains all identifying information for communicating with a registry

func ParseRegistry

func ParseRegistry(registryURI string) (Registry, error)

ParseRegistry takes in a registry URI string and converts it into a registry object

func (*Registry) GetURI

func (r *Registry) GetURI() string

GetURI returns the full url path for communicating with this registry

type RepositoriesList

type RepositoriesList struct {
	Repositories []string
}

RepositoriesList contains a slice of all repositories

func GetRepositoriesFromRegistry

func GetRepositoriesFromRegistry(registryName string) (RepositoriesList, error)

GetRepositoriesFromRegistry returns a slice of repositories for this registry name

type Repository

type Repository struct {
	Name       string
	Registry   string
	EncodedURI string
	TagCount   int
}

Repository contains information on the name and encoded name

func GetRepositories

func GetRepositories(registryName string) []Repository

GetRepositories returns a slice of repositories with their names and encoded names

type TagForView

type TagForView struct {
	ID              string
	Name            string
	UpdatedTime     time.Time
	UpdatedTimeUnix int64
	TimeAgo         string
	Layers          int
	Size            string
}

type Tags

type Tags struct {
	Name string
	Tags []string
}

Tags contains a slice of tags for the given repository https://github.com/docker/distribution/blob/master/docs/spec/api.md#listing-image-tags

func GetTags

func GetTags(registryName string, repositoryName string) (Tags, error)

GetTags returns a slice of tags for a given repository and registry

type TagsForView

type TagsForView []TagForView

TagsForView contains a slice of TagsForView with the methods required to sort

func GetTagsForView

func GetTagsForView(registryName string, repositoryName string) (TagsForView, error)

GetTagsForView returns the sanitized tag structs with the required information for the tags template

func (TagsForView) Len

func (slice TagsForView) Len() int

func (TagsForView) Less

func (slice TagsForView) Less(i, j int) bool

func (TagsForView) Swap

func (slice TagsForView) Swap(i, j int)

type V1Compatibility

type V1Compatibility struct {
	ID              string    `json:"id"`
	Parent          string    `json:"parent"`
	Created         time.Time `json:"created"`
	Container       string    `json:"container"`
	ContainerConfig struct {
		Hostname        string        `json:"Hostname"`
		Domainname      string        `json:"Domainname"`
		User            string        `json:"User"`
		AttachStdin     bool          `json:"AttachStdin"`
		AttachStdout    bool          `json:"AttachStdout"`
		AttachStderr    bool          `json:"AttachStderr"`
		ExposedPorts    interface{}   `json:"ExposedPorts"`
		PublishService  string        `json:"PublishService"`
		Tty             bool          `json:"Tty"`
		OpenStdin       bool          `json:"OpenStdin"`
		StdinOnce       bool          `json:"StdinOnce"`
		Env             []string      `json:"Env"`
		Cmd             []string      `json:"Cmd"`
		Image           string        `json:"Image"`
		Volumes         interface{}   `json:"Volumes"`
		VolumeDriver    string        `json:"VolumeDriver"`
		WorkingDir      string        `json:"WorkingDir"`
		Entrypoint      interface{}   `json:"Entrypoint"`
		NetworkDisabled bool          `json:"NetworkDisabled"`
		MacAddress      string        `json:"MacAddress"`
		OnBuild         []interface{} `json:"OnBuild"`
		Labels          struct {
		} `json:"Labels"`
	} `json:"container_config"`
	DockerVersion string `json:"docker_version"`
	Config        struct {
		Hostname        string        `json:"Hostname"`
		Domainname      string        `json:"Domainname"`
		User            string        `json:"User"`
		AttachStdin     bool          `json:"AttachStdin"`
		AttachStdout    bool          `json:"AttachStdout"`
		AttachStderr    bool          `json:"AttachStderr"`
		ExposedPorts    interface{}   `json:"ExposedPorts"`
		PublishService  string        `json:"PublishService"`
		Tty             bool          `json:"Tty"`
		OpenStdin       bool          `json:"OpenStdin"`
		StdinOnce       bool          `json:"StdinOnce"`
		Env             []string      `json:"Env"`
		Cmd             []string      `json:"Cmd"`
		Image           string        `json:"Image"`
		Volumes         interface{}   `json:"Volumes"`
		VolumeDriver    string        `json:"VolumeDriver"`
		WorkingDir      string        `json:"WorkingDir"`
		Entrypoint      interface{}   `json:"Entrypoint"`
		NetworkDisabled bool          `json:"NetworkDisabled"`
		MacAddress      string        `json:"MacAddress"`
		OnBuild         []interface{} `json:"OnBuild"`
		Labels          struct {
		} `json:"Labels"`
	} `json:"config"`
	Architecture string `json:"architecture"`
	Os           string `json:"os"`
	Size         int    `json:"Size"`
	SizeStr      string `json:"-"`
}

V1Compatibility contains all information grabbed from the V1Compatibility field from registry v1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL