workspace

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 4 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")

	ErrEmptyKubeConfig                   = errors.New("empty kubeconfig")
	ErrEmptyTerraformProviderName        = errors.New("empty terraform provider name")
	ErrEmptyTerraformProviderConfig      = errors.New("empty terraform provider config")
	ErrEmptyTerraformProviderSource      = errors.New("empty provider source")
	ErrEmptyTerraformProviderVersion     = errors.New("empty provider version")
	ErrEmptyTerraformProviderConfigKey   = errors.New("empty provider config key")
	ErrEmptyTerraformProviderConfigValue = errors.New("empty provider config value")

	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 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 GetKubernetesConfig

func GetKubernetesConfig(configs *v1.RuntimeConfigs) *v1.KubernetesConfig

GetKubernetesConfig returns kubernetes config from runtime config, should be called after ValidateRuntimeConfigs. If got empty kubernetes config, 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 GetProviderConfig added in v0.10.0

func GetProviderConfig(configs *v1.RuntimeConfigs, providerName string) (*v1.ProviderConfig, error)

GetProviderConfig returns the specified terraform provider config from runtime config, should be called after ValidateRuntimeConfigs. If got empty terraform config, 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 GetTerraformConfig

func GetTerraformConfig(configs *v1.RuntimeConfigs) v1.TerraformConfig

GetTerraformConfig returns terraform config from runtime config, should be called after ValidateRuntimeConfigs. If got empty terraform config, return nil.

func ValidateKubernetesConfig

func ValidateKubernetesConfig(config *v1.KubernetesConfig) error

ValidateKubernetesConfig is used to validate the kubernetesConfig is valid or not.

func ValidateModuleConfig

func ValidateModuleConfig(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 ValidateModulePatcherConfigs added in v0.10.0

func ValidateModulePatcherConfigs(config v1.ModulePatcherConfigs) error

func ValidateProviderConfig added in v0.10.0

func ValidateProviderConfig(config *v1.ProviderConfig) error

ValidateProviderConfig is used to validate the providerConfig is valid or not.

func ValidateRuntimeConfigs

func ValidateRuntimeConfigs(configs *v1.RuntimeConfigs) error

ValidateRuntimeConfigs is used to validate the runtimeConfigs is valid or not.

func ValidateSecretStoreConfig added in v0.10.0

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

ValidateSecretStoreConfig tests that the specified SecretStoreSpec has valid data.

func ValidateTerraformConfig

func ValidateTerraformConfig(config v1.TerraformConfig) error

ValidateTerraformConfig is used to validate the terraformConfig is valid or not.

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