server

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: MIT Imports: 23 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler added in v1.0.1

func Handler(sc ComponentLocator, metrics http.Handler, ls logging.LogSink) http.Handler

Handler builds the http.Handler for the Sous server httprouter.

func ProfilingHandler added in v1.0.1

func ProfilingHandler(sc ComponentLocator, metrics http.Handler, ls logging.LogSink) http.Handler

ProfilingHandler builds the http.Handler for the Sous server httprouter.

func Run added in v1.0.1

func Run(laddr string, handler http.Handler) (*http.Server, <-chan error)

Run starts a server up.

Types

type AllDeployQueuesResource added in v1.0.1

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

AllDeployQueuesResource describes resources for deployments.

func (*AllDeployQueuesResource) Get added in v1.0.1

Get returns a configured GETAllDeployQueuesHandler.

type ArtifactResource

type ArtifactResource struct {
	restful.QueryParser
	// contains filtered or unexported fields
}

ArtifactResource provides the /artifact endpoint

func (*ArtifactResource) Get added in v1.0.1

Get implements Getable on GDMResource

func (*ArtifactResource) Put

Put implements Putable on ArtifactResource, which marks it as accepting PUT requests

type ClientUser added in v1.0.1

type ClientUser sous.User

ClientUser is a local alias for sous.User

type ComponentLocator added in v1.0.1

type ComponentLocator struct {
	logging.LogSink
	*config.Config
	sous.Inserter
	sous.Registry
	sous.StateManager
	sous.ClusterManager    // xxx temporary?
	sous.DeploymentManager // xxx temporary?
	ResolveFilter          *sous.ResolveFilter
	*sous.AutoResolver
	Version  semv.Version
	QueueSet sous.QueueSet
}

ComponentLocator is a service locator for the Sous components that server endpoints need to function.

type DELETEManifestHandler

type DELETEManifestHandler struct {
	*sous.State
	restful.QueryValues
	StateWriter sous.StateWriter
}

DELETEManifestHandler handles DELETE exchanges for manifests

func (*DELETEManifestHandler) Exchange

func (dmh *DELETEManifestHandler) Exchange() (interface{}, int)

Exchange implements restful.Exchanger

type Default added in v1.0.1

type Default struct {
	Paths []string
}

Default data to send back no the default get request

type DeployQueueResource added in v1.0.1

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

DeployQueueResource describes resources for single deployments.

func (*DeployQueueResource) Get added in v1.0.1

Get returns a configured GETDeployQueueHandler.

type DeploymentQueuesResponse added in v1.0.1

type DeploymentQueuesResponse struct {
	Queues map[string]QueueDesc
}

DeploymentQueuesResponse is used by the Deployment queue handler

type GDMResource

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

GDMResource is the resource for the GDM

func (*GDMResource) Get

Get implements Getable on GDMResource

func (GDMResource) GetUser added in v1.0.1

func (GDMResource) GetUser(req *http.Request) ClientUser

func (*GDMResource) Put added in v1.0.1

Put implements Putable on GDMResource

type GETAllDeployQueuesHandler added in v1.0.1

type GETAllDeployQueuesHandler struct {
	QueueSet sous.QueueSet
}

GETAllDeployQueuesHandler handles GET exchanges for deployments.

func (*GETAllDeployQueuesHandler) Exchange added in v1.0.1

func (h *GETAllDeployQueuesHandler) Exchange() (interface{}, int)

Exchange returns deploymentsResponse representing all queues managed by this server instance.

type GETArtifactHandler added in v1.0.1

type GETArtifactHandler struct {
	logging.LogSink
	*http.Request
	restful.QueryValues
	sous.Registry
}

GETArtifactHandler is an injectable request handler

func (*GETArtifactHandler) Exchange added in v1.0.1

func (gh *GETArtifactHandler) Exchange() (interface{}, int)

Exchange implements the Handler interface

type GETDeployQueueHandler added in v1.0.1

type GETDeployQueueHandler struct {
	QueueSet        sous.QueueSet
	DeploymentID    sous.DeploymentID
	DeploymentIDErr error
}

GETDeployQueueHandler handles GET exchanges for single deployments.

func (*GETDeployQueueHandler) Exchange added in v1.0.1

func (h *GETDeployQueueHandler) Exchange() (interface{}, int)

Exchange returns a deployQueueResponse representing a single deploy queue.

type GETGDMHandler added in v1.0.1

type GETGDMHandler struct {
	logging.LogSink
	GDM *sous.State
}

GETGDMHandler is an injectable request handler

func (*GETGDMHandler) Exchange added in v1.0.1

func (h *GETGDMHandler) Exchange() (interface{}, int)

Exchange implements the Handler interface

type GETManifestHandler

type GETManifestHandler struct {
	*sous.State
	restful.QueryValues
}

GETManifestHandler handles GET exchanges for manifests

func (*GETManifestHandler) Exchange

func (gmh *GETManifestHandler) Exchange() (interface{}, int)

Exchange implements restful.Exchanger

type GETR11nHandler added in v1.0.1

type GETR11nHandler struct {
	WaitForResolution bool
	QueueSet          sous.QueueSet
	DeploymentID      sous.DeploymentID
	DeploymentIDErr   error
	R11nID            sous.R11nID
	R11nIDErr         error
}

GETR11nHandler handles getting r11ns.

func (*GETR11nHandler) Exchange added in v1.0.1

func (h *GETR11nHandler) Exchange() (interface{}, int)

Exchange returns the targeted r11nResponse and 200 if it exists, other non-200 responses otherwise.

type GETSingleDeploymentHandler added in v1.0.1

type GETSingleDeploymentHandler struct {
	SingleDeploymentHandler
}

GETSingleDeploymentHandler retrieves manifests containing single deployment specs. See Exchange method for more details.

func (*GETSingleDeploymentHandler) Exchange added in v1.0.1

func (h *GETSingleDeploymentHandler) Exchange() (interface{}, int)

Exchange returns a single deployment.

func (GETSingleDeploymentHandler) GetUser added in v1.0.1

func (GETSingleDeploymentHandler) GetUser(req *http.Request) ClientUser

type GETStateDeployments added in v1.0.1

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

A GETStateDeployments is the exchanger for GET /state/deployments

func (*GETStateDeployments) Exchange added in v1.0.1

func (gsd *GETStateDeployments) Exchange() (interface{}, int)

Exchange implements restful.Exchanger on GETStateDeployments

type Health added in v1.0.1

type Health struct {
	Version  string
	Revision string
}

Health is the DTO for representing the health of the Sous server

type ManifestResource

type ManifestResource struct {
	restful.QueryParser
	// contains filtered or unexported fields
}

ManifestResource describes resources for manifests

func (*ManifestResource) Delete

Delete implements Deleteable for ManifestResource

func (*ManifestResource) Get

Get implements Getable for ManifestResource

func (ManifestResource) GetUser added in v1.0.1

func (ManifestResource) GetUser(req *http.Request) ClientUser

func (*ManifestResource) Put

Put implements Putable for ManifestResource

type NameData added in v1.0.1

type NameData struct {
	ClusterName string
	URL         string
}

NameData structs contain the pair of clustername to URL for data transfer

type PUTArtifactHandler

type PUTArtifactHandler struct {
	*http.Request
	restful.QueryValues
	sous.Inserter
}

PUTArtifactHandler handles PUT requests to /artifact

func (*PUTArtifactHandler) Exchange

func (pah *PUTArtifactHandler) Exchange() (interface{}, int)

Exchange implements Exchanger on PUTArtifactHandler

type PUTGDMHandler added in v1.0.1

type PUTGDMHandler struct {
	*http.Request
	logging.LogSink
	//GDM          *sous.State
	StateManager sous.StateManager
	User         ClientUser
}

PUTGDMHandler is an injectable request handler

func (*PUTGDMHandler) Exchange added in v1.0.1

func (h *PUTGDMHandler) Exchange() (interface{}, int)

Exchange implements the Handler interface

type PUTManifestHandler

type PUTManifestHandler struct {
	*sous.State
	logging.LogSink
	*http.Request
	restful.QueryValues
	User        ClientUser
	StateWriter sous.StateWriter
}

PUTManifestHandler handles PUT exchanges for manifests

func (*PUTManifestHandler) Exchange

func (pmh *PUTManifestHandler) Exchange() (interface{}, int)

Exchange implements restful.Exchanger

type PUTSingleDeploymentHandler added in v1.0.1

type PUTSingleDeploymentHandler struct {
	SingleDeploymentHandler
	QueueSet sous.QueueSet

	StateWriter sous.StateWriter
	// contains filtered or unexported fields
}

PUTSingleDeploymentHandler updates manifests containing single deployment specs. See Exchange method for more details.

func (*PUTSingleDeploymentHandler) Exchange added in v1.0.1

func (psd *PUTSingleDeploymentHandler) Exchange() (interface{}, int)

Exchange triggers a deployment action when receiving a Manifest containing a deployment matching DeploymentID that differs from the current actual deployment set. It first writes the new deployment spec to the GDM.

func (PUTSingleDeploymentHandler) GetUser added in v1.0.1

func (PUTSingleDeploymentHandler) GetUser(req *http.Request) ClientUser

type PUTStateDeployments added in v1.0.1

type PUTStateDeployments struct {
	User ClientUser
	// contains filtered or unexported fields
}

A PUTStateDeployments is the exchanger for PUT /state/deployments

func (*PUTStateDeployments) Exchange added in v1.0.1

func (psd *PUTStateDeployments) Exchange() (interface{}, int)

Exchange implements Exchanger on PUTStateDeployments

type QueueDesc added in v1.0.1

type QueueDesc struct {
	sous.DeploymentID
	Length int
}

QueueDesc describes the queue related to a Deployment

type R11nResource added in v1.0.1

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

R11nResource is a handler factory for r11n handlers.

func (*R11nResource) Get added in v1.0.1

Get returns a configured GETR11nHandler.

type ResponseMeta added in v1.0.1

type ResponseMeta struct {
	// Links is a set of links related to a response body.
	Links map[string]string
}

ResponseMeta contains metadata to include in API response bodies.

type ServerListData added in v1.0.1

type ServerListData struct {
	Servers []NameData
}

ServerListData is the DTO for lists of servers

func (*ServerListData) EmptyReceiver added in v1.0.1

func (ld *ServerListData) EmptyReceiver() restful.Comparable

EmptyReceiver implements Comparable on ServerListData

func (*ServerListData) VariancesFrom added in v1.0.1

func (ld *ServerListData) VariancesFrom(other restful.Comparable) restful.Variances

VariancesFrom implements Comparable on ServerListData

type ServerListHandler

type ServerListHandler struct {
	Config *config.Config
}

ServerListHandler handles GET for /servers

func (*ServerListHandler) Exchange

func (slh *ServerListHandler) Exchange() (interface{}, int)

Exchange implements restful.Exchanger on ServerListHandler

type ServerListResource

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

ServerListResource dispatches /servers

func (*ServerListResource) Get

Get implements Getable on ServerListResource, which marks it as accepting GET requests

func (*ServerListResource) Put added in v1.0.1

Put implements Putable on ServerListResource, which marks is as accepting PUT requests

type ServerListUpdater added in v1.0.1

type ServerListUpdater struct {
	*http.Request
	Config *config.Config
	Log    logging.LogSink
}

ServerListUpdater handles PUT for /servers

func (*ServerListUpdater) Exchange added in v1.0.1

func (slh *ServerListUpdater) Exchange() (interface{}, int)

Exchange implements restful.Exchanger on ServerListUpdater

type SingleDeploymentBody added in v1.0.1

type SingleDeploymentBody struct {
	Meta       ResponseMeta
	Deployment *sous.DeploySpec
}

SingleDeploymentBody is the response struct returned from handlers of HTTP methods of a SingleDeploymentResource.

func (SingleDeploymentBody) AddHeaders added in v1.0.1

func (b SingleDeploymentBody) AddHeaders(headers http.Header)

AddHeaders implements HeaderAdder on SingleDeploymentBody

func (SingleDeploymentBody) EmptyReceiver added in v1.0.1

func (b SingleDeploymentBody) EmptyReceiver() restful.Comparable

EmptyReceiver implements Comparable on SingleDeploymentBody

func (SingleDeploymentBody) VariancesFrom added in v1.0.1

func (b SingleDeploymentBody) VariancesFrom(other restful.Comparable) restful.Variances

VariancesFrom implements Comparable on SingleDeploymentBody

type SingleDeploymentHandler added in v1.0.1

type SingleDeploymentHandler struct {
	Body SingleDeploymentBody

	GDM *sous.State
	// contains filtered or unexported fields
}

SingleDeploymentHandler contains common data and methods to both the GET and PUT handlers.

func (SingleDeploymentHandler) GetUser added in v1.0.1

func (SingleDeploymentHandler) GetUser(req *http.Request) ClientUser

type SingleDeploymentResource added in v1.0.1

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

SingleDeploymentResource creates handlers for dealing with single deployments.

func (*SingleDeploymentResource) Get added in v1.0.1

Get returns a configured get single deployment handler.

func (*SingleDeploymentResource) Put added in v1.0.1

Put returns a configured put single deployment handler.

type StateDefGetHandler

type StateDefGetHandler struct {
	*sous.State
}

StateDefGetHandler handles GET /defs.

func (*StateDefGetHandler) Exchange

func (sdg *StateDefGetHandler) Exchange() (interface{}, int)

Exchange implements restful.Exchanger on StateDefGetHandler.

type StateDefPutHandler added in v1.0.1

type StateDefPutHandler struct {
	sous.StateManager
	// contains filtered or unexported fields
}

StateDefPutHandler handles PUT /defs.

func (*StateDefPutHandler) Exchange added in v1.0.1

func (sdp *StateDefPutHandler) Exchange() (interface{}, int)

Exchange implements restful.Exchanger on StateDefGetHandler.

type StateDefResource

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

StateDefResource defines the /defs endpoint

func (*StateDefResource) Get

Get implements restful.Getter on StateDefResource (and therefore makes it handle GET requests.)

func (StateDefResource) GetUser added in v1.0.1

func (StateDefResource) GetUser(req *http.Request) ClientUser

func (*StateDefResource) Put added in v1.0.1

Put implements restful.Putter on StateDefResource (and therefore makes it handle PUT requests.)

type StateDeploymentResource added in v1.0.1

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

A StateDeploymentResource provides for the /state/deployments resource family

func (*StateDeploymentResource) Get added in v1.0.1

Get implements restful.Getable on StateDeployments

func (StateDeploymentResource) GetUser added in v1.0.1

func (StateDeploymentResource) GetUser(req *http.Request) ClientUser

func (*StateDeploymentResource) Put added in v1.0.1

Put implements restful.Putable on StateDeployments

type StateManager added in v1.0.1

type StateManager struct {
	sous.StateManager
}

StateManager is a DI adapter

type StatusHandler

type StatusHandler struct {
	AutoResolver *sous.AutoResolver
	*sous.ResolveFilter
}

StatusHandler handles requests for status.

func (*StatusHandler) Exchange

func (h *StatusHandler) Exchange() (interface{}, int)

Exchange implements the Handler interface.

type StatusResource

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

StatusResource encapsulates a status response.

func (*StatusResource) Get

Get implements Getable on StatusResource.

type TestServerControl added in v1.0.1

type TestServerControl struct {
	State    *sous.State
	Inserter sous.InserterSpy
	Log      logging.LogSink
}

TestServerControl wraps the spies and dummies used to construct a test server. Can be used to control or inspect while using the client returned by TestingInMemoryClient.

func TestingInMemoryClient added in v1.0.1

func TestingInMemoryClient() (restful.HTTPClient, TestServerControl, error)

TestingInMemoryClient returns a restful.HTTPClient that sends requests to a dummy server, as well as a TestServerControl struct to control and inspect the test server.

Jump to

Keyboard shortcuts

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