api

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the outer handle for the broker HTTP client.

func New

func New(cc Config) *Client

New constructs a new http client from the configuration provided.

func (*Client) ControlShutdown

func (c *Client) ControlShutdown(ctx context.Context, id uint64) error

ControlShutdown attempts to gracefully shutdown the VM by ID. It will take no further actions if it does not succeed.

func (*Client) ControlStart

func (c *Client) ControlStart(ctx context.Context, id uint64) error

ControlStart starts a VM by id.

func (*Client) ControlStop

func (c *Client) ControlStop(ctx context.Context, id uint64) error

ControlStop attempts to gracefully stop a VM by id. If it fails, it will terminate the vm forcefully after 30 seconds.

func (*Client) VMCreate

func (c *Client) VMCreate(ctx context.Context, vm *spinapiserver.CreateVM) (uint64, error)

VMCreate creates a new VM based on the properties provided.

func (*Client) VMDelete

func (c *Client) VMDelete(ctx context.Context, id uint64) error

VMDelete deletes a vm by ID.

func (*Client) VMGet

func (c *Client) VMGet(ctx context.Context, id uint64) (*spinapiserver.UpdatedVM, error)

VMGet gets a VM by ID

func (*Client) VMList

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

VMList lists the ids of all vms

func (*Client) VMUpdate

func (c *Client) VMUpdate(ctx context.Context, id uint64, vm *spinapiserver.UpdatedVM) error

VMUpdate updates a single VM for an ID.

type Config

type Config struct {
	Host    string
	Timeout int
}

Config is the configuration struct for the HTTP client. Timeout is in seconds. Host should contain a port if not port 80.

Jump to

Keyboard shortcuts

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