project

package
v0.0.23 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteProjects added in v0.0.23

func DeleteProjects(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(logger logger.Logger, baseUrl string, token string, name string) (bool, 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"`
	Name        string `json:"name" yaml:"name"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

type Bundler added in v0.0.17

type Bundler struct {
	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"`
	CLIVersion  string             `yaml:"-" json:"-"`
}

type CleanupFunc

type CleanupFunc func()

type Deployment

type Deployment struct {
	Resources *Resources `json:"resources,omitempty" yaml:"resources,omitempty"`
}

type DeploymentConfig

type DeploymentConfig struct {
	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"`
	Deployment *Deployment `yaml:"deployment,omitempty" json:"deployment,omitempty"`
	Bundler    *Bundler    `yaml:"bundler,omitempty" json:"bundler,omitempty"`
}

func NewDeploymentConfig

func NewDeploymentConfig() *DeploymentConfig

func (*DeploymentConfig) Write

func (c *DeploymentConfig) Write(dir string) (CleanupFunc, error)

type Development added in v0.0.23

type Development struct {
	Port  int  `json:"port,omitempty" yaml:"port,omitempty"`
	Watch bool `json:"watch,omitempty" yaml:"watch,omitempty"`
}

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 {
	ProjectId   string        `json:"project_id" yaml:"project_id"`
	Name        string        `json:"name" yaml:"name"`
	Description string        `json:"description" yaml:"description"`
	Development *Development  `json:"development,omitempty" yaml:"development,omitempty"`
	Deployment  *Deployment   `json:"deployment,omitempty" yaml:"deployment,omitempty"`
	Bundler     *Bundler      `json:"bundler,omitempty" yaml:"bundler,omitempty"`
	Agents      []AgentConfig `json:"agents" yaml:"agents"`
}

func NewProject

func NewProject() *Project

NewProject will create a new project that is empty.

func (*Project) DeleteProjectEnv

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

func (*Project) ListProjectEnv

func (p *Project) ListProjectEnv(logger logger.Logger, baseUrl string, token string) (*ProjectData, 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(logger logger.Logger, baseUrl string, token string, env map[string]string, secrets map[string]string) (*ProjectData, error)

type ProjectData

type ProjectData struct {
	APIKey           string            `json:"api_key"`
	ProjectId        string            `json:"id"`
	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(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 ProjectListData added in v0.0.23

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

func ListProjects added in v0.0.23

func ListProjects(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"`
	CPU    string `json:"cpu,omitempty" yaml:"cpu,omitempty"`
	Disk   string `json:"disk,omitempty" yaml:"disk,omitempty"`

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

Jump to

Keyboard shortcuts

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