cms

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	CtxKeyPipelineSource = "pipelineSource"
	CtxKeyForceDelete    = "forceDelete"
)

Variables

View Source
var EnvTransferValidator strutil.Validator = func(s string) error {

	env := strings.Replace(strings.Replace(strings.ToUpper(s), ".", "_", -1), "-", "_", -1)
	if err := strutil.Validate(env, strutil.EnvKeyValidator); err != nil {
		return errors.Errorf("failed to transfer config key to env key, config key: %s, env key: %s, err: %v",
			s, env, err)
	}
	return nil
}
View Source
var KeyValidator strutil.Validator = func(s string) error {

	keyRegexp := `^[a-zA-Z_]+[.a-zA-Z0-9_-]*$`
	valid := regexp.MustCompilePOSIX(keyRegexp).MatchString(s)
	if !valid {
		return fmt.Errorf("valid key regexp: %s", keyRegexp)
	}
	return nil
}

Functions

func NewPipelineCms

func NewPipelineCms(dbClient *dbclient.Client, rsaCrypt *encryption.RsaCrypt) *pipelineCm

Types

type ConfigManager

type ConfigManager interface {
	// IdempotentCreateNS 幂等创建 ns
	IdempotentCreateNS(ctx context.Context, ns string) error
	// IdempotentDeleteNS 幂等删除 ns,ns 下的所有配置一并删除
	IdempotentDeleteNS(ctx context.Context, ns string) error
	// PrefixListNS 获取 ns 列表,支持前缀过滤
	PrefixListNS(ctx context.Context, nsPrefix string) ([]apistructs.PipelineCmsNs, error)
	// UpdateConfigs 不存在,则创建;已存在,则更新
	UpdateConfigs(ctx context.Context, ns string, kvs map[string]apistructs.PipelineCmsConfigValue) error
	// DeleteConfigs 根据 keys 删除配置。若 ns 不存在,返回空
	DeleteConfigs(ctx context.Context, ns string, keys ...string) error
	// GetConfigs 获取 ns 下配置。若 ns 不存在,则返回空。若指定 keys,则只获取指定 key 的配置
	GetConfigs(ctx context.Context, ns string, globalDecrypt bool, keys ...apistructs.PipelineCmsConfigKey) (map[string]apistructs.PipelineCmsConfigValue, error)
}

Jump to

Keyboard shortcuts

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