core

package
v0.0.0-...-802ae29 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SERVE_PORT_KEY = "serve.port"
	SERVE_ZK_CONN  = "serve.zkconn"
	SERVE_ACL_KEY  = "serve.acl"
	SERVE_ROOTPATH = "serve.rootpath"

	AUTHZ_GETMODE = "authz.getmode"

	INTERNAL_POOLS   = "xipools"
	INTERNAL_POOLMAP = "xipoolmap"
)
View Source
const (
	SERVER_VERSION = "0.2"
)

Variables

View Source
var WG_CTX_KEY wtfisctx

Functions

func ConnectZK

func ConnectZK() (*zk.Conn, error)

func ExtractSpanFromHeaders

func ExtractSpanFromHeaders(operationName string, r *http.Request) opentracing.Span

Extracts Span from headers or returns a root one

func GetRemoteUser

func GetRemoteUser(r *http.Request) (string, bool)

func InitTracing

func InitTracing() (error, opentracing.Tracer, io.Closer)

initialising Jaeger client

func IsOnRestrictedList

func IsOnRestrictedList(scheddName string, poolName string) bool

func IsOnStandardList

func IsOnStandardList(scheddName string, poolName string) bool

func IsPoolOK

func IsPoolOK(poolName string) bool

func LogAndSetHttpStatus

func LogAndSetHttpStatus(w http.ResponseWriter, r *http.Request, httpstatus int, methodName string, optionalMessage string)

func RequireUserIsAdmin

func RequireUserIsAdmin(w http.ResponseWriter, r *http.Request, methodName string) (requestedUser string, authenticatedUser string, isAdmin bool, ok bool)

func RequireUserIsAdminOrDealingWithSelf

func RequireUserIsAdminOrDealingWithSelf(w http.ResponseWriter, r *http.Request, methodName string) (requestedUser string, authenticatedUser string, isAdmin bool, ok bool)

func SetupLogger

func SetupLogger()

config hashilogger from debug flag writing to stderr

func SetupPools

func SetupPools()

func StringInSlice

func StringInSlice(a string, list []string) bool

Types

type ActiveUserMessage

type ActiveUserMessage struct {
	User          string   `json:"user"`
	Pool          string   `json:"pool"`
	ActiveSchedds []string `json:"activeschedds"`
}

type GetUserMessage

type GetUserMessage struct {
	User          string   `json:"user"`
	Pool          string   `json:"pool"`
	CurrentSchedd string   `json:"currentschedd"`
	OldSchedds    []string `json:"oldschedds"`
}

type NullLogger

type NullLogger struct{}

func (NullLogger) Printf

func (n NullLogger) Printf(s string, i ...interface{})

type PoolMap

type PoolMap struct {
	Pools map[string]ScheddList
}

type PutUserMessage

type PutUserMessage struct {
	User          string `json:"user"`
	Pool          string `json:"pool"`
	CurrentSchedd string `json:"currentschedd"`
}

type ScheddList

type ScheddList struct {
	Standard   []string
	Restricted []string
}

type ScheddUsers

type ScheddUsers struct {
	Pool   string   `json:"pool"`
	Schedd string   `json:"schedd"`
	Users  []string `json:"users"`
}

Jump to

Keyboard shortcuts

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