openapi

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package openapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

Types

type CreateInstanceJSONBody

type CreateInstanceJSONBody = CreateInstanceRequestBody

CreateInstanceJSONBody defines parameters for CreateInstance.

type CreateInstanceJSONRequestBody

type CreateInstanceJSONRequestBody = CreateInstanceJSONBody

CreateInstanceJSONRequestBody defines body for CreateInstance for application/json ContentType.

type CreateInstanceRequestBody

type CreateInstanceRequestBody struct {
	// URL will be downloaded and written to the root disk
	BaseImage string `json:"base_image"`

	// number of CPU cores to allocate to the new instance
	Cpu int `json:"cpu"`

	// the size of the root disk, in gigabytes
	DiskSize int `json:"disk_size"`

	// memory (in MB) to allocate to the new instance
	Memory int `json:"memory"`

	// a list of networks to connect the new instance to. a NIC will be added for each network.
	Networks []string `json:"networks"`

	// a list of special cases to apply to the new instance
	SpecialCases *[]string `json:"special_cases,omitempty"`

	// arbitrary data that will be available to the VM
	UserData *string `json:"user_data,omitempty"`
}

CreateInstanceRequestBody defines model for CreateInstanceRequestBody.

type EchoRouter

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type Instance

type Instance struct {
	Cpu        int                `json:"cpu"`
	Interfaces []NetworkInterface `json:"interfaces"`
	Memory     int                `json:"memory"`
	Node       *string            `json:"node,omitempty"`
	ResourceId string             `json:"resource_id"`
	RootVolume string             `json:"root_volume"`
	State      InstanceState      `json:"state"`
	UserData   *string            `json:"user_data,omitempty"`
}

Instance defines model for Instance.

type InstanceState

type InstanceState string

InstanceState defines model for Instance.State.

const (
	CREATING InstanceState = "CREATING"
	DELETED  InstanceState = "DELETED"
	DELETING InstanceState = "DELETING"
	ERROR    InstanceState = "ERROR"
	PENDING  InstanceState = "PENDING"
	RUNNING  InstanceState = "RUNNING"
	STARTING InstanceState = "STARTING"
	STOPPED  InstanceState = "STOPPED"
	STOPPING InstanceState = "STOPPING"
)

Defines values for InstanceState.

type NetworkInterface

type NetworkInterface struct {
	Addresses []string `json:"addresses"`
	Id        string   `json:"id"`
	Mac       string   `json:"mac"`
	Network   string   `json:"network"`

	// indicates this port NIC will receive vlan-tagged traffic
	Trunk *bool `json:"trunk,omitempty"`
}

NetworkInterface defines model for NetworkInterface.

type ServerInterface

type ServerInterface interface {

	// (GET /instances/v0/instance)
	ListAllInstances(ctx echo.Context) error

	// (POST /instances/v0/instance)
	CreateInstance(ctx echo.Context) error

	// (DELETE /instances/v0/instance/{id})
	DeleteInstance(ctx echo.Context, id string) error

	// (GET /instances/v0/instance/{id})
	GetInstance(ctx echo.Context, id string) error

	// (PUT /instances/v0/instance/{id}/nic/{nic}/add-trunk-vlan)
	TrunkNicAddNetwork(ctx echo.Context, id string, nic string) error

	// (POST /instances/v0/instance/{id}/start)
	StartInstance(ctx echo.Context, id string) error

	// (POST /instances/v0/instance/{id}/stop)
	StopInstance(ctx echo.Context, id string) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) CreateInstance

func (w *ServerInterfaceWrapper) CreateInstance(ctx echo.Context) error

CreateInstance converts echo context to params.

func (*ServerInterfaceWrapper) DeleteInstance

func (w *ServerInterfaceWrapper) DeleteInstance(ctx echo.Context) error

DeleteInstance converts echo context to params.

func (*ServerInterfaceWrapper) GetInstance

func (w *ServerInterfaceWrapper) GetInstance(ctx echo.Context) error

GetInstance converts echo context to params.

func (*ServerInterfaceWrapper) ListAllInstances

func (w *ServerInterfaceWrapper) ListAllInstances(ctx echo.Context) error

ListAllInstances converts echo context to params.

func (*ServerInterfaceWrapper) StartInstance

func (w *ServerInterfaceWrapper) StartInstance(ctx echo.Context) error

StartInstance converts echo context to params.

func (*ServerInterfaceWrapper) StopInstance

func (w *ServerInterfaceWrapper) StopInstance(ctx echo.Context) error

StopInstance converts echo context to params.

func (*ServerInterfaceWrapper) TrunkNicAddNetwork

func (w *ServerInterfaceWrapper) TrunkNicAddNetwork(ctx echo.Context) error

TrunkNicAddNetwork converts echo context to params.

type TrunkNicAddNetworkJSONBody

type TrunkNicAddNetworkJSONBody = string

TrunkNicAddNetworkJSONBody defines parameters for TrunkNicAddNetwork.

type TrunkNicAddNetworkJSONRequestBody

type TrunkNicAddNetworkJSONRequestBody = TrunkNicAddNetworkJSONBody

TrunkNicAddNetworkJSONRequestBody defines body for TrunkNicAddNetwork for application/json ContentType.

Jump to

Keyboard shortcuts

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