packages

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2017 License: BSD-3-Clause Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrForbidden                     = errors.New("forbidden")
	ErrDomainNotFound                = errors.New("domain not found")
	ErrDomainAlreadyExists           = errors.New("domain already exists")
	ErrDomainFQDNRequired            = errors.New("domain fqdn required")
	ErrDomainOwnerUserIDRequired     = errors.New("domain owner user id required")
	ErrUserDoesNotExist              = errors.New("user does not exist")
	ErrUserExists                    = errors.New("user exists")
	ErrPackageNotFound               = errors.New("package not found")
	ErrPackageAlreadyExists          = errors.New("package already exists")
	ErrPackageDomainRequired         = errors.New("package domain required")
	ErrPackagePathRequired           = errors.New("package path required")
	ErrPackageVCSRequired            = errors.New("package vcs required")
	ErrPackageRepoRootRequired       = errors.New("package repository root required")
	ErrPackageRepoRootInvalid        = errors.New("package repository root invalid")
	ErrPackageRepoRootSchemeRequired = errors.New("package repository root scheme required")
	ErrPackageRepoRootSchemeInvalid  = errors.New("package repository root scheme invalid")
	ErrPackageRepoRootHostInvalid    = errors.New("package repository root host invalid")
	ErrPackageRefChangeRejected      = errors.New("Package Reference Change Rejected")
	ErrChangelogRecordNotFound       = errors.New("changelog record not found")
)

Errors that are related to the Packages Service.

View Source
var VCSSchemes = map[VCS][]string{
	VCSGit:        {"https", "http", "git", "git+ssh", "ssh"},
	VCSMercurial:  {"https", "http", "ssh"},
	VCSBazaar:     {"https", "http", "bzr", "bzr+ssh"},
	VCSSubversion: {"https", "http", "svn", "svn+ssh"},
}

Functions

This section is empty.

Types

type Action

type Action string
var (
	ActionAddDomain        Action = "add-domain"
	ActionUpdateDomain     Action = "update-domain"
	ActionDeleteDomain     Action = "delete-domain"
	ActionDomainAddUser    Action = "domain-add-user"
	ActionDomainRemoveUser Action = "domain-remove-user"
	ActionAddPackage       Action = "add-package"
	ActionUpdatePackage    Action = "update-package"
	ActionDeletePackage    Action = "delete-package"
)

type Change

type Change struct {
	Field string  `json:"field"`
	From  *string `json:"from,omitempty"`
	To    *string `json:"to,omitempty"`
}

func (Change) FromString

func (c Change) FromString() string

func (Change) ToString

func (c Change) ToString() string

type Changelog

type Changelog struct {
	Records  ChangelogRecords `json:"records"`
	Previous string           `json:"previous,omitempty"`
	Next     string           `json:"next,omitempty"`
	Count    int              `json:"count,omitempty"`
}

type ChangelogRecord

type ChangelogRecord struct {
	ID        string    `json:"id,omitempty"`
	Time      time.Time `json:"time,omitempty"`
	DomainID  string    `json:"domain-id,omitempty"`
	FQDN      string    `json:"fqdn,omitempty"`
	PackageID string    `json:"package-id,omitempty"`
	Path      string    `json:"path,omitempty"`
	UserID    string    `json:"user-id,omitempty"`
	Action    Action    `json:"action,omitempty"`
	Changes   Changes   `json:"changes,omitempty"`
}

func (ChangelogRecord) ImportPrefix

func (c ChangelogRecord) ImportPrefix() string

type ChangelogRecords

type ChangelogRecords []ChangelogRecord

type ChangelogService

type ChangelogService interface {
	ChangelogRecord(domainRef, id string) (*ChangelogRecord, error)
	DeleteChangelogRecord(domainRef, id string) (*ChangelogRecord, error)
	ChangelogForDomain(domainRef, start string, limit int) (Changelog, error)
}

type Changes

type Changes []Change

type Domain

type Domain struct {
	ID                string `json:"id"`
	FQDN              string `json:"fqdn"`
	OwnerUserID       string `json:"owner-user-id,omitempty"`
	CertificateIgnore bool   `json:"certificate-ignore,omitempty"`
	Disabled          bool   `json:"disabled,omitempty"`

	// Internal functionality fields (changes not logged)
	CertificateIgnoreMissing bool `json:"certificate-ignore-missing,omitempty"`
}

type DomainOptions

type DomainOptions struct {
	FQDN              *string `json:"fqdn,omitempty"`
	OwnerUserID       *string `json:"owner-user-id,omitempty"`
	CertificateIgnore *bool   `json:"certificate-ignore,omitempty"`
	Disabled          *bool   `json:"disabled,omitempty"`

	CertificateIgnoreMissing *bool `json:"certificate-ignore-missing,omitempty"`
}

type DomainService

type DomainService interface {
	Domain(ref string) (*Domain, error)
	AddDomain(o *DomainOptions, byUserID string) (*Domain, error)
	UpdateDomain(ref string, o *DomainOptions, byUserID string) (*Domain, error)
	DeleteDomain(ref, byUserID string) (*Domain, error)
	DomainUsers(ref string) (DomainUsers, error)
	AddUserToDomain(ref, userID, byUserID string) error
	RemoveUserFromDomain(ref, userID, byUserID string) error
	Domains(startFQDN string, limit int) (DomainsPage, error)
	DomainsByUser(userID, startRef string, limit int) (DomainsPage, error)
	DomainsByOwner(userID, startRef string, limit int) (DomainsPage, error)
}

type DomainUsers

type DomainUsers struct {
	OwnerUserID string   `json:"owner-user-id"`
	UserIDs     []string `json:"user-ids,omitempty"`
}

type Domains

type Domains []Domain

type DomainsPage

type DomainsPage struct {
	Domains  Domains `json:"domains"`
	UserID   string  `json:"user-id,omitempty"`
	Previous string  `json:"previous,omitempty"`
	Next     string  `json:"next,omitempty"`
	Count    int     `json:"count,omitempty"`
}

type Package

type Package struct {
	ID          string  `json:"id"`
	Domain      *Domain `json:"domain,omitempty"`
	Path        string  `json:"path"`
	VCS         VCS     `json:"vcs"`
	RepoRoot    string  `json:"repo-root"`
	RefType     RefType `json:"ref-type"`
	RefName     string  `json:"ref-name"`
	GoSource    string  `json:"go-source,omitempty"`
	RedirectURL string  `json:"redirect-url,omitempty"`
	Disabled    bool    `json:"disabled,omitempty"`
}

Package hods data that represents Go package location and metadate for remotr import path. https://golang.org/cmd/go/#hdr-Remote_import_paths

func (Package) ImportPrefix

func (p Package) ImportPrefix() string

type PackageOptions

type PackageOptions struct {
	Domain      *string  `json:"domain,omitempty"`
	Path        *string  `json:"path,omitempty"`
	VCS         *VCS     `json:"vcs,omitempty"`
	RepoRoot    *string  `json:"repo-root,omitempty"`
	RefType     *RefType `json:"ref-type"`
	RefName     *string  `json:"ref-name"`
	GoSource    *string  `json:"go-source,omitempty"`
	RedirectURL *string  `json:"redirect-url,omitempty"`
	Disabled    *bool    `json:"disabled,omitempty"`
}

type PackageResolution

type PackageResolution struct {
	ImportPrefix string  `json:"import-prefix"`
	VCS          VCS     `json:"vcs"`
	RepoRoot     string  `json:"repo-root"`
	RefType      RefType `json:"ref-type"`
	RefName      string  `json:"ref-name"`
	GoSource     string  `json:"go-source,omitempty"`
	RedirectURL  string  `json:"redirect-url,omitempty"`
	Disabled     bool    `json:"disabled,omitempty"`
}

type PackageService

type PackageService interface {
	Package(id string) (*Package, error)
	AddPackage(o *PackageOptions, byUserID string) (*Package, error)
	UpdatePackage(id string, o *PackageOptions, byUserID string) (*Package, error)
	DeletePackage(id string, byUserID string) (*Package, error)
	PackagesByDomain(domainRef, startName string, limit int) (PackagesPage, error)
	ResolvePackage(path string) (*PackageResolution, error)
}

type Packages

type Packages []Package

type PackagesPage

type PackagesPage struct {
	Packages Packages `json:"packages"`
	Domain   *Domain  `json:"domain,omitempty"`
	Previous string   `json:"previous,omitempty"`
	Next     string   `json:"next,omitempty"`
	Count    int      `json:"count,omitempty"`
}

type RefType added in v0.5.1

type RefType string
const (
	RefTypeBranch RefType = "branch"
	RefTypeTag    RefType = "tag"
)

type Service

type Service interface {
	DomainService
	PackageService
	ChangelogService
}

type VCS

type VCS string
var (
	VCSGit        VCS = "git"
	VCSMercurial  VCS = "hg"
	VCSBazaar     VCS = "bzr"
	VCSSubversion VCS = "svn"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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