Help us shape the future of Go! Take the 2026 Go Developer Survey

project

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProjectExists

func ProjectExists(dir string) bool

Types

type CleanupFunc

type CleanupFunc func()

type Deployment

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

type DeploymentConfig

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

func NewDeploymentConfig

func NewDeploymentConfig() *DeploymentConfig

func (*DeploymentConfig) Write

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

type IO

type IO struct {
	Type      string         `json:"type" yaml:"type"`
	ID        string         `json:"id,omitempty" yaml:"id,omitempty"`
	Direction string         `json:"direction" yaml:"-"`
	Config    map[string]any `json:"config,omitempty" yaml:"config,omitempty"`
}

type IOResponse

type IOResponse = Response[IO]

type InitProjectArgs

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

type Project

type Project struct {
	ProjectId  string      `json:"project_id" yaml:"project_id"`
	Provider   string      `json:"provider" yaml:"provider"`
	Deployment *Deployment `json:"deployment,omitempty" yaml:"deployment,omitempty"`
	Inputs     []IO        `json:"inputs,omitempty" yaml:"inputs,omitempty"`
	Outputs    []IO        `json:"outputs,omitempty" yaml:"outputs,omitempty"`
}

func NewProject

func NewProject() *Project

NewProject will create a new project that is empty.

func (*Project) CreateIO

func (p *Project) CreateIO(logger logger.Logger, baseUrl string, token string, direction string, io IO) (*IO, error)

func (*Project) DeleteIO

func (p *Project) DeleteIO(logger logger.Logger, baseUrl string, token string, id string) error

func (*Project) DeleteProjectEnv

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

func (*Project) ListIO

func (p *Project) ListIO(logger logger.Logger, baseUrl string, token string, direction string) ([]IO, 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"`
	IOId        string            `json:"ioId"`
	IOAuthToken string            `json:"ioAuthToken,omitempty"`
}

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 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