Documentation ¶
Index ¶
- Constants
- Variables
- func FindProjectPath() (string, error)
- func FindProjectPathFrom(path string) (string, error)
- func IsProject(path string) bool
- func IsProjectFile(path string) bool
- type BuilderType
- type Configuration
- type GeneratorConfig
- type MonitorType
- type Project
- func DetectProjectAndStack(stackDir string) (p *Project, s *stack.Stack, err error)
- func FindAllProjects() ([]*Project, error)
- func FindAllProjectsFrom(path string) ([]*Project, error)
- func GetProject() (*Project, error)
- func GetProjectFrom(path string) (*Project, error)
- func NewProject(config *Configuration, path string, stacks []*stack.Stack) *Project
- type PrometheusConfig
Constants ¶
const ( ProjectFile = "project.yaml" KclFile = "kcl.yaml" KCLBuilder BuilderType = "KCL" AppConfigurationBuilder BuilderType = "AppConfiguration" PodMonitorType MonitorType = "Pod" ServiceMonitorType MonitorType = "Service" )
Variables ¶
var ( ErrNotProjectDirectory = errors.New("path must be a project directory") ErrProjectNotUnique = errors.New("the project obtained is not unique") )
Functions ¶
func FindProjectPath ¶
FindProjectPath locates the closest project from the current working directory, or an error if not found.
func FindProjectPathFrom ¶
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 IsProjectFile ¶
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 ¶
DetectProjectAndStack try to get stack and project from given path
func FindAllProjects ¶
FindAllProjects find all projects from the current working directory
func FindAllProjectsFrom ¶
FindAllProjectsFrom find all project from the given path
func GetProject ¶
GetProject get project from the current working directory
func GetProjectFrom ¶
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) TableReport ¶
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