admin

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package admin : - has a rpc over http server listening on a unix socket - support other packages to expose any admin functionality over the above server

Example for registering admin handler from another package

// Add this while initializing the package in setup or init etc. admin.RegisterAdminHandler("PackageName", &PackageAdmin{}) admin.RegisterStatusHandler("PackageName", &PackageAdmin{})

// Convention is to keep the following code in admin.go in the respective package type PackageAdmin struct { }

// Status function is used for debug purposes by the admin interface

func (p *PackageAdmin) Status() map[string]interface{} {
	return map[string]interface{}{
		"parameter-1"  : value,
		"parameter-2"  : value,
	}
}

// The following function can be called from rudder-cli using getUDSClient().Call("PackageName.SomeAdminFunction", &arg, &reply)

func (p *PackageAdmin) SomeAdminFunction(arg *string, reply *string) error {
	*reply = "admin function output"
	return nil
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

func RegisterAdminHandler

func RegisterAdminHandler(name string, handler interface{})

RegisterAdminHandler is used by other packages to expose admin functions over the unix socket based rpc interface

func StartServer

func StartServer(ctx context.Context) error

StartServer starts an HTTP server listening on unix socket and serving rpc communication

Types

type Admin

type Admin struct {
	// contains filtered or unexported fields
}

func (*Admin) GetFormattedEnv

func (*Admin) GetFormattedEnv(env string, reply *string) (err error)

GetFormattedEnv return the formatted env

func (*Admin) GetLoggingConfig

func (*Admin) GetLoggingConfig(_ struct{}, reply *string) (err error)

GetLoggingConfig returns the logging configuration

func (*Admin) ServerConfig

func (*Admin) ServerConfig(_ struct{}, reply *string) (err error)

ServerConfig fetches current configuration as set in viper

func (*Admin) SetLogLevel

func (*Admin) SetLogLevel(l LogLevel, reply *string) (err error)

type LogLevel

type LogLevel struct {
	Module string
	Level  string
}

type PackageStatusHandler

type PackageStatusHandler interface {
	Status() interface{}
}

PackageStatusHandler to be implemented by the package objects that are registered as status handlers output of Status() is expected to be json encodable by default

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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