Documentation
¶
Index ¶
- Variables
- func GetKubernetesConfig(configs *workspace.RuntimeConfigs) (*workspace.KubernetesConfig, error)
- func GetProjectModuleConfig(config workspace.ModuleConfig, projectName string) (workspace.GenericConfig, error)
- func GetProjectModuleConfigs(configs workspace.ModuleConfigs, projectName string) (map[string]workspace.GenericConfig, error)
- func GetTerraformConfig(configs *workspace.RuntimeConfigs) (workspace.TerraformConfig, error)
- func GetTerraformProviderConfig(configs *workspace.RuntimeConfigs, providerName string) (workspace.GenericConfig, error)
- func ValidateBackendConfigs(configs *workspace.BackendConfigs) error
- func ValidateKubernetesConfig(config *workspace.KubernetesConfig) error
- func ValidateLocalFileConfig(config *workspace.LocalFileConfig) error
- func ValidateModuleConfig(config workspace.ModuleConfig) error
- func ValidateModuleConfigs(configs workspace.ModuleConfigs) error
- func ValidateRuntimeConfigs(configs *workspace.RuntimeConfigs) error
- func ValidateTerraformConfig(config workspace.TerraformConfig) error
- func ValidateWorkspace(ws *workspace.Workspace) error
- type Operator
- func (o *Operator) CreateWorkspace(ws *workspace.Workspace) error
- func (o *Operator) DeleteWorkspace(name string) error
- func (o *Operator) GetWorkspace(name string) (*workspace.Workspace, error)
- func (o *Operator) GetWorkspaceNames() ([]string, error)
- func (o *Operator) UpdateWorkspace(ws *workspace.Workspace) error
- func (o *Operator) Validate() error
- func (o *Operator) WorkspaceExist(name string) bool
Constants ¶
This section is empty.
Variables ¶
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") )
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") )
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 ¶
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 ¶
NewDefaultOperator returns a default backend, whose storage path is the directory ".workspace" under kfile.KusionDataFolder().
func NewOperator ¶
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 ¶
CreateWorkspace creates a workspace. The validation of workspace should be done before creating.
func (*Operator) DeleteWorkspace ¶
DeleteWorkspace deletes a workspace.
func (*Operator) GetWorkspace ¶
GetWorkspace gets the workspace by name. The validity of the returned workspace is not guaranteed.
func (*Operator) GetWorkspaceNames ¶
GetWorkspaceNames gets all the workspace names.
func (*Operator) UpdateWorkspace ¶
UpdateWorkspace updates a workspace.The validation of workspace should be done before updating.
func (*Operator) WorkspaceExist ¶
WorkspaceExist checks the workspace exists or not.