packages

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2017 License: BSD-3-Clause Imports: 3 Imported by: 4

Documentation

Index

Constants

View Source
const (
	RefTypeBranch = "branch"
	RefTypeTag    = "tag"
)

Variables

View Source
var (
	Forbidden                 = NewError(403, "forbidden")
	DomainNotFound            = NewError(1000, "domain not found")
	DomainAlreadyExists       = NewError(1001, "domain already exists")
	DomainFQDNRequired        = NewError(1010, "domain fqdn required")
	DomainOwnerUserIDRequired = NewError(1020, "domain owner user id required")
	UserDoesNotExist          = NewError(1100, "user does not exist")
	UserExists                = NewError(1101, "user exists")
	PackageNotFound           = NewError(2000, "package not found")
	PackageAlreadyExists      = NewError(2001, "package already exists")
	PackageDomainRequired     = NewError(2010, "package domain required")
	PackagePathRequired       = NewError(2011, "package path required")
	PackageVCSRequired        = NewError(2012, "package vcs required")
	PackageRepoRootRequired   = NewError(2013, "package repo rut required")
	ChangelogRecordNotFound   = NewError(3000, "changelog record not found")
)

Errors that are related to the Packages Service.

View Source
var (
	// ErrorRegistry is a map of error codes to errors.
	// It is usually used in gopherpit.com/gopherpit/pkg/client.Client.
	ErrorRegistry = apiClient.NewMapErrorRegistry(nil)
)

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 Error

type Error struct {
	// Message is a text that describes an error.
	Message string `json:"message"`
	// Code is a number that identifies error.
	// It allows error identification when serialization is involved.
	Code int `json:"code"`
}

Error is a structure that holds error message and code.

func NewError

func NewError(code int, message string) (err *Error)

NewError creates an instance of Error and adds it to ErrorRegistry. If error code already exists in ErrorRegistry, it panics.

func (*Error) Error

func (e *Error) Error() string

Error returns error message.

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     string  `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     *string `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      string `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 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