env

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExceptionFailHandler

func ExceptionFailHandler(msg string, callerSkip ...int)

func ModifiableTestData

func ModifiableTestData(paths ...string) tdOpt

func TestData

func TestData(paths ...string) tdOpt

Types

type DefaultOptionHandler

type DefaultOptionHandler struct{}

func (DefaultOptionHandler) GetEnvironment

func (o DefaultOptionHandler) GetEnvironment() *Environment

func (DefaultOptionHandler) GetFailHandler

func (o DefaultOptionHandler) GetFailHandler() FailHandler

func (DefaultOptionHandler) GetFilesystem

func (o DefaultOptionHandler) GetFilesystem() vfs.FileSystem

func (DefaultOptionHandler) Mount

func (DefaultOptionHandler) OCMContext

func (o DefaultOptionHandler) OCMContext() ocm.Context

func (DefaultOptionHandler) Propagate

func (o DefaultOptionHandler) Propagate(e *Environment)

type Environment

type Environment struct {
	vfs.VFS
	// contains filtered or unexported fields
}

func NewEnvironment

func NewEnvironment(opts ...Option) *Environment

func (*Environment) ApplyOption

func (e *Environment) ApplyOption(options accessio.Options) error

func (*Environment) ConfigContext

func (e *Environment) ConfigContext() config.Context

func (*Environment) CredentialsContext

func (e *Environment) CredentialsContext() credentials.Context

func (*Environment) Fail

func (e *Environment) Fail(msg string, callerSkip ...int)

func (*Environment) FailOnErr

func (e *Environment) FailOnErr(err error, msg string, callerSkip ...int)

func (*Environment) FileSystem

func (e *Environment) FileSystem() vfs.FileSystem

func (*Environment) GetEnvironment

func (e *Environment) GetEnvironment() *Environment

func (*Environment) GetFailHandler

func (e *Environment) GetFailHandler() FailHandler

func (*Environment) GetFilesystem

func (e *Environment) GetFilesystem() vfs.FileSystem

func (*Environment) OCIContext

func (e *Environment) OCIContext() oci.Context

func (*Environment) OCMContext

func (e *Environment) OCMContext() ocm.Context

func (*Environment) OptionHandler

func (e *Environment) OptionHandler() OptionHandler

func (*Environment) RSAKeyPair

func (e *Environment) RSAKeyPair(name ...string)

func (*Environment) ReadRSAKeyPair

func (e *Environment) ReadRSAKeyPair(name, path string)

func (*Environment) SetFailHandler

func (e *Environment) SetFailHandler(h ...FailHandler) *Environment

SetFailHandler sets an explicit fail handler or by default a fail handler throwing an exception is set.

type FailHandler

type FailHandler func(msg string, callerSkip ...int)

func (FailHandler) GetEnvironment

func (FailHandler) GetEnvironment() *Environment

func (FailHandler) GetFailHandler

func (f FailHandler) GetFailHandler() FailHandler

func (FailHandler) GetFilesystem

func (FailHandler) GetFilesystem() vfs.FileSystem

func (FailHandler) Mount

func (FailHandler) OCMContext

func (f FailHandler) OCMContext() ocm.Context

func (FailHandler) OptionHandler

func (f FailHandler) OptionHandler() OptionHandler

func (FailHandler) Propagate

func (FailHandler) Propagate(e *Environment)

type Option

type Option interface {
	OptionHandler() OptionHandler
}

Option is he option interface for env creations. An Option just provides an OptionHandler which is used by the env creation to get info (like getting the ocm context) or to do something (like fs mounting).

func FileSystem

func FileSystem(fs vfs.FileSystem, path ...string) Option

func ModifiableProjectTestData

func ModifiableProjectTestData(source string, dest ...string) Option

func ModifiableProjectTestDataForCaller

func ModifiableProjectTestDataForCaller(source string, dest ...string) Option

func OCMContext

func OCMContext(ctx ocm.Context) Option

func ProjectTestData

func ProjectTestData(source string, dest ...string) Option

func ProjectTestDataForCaller

func ProjectTestDataForCaller(source string, dest ...string) Option

func UseAsContextFileSystem

func UseAsContextFileSystem() Option

type OptionHandler

type OptionHandler interface {
	OCMContext() ocm.Context
	GetFilesystem() vfs.FileSystem
	GetFailHandler() FailHandler
	GetEnvironment() *Environment

	// Mount mounts a new filesystem to the actual env filesystem.
	Mount(fs *composefs.ComposedFileSystem) error

	// Propagate is called on final environment.
	Propagate(e *Environment)
}

OptionHandler is the interface for the option actions. This indirection (Option -> OptionHandler) is introduced to enable objects to be usable as env option (for example Environment) without the need to pollute its interface with the effective option methods defiuned by OptionHandler. This would make no sense, because an option typically does nothing but for a selected set of methods according to its intended functionality. Nevertheless, is has to implement all the interface methods.

Jump to

Keyboard shortcuts

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