proxy

package
v0.0.0-...-a7dc4af Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutenticationErrorHandler

func AutenticationErrorHandler(w http.ResponseWriter, r *http.Request)

func MakeDownloadFilesHandler

func MakeDownloadFilesHandler(impl ProxyImplementer, pi persistency.PersistencyImplementer) http.HandlerFunc

MakeDownloadFilesHandler returns an http handler function which serves a file requested with the *name* http request.

func MakeFixedSecretHandler

func MakeFixedSecretHandler(secret string, f http.HandlerFunc) http.HandlerFunc

MakeFixedSecretHandler protects an http handler by a simple shared secret given a request or a post form value. Note that without TLS it is not encrypted through the network and it can be sniffed.

func MakeJSessionCategoriesHandler

func MakeJSessionCategoriesHandler(impl ProxyImplementer, pi persistency.PersistencyImplementer) http.HandlerFunc

MakeMSessionDRMSVersionHandler returns an http handler function which returns all available DRMAA2 job categories as JSON encoded string.

func MakeJSessionCategoryHandler

func MakeJSessionCategoryHandler(impl ProxyImplementer, pi persistency.PersistencyImplementer) http.HandlerFunc

MakeJSessionCategroyHandler returns an http handler function which returns a requested job category when it is available.

func MakeJSessionJobManipulationHandler

func MakeJSessionJobManipulationHandler(impl ProxyImplementer, pi persistency.PersistencyImplementer) http.HandlerFunc

MakeJSessionJobManipulationHandler returns an http handler function which calls the JobOperation function defined by an ProxyImplementer.

func MakeJSessionSubmitHandler

func MakeJSessionSubmitHandler(impl ProxyImplementer, pi persistency.PersistencyImplementer) http.HandlerFunc

MakeJSessionSubmitHandler returns an http handler function which reads in a DRMAA2 job template struct (in JSON) in the body of the http request. In case of success the job is submitted in the cluster using the RunJob function implemented by the proxy. TODO In case a ProxyImplementer is given as a parameter the job template is made persistent.

func MakeListFilesHandler

MakeListFilesHandler creates an http handler function which returns a list of all files in the staging area over http.

func MakeMSessionDRMSLoadHandler

func MakeMSessionDRMSLoadHandler(impl ProxyImplementer, pi persistency.PersistencyImplementer) http.HandlerFunc

MakeMSessionDRMSLoadHandler returns an http handler function which returns the DRMS encoded load by the ProxyImplementer as JSON string.

func MakeMSessionDRMSNameHandler

func MakeMSessionDRMSNameHandler(impl ProxyImplementer, pi persistency.PersistencyImplementer) http.HandlerFunc

MakeMSessionDRMSNameHandler returns an http handler function which returns the DRMS name encoded by the ProxyImplementer as JSON string.

func MakeMSessionDRMSVersionHandler

func MakeMSessionDRMSVersionHandler(impl ProxyImplementer, pi persistency.PersistencyImplementer) http.HandlerFunc

MakeMSessionDRMSVersionHandler returns an http handler function which returns the DRMS name encoded by the ProxyImplementer as JSON string.

func MakeMSessionJobInfoHandler

func MakeMSessionJobInfoHandler(impl ProxyImplementer, pi persistency.PersistencyImplementer) http.HandlerFunc

MakeMSessionJobInfoHandler returns an http handler function which returns a JSON encoded DRMAA2 Job Info object.

func MakeMSessionJobInfosHandler

func MakeMSessionJobInfosHandler(impl ProxyImplementer, pi persistency.PersistencyImplementer) http.HandlerFunc

MakeMSessionJobInfosHandler retuns an http handler function which returns a JSON encoded collection of DRMAA2 job info object of all jobs available.

func MakeMachineHandler

MakeMachineHandler retuns an http handler function which returns a JSON encoded DRMAA2 machine object if the machine is part of the DRM system.

func MakeMachinesHandler

MakeMachinesHandler returns an http handler function which returns a JSON encoded collection of all machines availale in the DRM.

func MakeQueueHandler

MakeQueueHandler returns an http handler function which returns the requested queue if it is available on the system JSON encoded.

func MakeQueuesHandler

MakeQueuesHandler retuns an http handler function which returns all available queues in the DRM system JSON encoded.

func MakeRunLocalHandler

MakeRunLocalHandler spawns a process on the same host as proxy.

func MakeSessionListHandler

func MakeSessionListHandler(impl ProxyImplementer, pi persistency.PersistencyImplementer) http.HandlerFunc

MakeSessionListHandler implements an http handler which serves a list of (DRMAA2) job sessions available on this proxy.

func MakeYubikeyHandler

func MakeYubikeyHandler(id, key string, allowedIDs []string, f http.HandlerFunc) http.HandlerFunc

MakeYubikeyHandler creates an http handler which is protected by an yubkikey one-time-password verification. The OTP needs to be given by either a form value ("otp") or a POST form value ("otp").

func NewProxyRouter

NewProxyRouter creates a mux router for matching http requests to handlers. When security is configured it adds neccessary closures around the functions.

func ProxyListenAndServe

func ProxyListenAndServe(addr, certFile, keyFile string, sc SecConfig, pi persistency.PersistencyImplementer, impl ProxyImplementer)

ProxyListenAndServe starts an http proxy for a cluster which is accessed by functions specified in the ProxyImplementer interface. If a certification and key file is given as parameter then it starts an TLS secured http proxy. The port is specified by addr in the form which is used by http.ListenAndServe.

func ReadTrustedClientCertPool

func ReadTrustedClientCertPool(directory string) (*x509.CertPool, error)

Types

type ProxyImplementer

type ProxyImplementer interface {
	GetJobInfosByFilter(filtered bool, filter types.JobInfo) []types.JobInfo
	GetJobInfo(jobid string) *types.JobInfo
	GetAllMachines(machines []string) ([]types.Machine, error)
	GetAllQueues(queues []string) ([]types.Queue, error)
	GetAllCategories() ([]string, error)
	GetAllSessions(session []string) ([]string, error)
	DRMSVersion() string
	DRMSName() string
	RunJob(template types.JobTemplate) (string, error)
	JobOperation(jobsessionname, operation, jobid string) (string, error)
	DRMSLoad() float64
}

ProxyImplementer interface specified functions required to interface a ubercluster proxy. Those functions are called in the standard http request handlers.

type Route

type Route struct {
	Name            string
	Method          string
	Pattern         string
	MakeHandlerFunc func(ProxyImplementer, persistency.PersistencyImplementer) http.HandlerFunc
}

Route is a structure which maps a name, method, and a http request pattern to a http handler function which is executed.

type Routes

type Routes []Route

type RunJobResult

type RunJobResult struct {
	JobId string `json:"jobid"`
}

RunJobResult is the JSON answer when a job could successully started in the cluster.

type SecConfig

type SecConfig struct {
	OTP                  string   // secret key or "yubikey"
	YubiID               string   // ID of yubiservice in case of yubikey https://upgrade.yubico.com/getapikey/
	YubiSecret           string   // Secret of yubiservice in case of yubikey https://upgrade.yubico.com/getapikey/
	YubiAllowedIDs       []string // IDs of yubkeys which are allowed
	TrustedClientCertDir string   // Directory which contains trusted certs for mutual TLS
}

SecConfig stores security related configuration settings for the ubercluster Proxy

Jump to

Keyboard shortcuts

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