toaster

package
v0.0.0-...-8291241 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsuccessfulBuild = errors.New("build failed")

Functions

func Create

func Create(w http.ResponseWriter, r *http.Request, userid string)

func Delete

func Delete(w http.ResponseWriter, r *http.Request, userid, toasterid string)

func DeleteToasterHelper

func DeleteToasterHelper(w http.ResponseWriter, userid string, toaster *model.Toaster) bool

func Get

func Get(w http.ResponseWriter, r *http.Request, userid, toasterid string)

func GetBuildResult

func GetBuildResult(w http.ResponseWriter, r *http.Request, userid, buildid string)

GetBuildLogs is called when a build time exceeded at least 15s its result will then be stored for an async retrieval because of web browser HTTP requests timeout

func GetCodeFile

func GetCodeFile(w http.ResponseWriter, r *http.Request, userid, toasterid, filePath string)

func GetRunningLogs

func GetRunningLogs(w http.ResponseWriter, r *http.Request, userid, exeid string)

toasterid is contained within the exeid

func GetToasterPicture

func GetToasterPicture(w http.ResponseWriter, r *http.Request, userid, toasterid, lastURLPart string)

func List

func List(w http.ResponseWriter, r *http.Request, userid string)

func RunToaster

func RunToaster(w http.ResponseWriter, r *http.Request, exeid, toasteridOrSubdomain, requestedRegion string, isHTTPS bool)

func RunningCount

func RunningCount(w http.ResponseWriter, r *http.Request, userid, toasterid string)

func Update

func Update(w http.ResponseWriter, r *http.Request, userid, toasterID string)

func UpdateToasterPictureRoute

func UpdateToasterPictureRoute(w http.ResponseWriter, r *http.Request, userid, toasterid string)

func Usage

func Usage(w http.ResponseWriter, r *http.Request, userid, toasterid string)

Types

type CreateRequest

type CreateRequest struct {
	FileContents   [][]byte `json:"file_contents,omitempty"`
	FilePaths      []string `json:"file_paths,omitempty"`
	GitURL         string   `json:"git_url,omitempty"`
	GitUsername    string   `json:"git_username,omitempty"`
	GitAccessToken string   `json:"git_access_token,omitempty"`
	GitPassword    string   `json:"git_password,omitempty"`
	GitBranch      string   `json:"git_branch,omitempty"`

	Image string `json:"image,omitempty"`

	// Executed in the root directory of the FilePaths
	BuildCmd []string `json:"build_command,omitempty"`
	ExeCmd   []string `json:"execution_command,omitempty"`
	Env      []string `json:"environment_variables,omitempty"`

	JoinableForSec       int `json:"joinable_for_seconds,omitempty"`
	MaxConcurrentJoiners int `json:"max_concurrent_joiners,omitempty"`
	TimeoutSec           int `json:"timeout_seconds,omitempty"`

	Name     string   `json:"name,omitempty"`
	Readme   string   `json:"readme,omitempty"`
	Keywords []string `json:"keywords,omitempty"`
}

type CreateResponse

type CreateResponse struct {
	Success    bool           `json:"success"`
	BuildLogs  []byte         `json:"build_logs,omitempty"`  // base64 encoded string, see https://pkg.go.dev/encoding/json#Marshal
	BuildError []byte         `json:"build_error,omitempty"` // base64 encoded string, see https://pkg.go.dev/encoding/json#Marshal
	BuildID    string         `json:"build_id,omitempty"`
	Toaster    *model.Toaster `json:"toaster,omitempty"`
}

type DelResponse

type DelResponse struct {
	Success bool           `json:"success,omitempty"`
	Toaster *model.Toaster `json:"toaster,omitempty"`
}

type GetBuildResultRequest

type GetBuildResultRequest struct {
}

type GetBuildResultResponse

type GetBuildResultResponse struct {
	Success    bool           `json:"success,omitempty"`
	InProgress bool           `json:"in_progress"`
	Toaster    *model.Toaster `json:"toaster,omitempty"`
	BuildLogs  []byte         `json:"build_logs,omitempty"`
	BuildError []byte         `json:"build_error,omitempty"`
}

type GetResponse

type GetResponse struct {
	Success bool           `json:"success,omitempty"`
	Toaster *model.Toaster `json:"toaster,omitempty"`
}

type GetRunningLogsResponse

type GetRunningLogsResponse struct {
	Success bool   `json:"success"`
	Logs    []byte `json:"logs"`
}

type ListResponse

type ListResponse struct {
	Success  bool             `json:"success,omitempty"`
	Toasters []*model.Toaster `json:"toasters,omitempty"`
}

type RunningCountResponse

type RunningCountResponse struct {
	Success bool `json:"success,omitempty"`
	Count   int  `json:"count"`
}

type UpdateRequest

type UpdateRequest struct {
	FileContents   [][]byte `json:"file_contents,omitempty"`
	FilePaths      []string `json:"file_paths,omitempty"`
	GitURL         *string  `json:"git_url,omitempty"`
	GitUsername    *string  `json:"git_username,omitempty"`
	GitAccessToken *string  `json:"git_access_token,omitempty"`
	GitPassword    *string  `json:"git_password,omitempty"`
	GitBranch      *string  `json:"git_branch,omitempty"`

	// Executed in the root directory of the FilePaths
	BuildCmd []string `json:"build_command,omitempty"`
	ExeCmd   []string `json:"execution_command,omitempty"`
	Env      []string `json:"environment_variables,omitempty"`

	JoinableForSec       *int `json:"joinable_for_seconds,omitempty"`
	MaxConcurrentJoiners *int `json:"max_concurrent_joiners,omitempty"`
	TimeoutSec           *int `json:"timeout_seconds,omitempty"`

	Name     *string  `json:"name,omitempty"`
	Readme   *string  `json:"readme,omitempty"`
	Keywords []string `json:"keywords,omitempty"`
}

type UpdateResponse

type UpdateResponse struct {
	Success    bool           `json:"success,omitempty"`
	BuildLogs  []byte         `json:"build_logs,omitempty"`  // base64 encoded string, see https://pkg.go.dev/encoding/json#Marshal
	BuildError []byte         `json:"build_error,omitempty"` // base64 encoded string, see https://pkg.go.dev/encoding/json#Marshal
	BuildID    string         `json:"build_id,omitempty"`
	Toaster    *model.Toaster `json:"toaster,omitempty"`
}

type UsageResponse

type UsageResponse struct {
	Success bool   `json:"success,omitempty"`
	Usage   *usage `json:"usage"`
}

Jump to

Keyboard shortcuts

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