Documentation ¶
Index ¶
- Constants
- func CopyFile(src string, dst string) error
- func ExecuteScript(c Connector, conf executeConfiguration) error
- func InitDB(dataSourceName string) (*sql.DB, error)
- func RunsWithinContainer() bool
- type API
- type ConfigurationRequest
- type ConfigurationResponse
- type Connector
- type SSHConnector
- func (c SSHConnector) CloseSession(session *ssh.Session) error
- func (c SSHConnector) CombinedOutput(session *ssh.Session, command string) ([]byte, error)
- func (c SSHConnector) NewClient(remoteServer string, clientConfig *ssh.ClientConfig) (*ssh.Client, error)
- func (c SSHConnector) NewSession(client *ssh.Client) (*ssh.Session, error)
- func (c SSHConnector) Run(session *ssh.Session, command string) error
- type Webhook
Constants ¶
const ConfigurationPath = "/configuration"
ConfigurationPath is the URL path to add a new webhook
const WebhookPath = "/webhook/"
WebhookPath is the first part of the webhook payload URL
Variables ¶
This section is empty.
Functions ¶
func CopyFile ¶
CopyFile copies a source file to a destination file. Any existing file will be overwritten and will not copy file attributes.
func ExecuteScript ¶
ExecuteScript triggers a qsub command on the HPC cluster
func RunsWithinContainer ¶
func RunsWithinContainer() bool
RunsWithinContainer checks if the program runs in a Docker container or not
Types ¶
type API ¶
type API struct { DB *sql.DB Connector Connector DataDir string HomeDir string RelayNode string RelayNodeTestUser string RelayNodeTestUserPassword string QaasHost string QaasPort string PrivateKeyFilename string PublicKeyFilename string }
API is used to store the database pointer
func (*API) ConfigurationHandler ¶
func (a *API) ConfigurationHandler(w http.ResponseWriter, req *http.Request)
ConfigurationHandler handles a webhook registration HTTP PUT request with the hash and username in its body
func (*API) WebhookHandler ¶
func (a *API) WebhookHandler(w http.ResponseWriter, req *http.Request)
WebhookHandler handles a HTTP POST request containing the webhook payload in its body
type ConfigurationRequest ¶
type ConfigurationRequest struct { Hash string `json:"hash"` Groupname string `json:"groupname"` Username string `json:"username"` }
ConfigurationRequest stores one row of webhook information
type ConfigurationResponse ¶
type ConfigurationResponse struct {
Webhook string `json:"webhook"`
}
ConfigurationResponse contains the complet webhook payload URL
type Connector ¶
type Connector interface { NewClient(remoteServer string, clientConfig *ssh.ClientConfig) (*ssh.Client, error) NewSession(client *ssh.Client) (*ssh.Session, error) Run(session *ssh.Session, command string) error CombinedOutput(session *ssh.Session, command string) ([]byte, error) CloseSession(session *ssh.Session) error }
Connector is an interface to be able to mock SSH connections
type SSHConnector ¶
type SSHConnector struct {
Description string
}
SSHConnector is used tp replace the standard SSH library functions
func (SSHConnector) CloseSession ¶
func (c SSHConnector) CloseSession(session *ssh.Session) error
CloseSession makes it possible to mock the closing of a session
func (SSHConnector) CombinedOutput ¶
CombinedOutput makes it possible to mock a local CombinedOutput
func (SSHConnector) NewClient ¶
func (c SSHConnector) NewClient(remoteServer string, clientConfig *ssh.ClientConfig) (*ssh.Client, error)
NewClient makes it possible to mock SSH dial
func (SSHConnector) NewSession ¶
NewSession makes it possible to mock a SSH session