workspace

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyWorkspaceName = errors.New("empty workspace name")

	ErrEmptyModuleName                      = errors.New("empty module name")
	ErrEmptyModuleConfig                    = errors.New("empty module config")
	ErrEmptyModuleConfigBlock               = errors.New("empty config of a module block")
	ErrEmptyModuleConfigPatcherBlock        = errors.New("empty patcher block in module config")
	ErrEmptyModuleConfigPatcherBlockName    = errors.New("empty patcher block name in module config")
	ErrInvalidModuleConfigPatcherBlockName  = errors.New("patcher name must not be default in module config")
	ErrEmptyModuleConfigProjectSelector     = errors.New("empty projectSelector in module config patcher block")
	ErrNotEmptyModuleConfigProjectSelector  = errors.New("not empty projectSelector in module config default block")
	ErrEmptyModuleConfigProjectName         = errors.New("empty project name at 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")
	ErrMissingProvider                      = errors.New("invalid secret store spec, missing provider config")
	ErrMultiSecretStoreProviders            = errors.New("may not specify more than 1 secret store provider")
	ErrEmptyAWSRegion                       = errors.New("region must be provided when using AWS Secrets Manager")
	ErrEmptyVaultServer                     = errors.New("server address must be provided when using Hashicorp Vault")
	ErrEmptyVaultURL                        = errors.New("vault url must be provided when using Azure KeyVault")
	ErrEmptyTenantID                        = errors.New("azure tenant id must be provided when using Azure KeyVault")
	ErrEmptyAlicloudRegion                  = errors.New("region must be provided when using Alicloud Secrets Manager")
	ErrMissingProviderType                  = errors.New("must specify a provider type")
)
View Source
var ErrEmptyProjectName = errors.New("empty project name")

Functions

func GetInt32PointerFromGenericConfig

func GetInt32PointerFromGenericConfig(config v1.GenericConfig, key string) (*int32, error)

GetInt32PointerFromGenericConfig returns the value of the key in config which should be of type int. If exist but not int, return error. If not exist, return nil.

func GetMapFromGenericConfig

func GetMapFromGenericConfig(config v1.GenericConfig, key string) (map[string]any, error)

GetMapFromGenericConfig returns the value of the key in config which should be of type map[string]any. If exist but not map[string]any, return error; If not exist, return nil, nil.

func GetProjectModuleConfig

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

GetProjectModuleConfig returns the module config of a specified project, should be called after ValidateModuleConfig. If got empty module config, return nil config and nil error.

func GetProjectModuleConfigs

func GetProjectModuleConfigs(configs v1.ModuleConfigs, projectName string) (map[string]v1.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, return nil config and nil error.

func GetStringFromGenericConfig

func GetStringFromGenericConfig(config v1.GenericConfig, key string) (string, error)

GetStringFromGenericConfig returns the value of the key in config which should be of type string. If exist but not string, return error; If not exist, return "", nil.

func GetStringMapFromGenericConfig

func GetStringMapFromGenericConfig(config v1.GenericConfig, key string) (map[string]string, error)

GetStringMapFromGenericConfig returns the value of the key in config which should be of type map[string]string. If exist but not map[string]string, return error; If not exist, return nil, nil.

func ValidateModuleConfig

func ValidateModuleConfig(name string, config *v1.ModuleConfig) error

ValidateModuleConfig is used to validate the moduleConfig is valid or not.

func ValidateModuleConfigs

func ValidateModuleConfigs(configs v1.ModuleConfigs) error

ValidateModuleConfigs validates the moduleConfigs is valid or not.

func ValidateModuleDefaultConfig

func ValidateModuleDefaultConfig(config v1.GenericConfig) error

func ValidateModuleMetadata

func ValidateModuleMetadata(name string, config *v1.ModuleConfig) error

func ValidateModulePatcherConfigs

func ValidateModulePatcherConfigs(config v1.ModulePatcherConfigs) error

func ValidateSecretStoreConfig

func ValidateSecretStoreConfig(spec *v1.SecretStore) []error

ValidateSecretStoreConfig tests that the specified SecretStore has valid data.

func ValidateWorkspace

func ValidateWorkspace(ws *v1.Workspace) error

ValidateWorkspace is used to validate the workspace get or set in the storage.

Types

type Storage

type Storage interface {
	// Get returns the workspace configurations. If name is not specified, get the current workspace
	// configurations.
	Get(name string) (*v1.Workspace, error)

	// Create the workspace.
	Create(ws *v1.Workspace) error

	// Update the workspace. If name is not specified, updates the current workspace, and set the current
	// workspace name in the input's name field.
	Update(ws *v1.Workspace) error

	// Delete deletes the workspace. If name is not specified, deletes the current workspace.
	Delete(name string) error

	// GetNames returns the names of all the existing workspaces.
	GetNames() ([]string, error)

	// GetCurrent gets the name of the current workspace.
	GetCurrent() (string, error)

	// SetCurrent sets the specified workspace as the current workspace.
	SetCurrent(name string) error
}

Storage is used to provide the storage service for multiple workspaces.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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