project

package
v0.0.90 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: Apache-2.0 Imports: 16 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")
)
View Source
var Version string

Functions

func DeleteProjects added in v0.0.23

func DeleteProjects(ctx context.Context, logger logger.Logger, baseUrl string, token string, ids []string) ([]string, error)

func ProjectExists

func ProjectExists(dir string) bool

func ProjectWithNameExists added in v0.0.23

func ProjectWithNameExists(ctx context.Context, logger logger.Logger, baseUrl string, token string, name string) (bool, error)

func RemoveEnvValues added in v0.0.74

func RemoveEnvValues(ctx context.Context, logger logger.Logger, dir string, keys ...string) error

func ResolveProjectDir added in v0.0.42

func ResolveProjectDir(logger logger.Logger, cmd *cobra.Command, required bool) string

func SaveEnvValue added in v0.0.74

func SaveEnvValue(ctx context.Context, logger logger.Logger, dir string, keyvalues map[string]string) error

Types

type AgentBundlerConfig added in v0.0.23

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

type AgentConfig added in v0.0.23

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"`
}

type Bundler added in v0.0.17

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"`
}

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"` // FIXME
	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"`
}

func NewDeploymentConfig

func NewDeploymentConfig() *DeploymentConfig

func (*DeploymentConfig) Write

func (c *DeploymentConfig) Write(logger logger.Logger, dir string) error

type Development added in v0.0.23

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 InitProjectArgs

type InitProjectArgs struct {
	BaseURL           string
	Dir               string
	Token             string
	OrgId             string
	Provider          string
	Name              string
	Description       string
	EnableWebhookAuth bool
	AgentName         string
	AgentDescription  string
	AgentID           string
}

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 NewProject

func NewProject() *Project

NewProject will create a new project that is empty.

func (*Project) DeleteProjectEnv

func (p *Project) DeleteProjectEnv(ctx context.Context, logger logger.Logger, baseUrl string, token string, env []string, secrets []string) error

func (*Project) GetProject added in v0.0.39

func (p *Project) GetProject(ctx context.Context, logger logger.Logger, baseUrl string, token string) (*ProjectData, error)

func (*Project) Import added in v0.0.56

func (p *Project) Import(ctx context.Context, logger logger.Logger, baseUrl string, token string, orgId string, enableWebhookAuth bool) (*ProjectImportResponse, error)

func (*Project) Load

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

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

func (*Project) Save

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

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

func (*Project) SetProjectEnv

func (p *Project) SetProjectEnv(ctx context.Context, logger logger.Logger, baseUrl string, token string, env map[string]string, secrets map[string]string) (*ProjectData, error)

type ProjectContext added in v0.0.42

type ProjectContext struct {
	Logger       logger.Logger
	Project      *Project
	Dir          string
	APIURL       string
	APPURL       string
	TransportURL string
	Token        string
	NewProject   bool
}

func EnsureProject added in v0.0.42

func EnsureProject(ctx context.Context, cmd *cobra.Command) ProjectContext

func LoadProject added in v0.0.42

func LoadProject(logger logger.Logger, dir string, apiUrl string, appUrl string, transportUrl, token string) ProjectContext

func TryProject added in v0.0.74

func TryProject(ctx context.Context, cmd *cobra.Command) ProjectContext

type ProjectData

type ProjectData struct {
	APIKey           string            `json:"api_key"`
	ProjectId        string            `json:"id"`
	OrgId            string            `json:"orgId"`
	Env              map[string]string `json:"env"`
	Secrets          map[string]string `json:"secrets"`
	WebhookAuthToken string            `json:"webhookAuthToken,omitempty"`
	AgentID          string            `json:"agentId"`
}

func InitProject

func InitProject(ctx context.Context, logger logger.Logger, args InitProjectArgs) (*ProjectData, error)

InitProject will create a new project in the organization. It will return the API key and project ID if the project is initialized successfully.

type ProjectImportRequest added in v0.0.56

type ProjectImportRequest struct {
	Name              string        `json:"name"`
	Description       string        `json:"description"`
	Provider          string        `json:"provider"`
	OrgId             string        `json:"orgId"`
	Agents            []AgentConfig `json:"agents"`
	EnableWebhookAuth bool          `json:"enableWebhookAuth"`
}

type ProjectImportResponse added in v0.0.56

type ProjectImportResponse struct {
	ID          string        `json:"id"`
	Agents      []AgentConfig `json:"agents"`
	APIKey      string        `json:"apiKey"`
	IOAuthToken string        `json:"ioAuthToken"`
}

type ProjectListData added in v0.0.23

type ProjectListData struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	OrgId       string `json:"orgId"`
	OrgName     string `json:"orgName"`
}

func ListProjects added in v0.0.23

func ListProjects(ctx context.Context, logger logger.Logger, baseUrl string, token string) ([]ProjectListData, error)

type ProjectResponse

type ProjectResponse = Response[ProjectData]

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:"-"`
}

type Response

type Response[T any] struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
	Data    T      `json:"data"`
}

type Watch added in v0.0.32

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