workspace

package
v0.9.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyStoragePath = errors.New("empty storage path")
	ErrUnexpectedDir    = errors.New("unexpected dir under storage path")
	ErrFileNotYAML      = errors.New("not yaml file under storage path")

	ErrEmptyWorkspace        = errors.New("empty workspace")
	ErrWorkspaceNotExist     = errors.New("workspace does not exist")
	ErrWorkspaceAlreadyExist = errors.New("workspace has already existed")
)
View Source
var (
	ErrEmptyProjectName          = errors.New("empty project name")
	ErrEmptyModuleConfigs        = errors.New("empty module configs")
	ErrEmptyProjectModuleConfigs = errors.New("empty module configs of the project")
	ErrEmptyProjectModuleConfig  = errors.New("empty module config of the project")

	ErrEmptyRuntimeConfigs   = errors.New("empty runtime configs")
	ErrEmptyKubernetesConfig = errors.New("empty kubernetes config")
	ErrEmptyTerraformConfig  = errors.New("empty terraform config")
)
View Source
var (
	ErrEmptyWorkspaceName = errors.New("empty workspace name")

	ErrEmptyModuleName                      = errors.New("empty module name")
	ErrEmptyModuleConfig                    = errors.New("empty module config")
	ErrEmptyModuleConfigBlockName           = errors.New("empty block name in module config")
	ErrEmptyModuleConfigBlock               = errors.New("empty block in module config")
	ErrEmptyModuleConfigProjectSelector     = errors.New("empty projectSelector in module config patcher block")
	ErrNotEmptyModuleConfigProjectSelector  = errors.New("not empty projectSelector in module config default block")
	ErrInvalidModuleConfigProjectSelector   = errors.New("invalid projectSelector in module config patcher block")
	ErrRepeatedModuleConfigSelectedProjects = errors.New("project should not repeat in one patcher block's projectSelector")
	ErrMultipleModuleConfigSelectedProjects = errors.New("a project cannot assign in more than one patcher block's projectSelector")

	ErrEmptyKubeConfig              = errors.New("empty kubeconfig")
	ErrEmptyTerraformProviderName   = errors.New("empty terraform provider name")
	ErrEmptyTerraformProviderConfig = errors.New("empty terraform provider config")

	ErrEmptyLocalFilePath = errors.New("empty local file path")
)

Functions

func GetKubernetesConfig

func GetKubernetesConfig(configs *workspace.RuntimeConfigs) (*workspace.KubernetesConfig, error)

GetKubernetesConfig returns kubernetes config from runtime config, should be called after ValidateRuntimeConfigs. If got empty kubernetes config, ErrEmptyKubernetesConfig will get returned.

func GetProjectModuleConfig

func GetProjectModuleConfig(config workspace.ModuleConfig, projectName string) (workspace.GenericConfig, error)

GetProjectModuleConfig returns the module config of a specified project, should be called after ValidateModuleConfig. If got empty module config, ErrEmptyProjectModuleConfig will get returned.

func GetProjectModuleConfigs

func GetProjectModuleConfigs(configs workspace.ModuleConfigs, projectName string) (map[string]workspace.GenericConfig, error)

GetProjectModuleConfigs returns the module configs of a specified project, whose key is the module name, should be called after ValidateModuleConfigs. If got empty module configs, ErrEmptyProjectModuleConfigs will get returned.

func GetTerraformConfig

func GetTerraformConfig(configs *workspace.RuntimeConfigs) (workspace.TerraformConfig, error)

GetTerraformConfig returns terraform config from runtime config, should be called after ValidateRuntimeConfigs. If got empty terraform config, ErrEmptyTerraformConfig will get returned.

func GetTerraformProviderConfig

func GetTerraformProviderConfig(configs *workspace.RuntimeConfigs, providerName string) (workspace.GenericConfig, error)

GetTerraformProviderConfig returns the specified terraform provider config from runtime config, should be called after ValidateRuntimeConfigs. If got empty terraform config, ErrEmptyTerraformProviderConfig will get returned.

func ValidateBackendConfigs

func ValidateBackendConfigs(configs *workspace.BackendConfigs) error

ValidateBackendConfigs is used to validate workspace.BackendConfigs is valid or not.

func ValidateKubernetesConfig

func ValidateKubernetesConfig(config *workspace.KubernetesConfig) error

ValidateKubernetesConfig is used to validate the workspace.KubernetesConfig is valid or not.

func ValidateLocalFileConfig

func ValidateLocalFileConfig(config *workspace.LocalFileConfig) error

ValidateLocalFileConfig is used to validate workspace.LocalFileConfig is valid or not.

func ValidateModuleConfig

func ValidateModuleConfig(config workspace.ModuleConfig) error

ValidateModuleConfig is used to validate the workspace.ModuleConfig is valid or not.

func ValidateModuleConfigs

func ValidateModuleConfigs(configs workspace.ModuleConfigs) error

ValidateModuleConfigs validates the workspace.ModuleConfigs is valid or not.

func ValidateRuntimeConfigs

func ValidateRuntimeConfigs(configs *workspace.RuntimeConfigs) error

ValidateRuntimeConfigs is used to validate the workspace.RuntimeConfigs is valid or not.

func ValidateTerraformConfig

func ValidateTerraformConfig(config workspace.TerraformConfig) error

ValidateTerraformConfig is used to validate the workspace.TerraformConfig is valid or not.

func ValidateWorkspace

func ValidateWorkspace(ws *workspace.Workspace) error

ValidateWorkspace is used to validate the workspace.Workspace is valid or not.

Types

type Operator

type Operator struct {
	// contains filtered or unexported fields
}

Operator is used to handle the CURD operations of workspace. Operator only supports local file system as backend for now.

func NewDefaultOperator

func NewDefaultOperator() (*Operator, error)

NewDefaultOperator returns a default backend, whose storage path is the directory ".workspace" under kfile.KusionDataFolder().

func NewOperator

func NewOperator(storagePath string) (*Operator, error)

NewOperator news an Operator with the specified storage path. If the directory of the storage path has not created, then create the directory.

func (*Operator) CreateWorkspace

func (o *Operator) CreateWorkspace(ws *workspace.Workspace) error

CreateWorkspace creates a workspace. The validation of workspace should be done before creating.

func (*Operator) DeleteWorkspace

func (o *Operator) DeleteWorkspace(name string) error

DeleteWorkspace deletes a workspace.

func (*Operator) GetWorkspace

func (o *Operator) GetWorkspace(name string) (*workspace.Workspace, error)

GetWorkspace gets the workspace by name. The validity of the returned workspace is not guaranteed.

func (*Operator) GetWorkspaceNames

func (o *Operator) GetWorkspaceNames() ([]string, error)

GetWorkspaceNames gets all the workspace names.

func (*Operator) UpdateWorkspace

func (o *Operator) UpdateWorkspace(ws *workspace.Workspace) error

UpdateWorkspace updates a workspace.The validation of workspace should be done before updating.

func (*Operator) Validate

func (o *Operator) Validate() error

Validate is used to validate the Operator is valid or not.

func (*Operator) WorkspaceExist

func (o *Operator) WorkspaceExist(name string) bool

WorkspaceExist checks the workspace exists or not.

Jump to

Keyboard shortcuts

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