Documentation
¶
Index ¶
- Constants
- Variables
- type CleanupOpts
- type CloseableRepository
- type Context
- type DockerRepository
- func (this *DockerRepository) Cleanup(ctx context.Context, opts *CleanupOpts) error
- func (this *DockerRepository) Close() error
- func (this *DockerRepository) DoesSupportPty(Context, glssh.Pty) (bool, error)
- func (this *DockerRepository) Ensure(req Request) (Environment, error)
- func (this *DockerRepository) FindBySession(ctx context.Context, sess session.Session, opts *FindOpts) (Environment, error)
- func (this *DockerRepository) WillBeAccepted(ctx Context) (ok bool, err error)
- type DummyRepository
- func (this *DummyRepository) Cleanup(context.Context, *CleanupOpts) error
- func (this *DummyRepository) Close() error
- func (this *DummyRepository) DoesSupportPty(_ Context, _ glssh.Pty) (bool, error)
- func (this *DummyRepository) Ensure(req Request) (Environment, error)
- func (this *DummyRepository) FindBySession(_ context.Context, sess session.Session, _ *FindOpts) (Environment, error)
- func (this *DummyRepository) WillBeAccepted(_ Context) (bool, error)
- type Environment
- type FindOpts
- type LocalRepository
- func (this *LocalRepository) Cleanup(context.Context, *CleanupOpts) error
- func (this *LocalRepository) Close() error
- func (this *LocalRepository) DoesSupportPty(Context, glssh.Pty) (bool, error)
- func (this *LocalRepository) Ensure(req Request) (Environment, error)
- func (this *LocalRepository) FindBySession(ctx context.Context, sess session.Session, opts *FindOpts) (Environment, error)
- func (this *LocalRepository) WillBeAccepted(ctx Context) (ok bool, err error)
- type PreparationProgress
- type PreparationProgressAttributes
- type Repository
- type RepositoryFacade
- func (this *RepositoryFacade) Cleanup(ctx context.Context, opts *CleanupOpts) error
- func (this *RepositoryFacade) Close() (rErr error)
- func (this *RepositoryFacade) DoesSupportPty(ctx Context, pty glssh.Pty) (bool, error)
- func (this *RepositoryFacade) Ensure(req Request) (Environment, error)
- func (this *RepositoryFacade) FindBySession(ctx context.Context, sess session.Session, opts *FindOpts) (Environment, error)
- func (this *RepositoryFacade) WillBeAccepted(ctx Context) (bool, error)
- type RepositoryFactory
- type Request
- type Task
- type TaskType
Constants ¶
View Source
const ( BifroestUnixBinaryMountTarget = `/usr/bin/bifroest` BifroestWindowsBinaryMountTarget = `C:\Program Files\Engity\Bifroest\bifroest.exe` DockerLabelPrefix = "org.engity.bifroest/" DockerLabelFlow = DockerLabelPrefix + "flow" DockerLabelSessionId = DockerLabelPrefix + "session-id" DockerLabelCreatedRemoteUser = DockerLabelPrefix + "created-remote-user" DockerLabelCreatedRemoteHost = DockerLabelPrefix + "created-remote-host" DockerLabelShellCommand = DockerLabelPrefix + "shellCommand" DockerLabelExecCommand = DockerLabelPrefix + "execCommand" DockerLabelSftpCommand = DockerLabelPrefix + "sftpCommand" DockerLabelUser = DockerLabelPrefix + "user" DockerLabelDirectory = DockerLabelPrefix + "directory" DockerLabelPortForwardingAllowed = DockerLabelPrefix + "portForwardingAllowed" )
Variables ¶
View Source
var ( ErrNoSuchEnvironment = errors.New("no such environment") ErrNotAcceptable = errors.New("not acceptable") )
Functions ¶
This section is empty.
Types ¶
type CleanupOpts ¶ added in v0.4.0
type CleanupOpts struct {
// FlowOfNamePredicate returns true if in the context of Bifröst
// there exists another flow with this name.
FlowOfNamePredicate func(configuration.FlowName) (bool, error)
// Logger will be used (if any log is required) instead of the standard logger.
Logger log.Logger
}
CleanupOpts adds some more hints what should happen when Repository.Cleanup is executed.
func (*CleanupOpts) GetLogger ¶ added in v0.4.0
func (this *CleanupOpts) GetLogger(or func() log.Logger) log.Logger
func (*CleanupOpts) HasFlowOfName ¶ added in v0.4.0
func (this *CleanupOpts) HasFlowOfName(name configuration.FlowName) (bool, error)
type CloseableRepository ¶
type CloseableRepository interface {
Repository
io.Closer
}
type Context ¶ added in v0.4.0
type Context interface {
Connection() connection.Connection
Context() glssh.Context
Authorization() authorization.Authorization
}
type DockerRepository ¶ added in v0.4.0
type DockerRepository struct {
Logger log.Logger
// contains filtered or unexported fields
}
func NewDockerRepository ¶ added in v0.4.0
func NewDockerRepository(ctx context.Context, flow configuration.FlowName, conf *configuration.EnvironmentDocker, ap alternatives.Provider, i imp.Imp) (*DockerRepository, error)
func (*DockerRepository) Cleanup ¶ added in v0.4.0
func (this *DockerRepository) Cleanup(ctx context.Context, opts *CleanupOpts) error
func (*DockerRepository) Close ¶ added in v0.4.0
func (this *DockerRepository) Close() error
func (*DockerRepository) DoesSupportPty ¶ added in v0.4.0
func (*DockerRepository) Ensure ¶ added in v0.4.0
func (this *DockerRepository) Ensure(req Request) (Environment, error)
func (*DockerRepository) FindBySession ¶ added in v0.4.0
func (this *DockerRepository) FindBySession(ctx context.Context, sess session.Session, opts *FindOpts) (Environment, error)
func (*DockerRepository) WillBeAccepted ¶ added in v0.4.0
func (this *DockerRepository) WillBeAccepted(ctx Context) (ok bool, err error)
type DummyRepository ¶ added in v0.4.0
type DummyRepository struct {
// contains filtered or unexported fields
}
func NewDummyRepository ¶ added in v0.4.0
func NewDummyRepository(_ context.Context, flow configuration.FlowName, conf *configuration.EnvironmentDummy, _ alternatives.Provider, _ imp.Imp) (*DummyRepository, error)
func (*DummyRepository) Cleanup ¶ added in v0.4.0
func (this *DummyRepository) Cleanup(context.Context, *CleanupOpts) error
func (*DummyRepository) Close ¶ added in v0.4.0
func (this *DummyRepository) Close() error
func (*DummyRepository) DoesSupportPty ¶ added in v0.4.0
func (*DummyRepository) Ensure ¶ added in v0.4.0
func (this *DummyRepository) Ensure(req Request) (Environment, error)
func (*DummyRepository) FindBySession ¶ added in v0.4.0
func (this *DummyRepository) FindBySession(_ context.Context, sess session.Session, _ *FindOpts) (Environment, error)
func (*DummyRepository) WillBeAccepted ¶ added in v0.4.0
func (this *DummyRepository) WillBeAccepted(_ Context) (bool, error)
type Environment ¶
type Environment interface {
Banner(Request) (io.ReadCloser, error)
Run(Task) (int, error)
IsPortForwardingAllowed(net.HostPort) (bool, error)
NewDestinationConnection(context.Context, net.HostPort) (io.ReadWriteCloser, error)
// Dispose will fully dispose this instance.
// It does also implicitly call Close() to ensure everything happens
// in the correct synchronized context.
Dispose(context.Context) (bool, error)
// Close can be safely called more than once.
Close() error
}
type FindOpts ¶
type FindOpts struct {
// AutoCleanUpAllowed tells the repository to clean up everything
// automatically while executing the search. The requester will never
// see the requested result. This is false by default because it could
// lead to quite performance impacts or other unwanted side effects.
//
// Therefore: Use with caution.
AutoCleanUpAllowed *bool
// Logger will be used (if any log is required) instead of the standard logger.
Logger log.Logger
}
FindOpts adds some more hints what should happen when find methods of Repository are executed.
func (*FindOpts) IsAutoCleanUpAllowed ¶
type LocalRepository ¶
func NewLocalRepository ¶
func NewLocalRepository(ctx context.Context, flow configuration.FlowName, conf *configuration.EnvironmentLocal, _ alternatives.Provider, _ imp.Imp) (*LocalRepository, error)
func (*LocalRepository) Cleanup ¶ added in v0.4.0
func (this *LocalRepository) Cleanup(context.Context, *CleanupOpts) error
func (*LocalRepository) Close ¶
func (this *LocalRepository) Close() error
func (*LocalRepository) DoesSupportPty ¶ added in v0.2.0
func (*LocalRepository) Ensure ¶
func (this *LocalRepository) Ensure(req Request) (Environment, error)
func (*LocalRepository) FindBySession ¶
func (this *LocalRepository) FindBySession(ctx context.Context, sess session.Session, opts *FindOpts) (Environment, error)
func (*LocalRepository) WillBeAccepted ¶
func (this *LocalRepository) WillBeAccepted(ctx Context) (ok bool, err error)
type PreparationProgress ¶ added in v0.4.0
type PreparationProgressAttributes ¶ added in v0.4.0
type Repository ¶
type Repository interface {
// WillBeAccepted returns true if it is possible to get an Environment for the
// provided Request.
WillBeAccepted(Context) (bool, error)
// DoesSupportPty will return true if the resulting Environment will support
// an PTY.
DoesSupportPty(Context, glssh.Pty) (bool, error)
// Ensure will create or return an environment that matches the given Request.
// If it is not acceptable to do this action with the provided Request
// ErrNotAcceptable is returned; you can call WillBeAccepted to prevent such
// errors.
Ensure(Request) (Environment, error)
// FindBySession will find an existing environment for a given session.Session.
// If there is no matching one ErrNoSuchEnvironment will be returned.
FindBySession(context.Context, session.Session, *FindOpts) (Environment, error)
// Cleanup can be called while housekeeping iteration. It will also forward
// all otherFlows that are configured within Bifröst. This gives the Repository
// to potentially cleanup orphan resources that where initially owned by another
// flow.
Cleanup(context.Context, *CleanupOpts) error
}
type RepositoryFacade ¶
type RepositoryFacade struct {
// contains filtered or unexported fields
}
func NewRepositoryFacade ¶
func NewRepositoryFacade(ctx context.Context, flows *configuration.Flows, ap alternatives.Provider, i imp.Imp) (*RepositoryFacade, error)
func (*RepositoryFacade) Cleanup ¶ added in v0.4.0
func (this *RepositoryFacade) Cleanup(ctx context.Context, opts *CleanupOpts) error
func (*RepositoryFacade) Close ¶
func (this *RepositoryFacade) Close() (rErr error)
func (*RepositoryFacade) DoesSupportPty ¶ added in v0.2.0
func (*RepositoryFacade) Ensure ¶
func (this *RepositoryFacade) Ensure(req Request) (Environment, error)
func (*RepositoryFacade) FindBySession ¶
func (this *RepositoryFacade) FindBySession(ctx context.Context, sess session.Session, opts *FindOpts) (Environment, error)
func (*RepositoryFacade) WillBeAccepted ¶
func (this *RepositoryFacade) WillBeAccepted(ctx Context) (bool, error)
type RepositoryFactory ¶ added in v0.2.0
type RepositoryFactory[C any, R CloseableRepository] func(context.Context, configuration.FlowName, C, alternatives.Provider, imp.Imp) (R, error)
func RegisterRepository ¶ added in v0.2.0
func RegisterRepository[C any, R CloseableRepository](factory RepositoryFactory[C, R]) RepositoryFactory[C, R]
type Request ¶
type Request interface {
Context
StartPreparation(id, title string, attrs PreparationProgressAttributes) (PreparationProgress, error)
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.