project

package
v1.0.99 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProjectNotFound         = errors.New("project not found")
	ErrProjectMissingProjectId = errors.New("missing project_id value")
)

Functions

func GetProjectFilename added in v1.0.98

func GetProjectFilename(dir string) string

GetProjectFilename returns the filename for a project.

func ProjectExists added in v1.0.98

func ProjectExists(dir string) bool

ProjectExists returns true if a project exists in the given directory.

func SafeProjectFilename added in v1.0.98

func SafeProjectFilename(name string, isPython bool) string

SafeProjectFilename returns a safe filename for a project.

Types

type AgentBundlerConfig

type AgentBundlerConfig struct {
	Dir string `yaml:"dir" json:"dir"`
}

type AgentConfig

type AgentConfig struct {
	ID             string         `json:"id" yaml:"id" hc:"The ID of the Agent which is automatically generated"`
	Name           string         `json:"name" yaml:"name" hc:"The name of the Agent which is editable"`
	Description    string         `json:"description,omitempty" yaml:"description,omitempty" hc:"The description of the Agent which is editable"`
	Authentication Authentication `json:"authentication" yaml:"authentication" hc:"The authentication configuration for the Agent"`
	Triggers       []Trigger      `json:"triggers" yaml:"triggers" hc:"The triggers for the Agent"`
}

type Authentication

type Authentication struct {
	Type   AuthenticationType `json:"-" yaml:"-"`
	Fields map[string]any     `json:"-" yaml:"-"`
}

Authentication has a fixed Type plus arbitrary other fields

func (Authentication) MarshalJSON

func (a Authentication) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (Authentication) MarshalYAML

func (a Authentication) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler

func (*Authentication) UnmarshalJSON

func (a *Authentication) UnmarshalJSON(data []byte) error

JSON

func (*Authentication) UnmarshalYAML

func (a *Authentication) UnmarshalYAML(value *yaml.Node) error

type AuthenticationType

type AuthenticationType string
const (
	AuthenticationTypeProject AuthenticationType = "project"
	AuthenticationTypeBearer  AuthenticationType = "bearer"
	AuthenticationTypeBasic   AuthenticationType = "basic"
	AuthenticationTypeHeader  AuthenticationType = "header"
)

type Bundler

type Bundler struct {
	Enabled     bool               `yaml:"enabled" json:"enabled"`
	Identifier  string             `yaml:"identifier" json:"identifier"`
	Language    string             `yaml:"language" json:"language"`
	Framework   string             `yaml:"framework,omitempty" json:"framework,omitempty"`
	Runtime     string             `yaml:"runtime,omitempty" json:"runtime,omitempty"`
	AgentConfig AgentBundlerConfig `yaml:"agents" json:"agents"`
	Ignore      []string           `yaml:"ignore,omitempty" json:"ignore,omitempty"`
	CLIVersion  string             `yaml:"-" json:"-"`
}

type Deployment

type Deployment struct {
	Command      string     `json:"command" yaml:"command"`
	Args         []string   `json:"args" yaml:"args"`
	Resources    *Resources `json:"resources" yaml:"resources" hc:"You should tune the resources for the deployment"`
	Mode         *Mode      `json:"mode,omitempty" yaml:"mode,omitempty" hc:"The deployment mode"`
	Dependencies []string   `json:"dependencies,omitempty" yaml:"dependencies,omitempty" hc:"The dependencies to install before running the deployment"`
	DomainNames  []string   `yaml:"domains,omitempty" json:"domains,omitempty"`
}

type DeploymentConfig

type DeploymentConfig struct {
	Provider   string   `yaml:"provider" json:"provider"`
	Language   string   `yaml:"language" json:"language"`
	Runtime    string   `yaml:"runtime,omitempty" json:"runtime,omitempty"`
	MinVersion string   `yaml:"min_version,omitempty" json:"min_version,omitempty"`
	WorkingDir string   `yaml:"working_dir,omitempty" json:"working_dir,omitempty"`
	Command    []string `yaml:"command,omitempty" json:"command,omitempty"`
	Env        []string `yaml:"env,omitempty" json:"env,omitempty"`
}

type Development

type Development struct {
	Port    int      `` /* 135-byte string literal not displayed */
	Watch   Watch    `json:"watch" yaml:"watch"`
	Command string   `json:"command" yaml:"command" hc:"The command to run the development server"`
	Args    []string `json:"args" yaml:"args" hc:"The arguments to pass to the development server"`
}

type Mode

type Mode struct {
	Type string  `json:"type" yaml:"type" hc:"on-demand or provisioned"`                                       // on-demand or provisioned
	Idle *string `json:"idle,omitempty" yaml:"idle,omitempty" hc:"duration in seconds if on-demand, optional"` // duration in seconds if on-demand, optional
}

type Project

type Project struct {
	Version     string        `json:"version" yaml:"version" hc:"The version semver range required to run this project"`
	ProjectId   string        `json:"project_id" yaml:"project_id" hc:"The ID of the project which is automatically generated"`
	Name        string        `json:"name" yaml:"name" hc:"The name of the project which is editable"`
	Description string        `json:"description" yaml:"description" hc:"The description of the project which is editable"`
	Development *Development  `json:"development,omitempty" yaml:"development,omitempty" hc:"The development configuration for the project"`
	Deployment  *Deployment   `json:"deployment,omitempty" yaml:"deployment,omitempty"`
	Bundler     *Bundler      `json:"bundler,omitempty" yaml:"bundler,omitempty" hc:"You should not need to change these value"`
	Agents      []AgentConfig `json:"agents" yaml:"agents" hc:"The agents that are part of this project"`
}

func (*Project) IsJavaScript added in v1.0.98

func (p *Project) IsJavaScript() bool

IsJavaScript returns true if the project is a JavaScript project.

func (*Project) IsPython added in v1.0.98

func (p *Project) IsPython() bool

IsPython returns true if the project is a Python project.

func (*Project) Load added in v1.0.98

func (p *Project) Load(dir string) error

Load will load the project from a file in the given directory.

func (*Project) SafeFilename added in v1.0.98

func (p *Project) SafeFilename() string

SafeFilename returns a safe filename for the project.

func (*Project) Save added in v1.0.98

func (p *Project) Save(dir string) error

Save will save the project to a file in the given directory.

type Resources

type Resources struct {
	Memory string `json:"memory,omitempty" yaml:"memory,omitempty" hc:"The memory requirements"`
	CPU    string `json:"cpu,omitempty" yaml:"cpu,omitempty" hc:"The CPU requirements"`
	Disk   string `json:"disk,omitempty" yaml:"disk,omitempty" hc:"The disk size requirements"`

	CPUQuantity    resource.Quantity `json:"-" yaml:"-"`
	MemoryQuantity resource.Quantity `json:"-" yaml:"-"`
	DiskQuantity   resource.Quantity `json:"-" yaml:"-"`
}

func (*Resources) UnmarshalJSON

func (a *Resources) UnmarshalJSON(data []byte) error

func (*Resources) UnmarshalYAML

func (a *Resources) UnmarshalYAML(value *yaml.Node) error

type Trigger

type Trigger struct {
	Type        TriggerType      `json:"-" yaml:"-"`
	Destination TriggerDirection `json:"-" yaml:"-"`
	Fields      map[string]any   `json:"-" yaml:"-"`
}

func (Trigger) MarshalJSON

func (a Trigger) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (Trigger) MarshalYAML

func (a Trigger) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler

func (*Trigger) UnmarshalJSON

func (a *Trigger) UnmarshalJSON(data []byte) error

JSON

func (*Trigger) UnmarshalYAML

func (a *Trigger) UnmarshalYAML(value *yaml.Node) error

type TriggerDirection

type TriggerDirection string
const (
	TriggerDirectionSource      TriggerDirection = "source"
	TriggerDirectionDestination TriggerDirection = "destination"
)

type TriggerType

type TriggerType string
const (
	TriggerTypeAPI     TriggerType = "api"
	TriggerTypeWebhook TriggerType = "webhook"
	TriggerTypeCron    TriggerType = "cron"
	TriggerTypeManual  TriggerType = "manual"
	TriggerTypeAgent   TriggerType = "agent"
	TriggerTypeSMS     TriggerType = "sms"
	TriggerTypeEmail   TriggerType = "email"
)

type Watch

type Watch struct {
	Enabled bool     `json:"enabled" yaml:"enabled" hc:"Whether to watch for changes and automatically restart the server"`
	Files   []string `json:"files" yaml:"files" hc:"Rules for files to watch for changes"`
}

Jump to

Keyboard shortcuts

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