Documentation ¶
Index ¶
- type APIService
- type ClientSession
- type Context
- type EventCB
- type EventDef
- type Events
- type IPROJECT
- type PathMap
- func (p *PathMap) Add(cfg xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
- func (p *PathMap) Delete() error
- func (p *PathMap) GetProject() *xaapiv1.ProjectConfig
- func (p *PathMap) GetServer() *XdsServer
- func (p *PathMap) IsInSync() (bool, error)
- func (p *PathMap) Setup(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
- func (p *PathMap) Sync() error
- func (p *PathMap) Update(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
- type Projects
- func (p *Projects) Add(newF xaapiv1.ProjectConfig, fromSid string) (*xaapiv1.ProjectConfig, error)
- func (p *Projects) Delete(id, fromSid string) (xaapiv1.ProjectConfig, error)
- func (p *Projects) ForceSync(id string) error
- func (p *Projects) Get(id string) *IPROJECT
- func (p *Projects) GetProjectArr() []xaapiv1.ProjectConfig
- func (p *Projects) GetProjectArrUnsafe() []xaapiv1.ProjectConfig
- func (p *Projects) Init(server *XdsServer) error
- func (p *Projects) IsProjectInSync(id string) (bool, error)
- func (p *Projects) ResolveID(id string) (string, error)
- func (p *Projects) Update(id string, prj xaapiv1.ProjectConfig, fromSid string) (*xaapiv1.ProjectConfig, error)
- type STProject
- func (p *STProject) Add(cfg xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
- func (p *STProject) Delete() error
- func (p *STProject) GetProject() *xaapiv1.ProjectConfig
- func (p *STProject) GetServer() *XdsServer
- func (p *STProject) IsInSync() (bool, error)
- func (p *STProject) Setup(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
- func (p *STProject) Sync() error
- func (p *STProject) Update(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
- type Sessions
- func (s *Sessions) Get(c *gin.Context) *ClientSession
- func (s *Sessions) GetID(c *gin.Context) string
- func (s *Sessions) IOSocketGet(sid string) *socketio.Socket
- func (s *Sessions) Middleware() gin.HandlerFunc
- func (s *Sessions) Stop()
- func (s *Sessions) UpdateIOSocket(sid string, so *socketio.Socket) error
- type WebServer
- type XdsServer
- func (xs *XdsServer) Close() error
- func (xs *XdsServer) CommandAdd(cmdID string, data interface{}) error
- func (xs *XdsServer) CommandDelete(cmdID string) error
- func (xs *XdsServer) CommandExec(args *xsapiv1.ExecArgs, res *xsapiv1.ExecResult) error
- func (xs *XdsServer) CommandGet(cmdID string) interface{}
- func (xs *XdsServer) CommandSignal(args *xsapiv1.ExecSignalArgs, res *xsapiv1.ExecSigResult) error
- func (xs *XdsServer) Connect() error
- func (xs *XdsServer) EventEmit(message string, args ...interface{}) error
- func (xs *XdsServer) EventOff(evName string, id uuid.UUID) error
- func (xs *XdsServer) EventOn(evName string, privData interface{}, f EventCB) (uuid.UUID, error)
- func (xs *XdsServer) EventRegister(evName string, id string) error
- func (xs *XdsServer) FolderAdd(fld *xsapiv1.FolderConfig, res interface{}) error
- func (xs *XdsServer) FolderDelete(id string) error
- func (xs *XdsServer) FolderSync(id string) error
- func (xs *XdsServer) FolderToProject(fPrj xsapiv1.FolderConfig) xaapiv1.ProjectConfig
- func (xs *XdsServer) FolderUpdate(fld *xsapiv1.FolderConfig, resFld *xsapiv1.FolderConfig) error
- func (xs *XdsServer) GetFolders(folders *[]xsapiv1.FolderConfig) error
- func (xs *XdsServer) GetVersion(res interface{}) error
- func (xs *XdsServer) IsTempoID() bool
- func (xs *XdsServer) PassthroughGet(url string)
- func (xs *XdsServer) PassthroughPost(url string)
- func (xs *XdsServer) ProjectToFolder(pPrj xaapiv1.ProjectConfig) *xsapiv1.FolderConfig
- func (xs *XdsServer) SendCommand(cmd string, body []byte, res interface{}) error
- func (xs *XdsServer) SetAPIRouterGroup(r *gin.RouterGroup)
- func (xs *XdsServer) SetLoggerOutput(out io.Writer)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIService ¶ added in v1.0.0
type APIService struct { *Context // contains filtered or unexported fields }
APIService .
func NewAPIV1 ¶ added in v1.0.0
func NewAPIV1(ctx *Context) *APIService
NewAPIV1 creates a new instance of API service
func (*APIService) AddXdsServer ¶ added in v1.0.0
func (s *APIService) AddXdsServer(cfg xdsconfig.XDSServerConf) (*XdsServer, error)
AddXdsServer Add a new XDS Server to the list of a server
func (*APIService) DelXdsServer ¶ added in v1.0.0
func (s *APIService) DelXdsServer(id string) error
DelXdsServer Delete an XDS Server from the list of a server
func (*APIService) Stop ¶ added in v1.0.0
func (s *APIService) Stop()
Stop Used to stop/close created services
type ClientSession ¶ added in v1.0.0
type ClientSession struct { ID string WSID string // only one WebSocket per client/session MaxAge int64 IOSocket *socketio.Socket // contains filtered or unexported fields }
ClientSession contains the info of a user/client session
type Context ¶
type Context struct { ProgName string Config *xdsconfig.Config Log *logrus.Logger LogLevelSilly bool SThg *st.SyncThing SThgCmd *exec.Cmd SThgInotCmd *exec.Cmd Exit chan os.Signal // contains filtered or unexported fields }
Context holds the Agent context structure
type EventCB ¶ added in v1.0.0
type EventCB func(privData interface{}, evtData interface{}) error
EventCB Event emitter callback
type EventDef ¶ added in v1.0.0
type EventDef struct {
// contains filtered or unexported fields
}
EventDef Definition on one event
type Events ¶ added in v1.0.0
type Events struct { *Context // contains filtered or unexported fields }
Events Hold registered events per context
func NewEvents ¶ added in v1.0.0
NewEvents creates an instance of Events
func (*Events) Emit ¶ added in v1.0.0
Emit Used to manually emit an event
func (*Events) GetList ¶ added in v1.0.0
GetList returns the list of all supported events
func (*Events) Register ¶ added in v1.0.0
Register Used by a client/session to register to a specific (or all) event(s)
type IPROJECT ¶ added in v1.0.0
type IPROJECT interface { Add(cfg xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error) // Add a new project Setup(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error) // Local setup of the project Delete() error // Delete a project GetProject() *xaapiv1.ProjectConfig // Get project public configuration Update(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error) // Update project configuration GetServer() *XdsServer // Get XdsServer that holds this project Sync() error // Force project files synchronization IsInSync() (bool, error) // Check if project files are in-sync }
IPROJECT Project interface
type PathMap ¶ added in v1.0.0
type PathMap struct { *Context // contains filtered or unexported fields }
PathMap .
func NewProjectPathMap ¶ added in v1.0.0
NewProjectPathMap Create a new instance of PathMap
func (*PathMap) Add ¶ added in v1.0.0
func (p *PathMap) Add(cfg xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
Add a new project
func (*PathMap) GetProject ¶ added in v1.0.0
func (p *PathMap) GetProject() *xaapiv1.ProjectConfig
GetProject Get public part of project config
func (*PathMap) GetServer ¶ added in v1.0.0
GetServer Get the XdsServer that holds this project
func (*PathMap) IsInSync ¶ added in v1.0.0
IsInSync Check if project files are in-sync
func (*PathMap) Setup ¶ added in v1.0.0
func (p *PathMap) Setup(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
Setup Setup local project config
func (*PathMap) Sync ¶ added in v1.0.0
Sync Force project files synchronization
func (*PathMap) Update ¶ added in v1.0.0
func (p *PathMap) Update(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
Update Update some field of a project
type Projects ¶ added in v1.0.0
type Projects struct { *Context SThg *st.SyncThing // contains filtered or unexported fields }
Projects Represent a an XDS Projects
func NewProjects ¶ added in v1.0.0
NewProjects Create a new instance of Project Model
func (*Projects) Add ¶ added in v1.0.0
func (p *Projects) Add(newF xaapiv1.ProjectConfig, fromSid string) (*xaapiv1.ProjectConfig, error)
Add adds a new folder
func (*Projects) Delete ¶ added in v1.0.0
func (p *Projects) Delete(id, fromSid string) (xaapiv1.ProjectConfig, error)
Delete deletes a specific folder
func (*Projects) ForceSync ¶ added in v1.0.0
ForceSync Force the synchronization of a folder
func (*Projects) Get ¶ added in v1.0.0
Get returns the folder config or nil if not existing
func (*Projects) GetProjectArr ¶ added in v1.0.0
func (p *Projects) GetProjectArr() []xaapiv1.ProjectConfig
GetProjectArr returns the config of all folders as an array
func (*Projects) GetProjectArrUnsafe ¶ added in v1.0.0
func (p *Projects) GetProjectArrUnsafe() []xaapiv1.ProjectConfig
GetProjectArrUnsafe Same as GetProjectArr without mutex protection
func (*Projects) Init ¶ added in v1.0.0
Init Load Projects configuration
func (*Projects) IsProjectInSync ¶ added in v1.0.0
IsProjectInSync Returns true when folder is in sync
func (*Projects) ResolveID ¶ added in v1.0.0
ResolveID Complete a Project ID (helper for user that can use partial ID value)
func (*Projects) Update ¶ added in v1.0.0
func (p *Projects) Update(id string, prj xaapiv1.ProjectConfig, fromSid string) (*xaapiv1.ProjectConfig, error)
Update Update some field of a project
type STProject ¶ added in v1.0.0
type STProject struct { *Context // contains filtered or unexported fields }
STProject .
func NewProjectST ¶ added in v1.0.0
NewProjectST Create a new instance of STProject
func (*STProject) Add ¶ added in v1.0.0
func (p *STProject) Add(cfg xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
Add a new project
func (*STProject) GetProject ¶ added in v1.0.0
func (p *STProject) GetProject() *xaapiv1.ProjectConfig
GetProject Get public part of project config
func (*STProject) GetServer ¶ added in v1.0.0
GetServer Get the XdsServer that holds this project
func (*STProject) IsInSync ¶ added in v1.0.0
IsInSync Check if project files are in-sync
func (*STProject) Setup ¶ added in v1.0.0
func (p *STProject) Setup(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
Setup Setup local project config
func (*STProject) Sync ¶ added in v1.0.0
Sync Force project files synchronization
func (*STProject) Update ¶ added in v1.0.0
func (p *STProject) Update(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
Update Update some field of a project
type Sessions ¶ added in v1.0.0
type Sessions struct { *Context // contains filtered or unexported fields }
Sessions holds client sessions
func NewClientSessions ¶ added in v1.0.0
NewClientSessions .
func (*Sessions) Get ¶ added in v1.0.0
func (s *Sessions) Get(c *gin.Context) *ClientSession
Get returns the client session for a specific ID
func (*Sessions) GetID ¶ added in v1.0.0
GetID returns the session or an empty string
func (*Sessions) IOSocketGet ¶ added in v1.0.0
IOSocketGet Get socketio definition from sid
func (*Sessions) Middleware ¶ added in v1.0.0
func (s *Sessions) Middleware() gin.HandlerFunc
Middleware is used to managed session
type WebServer ¶ added in v1.0.0
type WebServer struct { *Context // contains filtered or unexported fields }
WebServer .
func NewWebServer ¶ added in v1.0.0
NewWebServer creates an instance of WebServer
func (*WebServer) Serve ¶ added in v1.0.0
Serve starts a new instance of the Web Server
type XdsServer ¶ added in v1.0.0
type XdsServer struct { *Context ID string BaseURL string APIURL string PartialURL string ConnRetry int Connected bool Disabled bool ServerConfig *xsapiv1.APIConfig // Events management CBOnError func(error) CBOnDisconnect func(error) // contains filtered or unexported fields }
XdsServer .
func NewXdsServer ¶ added in v1.0.0
func NewXdsServer(ctx *Context, conf xdsconfig.XDSServerConf) *XdsServer
NewXdsServer creates an instance of XdsServer
func (*XdsServer) Close ¶ added in v1.0.0
Close Free and close XDS Server connection
func (*XdsServer) CommandAdd ¶ added in v1.0.0
CommandAdd Add a new command to the list of running commands
func (*XdsServer) CommandDelete ¶ added in v1.0.0
CommandDelete Delete a command from the command list
func (*XdsServer) CommandExec ¶ added in v1.0.0
CommandExec Send POST request to execute a command
func (*XdsServer) CommandGet ¶ added in v1.0.0
CommandGet Retrieve a command data
func (*XdsServer) CommandSignal ¶ added in v1.0.0
func (xs *XdsServer) CommandSignal(args *xsapiv1.ExecSignalArgs, res *xsapiv1.ExecSigResult) error
CommandSignal Send POST request to send a signal to a command
func (*XdsServer) Connect ¶ added in v1.0.0
Connect Establish HTTP connection with XDS Server
func (*XdsServer) EventEmit ¶ added in v1.0.0
EventEmit Emit a event to XDS Server through WS
func (*XdsServer) EventOff ¶ added in v1.0.0
EventOff Un-register a (or all) callbacks associated to an event
func (*XdsServer) EventOn ¶ added in v1.0.0
EventOn Register a callback on events reception
func (*XdsServer) EventRegister ¶ added in v1.0.0
EventRegister Post a request to register to an XdsServer event
func (*XdsServer) FolderAdd ¶ added in v1.0.0
func (xs *XdsServer) FolderAdd(fld *xsapiv1.FolderConfig, res interface{}) error
FolderAdd Send POST request to add a folder
func (*XdsServer) FolderDelete ¶ added in v1.0.0
FolderDelete Send DELETE request to delete a folder
func (*XdsServer) FolderSync ¶ added in v1.0.0
FolderSync Send POST request to force synchronization of a folder
func (*XdsServer) FolderToProject ¶ added in v1.0.0
func (xs *XdsServer) FolderToProject(fPrj xsapiv1.FolderConfig) xaapiv1.ProjectConfig
FolderToProject Convert Folder structure to Project structure
func (*XdsServer) FolderUpdate ¶ added in v1.0.0
func (xs *XdsServer) FolderUpdate(fld *xsapiv1.FolderConfig, resFld *xsapiv1.FolderConfig) error
FolderUpdate Send PUT request to update a folder
func (*XdsServer) GetFolders ¶ added in v1.0.0
func (xs *XdsServer) GetFolders(folders *[]xsapiv1.FolderConfig) error
GetFolders Send GET request to get current folder configuration
func (*XdsServer) GetVersion ¶ added in v1.0.0
GetVersion Send Get request to retrieve XDS Server version
func (*XdsServer) IsTempoID ¶ added in v1.0.0
IsTempoID returns true when server as a temporary id
func (*XdsServer) PassthroughGet ¶ added in v1.0.0
PassthroughGet Used to declare a route that sends directly a GET request to XDS Server
func (*XdsServer) PassthroughPost ¶ added in v1.0.0
PassthroughPost Used to declare a route that sends directly a POST request to XDS Server
func (*XdsServer) ProjectToFolder ¶ added in v1.0.0
func (xs *XdsServer) ProjectToFolder(pPrj xaapiv1.ProjectConfig) *xsapiv1.FolderConfig
ProjectToFolder Convert Project structure to Folder structure
func (*XdsServer) SendCommand ¶ added in v1.0.0
SendCommand Send a command to XDS Server
func (*XdsServer) SetAPIRouterGroup ¶ added in v1.0.0
func (xs *XdsServer) SetAPIRouterGroup(r *gin.RouterGroup)
SetAPIRouterGroup .