v1

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RingMeta represents R0 secrets.
	RingMeta Ring = &ring{
		level:  0,
		name:   "Meta",
		prefix: ringMeta,
		pathBuilderFunc: func(ring Ring, values ...string) (string, error) {
			return csoPath("meta/%s", 1, values...)
		},
	}
	// RingInfra represents R1 secrets.
	RingInfra = &ring{
		level:  1,
		name:   "Infrastructure",
		prefix: ringInfra,
		pathBuilderFunc: func(ring Ring, values ...string) (string, error) {
			return csoPath("infra/%s/%s/%s/%s/%s", 5, values...)
		},
	}
	// RingPlatform repsents R2 secrets.
	RingPlatform = &ring{
		level:  2,
		name:   "Platform",
		prefix: ringPlatform,
		pathBuilderFunc: func(ring Ring, values ...string) (string, error) {
			return csoPath("platform/%s/%s/%s/%s/%s", 5, values...)
		},
	}
	// RingProduct represents R3 secrets.
	RingProduct = &ring{
		level:  3,
		name:   "Product",
		prefix: ringProduct,
		pathBuilderFunc: func(ring Ring, values ...string) (string, error) {
			return csoPath("product/%s/%s/%s/%s", 4, values...)
		},
	}
	// RingApplication represents R4 secrets.
	RingApplication = &ring{
		level:  4,
		name:   "Application",
		prefix: ringApp,
		pathBuilderFunc: func(ring Ring, values ...string) (string, error) {
			return csoPath("app/%s/%s/%s/%s/%s/%s", 6, values...)
		},
	}
	// RingArtifact represents R5 secrets.
	RingArtifact = &ring{
		level:  5,
		name:   "Artifact",
		prefix: ringArtifact,
		pathBuilderFunc: func(ring Ring, values ...string) (string, error) {
			return csoPath("artifact/%s/%s/%s", 3, values...)
		},
	}
)

Functions

func Clean

func Clean(secretPath string) string

func FromRingName

func FromRingName(name string) csov1.RingLevel

FromRingName returns the ring level object according to given name.

func FromStageName

func FromStageName(name string) csov1.QualityLevel

FromStageName returns the stage level object from given name.

func Interpret

func Interpret(secret *csov1.Secret, templates map[csov1.RingLevel]string, w io.Writer) error

Interpret returns the cso secret interpretation.

func Pack

func Pack(secretPath string) (*csov1.Secret, error)

Pack a secret path to a protobuf object.

func Text

func Text() map[csov1.RingLevel]string

Text returns english text templates.

func ToRingName

func ToRingName(lvl csov1.RingLevel) string

ToRingName returns the ring level name.

func ToStageName

func ToStageName(lvl csov1.QualityLevel) string

ToStageName return the stage name.

func Validate

func Validate(path string) error

Validate path according to to CSO model.

Types

type Ring

type Ring interface {
	Level() int
	Name() string
	Prefix() string
	Path(...string) (string, error)
}

Ring describes secret ring contract.

Jump to

Keyboard shortcuts

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