cms

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CtxKeyPipelineSource = "pipelineSource"
	CtxKeyForceDelete    = "forceDelete"
)
View Source
const PipelineAppConfigNameSpacePrefix = "pipeline-secrets-app"

Variables

View Source
var (
	DefaultOperationsForKV        = db.DefaultOperationsForKV
	DefaultOperationsForDiceFiles = db.DefaultOperationsForDiceFiles
)
View Source
var (
	ConfigTypeKV       = db.ConfigTypeKV
	ConfigTypeDiceFile = db.ConfigTypeDiceFile
)
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 MakeAppBranchPrefixSecretNamespace

func MakeAppBranchPrefixSecretNamespace(appID, branch string) (string, error)

func MakeAppBranchPrefixSecretNamespaceByBranchPrefix added in v1.4.0

func MakeAppBranchPrefixSecretNamespaceByBranchPrefix(appID, branchPrefix string) string

func MakeAppDefaultSecretNamespace

func MakeAppDefaultSecretNamespace(appID string) string

func NewPipelineCms

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

Types

type ConfigManager

type ConfigManager interface {
	// IdempotentCreateNs create ns idempontently
	IdempotentCreateNs(ctx context.Context, ns string) error
	// IdempotentDeleteNs delete ns and its configs idempotently
	IdempotentDeleteNs(ctx context.Context, ns string) error
	// PrefixListNs list ns by prefix
	PrefixListNs(ctx context.Context, nsPrefix string) ([]*pb.PipelineCmsNs, error)
	// UpdateConfigs create if not exists; update if already exist
	UpdateConfigs(ctx context.Context, ns string, kvs map[string]*pb.PipelineCmsConfigValue) error
	// DeleteConfigs delete configs by keys; if ns not exists, return nil
	DeleteConfigs(ctx context.Context, ns string, keys ...string) error
	// GetConfigs get configs: if ns is empty, return nil; if keys is not empty, return specified configs
	GetConfigs(ctx context.Context, ns string, globalDecrypt bool, keys ...*pb.PipelineCmsConfigKey) (map[string]*pb.PipelineCmsConfigValue, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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