server

package
v0.0.0-...-c0b5b33 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ControlShutdownSpinApiserverPath

func ControlShutdownSpinApiserverPath(id uint64) string

ControlShutdownSpinApiserverPath returns the URL path to the spin-apiserver service control_shutdown HTTP endpoint.

func ControlStartSpinApiserverPath

func ControlStartSpinApiserverPath(id uint64) string

ControlStartSpinApiserverPath returns the URL path to the spin-apiserver service control_start HTTP endpoint.

func ControlStopSpinApiserverPath

func ControlStopSpinApiserverPath(id uint64) string

ControlStopSpinApiserverPath returns the URL path to the spin-apiserver service control_stop HTTP endpoint.

func DecodeControlShutdownRequest

func DecodeControlShutdownRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeControlShutdownRequest returns a decoder for requests sent to the spin-apiserver control_shutdown endpoint.

func DecodeControlStartRequest

func DecodeControlStartRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeControlStartRequest returns a decoder for requests sent to the spin-apiserver control_start endpoint.

func DecodeControlStopRequest

func DecodeControlStopRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeControlStopRequest returns a decoder for requests sent to the spin-apiserver control_stop endpoint.

func DecodeVMCreateRequest

func DecodeVMCreateRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeVMCreateRequest returns a decoder for requests sent to the spin-apiserver vm_create endpoint.

func DecodeVMDeleteRequest

func DecodeVMDeleteRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeVMDeleteRequest returns a decoder for requests sent to the spin-apiserver vm_delete endpoint.

func DecodeVMGetRequest

func DecodeVMGetRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeVMGetRequest returns a decoder for requests sent to the spin-apiserver vm_get endpoint.

func DecodeVMUpdateRequest

func DecodeVMUpdateRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error)

DecodeVMUpdateRequest returns a decoder for requests sent to the spin-apiserver vm_update endpoint.

func EncodeControlShutdownResponse

func EncodeControlShutdownResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeControlShutdownResponse returns an encoder for responses returned by the spin-apiserver control_shutdown endpoint.

func EncodeControlStartResponse

func EncodeControlStartResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeControlStartResponse returns an encoder for responses returned by the spin-apiserver control_start endpoint.

func EncodeControlStopResponse

func EncodeControlStopResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeControlStopResponse returns an encoder for responses returned by the spin-apiserver control_stop endpoint.

func EncodeVMCreateResponse

func EncodeVMCreateResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeVMCreateResponse returns an encoder for responses returned by the spin-apiserver vm_create endpoint.

func EncodeVMDeleteResponse

func EncodeVMDeleteResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeVMDeleteResponse returns an encoder for responses returned by the spin-apiserver vm_delete endpoint.

func EncodeVMGetResponse

func EncodeVMGetResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeVMGetResponse returns an encoder for responses returned by the spin-apiserver vm_get endpoint.

func EncodeVMListResponse

func EncodeVMListResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeVMListResponse returns an encoder for responses returned by the spin-apiserver vm_list endpoint.

func EncodeVMUpdateResponse

func EncodeVMUpdateResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error

EncodeVMUpdateResponse returns an encoder for responses returned by the spin-apiserver vm_update endpoint.

func Mount

func Mount(mux goahttp.Muxer, h *Server)

Mount configures the mux to serve the spin-apiserver endpoints.

func MountControlShutdownHandler

func MountControlShutdownHandler(mux goahttp.Muxer, h http.Handler)

MountControlShutdownHandler configures the mux to serve the "spin-apiserver" service "control_shutdown" endpoint.

func MountControlStartHandler

func MountControlStartHandler(mux goahttp.Muxer, h http.Handler)

MountControlStartHandler configures the mux to serve the "spin-apiserver" service "control_start" endpoint.

func MountControlStopHandler

func MountControlStopHandler(mux goahttp.Muxer, h http.Handler)

MountControlStopHandler configures the mux to serve the "spin-apiserver" service "control_stop" endpoint.

func MountVMCreateHandler

func MountVMCreateHandler(mux goahttp.Muxer, h http.Handler)

MountVMCreateHandler configures the mux to serve the "spin-apiserver" service "vm_create" endpoint.

func MountVMDeleteHandler

func MountVMDeleteHandler(mux goahttp.Muxer, h http.Handler)

MountVMDeleteHandler configures the mux to serve the "spin-apiserver" service "vm_delete" endpoint.

func MountVMGetHandler

func MountVMGetHandler(mux goahttp.Muxer, h http.Handler)

MountVMGetHandler configures the mux to serve the "spin-apiserver" service "vm_get" endpoint.

func MountVMListHandler

func MountVMListHandler(mux goahttp.Muxer, h http.Handler)

MountVMListHandler configures the mux to serve the "spin-apiserver" service "vm_list" endpoint.

func MountVMUpdateHandler

func MountVMUpdateHandler(mux goahttp.Muxer, h http.Handler)

MountVMUpdateHandler configures the mux to serve the "spin-apiserver" service "vm_update" endpoint.

func NewControlShutdownHandler

func NewControlShutdownHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewControlShutdownHandler creates a HTTP handler which loads the HTTP request and calls the "spin-apiserver" service "control_shutdown" endpoint.

func NewControlShutdownPayload

func NewControlShutdownPayload(id uint64) *spinapiserver.ControlShutdownPayload

NewControlShutdownPayload builds a spin-apiserver service control_shutdown endpoint payload.

func NewControlStartHandler

func NewControlStartHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewControlStartHandler creates a HTTP handler which loads the HTTP request and calls the "spin-apiserver" service "control_start" endpoint.

func NewControlStartPayload

func NewControlStartPayload(id uint64) *spinapiserver.ControlStartPayload

NewControlStartPayload builds a spin-apiserver service control_start endpoint payload.

func NewControlStopHandler

func NewControlStopHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewControlStopHandler creates a HTTP handler which loads the HTTP request and calls the "spin-apiserver" service "control_stop" endpoint.

func NewControlStopPayload

func NewControlStopPayload(id uint64) *spinapiserver.ControlStopPayload

NewControlStopPayload builds a spin-apiserver service control_stop endpoint payload.

func NewVMCreateCreateVM

func NewVMCreateCreateVM(body *VMCreateRequestBody) *spinapiserver.CreateVM

NewVMCreateCreateVM builds a spin-apiserver service vm_create endpoint payload.

func NewVMCreateHandler

func NewVMCreateHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewVMCreateHandler creates a HTTP handler which loads the HTTP request and calls the "spin-apiserver" service "vm_create" endpoint.

func NewVMDeleteHandler

func NewVMDeleteHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewVMDeleteHandler creates a HTTP handler which loads the HTTP request and calls the "spin-apiserver" service "vm_delete" endpoint.

func NewVMDeletePayload

func NewVMDeletePayload(id uint64) *spinapiserver.VMDeletePayload

NewVMDeletePayload builds a spin-apiserver service vm_delete endpoint payload.

func NewVMGetHandler

func NewVMGetHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewVMGetHandler creates a HTTP handler which loads the HTTP request and calls the "spin-apiserver" service "vm_get" endpoint.

func NewVMGetPayload

func NewVMGetPayload(id uint64) *spinapiserver.VMGetPayload

NewVMGetPayload builds a spin-apiserver service vm_get endpoint payload.

func NewVMListHandler

func NewVMListHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewVMListHandler creates a HTTP handler which loads the HTTP request and calls the "spin-apiserver" service "vm_list" endpoint.

func NewVMUpdateHandler

func NewVMUpdateHandler(
	endpoint goa.Endpoint,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) http.Handler

NewVMUpdateHandler creates a HTTP handler which loads the HTTP request and calls the "spin-apiserver" service "vm_update" endpoint.

func NewVMUpdatePayload

func NewVMUpdatePayload(body *VMUpdateRequestBody, id uint64) *spinapiserver.VMUpdatePayload

NewVMUpdatePayload builds a spin-apiserver service vm_update endpoint payload.

func VMCreateSpinApiserverPath

func VMCreateSpinApiserverPath() string

VMCreateSpinApiserverPath returns the URL path to the spin-apiserver service vm_create HTTP endpoint.

func VMDeleteSpinApiserverPath

func VMDeleteSpinApiserverPath(id uint64) string

VMDeleteSpinApiserverPath returns the URL path to the spin-apiserver service vm_delete HTTP endpoint.

func VMGetSpinApiserverPath

func VMGetSpinApiserverPath(id uint64) string

VMGetSpinApiserverPath returns the URL path to the spin-apiserver service vm_get HTTP endpoint.

func VMListSpinApiserverPath

func VMListSpinApiserverPath() string

VMListSpinApiserverPath returns the URL path to the spin-apiserver service vm_list HTTP endpoint.

func VMUpdateSpinApiserverPath

func VMUpdateSpinApiserverPath(id uint64) string

VMUpdateSpinApiserverPath returns the URL path to the spin-apiserver service vm_update HTTP endpoint.

func ValidateImageRequestBody

func ValidateImageRequestBody(body *ImageRequestBody) (err error)

ValidateImageRequestBody runs the validations defined on ImageRequestBody

func ValidateStorageRequestBody

func ValidateStorageRequestBody(body *StorageRequestBody) (err error)

ValidateStorageRequestBody runs the validations defined on StorageRequestBody

func ValidateUpdatedVMRequestBody

func ValidateUpdatedVMRequestBody(body *UpdatedVMRequestBody) (err error)

ValidateUpdatedVMRequestBody runs the validations defined on UpdatedVMRequestBody

func ValidateVMCreateRequestBody

func ValidateVMCreateRequestBody(body *VMCreateRequestBody) (err error)

ValidateVMCreateRequestBody runs the validations defined on vm_create_request_body

func ValidateVMUpdateRequestBody

func ValidateVMUpdateRequestBody(body *VMUpdateRequestBody) (err error)

ValidateVMUpdateRequestBody runs the validations defined on vm_update_request_body

Types

type ErrorNamer

type ErrorNamer interface {
	ErrorName() string
}

ErrorNamer is an interface implemented by generated error structs that exposes the name of the error as defined in the design.

type ImageRequestBody

type ImageRequestBody struct {
	// Image path
	Path *string `form:"path,omitempty" json:"path,omitempty" xml:"path,omitempty"`
	// Is this a cdrom image?
	Cdrom *bool `form:"cdrom,omitempty" json:"cdrom,omitempty" xml:"cdrom,omitempty"`
	// Volume name
	Volume *string `form:"volume,omitempty" json:"volume,omitempty" xml:"volume,omitempty"`
}

ImageRequestBody is used to define fields on request body types.

type ImageResponseBody

type ImageResponseBody struct {
	// Image path
	Path string `form:"path" json:"path" xml:"path"`
	// Is this a cdrom image?
	Cdrom bool `form:"cdrom" json:"cdrom" xml:"cdrom"`
	// Volume name
	Volume *string `form:"volume,omitempty" json:"volume,omitempty" xml:"volume,omitempty"`
}

ImageResponseBody is used to define fields on response body types.

type MountPoint

type MountPoint struct {
	// Method is the name of the service method served by the mounted HTTP handler.
	Method string
	// Verb is the HTTP method used to match requests to the mounted handler.
	Verb string
	// Pattern is the HTTP request path pattern used to match requests to the
	// mounted handler.
	Pattern string
}

MountPoint holds information about the mounted endpoints.

type Server

type Server struct {
	Mounts          []*MountPoint
	VMCreate        http.Handler
	VMDelete        http.Handler
	VMList          http.Handler
	VMGet           http.Handler
	VMUpdate        http.Handler
	ControlStart    http.Handler
	ControlStop     http.Handler
	ControlShutdown http.Handler
}

Server lists the spin-apiserver service endpoint HTTP handlers.

func New

func New(
	e *spinapiserver.Endpoints,
	mux goahttp.Muxer,
	decoder func(*http.Request) goahttp.Decoder,
	encoder func(context.Context, http.ResponseWriter) goahttp.Encoder,
	errhandler func(context.Context, http.ResponseWriter, error),
	formatter func(err error) goahttp.Statuser,
) *Server

New instantiates HTTP handlers for all the spin-apiserver service endpoints using the provided encoder and decoder. The handlers are mounted on the given mux using the HTTP verb and path defined in the design. errhandler is called whenever a response fails to be encoded. formatter is used to format errors returned by the service methods prior to encoding. Both errhandler and formatter are optional and can be nil.

func (*Server) Service

func (s *Server) Service() string

Service returns the name of the service served.

func (*Server) Use

func (s *Server) Use(m func(http.Handler) http.Handler)

Use wraps the server handlers with the given middleware.

type StorageRequestBody

type StorageRequestBody struct {
	// Volume name; required if image is not a cdrom
	Volume *string `form:"volume,omitempty" json:"volume,omitempty" xml:"volume,omitempty"`
	// Image filename, no `/` characters
	Image *string `form:"image,omitempty" json:"image,omitempty" xml:"image,omitempty"`
	// Image size (in gigabytes); required if image is not a cdrom
	ImageSize *uint `form:"image_size,omitempty" json:"image_size,omitempty" xml:"image_size,omitempty"`
	// Is this image a cdrom?
	Cdrom *bool `form:"cdrom,omitempty" json:"cdrom,omitempty" xml:"cdrom,omitempty"`
}

StorageRequestBody is used to define fields on request body types.

type UpdatedVMRequestBody

type UpdatedVMRequestBody struct {
	// Image references
	Images []*ImageRequestBody `form:"images,omitempty" json:"images,omitempty" xml:"images,omitempty"`
	// Name of VM; does not need to be unique
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// CPU count
	Cpus *uint `form:"cpus,omitempty" json:"cpus,omitempty" xml:"cpus,omitempty"`
	// Memory (in megabytes)
	Memory *uint `form:"memory,omitempty" json:"memory,omitempty" xml:"memory,omitempty"`
}

UpdatedVMRequestBody is used to define fields on request body types.

type VMCreateRequestBody

type VMCreateRequestBody struct {
	// Storage references
	Storage []*StorageRequestBody `form:"storage,omitempty" json:"storage,omitempty" xml:"storage,omitempty"`
	// Name of VM; does not need to be unique
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// CPU count
	Cpus *uint `form:"cpus,omitempty" json:"cpus,omitempty" xml:"cpus,omitempty"`
	// Memory (in megabytes)
	Memory *uint `form:"memory,omitempty" json:"memory,omitempty" xml:"memory,omitempty"`
}

VMCreateRequestBody is the type of the "spin-apiserver" service "vm_create" endpoint HTTP request body.

type VMGetResponseBody

type VMGetResponseBody struct {
	// Image references
	Images []*ImageResponseBody `form:"images" json:"images" xml:"images"`
	// Name of VM; does not need to be unique
	Name string `form:"name" json:"name" xml:"name"`
	// CPU count
	Cpus uint `form:"cpus" json:"cpus" xml:"cpus"`
	// Memory (in megabytes)
	Memory uint `form:"memory" json:"memory" xml:"memory"`
}

VMGetResponseBody is the type of the "spin-apiserver" service "vm_get" endpoint HTTP response body.

func NewVMGetResponseBody

func NewVMGetResponseBody(res *spinapiserver.UpdatedVM) *VMGetResponseBody

NewVMGetResponseBody builds the HTTP response body from the result of the "vm_get" endpoint of the "spin-apiserver" service.

type VMUpdateRequestBody

type VMUpdateRequestBody struct {
	// VM Manifest to Update
	VM *UpdatedVMRequestBody `form:"vm,omitempty" json:"vm,omitempty" xml:"vm,omitempty"`
}

VMUpdateRequestBody is the type of the "spin-apiserver" service "vm_update" endpoint HTTP request body.

Jump to

Keyboard shortcuts

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