spinapiserver

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: 2 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "spin-apiserver"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [8]string{"vm_create", "vm_delete", "vm_list", "vm_get", "vm_update", "control_start", "control_stop", "control_shutdown"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func NewControlShutdownEndpoint

func NewControlShutdownEndpoint(s Service) goa.Endpoint

NewControlShutdownEndpoint returns an endpoint function that calls the method "control_shutdown" of service "spin-apiserver".

func NewControlStartEndpoint

func NewControlStartEndpoint(s Service) goa.Endpoint

NewControlStartEndpoint returns an endpoint function that calls the method "control_start" of service "spin-apiserver".

func NewControlStopEndpoint

func NewControlStopEndpoint(s Service) goa.Endpoint

NewControlStopEndpoint returns an endpoint function that calls the method "control_stop" of service "spin-apiserver".

func NewVMCreateEndpoint

func NewVMCreateEndpoint(s Service) goa.Endpoint

NewVMCreateEndpoint returns an endpoint function that calls the method "vm_create" of service "spin-apiserver".

func NewVMDeleteEndpoint

func NewVMDeleteEndpoint(s Service) goa.Endpoint

NewVMDeleteEndpoint returns an endpoint function that calls the method "vm_delete" of service "spin-apiserver".

func NewVMGetEndpoint

func NewVMGetEndpoint(s Service) goa.Endpoint

NewVMGetEndpoint returns an endpoint function that calls the method "vm_get" of service "spin-apiserver".

func NewVMListEndpoint

func NewVMListEndpoint(s Service) goa.Endpoint

NewVMListEndpoint returns an endpoint function that calls the method "vm_list" of service "spin-apiserver".

func NewVMUpdateEndpoint

func NewVMUpdateEndpoint(s Service) goa.Endpoint

NewVMUpdateEndpoint returns an endpoint function that calls the method "vm_update" of service "spin-apiserver".

Types

type Client

type Client struct {
	VMCreateEndpoint        goa.Endpoint
	VMDeleteEndpoint        goa.Endpoint
	VMListEndpoint          goa.Endpoint
	VMGetEndpoint           goa.Endpoint
	VMUpdateEndpoint        goa.Endpoint
	ControlStartEndpoint    goa.Endpoint
	ControlStopEndpoint     goa.Endpoint
	ControlShutdownEndpoint goa.Endpoint
}

Client is the "spin-apiserver" service client.

func NewClient

func NewClient(vMCreate, vMDelete, vMList, vMGet, vMUpdate, controlStart, controlStop, controlShutdown goa.Endpoint) *Client

NewClient initializes a "spin-apiserver" service client given the endpoints.

func (*Client) ControlShutdown

func (c *Client) ControlShutdown(ctx context.Context, p *ControlShutdownPayload) (err error)

ControlShutdown calls the "control_shutdown" endpoint of the "spin-apiserver" service.

func (*Client) ControlStart

func (c *Client) ControlStart(ctx context.Context, p *ControlStartPayload) (err error)

ControlStart calls the "control_start" endpoint of the "spin-apiserver" service.

func (*Client) ControlStop

func (c *Client) ControlStop(ctx context.Context, p *ControlStopPayload) (err error)

ControlStop calls the "control_stop" endpoint of the "spin-apiserver" service.

func (*Client) VMCreate

func (c *Client) VMCreate(ctx context.Context, p *CreateVM) (res uint64, err error)

VMCreate calls the "vm_create" endpoint of the "spin-apiserver" service.

func (*Client) VMDelete

func (c *Client) VMDelete(ctx context.Context, p *VMDeletePayload) (err error)

VMDelete calls the "vm_delete" endpoint of the "spin-apiserver" service.

func (*Client) VMGet

func (c *Client) VMGet(ctx context.Context, p *VMGetPayload) (res *UpdatedVM, err error)

VMGet calls the "vm_get" endpoint of the "spin-apiserver" service.

func (*Client) VMList

func (c *Client) VMList(ctx context.Context) (res []uint64, err error)

VMList calls the "vm_list" endpoint of the "spin-apiserver" service.

func (*Client) VMUpdate

func (c *Client) VMUpdate(ctx context.Context, p *VMUpdatePayload) (err error)

VMUpdate calls the "vm_update" endpoint of the "spin-apiserver" service.

type ControlShutdownPayload

type ControlShutdownPayload struct {
	// ID of VM to shutdown
	ID uint64
}

ControlShutdownPayload is the payload type of the spin-apiserver service control_shutdown method.

type ControlStartPayload

type ControlStartPayload struct {
	// ID of VM to start
	ID uint64
}

ControlStartPayload is the payload type of the spin-apiserver service control_start method.

type ControlStopPayload

type ControlStopPayload struct {
	// ID of VM to stop
	ID uint64
}

ControlStopPayload is the payload type of the spin-apiserver service control_stop method.

type CreateVM

type CreateVM struct {
	// Storage references
	Storage []*Storage
	// Name of VM; does not need to be unique
	Name string
	// CPU count
	Cpus uint
	// Memory (in megabytes)
	Memory uint
}

CreateVM is the payload type of the spin-apiserver service vm_create method.

type Endpoints

type Endpoints struct {
	VMCreate        goa.Endpoint
	VMDelete        goa.Endpoint
	VMList          goa.Endpoint
	VMGet           goa.Endpoint
	VMUpdate        goa.Endpoint
	ControlStart    goa.Endpoint
	ControlStop     goa.Endpoint
	ControlShutdown goa.Endpoint
}

Endpoints wraps the "spin-apiserver" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "spin-apiserver" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "spin-apiserver" service endpoints.

type Image

type Image struct {
	// Image path
	Path string
	// Is this a cdrom image?
	Cdrom bool
	// Volume name
	Volume *string
}

type Service

type Service interface {
	// VMCreate implements vm_create.
	VMCreate(context.Context, *CreateVM) (res uint64, err error)
	// VMDelete implements vm_delete.
	VMDelete(context.Context, *VMDeletePayload) (err error)
	// VMList implements vm_list.
	VMList(context.Context) (res []uint64, err error)
	// VMGet implements vm_get.
	VMGet(context.Context, *VMGetPayload) (res *UpdatedVM, err error)
	// VMUpdate implements vm_update.
	VMUpdate(context.Context, *VMUpdatePayload) (err error)
	// ControlStart implements control_start.
	ControlStart(context.Context, *ControlStartPayload) (err error)
	// ControlStop implements control_stop.
	ControlStop(context.Context, *ControlStopPayload) (err error)
	// ControlShutdown implements control_shutdown.
	ControlShutdown(context.Context, *ControlShutdownPayload) (err error)
}

Bridge between the outer-facing UIs and the internals

type Storage

type Storage struct {
	// Volume name; required if image is not a cdrom
	Volume *string
	// Image filename, no `/` characters
	Image string
	// Image size (in gigabytes); required if image is not a cdrom
	ImageSize *uint
	// Is this image a cdrom?
	Cdrom bool
}

type UpdatedVM

type UpdatedVM struct {
	// Image references
	Images []*Image
	// Name of VM; does not need to be unique
	Name string
	// CPU count
	Cpus uint
	// Memory (in megabytes)
	Memory uint
}

UpdatedVM is the result type of the spin-apiserver service vm_get method.

type VMDeletePayload

type VMDeletePayload struct {
	// ID of VM to delete
	ID uint64
}

VMDeletePayload is the payload type of the spin-apiserver service vm_delete method.

type VMGetPayload

type VMGetPayload struct {
	// ID of VM to retrieve
	ID uint64
}

VMGetPayload is the payload type of the spin-apiserver service vm_get method.

type VMUpdatePayload

type VMUpdatePayload struct {
	// ID of VM to Update
	ID uint64
	// VM Manifest to Update
	VM *UpdatedVM
}

VMUpdatePayload is the payload type of the spin-apiserver service vm_update method.

Jump to

Keyboard shortcuts

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