session

package
v0.0.0-...-84310d3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Extensions = map[string]func(server.Session) Extension{}
)

Registered extensions

Functions

func Factory

func Factory() server.Session

Factory creates sessions

Types

type ConfigExpander

type ConfigExpander interface {
	ExpandConfig(in interface{}) interface{}
}

ConfigExpander is an extension that can expand config 'ref' objects

type Extension

type Extension interface {
}

Extension interface

type Session

type Session struct {
	sync.RWMutex

	ID         string
	Inv        server.InternalInventory
	Modules    server.ModuleMgr
	Log        server.Logging
	LogStdout  bool
	Config     interface{}
	Extensions map[string]Extension
	Args       []string
}

Session keeps everything related to one running session

func (*Session) Close

func (s *Session) Close()

Close a session

func (*Session) ExpandConfig

func (s *Session) ExpandConfig(in interface{}) interface{}

func (*Session) ExpandRef

func (s *Session) ExpandRef(in interface{}) interface{}

ExpandRef expands the configuration value using an extension if there is a mathching one

func (*Session) GetArgs

func (s *Session) GetArgs() []string

GetArgs returns args

func (*Session) GetCfg

func (s *Session) GetCfg(hostId, path string) interface{}

GetCfg returns a path from cfg, either seen by host, or global config

func (*Session) GetConfig

func (s *Session) GetConfig() interface{}

GetConfig returns the configuration

func (*Session) GetHost

func (s *Session) GetHost(hostID string) (*server.Host, error)

GetHost returns a host from the session

func (*Session) GetID

func (s *Session) GetID() string

GetID returns session ID

func (*Session) GetInv

func (s *Session) GetInv() server.InternalInventory

GetInv returns the inventory

func (*Session) GetLogger

func (s *Session) GetLogger(host *server.Host) server.Logger

GetLogger returns a logger for the host

func (*Session) GetModules

func (s *Session) GetModules() server.ModuleMgr

GetModules returns the module mgr

func (*Session) SetArgs

func (s *Session) SetArgs(args []string)

SetArgs sets args

func (*Session) SetConfig

func (s *Session) SetConfig(i interface{})

SetConfig sets the configuration

func (*Session) SetInv

func (s *Session) SetInv(i server.InternalInventory)

SetInv sets the inventory

func (*Session) SetLog

func (s *Session) SetLog(l server.Logging)

SetLog sets logger

func (*Session) SetLogStdout

func (s *Session) SetLogStdout(z bool)

SetLogStdout sets whether to log to stdout

func (*Session) SetModules

func (s *Session) SetModules(m server.ModuleMgr)

SetModules returns the module mgr

Jump to

Keyboard shortcuts

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