module

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 5 Imported by: 20

Documentation

Index

Constants

View Source
const RefPlaceholder = "ref"

Variables

View Source
var CPUArchMap = map[CPUArch]struct{}{
	X86:     {},
	I386:    {},
	X86_64:  {},
	AMD64:   {},
	AARCH32: {},
	ARM32V5: {},
	ARM32V6: {},
	ARM32V7: {},
	AARCH64: {},
	ARM64V8: {},
}
View Source
var DeploymentTypeMap = map[DeploymentType]struct{}{
	SingleDeployment:   {},
	MultipleDeployment: {},
}
View Source
var ModuleTypeMap = map[ModuleType]struct{}{
	AddOnModule:           {},
	DeviceConnectorModule: {},
}
View Source
var PortProtocolMap = map[PortProtocol]struct{}{
	TcpPort: {},
	UdpPort: {},
}

Functions

func GetServiceStartOrder

func GetServiceStartOrder(services map[string]*Service) ([]string, error)

Types

type AuxService added in v0.15.0

type AuxService struct {
	Name            string                         `json:"name"`
	RunConfig       RunConfig                      `json:"run_config"`
	BindMounts      map[string]BindMount           `json:"bind_mounts"`      // {mntPoint:BindMount}
	Tmpfs           map[string]TmpfsMount          `json:"tmpfs"`            // {mntPoint:TmpfsMount}
	Volumes         map[string]string              `json:"volumes"`          // {mntPoint:volName}
	Configs         map[string]string              `json:"configs"`          // {refVar:ref}
	SrvReferences   map[string]SrvRefTarget        `json:"srv_references"`   // {refVar:SrvRefTarget}
	ExtDependencies map[string]ExtDependencyTarget `json:"ext_dependencies"` // {refVar:ExtDependencyTarget}
}

type BindMount

type BindMount struct {
	Source   string `json:"source"`
	ReadOnly bool   `json:"read_only"`
}

type CPUArch

type CPUArch = string
const (
	X86     CPUArch = "x86"
	I386    CPUArch = "i386"
	X86_64  CPUArch = "x86_64"
	AMD64   CPUArch = "amd64"
	AARCH32 CPUArch = "aarch32"
	ARM32V5 CPUArch = "arm32v5"
	ARM32V6 CPUArch = "arm32v6"
	ARM32V7 CPUArch = "arm32v7"
	AARCH64 CPUArch = "aarch64"
	ARM64V8 CPUArch = "arm64v8"
)

type ConfigTypeOptions

type ConfigTypeOptions map[string]configTypeOption

func (ConfigTypeOptions) SetBool

func (o ConfigTypeOptions) SetBool(ref string, val bool)

func (ConfigTypeOptions) SetFloat64

func (o ConfigTypeOptions) SetFloat64(ref string, val float64)

func (ConfigTypeOptions) SetInt64

func (o ConfigTypeOptions) SetInt64(ref string, val int64)

func (ConfigTypeOptions) SetString

func (o ConfigTypeOptions) SetString(ref string, val string)

type Configs

type Configs map[string]configValue

func (Configs) SetBool

func (c Configs) SetBool(ref string, def *bool, opt []bool, optExt bool, cType string, cTypeOpt ConfigTypeOptions, required bool)

func (Configs) SetBoolSlice

func (c Configs) SetBoolSlice(ref string, def []bool, opt []bool, optExt bool, cType string, cTypeOpt ConfigTypeOptions, delimiter string, required bool)

func (Configs) SetFloat64

func (c Configs) SetFloat64(ref string, def *float64, opt []float64, optExt bool, cType string, cTypeOpt ConfigTypeOptions, required bool)

func (Configs) SetFloat64Slice

func (c Configs) SetFloat64Slice(ref string, def []float64, opt []float64, optExt bool, cType string, cTypeOpt ConfigTypeOptions, delimiter string, required bool)

func (Configs) SetInt64

func (c Configs) SetInt64(ref string, def *int64, opt []int64, optExt bool, cType string, cTypeOpt ConfigTypeOptions, required bool)

func (Configs) SetInt64Slice

func (c Configs) SetInt64Slice(ref string, def []int64, opt []int64, optExt bool, cType string, cTypeOpt ConfigTypeOptions, delimiter string, required bool)

func (Configs) SetString

func (c Configs) SetString(ref string, def *string, opt []string, optExt bool, cType string, cTypeOpt ConfigTypeOptions, required bool)

func (Configs) SetStringSlice

func (c Configs) SetStringSlice(ref string, def []string, opt []string, optExt bool, cType string, cTypeOpt ConfigTypeOptions, delimiter string, required bool)

type DataType

type DataType = string
const (
	BoolType    DataType = "bool"
	Int64Type   DataType = "int"
	Float64Type DataType = "float"
	StringType  DataType = "string"
)

type DeploymentType

type DeploymentType = string
const (
	SingleDeployment   DeploymentType = "single"
	MultipleDeployment DeploymentType = "multiple"
)

type ExtDependencyTarget added in v0.4.0

type ExtDependencyTarget struct {
	ID       string  `json:"id"`
	Service  string  `json:"service"`
	Template *string `json:"template"`
}

func (ExtDependencyTarget) FillTemplate added in v0.14.0

func (t ExtDependencyTarget) FillTemplate(s string) string

type HostResTarget added in v0.7.0

type HostResTarget struct {
	Ref      string `json:"ref"`
	ReadOnly bool   `json:"read_only"`
}

type HostResource added in v0.7.0

type HostResource struct {
	Resource
}

type HttpEndpoint

type HttpEndpoint struct {
	Name *string `json:"name"`
	Port *int    `json:"port"`
	Path *string `json:"path"` // internal path
}

type Input

type Input struct {
	Name        string  `json:"name"`
	Description *string `json:"description"`
	Group       *string `json:"group"`
}

type InputGroup

type InputGroup struct {
	Name        string  `json:"name"`
	Description *string `json:"description"`
	Group       *string `json:"group"`
}

type Inputs

type Inputs struct {
	Resources map[string]Input      `json:"resources"` // {ref:Input}
	Secrets   map[string]Input      `json:"secrets"`   // {ref:Input}
	Configs   map[string]Input      `json:"configs"`   // {ref:Input}
	Groups    map[string]InputGroup `json:"groups"`    // {ref:InputGroup}
}

type Module

type Module struct {
	ID             string                  `json:"id"`
	Name           string                  `json:"name"`
	Description    string                  `json:"description"`
	Tags           util.Set[string]        `json:"tags"`
	License        string                  `json:"license"`
	Author         string                  `json:"author"`
	Version        string                  `json:"version"`
	Type           ModuleType              `json:"type"`
	DeploymentType DeploymentType          `json:"deployment_type"`
	Architectures  util.Set[CPUArch]       `json:"architectures"`
	Services       map[string]*Service     `json:"services"`       // {ref:Service}
	Volumes        util.Set[string]        `json:"volumes"`        // {volName}
	Dependencies   map[string]string       `json:"dependencies"`   // {moduleID:moduleVersion}
	HostResources  map[string]HostResource `json:"host_resources"` // {ref:{tag}}
	Secrets        map[string]Secret       `json:"secrets"`        // {ref:Secret}
	Configs        Configs                 `json:"configs"`        // {ref:ConfigValue}
	Inputs         Inputs                  `json:"inputs"`
	AuxServices    map[string]*AuxService  `json:"aux_services"` // {ref:AuxService}
	AuxImgSrc      util.Set[string]        `json:"aux_img_src"`
}

type ModuleType

type ModuleType = string
const (
	AddOnModule           ModuleType = "add-on"
	DeviceConnectorModule ModuleType = "device-connector"
)

type Port

type Port struct {
	Name     *string      `json:"name"`
	Number   uint         `json:"number"`
	Protocol PortProtocol `json:"protocol"`
	Bindings []uint       `json:"bindings"`
}

type PortProtocol

type PortProtocol = string
const (
	TcpPort PortProtocol = "tcp"
	UdpPort PortProtocol = "udp"
)

type Resource added in v0.6.0

type Resource struct {
	Tags     util.Set[string] `json:"tags"`
	Required bool             `json:"required"`
}

type RunConfig

type RunConfig struct {
	MaxRetries  uint          `json:"max_retries"`
	RunOnce     bool          `json:"run_once"`
	StopTimeout time.Duration `json:"stop_timeout"`
	StopSignal  *string       `json:"stop_signal"`
	PseudoTTY   bool          `json:"pseudo_tty"`
	Command     []string      `json:"command"`
}

type Secret

type Secret struct {
	Resource
	Type string `json:"type"`
}

type SecretTarget added in v0.9.0

type SecretTarget struct {
	Ref  string  `json:"ref"`
	Item *string `json:"item"`
}

type Service

type Service struct {
	Name            string                         `json:"name"`
	Image           string                         `json:"image"`
	RunConfig       RunConfig                      `json:"run_config"`
	BindMounts      map[string]BindMount           `json:"bind_mounts"`      // {mntPoint:BindMount}
	Tmpfs           map[string]TmpfsMount          `json:"tmpfs"`            // {mntPoint:TmpfsMount}
	Volumes         map[string]string              `json:"volumes"`          // {mntPoint:volName}
	HostResources   map[string]HostResTarget       `json:"host_resources"`   // {mntPoint:HostResTarget}
	SecretMounts    map[string]SecretTarget        `json:"secret_mounts"`    // {mntPoint:SecretTarget}
	SecretVars      map[string]SecretTarget        `json:"secret_vars"`      // {refVar:SecretTarget}
	Configs         map[string]string              `json:"configs"`          // {refVar:ref}
	SrvReferences   map[string]SrvRefTarget        `json:"srv_references"`   // {refVar:SrvRefTarget}
	HttpEndpoints   map[string]HttpEndpoint        `json:"http_endpoints"`   // {externalPath:HttpEndpoint}
	RequiredSrv     util.Set[string]               `json:"required_srv"`     // {ref}
	RequiredBySrv   util.Set[string]               `json:"required_by_srv"`  // {ref}
	ExtDependencies map[string]ExtDependencyTarget `json:"ext_dependencies"` // {refVar:ExtDependencyTarget}
	Ports           []Port                         `json:"ports"`
}

type SrvRefTarget added in v0.13.0

type SrvRefTarget struct {
	Ref      string  `json:"ref"`
	Template *string `json:"template"`
}

func (SrvRefTarget) FillTemplate added in v0.13.0

func (t SrvRefTarget) FillTemplate(s string) string

type TmpfsMount

type TmpfsMount struct {
	Size uint64      `json:"size"`
	Mode fs.FileMode `json:"mode"`
}

Jump to

Keyboard shortcuts

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