model

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

View Source
const (
	HeaderRequestID   = "X-Request-ID"
	HeaderApiVer      = "X-Api-Version"
	HeaderSrvName     = "X-Service"
	AuxDepIdHeaderKey = "X-MGW-DID"
)
View Source
const (
	ModulesPath           = "modules"
	ModUpdatesPath        = "updates"
	ModUptPreparePath     = "prepare"
	ModUptCancelPath      = "cancel"
	DeploymentsPath       = "deployments"
	DepTemplatePath       = "dep-template"
	DepUpdateTemplatePath = "upt-template"
	DepBatchPath          = "deployments-batch"
	DepStartPath          = "start"
	DepStopPath           = "stop"
	DepRestartPath        = "restart"
	DepDeletePath         = "delete"
	AuxDeploymentsPath    = "aux-deployments"
	AuxDepBatchPath       = "aux-deployments-batch"
	JobsPath              = "jobs"
	JobsCancelPath        = "cancel"
	SrvInfoPath           = "info"
	RestrictedPath        = "restricted"
)

Variables

This section is empty.

Functions

func NewForbiddenError

func NewForbiddenError(err error) error

func NewInternalError

func NewInternalError(err error) error

func NewInvalidInputError

func NewInvalidInputError(err error) error

func NewNotFoundError

func NewNotFoundError(err error) error

func NewResourceBusyError

func NewResourceBusyError(err error) error

Types

type AuxDepBase

type AuxDepBase struct {
	ID        string            `json:"id"` // uuid
	DepID     string            `json:"dep_id"`
	Image     string            `json:"image"`
	Labels    map[string]string `json:"labels"`
	Configs   map[string]string `json:"configs"`
	Volumes   map[string]string `json:"volumes"` // {name:mntPoint}
	Ref       string            `json:"ref"`
	Name      string            `json:"name"`
	RunConfig AuxDepRunConfig   `json:"run_config"`
	Enabled   bool              `json:"enabled"`
	Created   time.Time         `json:"created"`
	Updated   time.Time         `json:"updated"`
}

type AuxDepContainer

type AuxDepContainer struct {
	ID    string         `json:"id"`
	Alias string         `json:"alias"`
	Info  *ContainerInfo `json:"info"`
}

type AuxDepFilter

type AuxDepFilter struct {
	IDs     []string
	Labels  map[string]string
	Image   string
	Enabled ToggleVal
}

type AuxDepReq

type AuxDepReq struct {
	Image     string            `json:"image"`
	Labels    map[string]string `json:"labels"`
	Configs   map[string]string `json:"configs"`
	Volumes   map[string]string `json:"volumes"` // {name:mntPoint}
	Ref       string            `json:"ref"`     // only required by create method
	Name      string            `json:"name"`
	RunConfig *AuxDepRunConfig  `json:"run_config"`
}

type AuxDepRunConfig

type AuxDepRunConfig struct {
	Command   string `json:"command"`
	PseudoTTY bool   `json:"pseudo_tty"`
}

type AuxDeployment

type AuxDeployment struct {
	AuxDepBase
	Container AuxDepContainer `json:"container"`
}

type ContainerInfo

type ContainerInfo struct {
	ImageID string `json:"image_id"` // docker image id
	State   string `json:"state"`    // docker container state
}

type DepAssets

type DepAssets struct {
	HostResources map[string]string    `json:"host_resources"` // {ref:resourceID}
	Secrets       map[string]DepSecret `json:"secrets"`        // {ref:DepSecret}
	Configs       map[string]DepConfig `json:"configs"`        // {ref:DepConfig}
}

type DepBase

type DepBase struct {
	ID       string    `json:"id"`
	Module   DepModule `json:"module"`
	Name     string    `json:"name"`
	Dir      string    `json:"dir"`
	Enabled  bool      `json:"enabled"`
	Indirect bool      `json:"indirect"`
	Created  time.Time `json:"created"`
	Updated  time.Time `json:"updated"`
}

type DepConfig

type DepConfig struct {
	Value    any             `json:"value"`
	DataType module.DataType `json:"data_type"`
	IsSlice  bool            `json:"is_slice"`
}

type DepContainer

type DepContainer struct {
	ID     string         `json:"id"`
	SrvRef string         `json:"srv_ref"`
	Alias  string         `json:"alias"`
	Order  uint           `json:"order"`
	Info   *ContainerInfo `json:"info"`
}

type DepCreateRequest

type DepCreateRequest struct {
	ModuleID string `json:"module_id"`
	DepInput
	Dependencies map[string]DepInput `json:"dependencies"`
}

type DepFilter

type DepFilter struct {
	IDs      []string
	ModuleID string
	Name     string
	Enabled  bool
	Indirect bool
}

type DepInput

type DepInput struct {
	Name           *string           `json:"name"`           // defaults to module name if nil
	HostResources  map[string]string `json:"host_resources"` // {ref:resourceID}
	Secrets        map[string]string `json:"secrets"`        // {ref:secretID}
	Configs        map[string]any    `json:"configs"`        // {ref:value}
	SecretRequests map[string]any    // {ref:value}
}

type DepModule

type DepModule struct {
	ID      string `json:"id"`
	Version string `json:"version"`
}

type DepSecret

type DepSecret struct {
	ID       string             `json:"id"`
	Variants []DepSecretVariant `json:"variants"`
}

type DepSecretVariant

type DepSecretVariant struct {
	Item    *string `json:"item"`
	AsMount bool    `json:"as_mount"`
	AsEnv   bool    `json:"as_env"`
}

type DepUpdateTemplate

type DepUpdateTemplate struct {
	Name string `json:"name"`
	InputTemplate
}

type Deployment

type Deployment struct {
	DepBase
	RequiredDep  []string `json:"required_dep"`  // deployments required by this deployment
	DepRequiring []string `json:"dep_requiring"` // deployments requiring this deployment
	DepAssets
	Containers map[string]DepContainer `json:"containers"` // {ref:DepContainer}
	State      *HealthState            `json:"state"`
}

type ForbiddenError

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

func (*ForbiddenError) Error

func (e *ForbiddenError) Error() string

func (*ForbiddenError) Unwrap

func (e *ForbiddenError) Unwrap() error

type HealthState

type HealthState = string
const (
	DepHealthy   HealthState = "healthy"
	DepUnhealthy HealthState = "unhealthy"
	DepTrans     HealthState = "transitioning"
)

type InputTemplate

type InputTemplate struct {
	HostResources map[string]InputTemplateHostRes `json:"host_resources"` // {ref:ResourceInput}
	Secrets       map[string]InputTemplateSecret  `json:"secrets"`        // {ref:SecretInput}
	Configs       map[string]InputTemplateConfig  `json:"configs"`        // {ref:ConfigInput}
	InputGroups   map[string]module.InputGroup    `json:"input_groups"`   // {ref:InputGroup}
}

type InputTemplateConfig

type InputTemplateConfig struct {
	module.Input
	Value    any             `json:"value"`
	Default  any             `json:"default"`
	Options  any             `json:"options"`
	OptExt   bool            `json:"opt_ext"`
	Type     string          `json:"type"`
	TypeOpt  map[string]any  `json:"type_opt"`
	DataType module.DataType `json:"data_type"`
	IsList   bool            `json:"is_list"`
	Required bool            `json:"required"`
}

type InputTemplateHostRes

type InputTemplateHostRes struct {
	module.Input
	module.HostResource
	Value any `json:"value"`
}

type InputTemplateSecret

type InputTemplateSecret struct {
	module.Input
	module.Secret
	Value any `json:"value"`
}

type InternalError

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

func (*InternalError) Error

func (e *InternalError) Error() string

func (*InternalError) Unwrap

func (e *InternalError) Unwrap() error

type InvalidInputError

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

func (*InvalidInputError) Error

func (e *InvalidInputError) Error() string

func (*InvalidInputError) Unwrap

func (e *InvalidInputError) Unwrap() error

type ModAddRequest

type ModAddRequest struct {
	ID      string `json:"id"`
	Version string `json:"version"`
}

type ModDeployTemplate

type ModDeployTemplate struct {
	InputTemplate
	Dependencies map[string]InputTemplate `json:"dependencies"`
}

type ModFilter

type ModFilter struct {
	IDs            []string
	Name           string
	Author         string
	Type           string
	DeploymentType string
	Indirect       bool
	Tags           map[string]struct{}
}

type ModUpdate

type ModUpdate struct {
	Versions        []string          `json:"versions"`
	Checked         time.Time         `json:"checked"`
	Pending         bool              `json:"pending"`
	PendingVersions map[string]string `json:"pending_versions"`
}

type ModUpdatePrepareRequest

type ModUpdatePrepareRequest struct {
	Version string `json:"version"`
}

type ModUpdateRequest

type ModUpdateRequest struct {
	DepInput
	Dependencies map[string]DepInput `json:"dependencies"`
}

type ModUpdateTemplate

type ModUpdateTemplate = ModDeployTemplate

type Module

type Module struct {
	*module.Module
	Added   time.Time `json:"added"`
	Updated time.Time `json:"updated"`
}

type NotFoundError

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

func (*NotFoundError) Unwrap

func (e *NotFoundError) Unwrap() error

type ResourceBusyError

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

func (*ResourceBusyError) Error

func (e *ResourceBusyError) Error() string

func (*ResourceBusyError) Unwrap

func (e *ResourceBusyError) Unwrap() error

type ToggleVal added in v0.3.0

type ToggleVal = int8
const (
	No  ToggleVal = -1
	Yes ToggleVal = 1
)

Jump to

Keyboard shortcuts

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