server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2018 License: Apache-2.0, Apache-2.0 Imports: 29 Imported by: 1

Documentation

Overview

Package server Weles This is a Weles server. You can find out more about Weles at [http://tbd.tbd](http://tbd.tbd).

Terms Of Service:

http://tbd.tbd/terms/

Schemes:
  http
Host: localhost:8088
BasePath: /api/v1
Version: v1
License: Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0.html
Contact: <tbd@tbd.com>

Consumes:
- application/json
- multipart/form-data

Produces:
- application/json

swagger:meta

Index

Constants

This section is empty.

Variables

View Source
var (
	// SwaggerJSON embedded version of the swagger document used at generation time
	SwaggerJSON json.RawMessage
	// FlatSwaggerJSON embedded flattened version of the swagger document used at generation time
	FlatSwaggerJSON json.RawMessage
)

Functions

This section is empty.

Types

type APIDefaults

type APIDefaults struct {
	Managers  *Managers
	PageLimit int32
}

APIDefaults contains interface implementations (Managers) and default values (set via CLI flags) for the API.

func (*APIDefaults) ArtifactLister

ArtifactLister is a handler which passess requests for listing artifacts to ArtifactManager.

func (*APIDefaults) JobLister

func (a *APIDefaults) JobLister(params jobs.JobListerParams) middleware.Responder

JobLister is a handler which passess requests for listing jobs to jobmanager.

func (*APIDefaults) Version

Version is Weles version information API endpoint handler.

type Managers

type Managers struct {
	JM weles.JobManager
	AM weles.ArtifactManager
}

Managers provide implementation of JobManager and ArtifactManager interfaces.

func NewManagers

func NewManagers(jm weles.JobManager, am weles.ArtifactManager) (m *Managers)

NewManagers creates managers struct and assigns JobManager and ArtifactManager implementation to it.

func (*Managers) JobCanceller

func (m *Managers) JobCanceller(params jobs.JobCancelerParams) middleware.Responder

JobCanceller is a handler which passess JobID to JobManager to cancel a job.

func (*Managers) JobCreator

func (m *Managers) JobCreator(params jobs.JobCreatorParams) middleware.Responder

JobCreator is a handler which passes yaml file with job description to jobmanager.

type Server

type Server struct {
	EnabledListeners []string
	CleanupTimeout   time.Duration
	MaxHeaderSize    flagext.ByteSize

	SocketPath string

	Host         string
	Port         int
	ListenLimit  int
	KeepAlive    time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration

	TLSHost           string
	TLSPort           int
	TLSCertificate    string
	TLSCertificateKey string
	TLSCACertificate  string
	TLSListenLimit    int
	TLSKeepAlive      time.Duration
	TLSReadTimeout    time.Duration
	TLSWriteTimeout   time.Duration
	// contains filtered or unexported fields
}

Server for the weles API

func NewServer

func NewServer(api *operations.WelesAPI) *Server

NewServer creates a new api weles server but does not configure it

func (*Server) ConfigureAPI

func (s *Server) ConfigureAPI()

ConfigureAPI configures the API and handlers.

func (*Server) ConfigureFlags

func (s *Server) ConfigureFlags()

ConfigureFlags configures the additional flags defined by the handlers. Needs to be called before the parser.Parse

func (*Server) Fatalf

func (s *Server) Fatalf(f string, args ...interface{})

Fatalf logs message either via defined user logger or via system one if no user logger is defined. Exits with non-zero status after printing

func (*Server) GetHandler

func (s *Server) GetHandler() http.Handler

GetHandler returns a handler useful for testing

func (*Server) HTTPListener

func (s *Server) HTTPListener() (net.Listener, error)

HTTPListener returns the http listener

func (*Server) Listen

func (s *Server) Listen() error

Listen creates the listeners for the server

func (*Server) Logf

func (s *Server) Logf(f string, args ...interface{})

Logf logs message either via defined user logger or via system one if no user logger is defined.

func (*Server) Serve

func (s *Server) Serve() (err error)

Serve the api

func (*Server) SetAPI

func (s *Server) SetAPI(api *operations.WelesAPI)

SetAPI configures the server with the specified API. Needs to be called before Serve

func (*Server) SetHandler

func (s *Server) SetHandler(handler http.Handler)

SetHandler allows for setting a http handler on this server

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown server and clean up resources

func (*Server) TLSListener

func (s *Server) TLSListener() (net.Listener, error)

TLSListener returns the https listener

func (*Server) UnixListener

func (s *Server) UnixListener() (net.Listener, error)

UnixListener returns the domain socket listener

func (*Server) WelesConfigureAPI

func (s *Server) WelesConfigureAPI(a *APIDefaults)

WelesConfigureAPI configures the API and handlers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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