manager

package
v0.0.0-...-c95a057 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const STATUS_DOWN = "DOWN"
View Source
const STATUS_UP = "UP"

Variables

View Source
var KeywordMapping = map[string]KeywordInfo{
	`ArtText`:       {`arttext-icon`, `dark-purple`, []string{`\.artx`}},
	`Atom`:          {`atom-icon`, `dark-green`, []string{`\.atom`}},
	`Bower`:         {`bower-icon`, `medium-orange`, []string{`bower[-_]components`, `\.(bowerrc|bower\.json|Bowerfile)`}},
	`Chef`:          {`chef-icon`, `dark-purple`, []string{`\.chef`}},
	`CircleCI`:      {`circleci-icon`, `dark-purple`, []string{`\.circleci`, `circle\.yml`}},
	`Docker`:        {`docker-icon`, `dark-blue`, []string{`docker`}},
	`Dropbox`:       {`dropbox-icon`, `medium-blue`, []string{`(Dropbox|\.dropbox\.cache)`}},
	`Emacs`:         {`emacs-icon`, `medium-purple`, []string{`\.emacs`}},
	`Framework`:     {`dylib-icon`, `medium-yellow`, []string{`\.framework`}},
	`Git`:           {`git-icon`, `medium-red`, []string{`\.git`, `git`}},
	`Github`:        {`fa-github`, `medium-orange`, []string{`\.github`}},
	`Gitlab`:        {`gitlab-icon`, `medium-orange`, []string{`\.gitlab`, `\.gitlab-ci\.yml`}},
	`Meteor`:        {`meteor-icon`, `dark-orange`, []string{`\.meteor`}},
	`Mercurial`:     {`hg-icon`, `dark-orange`, []string{`\.hg`, `mercurial`}},
	`Packet`:        {`package-icon`, `medium-green`, []string{`(bundle|paket)`}},
	`SVN`:           {`svn-icon`, `medium-yellow`, []string{`\.svn`, `subversion`}},
	`Textmate`:      {`textmate-icon`, `medium-green`, []string{`\.tmbundle`}},
	`Vagrant`:       {`vagrant-icon`, `medium-cyan`, []string{`\.vagrant`}},
	`Visual Studio`: {`vs-icon`, `medium-blue`, []string{`\.vscode`}},
	`Xcode`:         {`appstore-icon`, `medium-cyan`, []string{`\.xcodeproj`}},
	`Debian`:        {`debian-icon`, `medium-red`, []string{`[a-zA-Z0-9]+\.deb\s+`}},
	`Go`:            {`go-icon`, `medium-blue`, []string{`[a-zA-Z0-9]+\.go\s+`, `GOPATH`, `GOLANG`, `GOROOT`}},
	`Zimpl`:         {`zimpl-icon`, `medium-orange`, []string{`\.(zimpl|zmpl|zpl) `}},
	`Vue`:           {`vue-icon`, `light-green`, []string{`\.vue `}},
	`Ruby`:          {`ruby-icon`, `medium-red`, []string{`\.(rb|ru|ruby|erb|gemspec|god|mspec|pluginspec|podspec|rabl|rake|opal|rails) `}},
	`Rust`:          {`rust-icon`, `medium-maroon`, []string{`\.(rs|\.rlib)`}},
	`R`:             {`r-icon`, `medium-blue`, []string{`\.(r|Rprofile|rsx|rd) `}},
	`Python`:        {`python-icon`, `dark-blue`, []string{`\.(py|\.ipy|pep|py3|\.pyi) `}},
	`Perl`:          {`perl-icon`, `medium-blue`, []string{`\.(pl|perl|pm) `}},
	`Perl6`:         {`perl6-icon`, `medium-purple`, []string{`\.(pl6|p6l|p6m) `}},
	`PHP`:           {`php-icon`, `dark-blue`, []string{`\.php `}},
	`PHPUnit`:       {`phpunit-icon`, `medium-purple`, []string{`\.phpunit\.xml `}},
	`Objective-C`:   {`objc-icon`, `dark-red`, []string{`\.objc`}},
	`NPM`:           {`npm-icon`, `medium-red`, []string{`package\.json|\.npmignore|\.?npmrc|npm-debug\.log|npm-shrinkwrap\.json|package-lock\.json `}},
	`NodeJS`:        {`node-icon`, `medium-green`, []string{`\.(njs|nvmrc|node|node-version) `, `node_modules`}},
	`NGINX`:         {`nginx-icon`, `dark-green`, []string{`nginx\.conf`}},
	`MATLAB`:        {`matlab-icon`, `medium-yellow`, []string{`\.matlab`}},
	`Kotlin`:        {`kotlin-icon`, `dark-blue`, []string{`\.(kt|ktm|kts) `}},
	`Jenkins`:       {`jenkins-icon`, `medium-red`, []string{`Jenkinsfile`}},
	`Java`:          {`java-icon`, `medium-purple`, []string{`\.java `}},
	`Javascript`:    {`js-icon`, `medium-yellow`, []string{`\.(js|_js|jsb|jsm|jss|es6|es|mjs|sjs|ssjs|xsjs|dust) `}},
	`HTML`:          {`html5-icon`, `medium-orange`, []string{`\.html `}},
	`Gulp`:          {`gulp-icon`, `medium-red`, []string{`gulpfile\.js`, `gulpfile\.coffe`, `gulpfile\.babel\.js `}},
	`Erlang`:        {`erlang-icon`, `medium-red`, []string{`\.erl `}},
	`Dart`:          {`dart-icon`, `medium-cyan`, []string{`\.dart `}},
	`CoffeeScript`:  {`coffee-icon`, `medium-maroon`, []string{`\.coffee `}},
	`Clojure`:       {`clojure-icon`, `medium-cyan`, []string{`\.(clj|cl2|cljc|cljx|hic) `}},
	`ClojureScript`: {`cljs-icon`, `dark-cyan`, []string{`\.cljs `}},
	`CMake`:         {`cmake-icon`, `medium-green`, []string{`\.cmake `}},
	`C`:             {`c-icon`, `medium-blue`, []string{`\.(c|h) `}},
	`C++`:           {`cpp-icon`, `light-blue`, []string{`\.(cpp|hpp) `}},
	`C#`:            {`csharp-icon`, `darker-blue`, []string{`\.(csharp|cs) `}},
	`Ansible`:       {`ansible-icon`, `dark-blue`, []string{`\.(ansible|ansible\.yaml|ansible\.yml) `}},
	`Alpine Linux`:  {`alpine-icon`, `dark-blue`, []string{`\.APKBUILD `, ` apk `}},
}

KeywordMapping keywords, icons, colors, and extensions taken heavily from file-icons atom see https://github.com/file-icons/atom for their amazing work

Functions

func Keywords

func Keywords(s string) (keywords []string)

Keywords takes in any meta information strings and returns the keywordMapping key by testing the string against any regex in the KeywordMapping map

Types

type Command

type Command struct {
	Cmd      string
	Keywords []string
}

Command represents any command in the Dockerfile, using the commands keywords are parsed from the extensions

func (*Command) KeywordTags

func (c *Command) KeywordTags() string

KeywordTags returns space delimited list of keywords for the given tag

type Envelope

type Envelope struct {
	Events []Event
}

Envelope contains all grouped events sent by the registries. see https://docs.docker.com/registry/notifications/#envelope for more details

func (*Envelope) Process

func (e *Envelope) Process()

Process adds each individual event to the map of all events

type Event

type Event struct {
	ID        string `json:"id"`
	Timestamp string `json:"timestamp"`
	Action    string `json:"action"`
	Target    struct {
		MediaType  string `json:"mediaType"`
		Size       int    `json:"size"`
		Digest     string `json:"digest"`
		Length     int    `json:"length"`
		Repository string `json:"repository"`
		URL        string `json:"url"`
		Tag        string `json:"tag"`
	} `json:"target"`
	Request struct {
		ID        string `json:"id"`
		Addr      string `json:"addr"`
		Host      string `json:"host"`
		Method    string `json:"method"`
		Useragent string `json:"useragent"`
	} `json:"request"`
	Actor struct {
	} `json:"actor"`
	Source struct {
		Addr       string `json:"addr"`
		InstanceID string `json:"instanceID"`
	} `json:"source"`
}

Event contains all information for the given event (e.g pull/pushes to the registry) see https://docs.docker.com/registry/notifications/#events for more details

type Events

type Events struct {
	sync.Mutex
	Events map[string]map[string]Event
}

Events contains event information in the structure registry->event_id->event

var AllEvents Events

AllEvents contains all events received for each individual registry, to read or write from the list of events the mutex needs to be used to ensure consistency

type KeywordInfo

type KeywordInfo struct {
	Icon   string
	Color  string
	Regexp []string
}

KeywordInfo contains information used by the front end to build the label

type Registries

type Registries struct {
	Registries map[string]*Registry
	sync.Mutex
}

Registries contains a map of all active registries identified by their name, locked when necessary

var AllRegistries Registries

AllRegistries contains a list of added registries using their hostnames access granted via mutex locks/unlocks

type Registry

type Registry struct {
	*client.Registry
	Repositories map[string]*Repository
	TTL          time.Duration
	Ticker       *time.Ticker
	Name         string
	Host         string
	Scheme       string
	Version      string
	Port         int
	sync.Mutex
	// contains filtered or unexported fields
}

func AddRegistry

func AddRegistry(scheme, host, user, password string, port int, ttl time.Duration, skipTLS bool) (*Registry, error)

AddRegistry adds the new registry for viewing in the interface and sets up the go routine for automatic refreshes

func (*Registry) IP

func (r *Registry) IP() string

func (*Registry) LayerCount

func (r *Registry) LayerCount() int

TagCount returns the total number of layers across all repositories

func (*Registry) Pulls

func (r *Registry) Pulls() (pulls int)

Pulls returns the number of pulls recorded by passing the forwarded registry events

func (*Registry) Pushes

func (r *Registry) Pushes() (pushes int)

Pushes returns the number of pushes recorded by passing the forwarded registry events

func (*Registry) Refresh

func (r *Registry) Refresh()

Refresh is called with the configured TTL time for the given registry

func (*Registry) Status

func (r *Registry) Status() string

Status returns the text representation of whether the registry is reachable

func (*Registry) TagCount

func (r *Registry) TagCount() (count int)

TagCount returns the total number of tags across all repositories

type Repository

type Repository struct {
	Name string
	Tags map[string]*Tag
}

func (*Repository) LastModified

func (r *Repository) LastModified() time.Time

LastModified returns the most recent time a tag was modified using the history field of each tag

func (*Repository) Size

func (r *Repository) Size() (size int64)

Size returns the deduplicated total byte size of all digests in the repo

type Tag

type Tag struct {
	*manifestV2.DeserializedManifest
	ID   string
	Name string
	*V1Compatibility
	Size int64
}

Tag contains all v1 compatibility and manifest information return by the registry

func (*Tag) LastModified

func (t *Tag) LastModified() (lastModified time.Time)

LastModified returns the latest last modified time using the history fields

type V1Compatibility

type V1Compatibility struct {
	Architecture string `json:"architecture"`
	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"`
		Tty          bool        `json:"Tty"`
		OpenStdin    bool        `json:"OpenStdin"`
		StdinOnce    bool        `json:"StdinOnce"`
		Env          []string    `json:"Env"`
		Cmd          []string    `json:"Cmd"`
		ArgsEscaped  bool        `json:"ArgsEscaped"`
		Image        string      `json:"Image"`
		Volumes      interface{} `json:"Volumes"`
		WorkingDir   string      `json:"WorkingDir"`
		Entrypoint   interface{} `json:"Entrypoint"`
		OnBuild      interface{} `json:"OnBuild"`
		Labels       struct {
		} `json:"Labels"`
	} `json:"config"`
	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"`
		Tty          bool        `json:"Tty"`
		OpenStdin    bool        `json:"OpenStdin"`
		StdinOnce    bool        `json:"StdinOnce"`
		Env          []string    `json:"Env"`
		Cmd          []string    `json:"Cmd"`
		ArgsEscaped  bool        `json:"ArgsEscaped"`
		Image        string      `json:"Image"`
		Volumes      interface{} `json:"Volumes"`
		WorkingDir   string      `json:"WorkingDir"`
		Entrypoint   interface{} `json:"Entrypoint"`
		OnBuild      interface{} `json:"OnBuild"`
		Labels       struct {
		} `json:"Labels"`
	} `json:"container_config"`
	Created       time.Time `json:"created"`
	DockerVersion string    `json:"docker_version"`
	History       []struct {
		Created       time.Time                `json:"created"`
		Author        string                   `json:"author,omitempty"`
		CreatedBy     string                   `json:"created_by,omitempty"`
		Comment       string                   `json:"comment,omitempty"`
		EmptyLayer    bool                     `json:"empty_layer,omitempty"`
		ManifestLayer *distribution.Descriptor `json:"manifest_layer"`
		ShellType     string
		Commands      []Command
	} `json:"history"`
	Os     string `json:"os"`
	Rootfs struct {
		Type      string   `json:"type"`
		DiffIDs   []string `json:"diff_ids,omitempty"`
		BaseLayer string   `json:"base_layer,omitempty"`
	} `json:"rootfs"`
}

V1Compatibility contains meta information for when each layer contained its own configuration for each stage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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