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
- func (a *API) ConfigurationAddHandler(w http.ResponseWriter, req *http.Request)
- func (a *API) ConfigurationDeleteHandler(w http.ResponseWriter, req *http.Request)
- func (a *API) ConfigurationInfoHandler(w http.ResponseWriter, req *http.Request)
- func (a *API) ConfigurationListHandler(w http.ResponseWriter, req *http.Request)
- func (a *API) WebhookHandler(w http.ResponseWriter, req *http.Request)
- type ConfigurationDeleteResponse
- type ConfigurationInfoResponse
- type ConfigurationListResponse
- type ConfigurationRequest
- type ConfigurationResponse
- type Connector
- type Item
- 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 ConfigurationAddPath = "/configuration"
ConfigurationAddPath is the URL path to add a new webhook [PUT]
const ConfigurationDeletePath = "/configuration/{webhook}"
ConfigurationDeletePath is the URL path to delete a certain webhook [DELETE]
const ConfigurationInfoPath = "/configuration/{webhook}"
ConfigurationInfoPath is the URL path to get detailed information about a certain webhook [GET]
const ConfigurationListPath = "/configuration"
ConfigurationListPath is the URL path to list all webhook for a certain user [GET]
const ConfigurationPath = "/configuration"
ConfigurationPath is the basic URL path for configuring the qaas server
const WebhookPath = "/webhook"
WebhookPath is the basic part of the webhook payload URL
const WebhookPostPath = "/webhook/{webhook}"
WebhookPostPath is the first part of the webhook payload URL [POST]
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 QaasInternalPort string // Port for internal use QaasExternalPort string // Port for the outside world PrivateKeyFilename string PublicKeyFilename string }
API is used to store the database pointer
func (*API) ConfigurationAddHandler ¶ added in v0.2.0
func (a *API) ConfigurationAddHandler(w http.ResponseWriter, req *http.Request)
ConfigurationAddHandler handles a HTTP PUT request to register a certain webhook with hash, groupname, and username in its body
func (*API) ConfigurationDeleteHandler ¶ added in v0.2.0
func (a *API) ConfigurationDeleteHandler(w http.ResponseWriter, req *http.Request)
ConfigurationDeleteHandler handles a HTTP DELETE request to delete a certain webhook for a certain user
func (*API) ConfigurationInfoHandler ¶ added in v0.2.0
func (a *API) ConfigurationInfoHandler(w http.ResponseWriter, req *http.Request)
ConfigurationInfoHandler handles a HTTP GET request to obtain detailed information about a specific webhook
func (*API) ConfigurationListHandler ¶ added in v0.2.0
func (a *API) ConfigurationListHandler(w http.ResponseWriter, req *http.Request)
ConfigurationListHandler handles a HTTP GET request to obtain all webhooks for a certain user
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 ConfigurationDeleteResponse ¶ added in v0.2.0
type ConfigurationDeleteResponse struct {
Webhook string `json:"webhook"`
}
ConfigurationDeleteResponse contains the webhook that has been deleted
type ConfigurationInfoResponse ¶ added in v0.2.0
type ConfigurationInfoResponse struct {
Webhook Item `json:"webhook"`
}
ConfigurationInfoResponse contains the detailed information about a specific webhook
type ConfigurationListResponse ¶ added in v0.2.0
type ConfigurationListResponse struct {
Webhooks []Item `json:"webhooks"`
}
ConfigurationListResponse contains the list of regstered webhooks for a certain user
type ConfigurationRequest ¶
type ConfigurationRequest struct { Hash string `json:"hash"` Groupname string `json:"groupname"` Username string `json:"username"` Description string `json:"description"` }
ConfigurationRequest stores one row of webhook information
type ConfigurationResponse ¶
type ConfigurationResponse struct {
Webhook string `json:"webhook"`
}
ConfigurationResponse contains the complete 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 Item ¶ added in v0.2.0
type Item struct { ID int `json:"-"` // Do not output this one Hash string `json:"hash"` Groupname string `json:"groupname"` Username string `json:"username"` Description string `json:"description"` Created string `json:"created"` URL string `json:"url"` }
Item corresponds to a row in the qaas database
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