util

package
v0.0.0-...-56be8c2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](elems []T, v T) bool

func Divmod

func Divmod(a, b int) (int, int)

func ParseRequest

func ParseRequest[R Request, T Validatable[R]](r *http.Request, rq T) error

func VerFromDec

func VerFromDec(version int) string

Parse xxxyyyzzz to xxx.yyy.zzz for version numbers

Types

type DomainCreateRequest

type DomainCreateRequest struct {
	ID         string `json:"id"`
	Hostname   string `json:"hostname"`
	CPU        int    `json:"cpu"`
	Memory     int    `json:"memory"`
	Image      string `json:"image"`
	Cloud      bool   `json:"cloud"`
	CloudImage string `json:"cloud_image"`
	OSVariant  string `json:"os_variant"`
	UserData   string `json:"user_data"`
	MetaData   string `json:"meta_data"`
	Disk       []struct {
		ID   int    `json:"id"`
		Size int    `json:"size"`
		Path string `json:"path"`
	} `json:"disk"`
	Iface []struct {
		Bridge string `json:"bridge"`
		MAC    string `json:"mac"`
	} `json:"iface"`
}

func (*DomainCreateRequest) Validate

func (r *DomainCreateRequest) Validate() error

type Request

type Request interface {
	SetDomainStateRequest |
		DomainCreateRequest
}

type SetDomainStateRequest

type SetDomainStateRequest struct {
	State string `json:"state"`
}

func (*SetDomainStateRequest) Validate

func (r *SetDomainStateRequest) Validate() error

type Validatable

type Validatable[T any] interface {
	Validate() error
	*T
}

Jump to

Keyboard shortcuts

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