comm

package
v0.0.0-...-9a1c0c1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JSON = "application/json"
View Source
var StopStreaming = false

Functions

func DisplayStream

func DisplayStream(response *Response)

Just keep printing up the lines from the response, until the user closes it

func GetClientRequest

func GetClientRequest(request *http.Request) *jobs.Request

Get the Request structure from HTTP request

func HandleError

func HandleError(response http.ResponseWriter, err interface{})

Handle logging and sending back and error

func HandleSighup

func HandleSighup()

func HandleSigint

func HandleSigint()

func Immediate

func Immediate(response http.ResponseWriter, request *http.Request)

Execute a command right away

func Int2Bytes

func Int2Bytes(value int) []byte

func NewClient

func NewClient() http.Client

func NewHttpServer

func NewHttpServer(host string, port string) *http.Server

Set up a server to handle http traffic

func NewRouter

func NewRouter() *mux.Router

func Output

func Output(response http.ResponseWriter, request *http.Request)

Execute a command right away

func Remove

func Remove(response http.ResponseWriter, request *http.Request)

Execute a command right away

func Schedule

func Schedule(response http.ResponseWriter, request *http.Request)

Execute a command right away

func Status

func Status(response http.ResponseWriter, request *http.Request)

Execute a command right away

func StreamResponse

func StreamResponse(job *jobs.ActiveJob, response http.ResponseWriter)

func Tail

func Tail(response http.ResponseWriter, request *http.Request)

Execute a command right away

func TokenArray

func TokenArray(config *accounts.ClientConfig) []string

func TryWebServerRestart

func TryWebServerRestart()

func ValidateRequest

func ValidateRequest(response http.ResponseWriter, request *http.Request) (*accounts.Account, error)

Return an account that matches, or issue an error

func WatchFileChange

func WatchFileChange()

TODO: This is pretty horrible...

func WriteResponse

func WriteResponse(response http.ResponseWriter, args ...interface{})

Types

type Response

type Response struct {
	Message string
	Reader  io.ReadCloser
}

func MakeRequest

func MakeRequest(config *accounts.ClientConfig, request *jobs.Request) *Response

Make a request to the server

func NewResponse

func NewResponse(message string, reader io.ReadCloser) *Response

type Server

type Server struct {
	// Config parameters
	Host string
	Port string

	// Global Datastores
	Auth   *accounts.Authentication
	Sched  *jobs.Scheduled
	Active *jobs.Active
	// contains filtered or unexported fields
}

func Global

func Global() *Server

Catch an error if init is messed up

func NewServer

func NewServer() *Server

func (*Server) Start

func (server *Server) Start()

Start receiving requests

Jump to

Keyboard shortcuts

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