project

package
v0.9.1-rc Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProjectFile                         = "project.yaml"
	KclFile                             = "kcl.yaml"
	KCLBuilder              BuilderType = "KCL"
	AppConfigurationBuilder BuilderType = "AppConfiguration"
	PodMonitorType          MonitorType = "Pod"
	ServiceMonitorType      MonitorType = "Service"
)

Variables

View Source
var (
	ErrNotProjectDirectory = errors.New("path must be a project directory")
	ErrProjectNotUnique    = errors.New("the project obtained is not unique")
)

Functions

func FindProjectPath

func FindProjectPath() (string, error)

FindProjectPath locates the closest project from the current working directory, or an error if not found.

func FindProjectPathFrom

func FindProjectPathFrom(path string) (string, error)

FindProjectPathFrom locates the closest project from the given path, searching "upwards" in the directory hierarchy. If no project is found, an empty path is returned.

func IsProject

func IsProject(path string) bool

IsProject determine whether the given path is Project directory

func IsProjectFile

func IsProjectFile(path string) bool

IsProjectFile determine whether the given path is Project file

Types

type BuilderType

type BuilderType string

type Configuration

type Configuration struct {
	// Project name
	Name string `json:"name" yaml:"name"`

	// Tenant name
	Tenant string `json:"tenant,omitempty" yaml:"tenant,omitempty"`

	// Backend storage config
	Backend *backend.Storage `json:"backend,omitempty" yaml:"backend,omitempty"`

	// SpecGenerator configs
	Generator *GeneratorConfig `json:"generator,omitempty" yaml:"generator,omitempty"`

	// Prometheus configs
	Prometheus *PrometheusConfig `json:"prometheus,omitempty" yaml:"prometheus,omitempty"`
}

Configuration is the project configuration

func ParseConfiguration

func ParseConfiguration(path string) (*Configuration, error)

ParseConfiguration parse the project configuration by the given directory

type GeneratorConfig

type GeneratorConfig struct {
	Type    BuilderType            `json:"type"`
	Configs map[string]interface{} `json:"configs,omitempty"`
}

GeneratorConfig represent Generator configs saved in project.yaml

type MonitorType

type MonitorType string

type Project

type Project struct {
	Configuration `json:",inline" yaml:",inline"`
	Path          string         `json:"path,omitempty" yaml:"path,omitempty"`     // Absolute path to the project directory
	Stacks        []*stack.Stack `json:"stacks,omitempty" yaml:"stacks,omitempty"` // Stacks
}

func DetectProjectAndStack

func DetectProjectAndStack(stackDir string) (p *Project, s *stack.Stack, err error)

DetectProjectAndStack try to get stack and project from given path

func FindAllProjects

func FindAllProjects() ([]*Project, error)

FindAllProjects find all projects from the current working directory

func FindAllProjectsFrom

func FindAllProjectsFrom(path string) ([]*Project, error)

FindAllProjectsFrom find all project from the given path

func GetProject

func GetProject() (*Project, error)

GetProject get project from the current working directory

func GetProjectFrom

func GetProjectFrom(path string) (*Project, error)

GetProjectFrom get project from the given path

func NewProject

func NewProject(config *Configuration, path string, stacks []*stack.Stack) *Project

NewProject creates a new project

func (*Project) GetName

func (p *Project) GetName() string

GetName returns the name of the project

func (*Project) GetPath

func (p *Project) GetPath() string

GetPath returns the path of the project

func (*Project) TableReport

func (p *Project) TableReport() string

TableReport returns the report string of table format

type PrometheusConfig

type PrometheusConfig struct {
	OperatorMode bool        `yaml:"operatorMode,omitempty" json:"operatorMode,omitempty"`
	MonitorType  MonitorType `yaml:"monitorType,omitempty" json:"monitorType,omitempty"`
}

PrometheusConfig represent Prometheus configs saved in project.yaml

Jump to

Keyboard shortcuts

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