prefab

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TAG_BLUEPRINT     = "BLUEPRINT"
	TAG_TYPE          = "TYPE"
	TAG_NAME          = "NAME"
	TAG_VERSION       = "VERSION"
	TAG_ENVIRONMENT   = "ENVIRONMENT"
	TAG_DEPLOYABILITY = "DEPLOYABILITY"
	TAG_USER          = "USER"
	TAG_WORKDIR       = "WORKDIR"
	TAG_TARGERDIR     = "TARGETDIR"
	TAG_ENVVAR        = "ENVVAR"
	TAG_CMD           = "CMD"
	TAG_DEPEND        = "DEPEND"
	TAG_CONTEXT       = "CONTEXT"
)

Variables

This section is empty.

Functions

func DecodeFileName

func DecodeFileName(filename string) (name string, version string, environment string, extension string, err error)

func EncodeBlueprintName

func EncodeBlueprintName(name string, version string, environment string) (filename string, err error)

func EncodePrefabName

func EncodePrefabName(name string, version string, environment string) (filename string, err error)

func IsPrefab added in v0.2.0

func IsPrefab(filename string) bool

func NormalizeName

func NormalizeName(name string) string

func Pack

func Pack(srcDir string, dstDir string, blueprint Blueprint) (prefabPath string, blueprintPath string, err error)

Generate Prefab file and Blueprint file

func Unpack

func Unpack(prefabPath string, dstDir string) (err error)

Types

type Blueprint

type Blueprint struct {
	Protocol      int
	Type          string
	Name          string
	Version       string
	Environment   string
	Deployability *dcontext.Deployability
	// the relative path where the file should be saved with respect to the root directory.
	// When set to "" or "/", the file will be placed directly in the root directory.
	TargetDir string
	User      string
	WorkDir   string
	EnvVar    []string // e.g. "PATH=/usr/local/bin:/usr/local/sbin"
	Command   []string // e.g. "python eaxmple.py"
	Depend    [][]*Prefab
	Context   *dcontext.DeployContext
}

func DecodeBlueprint

func DecodeBlueprint(input string) (bp Blueprint, err error)

func DecodeBlueprintFile

func DecodeBlueprintFile(path string) (bp Blueprint, err error)

func NewBlueprint

func NewBlueprint() Blueprint

func (*Blueprint) AddDepend

func (b *Blueprint) AddDepend(p *Prefab)

func (*Blueprint) AddDependAlternatives

func (b *Blueprint) AddDependAlternatives(p []*Prefab)

func (*Blueprint) Save added in v0.2.0

func (b *Blueprint) Save(path string) (blueprintPath string, err error)

type Prefab

type Prefab struct {
	// DockerHub, PyPI, Apt, LOCAL
	SpecType string
	Name     string
	// "any" is the best practice, providing more flexibility for the scheduling system
	Specifier string
	// if Filters returns false, then this prefab is not needed
	Deployability *dcontext.Deployability
}

func (*Prefab) GenKey

func (p *Prefab) GenKey() string

func (*Prefab) String

func (p *Prefab) String() string

Jump to

Keyboard shortcuts

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