bundle

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: 31 Imported by: 0

Documentation

Overview

Package bundle exposes Bundle object manipulation functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Annotate

func Annotate(obj AnnotationOwner, key, value string)

Annotate a bundle object.

func AsProtoJSON

func AsProtoJSON(w io.Writer, b *bundlev1.Bundle) error

AsProtoJSON export given bundle as a JSON representation.

func Dump

func Dump(w io.Writer, b *bundlev1.Bundle) error

Dump a file bundle to the writer.

func FromContainer

func FromContainer(c *containerv1.Container) (*bundlev1.Bundle, error)

FromContainer unwraps a Bundle from a secret container.

func FromContainerReader

func FromContainerReader(r io.Reader) (*bundlev1.Bundle, error)

FromContainerReader returns a Bundle extracted from a secret container.

func FromDump

func FromDump(r io.Reader) (*bundlev1.Bundle, error)

FromDump creates a bundle from a JSON Dump.

func FromHCL

func FromHCL(input *hcl.Config) (*bundlev1.Bundle, error)

FromHCL convert HCL-DSL to a bundle.

func FromMap

func FromMap(input map[string]KV) (*bundlev1.Bundle, error)

FromMap builds a secret container from map K/V.

func FromOpLog

func FromOpLog(oplog compare.OpLog) (*bundlev1.Bundle, error)

FromOpLog convert oplog to a bundle.

func FromSecretMap

func FromSecretMap(secretKv KV) ([]*bundlev1.KV, error)

FromSecretMap returns the protobuf representation of secretMap.

func JSONSchema

func JSONSchema() []byte

JSONSchema returns the used json schema for validation.

func Labelize

func Labelize(obj LabelOwner, key, value string)

Labelize a bundle object.

func Lint

func Lint(r io.Reader) ([]gojsonschema.ResultError, error)

Lint to input reader content with Bundle jsonschema.

func Load

func Load(r io.Reader) (*bundlev1.Bundle, error)

Load a file bundle from the buffer.

func Lock

func Lock(ctx context.Context, b *bundlev1.Bundle, transformer value.Transformer) error

Lock apply transformer function to all secret values and set as locked.

func PartialLock

func PartialLock(ctx context.Context, b *bundlev1.Bundle, transformerMap map[string]value.Transformer, skipUnresolved bool) error

PartialLock apply conditional transformer according to applicable annotation on the given package. The annotation is referring to a key alias provided.

func Paths

func Paths(b *bundlev1.Bundle) ([]string, error)

Paths returns ordered bundle secret paths.

func Read

func Read(b *bundlev1.Bundle, secretPath string) (map[string]interface{}, error)

Read a secret located at secretPath from the given bundle.

func SecretReader

func SecretReader(b *bundlev1.Bundle) func(path string) (map[string]interface{}, error)

SecretReader is used by template engine to resolve secret from secret container.

func ToContainer

func ToContainer(b *bundlev1.Bundle) (*containerv1.Container, error)

ToContainer wrpas a Bundle as a container object.

func ToContainerWriter

func ToContainerWriter(w io.Writer, b *bundlev1.Bundle) error

ToContainerWriter returns a Bundle packaged as a secret container.

func UnLock

func UnLock(ctx context.Context, b *bundlev1.Bundle, transformers []value.Transformer, skipNotDecryptable bool) error

UnLock apply transformer function to all secret values and set as unlocked.

Types

type AnnotationOwner

type AnnotationOwner interface {
	GetAnnotations() map[string]string
}

AnnotationOwner defines annotations owner contract.

type KV

type KV map[string]interface{}

KV describes map[string]interface{} alias.

func AsMap

func AsMap(b *bundlev1.Bundle) (KV, error)

AsMap returns a bundle as map.

func AsMetadataMap

func AsMetadataMap(b *bundlev1.Bundle) (KV, error)

AsMetadataMap exports given bundle metadata as a map.

func AsSecretMap

func AsSecretMap(p *bundlev1.Package) (KV, error)

AsSecretMap returns a KV map from given package.

func (KV) Get

func (kv KV) Get(name string) interface{}

Get returns a KV of the given package.

func (KV) Glob

func (kv KV) Glob(pattern string) KV

Glob returns package objects that have name matching the given pattern.

type LabelOwner

type LabelOwner interface {
	GetLabels() map[string]string
}

LabelOwner defines label owner contract.

type Reader

type Reader interface {
	Read(reader io.Reader) (*bundlev1.Bundle, error)
}

Reader exposes bundle reader contract.

type Statistic

type Statistic struct {
	PackageCount                 uint32
	CSOCompliantPackageNameCount uint32
	SecretCount                  uint32
}

Statistic hold bundle statistic information.

func Tree

Tree returns a merkle tree based on secrets hierarchy.

type Visitor

type Visitor interface {
	Error() error
	VisitForFile(obj *bundlev1.Bundle)
	VisitForPackage(obj *bundlev1.Package)
	VisitForChain(obj *bundlev1.SecretChain)
	VisitForKV(obj *bundlev1.KV)
}

Visitor delares the bundle vistor contract.

type Writer

type Writer interface {
	Write(file *bundlev1.Bundle) error
}

Writer exposes bundle writer contract.

Jump to

Keyboard shortcuts

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