application

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProjectManifest = "project.json"
	SSHKeySize      = 3072
)
View Source
const (
	ManifestFile = "manifest.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	UID      string         `json:"uid"`
	Manifest types.Manifest `json:"manifest"`
	IsGit    bool           `json:"git"`
	// contains filtered or unexported fields
}

func CreateApp

func CreateApp(location string, creds *syscall.Credential, manifest types.Manifest) (*App, error)

func CreateAppGit added in v0.2.8

func CreateAppGit(ctx context.Context, location, repo, privateKey string, creds *syscall.Credential) (*App, error)

func OpenApp

func OpenApp(location string, creds *syscall.Credential) (*App, error)

func (*App) ApplyOwner

func (app *App) ApplyOwner() error

func (*App) File

func (app *App) File(filename string) (string, error)

func (*App) InvokeAction added in v0.2.2

func (app *App) InvokeAction(ctx context.Context, name string, timeLimit time.Duration, globalEnv map[string]string) (string, error)

Invoke action by name (make target)

func (*App) ListActions added in v0.2.2

func (app *App) ListActions() ([]string, error)

List Make actions (if Makefile defined)

func (*App) ManifestFile

func (app *App) ManifestFile() string

func (*App) ReadFile

func (app *App) ReadFile(filename string) ([]byte, error)

func (*App) Run

func (app *App) Run(ctx context.Context,
	tracker stats.Recorder,
	env map[string]string,
	w http.ResponseWriter,
	r *http.Request)

Run application with parameters defined in manifest in directory

func (*App) RunScheduled added in v0.2.5

func (app *App) RunScheduled(ctx context.Context, last, now time.Time, globalEnv map[string]string)

func (*App) Touch

func (app *App) Touch(filename string, dir bool) error

func (*App) WriteFile

func (app *App) WriteFile(filename string, content []byte) error

type Project

type Project struct {
	// contains filtered or unexported fields
}

func OpenProject

func OpenProject(location string, defaultConfig ProjectConfig) (*Project, error)

func (*Project) ChangeUser added in v0.2.8

func (project *Project) ChangeUser(user string) error

func (*Project) CloneApps added in v0.2.5

func (project *Project) CloneApps() []*App

func (*Project) Create

func (project *Project) Create(ctx context.Context) (*App, error)

func (*Project) CreateFromGit added in v0.2.8

func (project *Project) CreateFromGit(ctx context.Context, repo string) (*App, error)

func (*Project) CreateFromTemplate

func (project *Project) CreateFromTemplate(ctx context.Context, template *templates.Template) (*App, error)

func (*Project) Credentials

func (project *Project) Credentials() *syscall.Credential

func (*Project) Download

func (project *Project) Download(ctx context.Context, uid string, tarGzBall io.Writer) error

func (*Project) FindApp

func (project *Project) FindApp(uid string) *App

func (*Project) FindAppByAlias added in v0.2.3

func (project *Project) FindAppByAlias(alias string) *App

func (*Project) GlobalEnvironment added in v0.2.8

func (project *Project) GlobalEnvironment() map[string]string

func (*Project) Handler

func (project *Project) Handler(ctx context.Context, tracker stats.Recorder) (http.HandlerFunc, error)

Handler for incoming requests

func (*Project) HandlerAlias added in v0.2.3

func (project *Project) HandlerAlias(ctx context.Context, tracker stats.Recorder) (http.HandlerFunc, error)

Handler for incoming requests

func (project *Project) Link(uid string, alias string) (*App, error)

func (*Project) List

func (project *Project) List() []*App

func (*Project) PublicKey added in v0.2.8

func (project *Project) PublicKey() []byte

Gets encoded public key if exists. Otherwise returns nil

func (*Project) Remove

func (project *Project) Remove(ctx context.Context, uid string) error

func (*Project) Root

func (project *Project) Root() string

root directory to search for applications

func (*Project) RunCron added in v0.2.5

func (project *Project) RunCron(ctx context.Context)

func (*Project) RunnerUser added in v0.2.8

func (project *Project) RunnerUser() string

func (*Project) Save

func (project *Project) Save() error

func (*Project) SetGlobalEnvironment added in v0.2.8

func (project *Project) SetGlobalEnvironment(env map[string]string) error

func (*Project) SetupSSHKey added in v0.2.8

func (project *Project) SetupSSHKey(file string) error
func (project *Project) Unlink(alias string) (*App, error)

func (*Project) Upload

func (project *Project) Upload(ctx context.Context, uid string, tarGzBall io.Reader) error

type ProjectConfig

type ProjectConfig struct {
	User        string            `json:"user"`                  // user that will be used for jobs
	UnTar       []string          `json:"untar,omitempty"`       // custom tar zxf command
	Tar         []string          `json:"tar,omitempty"`         // custom tar zcf command
	Environment map[string]string `json:"environment,omitempty"` // global environment
}

func (*ProjectConfig) Credentials

func (cfg *ProjectConfig) Credentials() (*syscall.Credential, error)

func (*ProjectConfig) LoadOrCreate

func (cfg *ProjectConfig) LoadOrCreate(file string) (*Project, error)

Open project: load or create project based on config, defined parameters will be used as default

func (*ProjectConfig) ReadFile added in v0.2.8

func (cfg *ProjectConfig) ReadFile(file string) error

func (*ProjectConfig) TarCommand

func (cfg *ProjectConfig) TarCommand() []string

func (*ProjectConfig) UnTarCommand

func (cfg *ProjectConfig) UnTarCommand() []string

func (*ProjectConfig) WriteFile added in v0.2.8

func (cfg *ProjectConfig) WriteFile(file string) error

Jump to

Keyboard shortcuts

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