workspace

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: Apache-2.0 Imports: 6 Imported by: 5

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")
	ErrInvalidViettelCloudProjectID         = errors.New("invalid format project id for ViettelCloud Secrets Manager")
)
View Source
var ErrEmptyProjectName = errors.New("empty project name")

Functions

func GetInt32PointerFromGenericConfig added in v0.11.0

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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

func ValidateModuleDefaultConfig(config v1.GenericConfig) error

func ValidateModuleMetadata added in v0.12.0

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

func ValidateModulePatcherConfigs added in v0.10.0

func ValidateModulePatcherConfigs(config v1.ModulePatcherConfigs) error

func ValidateSecretStoreConfig added in v0.10.0

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 added in v0.11.0

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