registry

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2016 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Registry
	CodeRegistryGetManifestError          = "503-14001"
	CodeRegistryManifestParseError        = "503-14002"
	CodeRegistryManifestDeleteError       = "503-14003"
	CodeRegistryImagePublicityParamError  = "503-14004"
	CodeRegistryImagePublicityUpdateError = "503-14005"
	CodeRegistryCatalogListError          = "503-14006"
	CodeRegistryTagsListError             = "503-14007"
	CodeRegistryGetBasicAuthFailed        = "400-14008"
	CodeRegistryUnauthorized              = "401-14009"
	CodeRegistryMakeTokenFailed           = "503-14010"
	CodeNamespaceParamError               = "406-14011"
	CodeNamespaceMisMatchedPatternError   = "406-14012"
	CodeSaveNamespaceError                = "409-14013"
	CodeGetNamespaceError                 = "400-14014"
)

Variables

This section is empty.

Functions

func Init

func Init(accountAuthenticator, registryPrivateKeyPath, registryAddr, dbDriver, dbDsn string, dbClient *gorm.DB)

func LikeParam

func LikeParam(like string) string

Types

type Actor

type Actor struct {
	Name string
}

Actor holds information about actor.

type Event

type Event struct {
	ID        string `json:"Id"`
	TimeStamp time.Time
	Action    string
	Target    *Target
	Request   *Request
	Actor     *Actor
}

Event holds the details of a event.

type Image

type Image struct {
	ID        uint64
	CreatedAt time.Time
	UpdatedAt time.Time

	LatestTag string `json:"LatestTag"`
	Namespace string `json:"Namespace" gorm:"not null"`
	Image     string `json:"Image" gorm:"not null"`
	Publicity uint8  `json:"Publicity" gorm:"not null default 0"`

	PushCount int64 `json:"PushCount" gorm:"-"`
	PullCount int64 `json:"PullCount" gorm:"-"`
}

type ImageAccess

type ImageAccess struct {
	ID        uint64
	CreatedAt time.Time
	UpdatedAt time.Time

	Namespace    string `json:"Namespace" gorm:"not null"`
	Image        string `json:"Image" gorm:"not null"`
	Digest       string `json:"Digest"`
	AccountEmail string `json:"AccountEmail"`
	Action       string `json:"Action"`
}

type Namespace added in v1.0.6

type Namespace struct {
	Namespace string `json:"Namespace"`
}

type NamespaceEmail added in v1.0.6

type NamespaceEmail struct {
	ID        uint64
	CreatedAt time.Time
	UpdatedAt time.Time

	Namespace    string `json:"Namespace" gorm:"not null" sql:"unique"`
	AccountEmail string `json:"AccountEmail" gorm:"not null" sql:"unique"`
}

type Notification

type Notification struct {
	Events []Event
}

Notification holds all events.

type Registry

type Registry struct {
	DbClient      *gorm.DB
	Authenticator auth.Authenticator

	AccountAuthenticator string
	PrivateKeyPath       string
	RegistryAddr         string
}

func NewRegistry

func NewRegistry(AccountAuthenticator string, PrivateKeyPath string, RegistryAddr string, DbDriver string, DbDSN string, dbClient *gorm.DB) *Registry

func (*Registry) ApiRegister

func (registry *Registry) ApiRegister(router *gin.Engine, middlewares ...gin.HandlerFunc)

func (*Registry) DeleteManifests

func (registry *Registry) DeleteManifests(ctx *gin.Context)

func (*Registry) FilterAccess

func (registry *Registry) FilterAccess(username string, authenticated bool, a *token.ResourceActions)

FilterAccess modify the action list in access based on permission determine if the request needs to be authenticated.

func (*Registry) GenTokenForUI

func (registry *Registry) GenTokenForUI(username, service, scope string) (string, error)

func (*Registry) GetManifests

func (registry *Registry) GetManifests(ctx *gin.Context)

func (*Registry) GetPermission

func (registry *Registry) GetPermission(username, namespace, image string) string

func (*Registry) HandleNotification

func (registry *Registry) HandleNotification(n Event)

func (*Registry) ImagePublicity

func (registry *Registry) ImagePublicity(ctx *gin.Context)

func (*Registry) LogImageAccess

func (registry *Registry) LogImageAccess(n Event)

func (*Registry) MakeToken

func (registry *Registry) MakeToken(privateKeyPath, username, service string, access []*token.ResourceActions) (string, error)

func (*Registry) MineRepositories

func (registry *Registry) MineRepositories(ctx *gin.Context)

func (*Registry) Namespace added in v1.0.6

func (registry *Registry) Namespace(ctx *gin.Context)

func (*Registry) Notifications

func (registry *Registry) Notifications(ctx *gin.Context)

func (*Registry) ParseResourceActions

func (registry *Registry) ParseResourceActions(scope string) []*token.ResourceActions

GetResourceActions ...

func (*Registry) PublicRepositories

func (registry *Registry) PublicRepositories(ctx *gin.Context)

func (*Registry) RegistryAPI

func (registry *Registry) RegistryAPI(method, path, username, acceptHeader string) ([]byte, string, error)

the following code borrowed from vmvare/Harbor project

func (*Registry) RegistryAPIDelete

func (registry *Registry) RegistryAPIDelete(path, username string) ([]byte, string, error)

func (*Registry) RegistryAPIDeleteSchemaV2

func (registry *Registry) RegistryAPIDeleteSchemaV2(path, username string) ([]byte, string, error)

func (*Registry) RegistryAPIGet

func (registry *Registry) RegistryAPIGet(path, username string) ([]byte, string, error)

func (*Registry) RegistryAPIGetSchemaV1

func (registry *Registry) RegistryAPIGetSchemaV1(path, username string) ([]byte, string, error)

func (*Registry) RegistryAPIGetSchemaV2

func (registry *Registry) RegistryAPIGetSchemaV2(path, username string) ([]byte, string, error)

func (*Registry) RegistryAPIHeadSchemaV2

func (registry *Registry) RegistryAPIHeadSchemaV2(path, username string) ([]byte, string, error)

func (*Registry) RegistryNamespaceForAccount added in v1.0.6

func (registry *Registry) RegistryNamespaceForAccount(a auth.Account) string

func (*Registry) SizeAndReferenceForTag

func (registry *Registry) SizeAndReferenceForTag(url string, account string) (uint64, string, error)

func (*Registry) TagList

func (registry *Registry) TagList(ctx *gin.Context)

func (*Registry) Token

func (registry *Registry) Token(ctx *gin.Context)

type Request

type Request struct {
	ID        string `json:"Id"`
	Method    string
	UserAgent string
}

Request holds information about a request.

type Tag

type Tag struct {
	ID        uint64
	CreatedAt time.Time
	UpdatedAt time.Time

	Digest    string `json:"Digest"`
	Tag       string `json:"Tag"`
	Namespace string `json:"Namespace" gorm:"not null"`
	Image     string `json:"Image" gorm:"not null"`
	Size      uint64 `json:"Size"`

	PushCount int64 `json:"PushCount" gorm:"-"`
	PullCount int64 `json:"PullCount" gorm:"-"`
}

type Target

type Target struct {
	MediaType  string
	Digest     string
	Repository string
	URL        string `json:"Url"`
}

Target holds information about the target of a event.

type V2RegistryResponse

type V2RegistryResponse struct {
	SchemaVersion int                      `json:"schemaVersion"`
	MediaType     string                   `json:"mediaType"`
	Config        V2RegistryResponseConfig `json:"config"`
	Layers        V2RegistryResponseLayers `json:"layers"`
}

type V2RegistryResponseConfig

type V2RegistryResponseConfig struct {
	MediaType string `json:"mediaType"`
	Size      uint64 `json:"size"`
	Digest    string `json:"digest"`
}

type V2RegistryResponseLayer

type V2RegistryResponseLayer struct {
	MediaType string `json:"mediaType"`
	Size      uint64 `json:"size"`
	Digest    string `json:"digest"`
}

type V2RegistryResponseLayers

type V2RegistryResponseLayers []V2RegistryResponseLayer

Jump to

Keyboard shortcuts

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