Documentation
¶
Index ¶
- func CopyDir(src string, dst string) (err error)
- func CopyFile(src, dst string) (err error)
- func Escape(path string) string
- func MoveFile(src string, dst string) (err error)
- func MoveFolderContent(srcFolder, dstFolder string) error
- type Api
- func (r *Api) DeletePackage(group, name, tag, user, pwd string, https bool) error
- func (r *Api) DeletePackageInfo(group, name, packageId, user, pwd string, https bool) error
- func (r *Api) Download(group, name, filename, user, pwd string, isSeal, https bool) (string, error, int)
- func (r *Api) GetAllRepositoryInfo(user, pwd string, showWarnings bool) ([]Repository, error, int, bool)
- func (r *Api) GetDigest(group, name, tag, user, pwd string, tls bool) (*DigestInfo, error, int)
- func (r *Api) GetPackageInfo(group, name, id, user, pwd string, https bool) (*Package, error)
- func (r *Api) GetRepositoryInfo(group, name, user, pwd string, https bool) (*Repository, error, int)
- func (r *Api) UploadPackage(name *core.PackageName, packageRef string, zipFile multipart.File, ...) error
- func (r *Api) UpsertPackageInfo(name *core.PackageName, pack *Package, user string, pwd string, https bool) error
- type DigestInfo
- type LocalRegistry
- func (r *LocalRegistry) Add(filename string, name *core.PackageName, s *data.Seal) error
- func (r *LocalRegistry) AllPackages() []string
- func (r *LocalRegistry) ExportPackage(names []core.PackageName, sourceCreds, targetUri, targetCreds string) ([]string, error)
- func (r *LocalRegistry) FindPackageById(id string) *Package
- func (r *LocalRegistry) FindPackageByName(name *core.PackageName) *Package
- func (r *LocalRegistry) FindPackageNamesById(id string) []*core.PackageName
- func (r *LocalRegistry) GetManifest(name *core.PackageName) *data.Manifest
- func (r *LocalRegistry) GetNetwork(pkg *core.PackageName, functionName string) (*data.Network, error)
- func (r *LocalRegistry) GetPackagesByName(name *core.PackageName) ([]*Package, bool)
- func (r *LocalRegistry) GetSeal(name *Package) (*data.Seal, error)
- func (r *LocalRegistry) Import(uri []string, creds string, v data.VerifyHandler, allowedAuthors []string, ...) error
- func (r *LocalRegistry) List(artHome string, extended bool)
- func (r *LocalRegistry) ListQ()
- func (r *LocalRegistry) Load() error
- func (r *LocalRegistry) Open(name *core.PackageName, credentials string, targetPath string, ...) error
- func (r *LocalRegistry) Prune() error
- func (r *LocalRegistry) Pull(name *core.PackageName, credentials string, showWarnings bool) (*Package, error)
- func (r *LocalRegistry) Push(name *core.PackageName, credentials string, showWarnings bool) error
- func (r *LocalRegistry) Remove(names []string) error
- func (r *LocalRegistry) RemoveAll() error
- func (r *LocalRegistry) Tag(srcName, tgtName string) error
- func (r *LocalRegistry) UpdatePkgId(name *core.PackageName, p *Package, s *data.Seal) error
- type Package
- type RemoteRegistry
- type RepoDiff
- type Repository
- func (r *Repository) DeepCopy() *Repository
- func (r *Repository) Diff(repo *Repository) (*RepoDiff, error)
- func (r *Repository) FindPackage(id string) *Package
- func (r *Repository) FindPackageByRef(ref string) *Package
- func (r *Repository) GetFileRef(tag string) (string, error)
- func (r *Repository) GetTag(tag string) (*Package, bool)
- func (r *Repository) Group() string
- func (r *Repository) IsDangling() bool
- func (r *Repository) Name() string
- func (r *Repository) RemovePackage(id string) error
- func (r *Repository) ToJsonBytes() ([]byte, error)
- func (r *Repository) UpsertPackage(a *Package) (updated bool)
- type UpdatedPackage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyDir ¶
CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist Symlinks are ignored and skipped.
func CopyFile ¶
CopyFile credit https://gist.github.com/r0l1/92462b38df26839a3ca324697c8cba04
func MoveFile ¶
MoveFile use instead of os.Rename() to avoid issues moving a file whose source and destination paths are on different file systems or drive e.g. when running in Kubernetes by Tekton
func MoveFolderContent ¶
Types ¶
type Api ¶
type Api struct {
// contains filtered or unexported fields
}
Api HTTP Registry API
func (*Api) DeletePackage ¶
func (*Api) DeletePackageInfo ¶
func (*Api) GetAllRepositoryInfo ¶
func (*Api) GetPackageInfo ¶
func (*Api) GetRepositoryInfo ¶
func (*Api) UploadPackage ¶
func (*Api) UpsertPackageInfo ¶
type DigestInfo ¶
type LocalRegistry ¶
type LocalRegistry struct { Repositories []*Repository `json:"repositories"` ArtHome string }
LocalRegistry the default local registry implemented as a file system
func NewLocalRegistry ¶
func NewLocalRegistry(artHome string) *LocalRegistry
NewLocalRegistry create a localRepo management structure
func (*LocalRegistry) Add ¶
func (r *LocalRegistry) Add(filename string, name *core.PackageName, s *data.Seal) error
Add the package and seal to the LocalRegistry
func (*LocalRegistry) AllPackages ¶
func (r *LocalRegistry) AllPackages() []string
func (*LocalRegistry) ExportPackage ¶
func (r *LocalRegistry) ExportPackage(names []core.PackageName, sourceCreds, targetUri, targetCreds string) ([]string, error)
ExportPackage exports one or more packages as a tar archive to the target URI names: the slice of packages to save sourceCreds: the artisan registry credentials to pull the packages to save (in the format user:password) targetUri: the URI where the tar archive should be saved (could be S3 or file system) targetCreds: the credentials to connect to the targetUri (if it is authenticated S3 in the format user:password)
func (*LocalRegistry) FindPackageById ¶
func (r *LocalRegistry) FindPackageById(id string) *Package
func (*LocalRegistry) FindPackageByName ¶
func (r *LocalRegistry) FindPackageByName(name *core.PackageName) *Package
FindPackageByName return the package that matches the specified: - domain/group/name:tag nil if not found in the LocalRegistry
func (*LocalRegistry) FindPackageNamesById ¶
func (r *LocalRegistry) FindPackageNamesById(id string) []*core.PackageName
FindPackageNamesById return the packages that matches the specified: - package id substring
func (*LocalRegistry) GetManifest ¶
func (r *LocalRegistry) GetManifest(name *core.PackageName) *data.Manifest
func (*LocalRegistry) GetNetwork ¶
func (r *LocalRegistry) GetNetwork(pkg *core.PackageName, functionName string) (*data.Network, error)
func (*LocalRegistry) GetPackagesByName ¶
func (r *LocalRegistry) GetPackagesByName(name *core.PackageName) ([]*Package, bool)
GetPackagesByName return all the packages within the same repository
func (*LocalRegistry) Import ¶
func (r *LocalRegistry) Import(uri []string, creds string, v data.VerifyHandler, allowedAuthors []string, flags uint8) error
Import a package tar archive into the local registry uri: the uri of the package to import (can be file path or S3 bucket uri) creds: the credentials to connect to the endpoint if it is authenticated S3 in the format user:password localPath: if specified, it downloads the remote files to a target folder
func (*LocalRegistry) List ¶
func (r *LocalRegistry) List(artHome string, extended bool)
List packages to stdout
func (*LocalRegistry) Load ¶
func (r *LocalRegistry) Load() error
Load the content of the LocalRegistry
func (*LocalRegistry) Open ¶
func (r *LocalRegistry) Open(name *core.PackageName, credentials string, targetPath string, v data.VerifyHandler, rh data.RunHandler, authorisedAuthors []string) error
func (*LocalRegistry) Prune ¶
func (r *LocalRegistry) Prune() error
func (*LocalRegistry) Pull ¶
func (r *LocalRegistry) Pull(name *core.PackageName, credentials string, showWarnings bool) (*Package, error)
func (*LocalRegistry) Push ¶
func (r *LocalRegistry) Push(name *core.PackageName, credentials string, showWarnings bool) error
func (*LocalRegistry) Remove ¶
func (r *LocalRegistry) Remove(names []string) error
func (*LocalRegistry) RemoveAll ¶
func (r *LocalRegistry) RemoveAll() error
func (*LocalRegistry) Tag ¶
func (r *LocalRegistry) Tag(srcName, tgtName string) error
Tag remove a given tag from an package
func (*LocalRegistry) UpdatePkgId ¶
func (r *LocalRegistry) UpdatePkgId(name *core.PackageName, p *Package, s *data.Seal) error
Update Package Id based on Seal checksum
type Package ¶
type Package struct { // a unique identifier for the package calculated as the checksum of the complete seal Id string `json:"id"` // the type of application in the package Type string `json:"type"` // the package actual file name FileRef string `json:"file_ref"` // the list of Tags associated with the package Tags []string `json:"tags"` // the size Size string `json:"size"` // the creation time Created string `json:"created"` }
Package metadata for an Artisan package
func (*Package) IsDangling ¶
type RemoteRegistry ¶
type RemoteRegistry struct { ArtHome string `json:"-"` // contains filtered or unexported fields }
RemoteRegistry enables admin operations on a remote registry
func NewRemoteRegistry ¶
func NewRemoteRegistry(domain, user, pwd, artHome string) (*RemoteRegistry, error)
NewRemoteRegistry creates an object to manage a remote registry
func (*RemoteRegistry) GetDigest ¶
func (r *RemoteRegistry) GetDigest(name *core.PackageName) (*DigestInfo, error, int)
GetDigest get the digest of the package in the remote registry
func (*RemoteRegistry) List ¶
func (r *RemoteRegistry) List(quiet bool)
List all packages in the remote registry
func (*RemoteRegistry) RemoveByNameFilter ¶
func (r *RemoteRegistry) RemoveByNameFilter(filter string, dryRun bool) error
RemoveByNameFilter remove one or more packages whose name matches the filter regex
func (*RemoteRegistry) RemoveByNameOrId ¶
func (r *RemoteRegistry) RemoveByNameOrId(nameOrId []string) error
RemoveByNameOrId remove any package matching the passed in name or id
type RepoDiff ¶
type RepoDiff struct { Added []*Package Removed []*Package Updated []*UpdatedPackage }
type Repository ¶
type Repository struct { // the package repository (name without tag) Repository string `json:"repository"` // the reference name of the package corresponding to different builds Packages []*Package `json:"artefacts"` }
func (*Repository) DeepCopy ¶
func (r *Repository) DeepCopy() *Repository
DeepCopy creates a copy that is totally unrelated to the original entity
func (*Repository) Diff ¶
func (r *Repository) Diff(repo *Repository) (*RepoDiff, error)
func (*Repository) FindPackage ¶
func (r *Repository) FindPackage(id string) *Package
FindPackage find a package using its unique id
func (*Repository) FindPackageByRef ¶
func (r *Repository) FindPackageByRef(ref string) *Package
func (*Repository) GetFileRef ¶
func (r *Repository) GetFileRef(tag string) (string, error)
GetFileRef get the file reference for a specific tag
func (*Repository) GetTag ¶
func (r *Repository) GetTag(tag string) (*Package, bool)
GetTag determines if the repository contains a package with the specified tag
func (*Repository) Group ¶
func (r *Repository) Group() string
func (*Repository) IsDangling ¶
func (r *Repository) IsDangling() bool
func (*Repository) Name ¶
func (r *Repository) Name() string
func (*Repository) RemovePackage ¶
func (r *Repository) RemovePackage(id string) error
func (*Repository) ToJsonBytes ¶
func (r *Repository) ToJsonBytes() ([]byte, error)
func (*Repository) UpsertPackage ¶
func (r *Repository) UpsertPackage(a *Package) (updated bool)
UpsertPackage updates the specified package information if exists, otherwise adds it to the repository returns true if the package info was updated or false if the package info was added