models

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: EPL-2.0 Imports: 16 Imported by: 0

README

Models Package

This package contains Edgelet data structures and domain models shared across the daemon, field agent, EdgeletAPI, and CLI.

Overview

Models provide:

  • JSON/YAML marshaling support
  • Controller-compatible field naming for PoT wire formats
  • Validation functions
  • Constructor functions (New*)
  • Thread-safe operations where needed

Models

Core Models
  • Microservice: Main microservice/container configuration
  • MicroserviceState: Enum for microservice states
  • PortMapping: Port mapping configuration
  • EnvVar: Environment variable
  • VolumeMapping: Volume mapping configuration
  • VolumeMappingType: Enum for volume mapping types
  • Healthcheck: Container healthcheck configuration
  • Route: Microservice routing configuration
  • Registry: Docker registry configuration
Message Models
  • Message: ioMessage with binary and JSON serialization support
  • ExecMessage: Exec session WebSocket message
  • LogMessage: Log session WebSocket message
Status Models
  • MicroserviceStatus: Microservice status information
  • FieldAgentStatus: Field agent status
  • ControllerStatus: Controller connection status enum
  • StatusReporterStatus: Status reporter status
Configuration Models
  • YamlConfig: Root YAML configuration structure
  • ProfileConfig: Profile configuration with flexible property mapping

Usage

Creating Models
// Create a microservice
ms := models.NewMicroservice("uuid-123", "image:tag")
ms.SetMemoryLimitMB(int64Ptr(512))

// Create a port mapping
pm := models.NewPortMapping(8080, 80, false)

// Create a registry using builder
reg := models.NewRegistryBuilder().
    SetID(1).
    SetURL("https://registry.example.com").
    SetIsPublic(true).
    Build()
JSON Marshaling
// Marshal to JSON
jsonData, err := json.Marshal(ms)
if err != nil {
    log.Fatal(err)
}

// Unmarshal from JSON
var ms2 models.Microservice
err = json.Unmarshal(jsonData, &ms2)
Validation
// Validate a model
if err := models.ValidateMicroservice(ms); err != nil {
    log.Fatal(err)
}

// Or use the model's Validate method
if err := ms.Validate(); err != nil {
    log.Fatal(err)
}

JSON compatibility

Models use PoT-compatible JSON field names. Optional fields use pointers to distinguish nil from zero values.

Thread Safety

  • Microservice.IsUpdating: Thread-safe getter/setter using sync.RWMutex
  • DeleteLock: Global mutex for microservice deletion operations

Testing

Run tests with:

go test ./internal/models/... -v

Notes

  • Binary serialization for Message is not yet fully implemented (placeholder for future work)
  • All optional fields use pointers to distinguish between nil and zero values
  • Enum types use string-based constants for JSON compatibility

Documentation

Index

Constants

View Source
const (

	// ControlPlaneHTTPS*Filename are container-relative names under /etc/iofog/controller-cert/.
	ControlPlaneHTTPSCertFilename = "tls.crt"
	ControlPlaneHTTPSKeyFilename  = "tls.key"
	ControlPlaneHTTPSCAFilename   = "ca.crt"
)
View Source
const (
	ExecMessageTypeStdin   byte = 0
	ExecMessageTypeStdout  byte = 1
	ExecMessageTypeStderr  byte = 2
	ExecMessageTypeControl byte = 3
)

ExecMessageType represents the type of exec message

View Source
const (
	LogMessageTypeLogLine  byte = 6
	LogMessageTypeLogStart byte = 7
	LogMessageTypeLogStop  byte = 8
	LogMessageTypeLogError byte = 9
)

LogMessageType represents the type of log message

View Source
const ControlPlaneDefaultNamespace = "default"

Variables

View Source
var DeleteLock = &sync.Mutex{}

DeleteLock is a global lock for microservice deletion operations

Functions

func CanonicalizeVerbs

func CanonicalizeVerbs(verbs []string) []string

func MaskedControlPlaneManifestYAML

func MaskedControlPlaneManifestYAML(manifest string) (string, error)

MaskedControlPlaneManifestYAML returns manifest YAML with secrets redacted.

func RuntimeClassBinaryPathForHandler

func RuntimeClassBinaryPathForHandler(handler string) string

func ValidateEnvVar

func ValidateEnvVar(e *EnvVar) error

ValidateEnvVar validates an EnvVar

func ValidateExecMessage

func ValidateExecMessage(em *ExecMessage) error

ValidateExecMessage validates an ExecMessage

func ValidateFieldAgentStatus

func ValidateFieldAgentStatus(fa *FieldAgentStatus) error

ValidateFieldAgentStatus validates a FieldAgentStatus

func ValidateLogMessage

func ValidateLogMessage(lm *LogMessage) error

ValidateLogMessage validates a LogMessage

func ValidateMicroserviceStatus

func ValidateMicroserviceStatus(ms *MicroserviceStatus) error

ValidateMicroserviceStatus validates a MicroserviceStatus

func ValidatePortMapping

func ValidatePortMapping(p *PortMapping) error

ValidatePortMapping validates a PortMapping

func ValidateRegistry

func ValidateRegistry(r *Registry) error

ValidateRegistry validates a Registry

func ValidateRoute

func ValidateRoute(r *Route) error

ValidateRoute validates a Route

func ValidateStatusReporterStatus

func ValidateStatusReporterStatus(sr *StatusReporterStatus) error

ValidateStatusReporterStatus validates a StatusReporterStatus

func ValidateVolumeMapping

func ValidateVolumeMapping(v *VolumeMapping) error

ValidateVolumeMapping validates a VolumeMapping

func ValidateYamlConfig

func ValidateYamlConfig(yc *YamlConfig) error

ValidateYamlConfig validates a YamlConfig

Types

type ControlPlaneDeployment

type ControlPlaneDeployment struct {
	ControllerUUID     string
	Namespace          string
	Name               string
	ManifestYAML       string
	Image              string
	State              string
	ContainerID        string
	DesiredState       string
	RuntimeState       string
	LastError          string
	RestartCount       int
	LastTransitionAt   int64
	LastReconcileAt    int64
	LastStartAttemptAt int64
	FailureCount       int
	DeletedAt          *int64
	Generation         int64
	ObservedGeneration int64
}

ControlPlaneDeployment is the singleton SQLite record for a local ControlPlane manifest.

func (*ControlPlaneDeployment) NormalizeDefaults

func (d *ControlPlaneDeployment) NormalizeDefaults()

NormalizeDefaults ensures lifecycle defaults for control plane records.

type ControlPlaneHTTPSBase64

type ControlPlaneHTTPSBase64 struct {
	CA   string `yaml:"ca,omitempty" json:"ca,omitempty"`
	Cert string `yaml:"cert,omitempty" json:"cert,omitempty"`
	Key  string `yaml:"key,omitempty" json:"key,omitempty"`
}

ControlPlaneHTTPSBase64 holds inline TLS material for ControlPlane HTTPS.

type ControlPlaneHTTPSConfig

type ControlPlaneHTTPSConfig struct {
	Path   string                   `yaml:"path,omitempty" json:"path,omitempty"`
	Base64 *ControlPlaneHTTPSBase64 `yaml:"base64,omitempty" json:"base64,omitempty"`
}

ControlPlaneHTTPSConfig configures TLS for the control plane controller.

type ControlPlaneManifest

type ControlPlaneManifest struct {
	APIVersion string `yaml:"apiVersion" json:"apiVersion"`
	Kind       string `yaml:"kind" json:"kind"`
	Metadata   struct {
		Name      string            `yaml:"name" json:"name"`
		Namespace string            `yaml:"namespace,omitempty" json:"namespace,omitempty"`
		Labels    map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"`
	} `yaml:"metadata" json:"metadata"`
	Spec ControlPlaneManifestSpec `yaml:"spec" json:"spec"`
}

ControlPlaneManifest is the operator YAML for kind ControlPlane.

func DecodeControlPlaneManifestYAML

func DecodeControlPlaneManifestYAML(manifest string) (*ControlPlaneManifest, error)

DecodeControlPlaneManifestYAML decodes ControlPlane YAML without semantic validation.

func ParseControlPlaneManifest

func ParseControlPlaneManifest(manifest string) (*ControlPlaneManifest, error)

ParseControlPlaneManifest decodes and validates ControlPlane YAML.

func (*ControlPlaneManifest) ControllerRegistryID

func (m *ControlPlaneManifest) ControllerRegistryID() (int, bool)

ControllerRegistryID returns spec.controller.registry when set.

func (*ControlPlaneManifest) ManifestControllerImage

func (m *ControlPlaneManifest) ManifestControllerImage() string

ManifestControllerImage returns spec.controller.image trimmed.

func (*ControlPlaneManifest) MaskSecrets

func (m *ControlPlaneManifest) MaskSecrets()

MaskSecrets redacts sensitive ControlPlane manifest fields in place.

func (*ControlPlaneManifest) NormalizeDefaults

func (m *ControlPlaneManifest) NormalizeDefaults()

NormalizeDefaults applies metadata defaults before validation or env build.

func (*ControlPlaneManifest) Validate

func (m *ControlPlaneManifest) Validate() error

Validate checks ControlPlane manifest semantics.

type ControlPlaneManifestSpec

type ControlPlaneManifestSpec struct {
	Controller struct {
		Image    string `yaml:"image" json:"image"`
		Registry *int   `yaml:"registry,omitempty" json:"registry,omitempty"`
		Port     *int   `yaml:"port,omitempty" json:"port,omitempty"`
	} `yaml:"controller" json:"controller"`
	Auth struct {
		URL              string `yaml:"url,omitempty" json:"url,omitempty"`
		Realm            string `yaml:"realm,omitempty" json:"realm,omitempty"`
		RealmKey         string `yaml:"realmKey,omitempty" json:"realmKey,omitempty"`
		SSL              string `yaml:"ssl,omitempty" json:"ssl,omitempty"`
		ControllerClient string `yaml:"controllerClient,omitempty" json:"controllerClient,omitempty"`
		ControllerSecret string `yaml:"controllerSecret,omitempty" json:"controllerSecret,omitempty"`
		ViewerClient     string `yaml:"viewerClient,omitempty" json:"viewerClient,omitempty"`
	} `yaml:"auth,omitempty" json:"auth,omitempty"`
	Database *struct {
		Provider     string `yaml:"provider,omitempty" json:"provider,omitempty"`
		User         string `yaml:"user,omitempty" json:"user,omitempty"`
		Host         string `yaml:"host,omitempty" json:"host,omitempty"`
		Port         *int   `yaml:"port,omitempty" json:"port,omitempty"`
		Password     string `yaml:"password,omitempty" json:"password,omitempty"`
		DatabaseName string `yaml:"databaseName,omitempty" json:"databaseName,omitempty"`
		SSL          *bool  `yaml:"ssl,omitempty" json:"ssl,omitempty"`
		CA           string `yaml:"ca,omitempty" json:"ca,omitempty"`
	} `yaml:"database,omitempty" json:"database,omitempty"`
	Events *struct {
		AuditEnabled     *bool `yaml:"auditEnabled,omitempty" json:"auditEnabled,omitempty"`
		RetentionDays    *int  `yaml:"retentionDays,omitempty" json:"retentionDays,omitempty"`
		CleanupInterval  *int  `yaml:"cleanupInterval,omitempty" json:"cleanupInterval,omitempty"`
		CaptureIPAddress *bool `yaml:"captureIpAddress,omitempty" json:"captureIpAddress,omitempty"`
	} `yaml:"events,omitempty" json:"events,omitempty"`
	SystemMicroservices *struct {
		Router map[string]string `yaml:"router,omitempty" json:"router,omitempty"`
		NATS   map[string]string `yaml:"nats,omitempty" json:"nats,omitempty"`
	} `yaml:"systemMicroservices,omitempty" json:"systemMicroservices,omitempty"`
	NATS *struct {
		Enabled *bool `yaml:"enabled,omitempty" json:"enabled,omitempty"`
	} `yaml:"nats,omitempty" json:"nats,omitempty"`
	ECNViewerPort *int                     `yaml:"ecnViewerPort,omitempty" json:"ecnViewerPort,omitempty"`
	ECNViewerURL  string                   `yaml:"ecnViewerUrl,omitempty" json:"ecnViewerUrl,omitempty"`
	LogLevel      string                   `yaml:"logLevel,omitempty" json:"logLevel,omitempty"`
	HTTPS         *ControlPlaneHTTPSConfig `yaml:"https,omitempty" json:"https,omitempty"`
	Vault         *ControlPlaneVaultSpec   `yaml:"vault,omitempty" json:"vault,omitempty"`
	// Forbidden in Edgelet ControlPlane YAML (potctl REST import only).
	SiteCA  any `yaml:"siteCA,omitempty" json:"-"`
	LocalCA any `yaml:"localCA,omitempty" json:"-"`
}

ControlPlaneManifestSpec holds controller deployment configuration.

type ControlPlaneVaultSpec

type ControlPlaneVaultSpec struct {
	Enabled   *bool  `yaml:"enabled,omitempty" json:"enabled,omitempty"`
	Provider  string `yaml:"provider,omitempty" json:"provider,omitempty"`
	BasePath  string `yaml:"basePath,omitempty" json:"basePath,omitempty"`
	Hashicorp *struct {
		Address string `yaml:"address,omitempty" json:"address,omitempty"`
		Token   string `yaml:"token,omitempty" json:"token,omitempty"`
		Mount   string `yaml:"mount,omitempty" json:"mount,omitempty"`
	} `yaml:"hashicorp,omitempty" json:"hashicorp,omitempty"`
	AWS *struct {
		Region      string `yaml:"region,omitempty" json:"region,omitempty"`
		AccessKeyID string `yaml:"accessKeyId,omitempty" json:"accessKeyId,omitempty"`
		AccessKey   string `yaml:"accessKey,omitempty" json:"accessKey,omitempty"`
	} `yaml:"aws,omitempty" json:"aws,omitempty"`
	Azure *struct {
		URL          string `yaml:"url,omitempty" json:"url,omitempty"`
		TenantID     string `yaml:"tenantId,omitempty" json:"tenantId,omitempty"`
		ClientID     string `yaml:"clientId,omitempty" json:"clientId,omitempty"`
		ClientSecret string `yaml:"clientSecret,omitempty" json:"clientSecret,omitempty"`
	} `yaml:"azure,omitempty" json:"azure,omitempty"`
	Google *struct {
		ProjectID   string `yaml:"projectId,omitempty" json:"projectId,omitempty"`
		Credentials string `yaml:"credentials,omitempty" json:"credentials,omitempty"`
	} `yaml:"google,omitempty" json:"google,omitempty"`
}

ControlPlaneVaultSpec mirrors optional vault provider blocks.

type ControllerStatus

type ControllerStatus string

ControllerStatus represents the controller connection status

const (
	ControllerStatusOK                ControllerStatus = "OK"
	ControllerStatusNotConnected      ControllerStatus = "NOT_CONNECTED"
	ControllerStatusNotProvisioned    ControllerStatus = "NOT_PROVISIONED"
	ControllerStatusBrokenCertificate ControllerStatus = "BROKEN_CERTIFICATE"
	ControllerStatusBadRequest        ControllerStatus = "BAD_REQUEST"
	ControllerStatusUnauthorized      ControllerStatus = "UNAUTHORIZED"
	ControllerStatusNotFound          ControllerStatus = "NOT_FOUND"
	ControllerStatusInternalError     ControllerStatus = "INTERNAL_ERROR"
)

type EdgeletAPIStatus

type EdgeletAPIStatus struct {
	OpenConfigSocketsCount  int `json:"openConfigSocketsCount" yaml:"openConfigSocketsCount"`   // Number of open control/config sockets
	OpenMessageSocketsCount int `json:"openMessageSocketsCount" yaml:"openMessageSocketsCount"` // Number of open message sockets
}

EdgeletAPIStatus represents the Edgelet API status

func NewEdgeletAPIStatus

func NewEdgeletAPIStatus() *EdgeletAPIStatus

NewEdgeletAPIStatus creates a new EdgeletAPIStatus

func (*EdgeletAPIStatus) SetOpenConfigSocketsCount

func (l *EdgeletAPIStatus) SetOpenConfigSocketsCount(count int) *EdgeletAPIStatus

SetOpenConfigSocketsCount sets the open config sockets count and returns the status for chaining

type EnvVar

type EnvVar struct {
	Key   string `json:"key" yaml:"key"`
	Value string `json:"value" yaml:"value"`
}

EnvVar represents microservice environment variables

func NewEnvVar

func NewEnvVar(key, value string) *EnvVar

NewEnvVar creates a new EnvVar

func (*EnvVar) Equals

func (e *EnvVar) Equals(other *EnvVar) bool

Equals checks if two EnvVars are equal

type ExecMessage

type ExecMessage struct {
	Type             byte   `json:"type" yaml:"type"` // 0: STDIN, 1: STDOUT, 2: STDERR, 3: CONTROL
	Data             []byte `json:"data" yaml:"data"`
	MicroserviceUUID string `json:"microserviceUuid" yaml:"microserviceUuid"`
	ExecID           string `json:"execId" yaml:"execId"`
	Timestamp        int64  `json:"timestamp" yaml:"timestamp"`
}

ExecMessage represents a message for exec session WebSocket communication

func NewExecMessage

func NewExecMessage(msgType byte, data []byte, microserviceUUID, execID string) *ExecMessage

NewExecMessage creates a new ExecMessage

type FieldAgentStatus

type FieldAgentStatus struct {
	ControllerStatus   ControllerStatus `json:"controllerStatus" yaml:"controllerStatus"`
	LastCommandTime    int64            `json:"lastCommandTime" yaml:"lastCommandTime"`
	ControllerVerified bool             `json:"controllerVerified" yaml:"controllerVerified"`
	ReadyToUpgrade     bool             `json:"readyToUpgrade" yaml:"readyToUpgrade"`
	ReadyToRollback    bool             `json:"readyToRollback" yaml:"readyToRollback"`
}

FieldAgentStatus represents the Field Agent status

func NewFieldAgentStatus

func NewFieldAgentStatus() *FieldAgentStatus

NewFieldAgentStatus creates a new FieldAgentStatus with default values

type Healthcheck

type Healthcheck struct {
	Test          []string `json:"test" yaml:"test"`
	Interval      *int64   `json:"interval,omitempty" yaml:"interval,omitempty"`
	Timeout       *int64   `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	StartPeriod   *int64   `json:"startPeriod,omitempty" yaml:"startPeriod,omitempty"`
	StartInterval *int64   `json:"startInterval,omitempty" yaml:"startInterval,omitempty"`
	Retries       *int     `json:"retries,omitempty" yaml:"retries,omitempty"`
}

Healthcheck represents container healthcheck configuration

func NewHealthcheck

func NewHealthcheck(test []string, interval, timeout, startPeriod, startInterval *int64, retries *int) *Healthcheck

NewHealthcheck creates a new Healthcheck

func (*Healthcheck) Equals

func (h *Healthcheck) Equals(other *Healthcheck) bool

Equals checks if two Healthchecks are equal

type LocalDeployManifest

type LocalDeployManifest struct {
	APIVersion string `yaml:"apiVersion" json:"apiVersion"`
	Kind       string `yaml:"kind" json:"kind"`
	Metadata   struct {
		Name      string            `yaml:"name" json:"name"`
		Namespace string            `yaml:"namespace,omitempty" json:"namespace,omitempty"`
		Labels    map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"`
	} `yaml:"metadata" json:"metadata"`
	Spec struct {
		Image     string `yaml:"image" json:"image"`
		Registry  *int   `yaml:"registry,omitempty" json:"registry,omitempty"`
		Container struct {
			Annotations     map[string]any `yaml:"annotations,omitempty" json:"annotations,omitempty"`
			HostNetworkMode bool           `yaml:"hostNetworkMode" json:"hostNetworkMode"`
			IsPrivileged    bool           `yaml:"isPrivileged" json:"isPrivileged"`
			CapAdd          []string       `yaml:"capAdd,omitempty" json:"capAdd,omitempty"`
			CapDrop         []string       `yaml:"capDrop,omitempty" json:"capDrop,omitempty"`
			IpcMode         string         `yaml:"ipcMode,omitempty" json:"ipcMode,omitempty"`
			PidMode         string         `yaml:"pidMode,omitempty" json:"pidMode,omitempty"`
			RunAsUser       string         `yaml:"runAsUser,omitempty" json:"runAsUser,omitempty"`
			Platform        string         `yaml:"platform,omitempty" json:"platform,omitempty"`
			Runtime         string         `yaml:"runtime,omitempty" json:"runtime,omitempty"`
			CDIDevices      []string       `yaml:"cdiDevices,omitempty" json:"cdiDevices,omitempty"`
			Volumes         []struct {
				HostDestination      string `yaml:"hostDestination" json:"hostDestination"`
				ContainerDestination string `yaml:"containerDestination" json:"containerDestination"`
				AccessMode           string `yaml:"accessMode,omitempty" json:"accessMode,omitempty"`
				Type                 string `yaml:"type,omitempty" json:"type,omitempty"`
			} `yaml:"volumes,omitempty" json:"volumes,omitempty"`
			ExtraHosts []struct {
				Name    string `yaml:"name" json:"name"`
				Address string `yaml:"address" json:"address"`
			} `yaml:"extraHosts,omitempty" json:"extraHosts,omitempty"`
			Env []struct {
				Key   string `yaml:"key" json:"key"`
				Value string `yaml:"value" json:"value"`
			} `yaml:"env,omitempty" json:"env,omitempty"`
			Ports []struct {
				Internal int    `yaml:"internal" json:"internal"`
				External int    `yaml:"external" json:"external"`
				Protocol string `yaml:"protocol,omitempty" json:"protocol,omitempty"`
			} `yaml:"ports,omitempty" json:"ports,omitempty"`
			Commands    []string `yaml:"commands,omitempty" json:"commands,omitempty"`
			CPUSetCpus  string   `yaml:"cpuSetCpus,omitempty" json:"cpuSetCpus,omitempty"`
			MemoryLimit int64    `yaml:"memoryLimit,omitempty" json:"memoryLimit,omitempty"`
			HealthCheck struct {
				Test        []string `yaml:"test,omitempty" json:"test,omitempty"`
				Interval    int      `yaml:"interval,omitempty" json:"interval,omitempty"`
				Timeout     int      `yaml:"timeout,omitempty" json:"timeout,omitempty"`
				StartPeriod int      `yaml:"startPeriod,omitempty" json:"startPeriod,omitempty"`
				Retries     int      `yaml:"retries,omitempty" json:"retries,omitempty"`
			} `yaml:"healthCheck,omitempty" json:"healthCheck,omitempty"`
		} `yaml:"container,omitempty" json:"container,omitempty"`
		Schedule int            `yaml:"schedule,omitempty" json:"schedule,omitempty"`
		Config   map[string]any `yaml:"config,omitempty" json:"config,omitempty"`
	} `yaml:"spec" json:"spec"`
}

LocalDeployManifest mirrors single-microservice deploy shape used by controller deploy flows.

func (*LocalDeployManifest) ManifestImage

func (m *LocalDeployManifest) ManifestImage() string

ManifestImage returns the resolved container image from spec.image.

func (*LocalDeployManifest) Validate

func (m *LocalDeployManifest) Validate() error

type LocalDeployedMicroservice

type LocalDeployedMicroservice struct {
	LocalUUID          string
	ApplicationName    string
	MicroserviceName   string
	SourceName         string
	ManifestYAML       string
	ImageName          string
	State              string
	ContainerID        string
	DesiredState       string
	RuntimeState       string
	LastError          string
	RestartCount       int
	LastTransitionAt   int64
	LastReconcileAt    int64
	LastStartAttemptAt int64
	FailureCount       int
	DeletedAt          *int64
	Generation         int64
	ObservedGeneration int64
}

LocalDeployedMicroservice represents a microservice deployed by EdgeletAPI/CLI (not controller-managed).

func (*LocalDeployedMicroservice) NormalizeDefaults

func (m *LocalDeployedMicroservice) NormalizeDefaults()

NormalizeDefaults ensures lifecycle defaults are present for local records.

type LocalRegistryManifest

type LocalRegistryManifest struct {
	APIVersion string `yaml:"apiVersion" json:"apiVersion"`
	Kind       string `yaml:"kind" json:"kind"`
	Spec       struct {
		URL       string `yaml:"url" json:"url"`
		UserName  string `yaml:"username,omitempty" json:"username,omitempty"`
		Password  string `yaml:"password,omitempty" json:"password,omitempty"`
		UserEmail string `yaml:"email,omitempty" json:"email,omitempty"`
		Private   bool   `yaml:"private" json:"private"`
	} `yaml:"spec" json:"spec"`
}

LocalRegistryManifest represents local registry deployment YAML.

func (*LocalRegistryManifest) Validate

func (m *LocalRegistryManifest) Validate() error

type LocalRuntimeClass

type LocalRuntimeClass struct {
	Name        string `json:"name"`
	Handler     string `json:"handler"`
	RuntimeName string `json:"runtimeName,omitempty"`
	CreatedAt   int64  `json:"createdAt,omitempty"`
	UpdatedAt   int64  `json:"updatedAt,omitempty"`
}

LocalRuntimeClass is the persistent RuntimeClass row stored in SQLite.

func (*LocalRuntimeClass) Normalize

func (r *LocalRuntimeClass) Normalize()

func (*LocalRuntimeClass) RuntimeBinaryPath

func (r *LocalRuntimeClass) RuntimeBinaryPath() string

type LocalRuntimeClassManifest

type LocalRuntimeClassManifest struct {
	APIVersion string `yaml:"apiVersion" json:"apiVersion"`
	Kind       string `yaml:"kind" json:"kind"`
	Metadata   struct {
		Name string `yaml:"name" json:"name"`
	} `yaml:"metadata" json:"metadata"`
	Handler string `yaml:"handler" json:"handler"`
}

LocalRuntimeClassManifest represents local RuntimeClass deployment YAML. RuntimeClass uses top-level fields to keep local manifests concise.

func (*LocalRuntimeClassManifest) Validate

func (m *LocalRuntimeClassManifest) Validate() error

type LogMessage

type LogMessage struct {
	Type             byte   `json:"type" yaml:"type"` // 6: LOG_LINE, 7: LOG_START, 8: LOG_STOP, 9: LOG_ERROR
	Data             []byte `json:"data" yaml:"data"`
	SessionID        string `json:"sessionId" yaml:"sessionId"`
	MicroserviceUUID string `json:"microserviceUuid,omitempty" yaml:"microserviceUuid,omitempty"` // For microservice logs
	IofogUUID        string `json:"iofogUuid,omitempty" yaml:"iofogUuid,omitempty"`               // For fog logs
	Timestamp        int64  `json:"timestamp" yaml:"timestamp"`
}

LogMessage represents a message for log session WebSocket communication

func NewLogMessage

func NewLogMessage(msgType byte, data []byte, sessionID, microserviceUUID, iofogUUID string) *LogMessage

NewLogMessage creates a new LogMessage

type Microservice

type Microservice struct {
	// Required fields
	MicroserviceUUID string `json:"microserviceUuid" yaml:"microserviceUuid"`
	ImageName        string `json:"imageName" yaml:"imageName"`

	// Optional fields
	PortMappings       []*PortMapping    `json:"portMappings,omitempty" yaml:"portMappings,omitempty"`
	Config             *string           `json:"config,omitempty" yaml:"config,omitempty"`
	RunAsUser          *string           `json:"runAsUser,omitempty" yaml:"runAsUser,omitempty"`
	Platform           *string           `json:"platform,omitempty" yaml:"platform,omitempty"`
	Runtime            *string           `json:"runtime,omitempty" yaml:"runtime,omitempty"`
	ContainerID        string            `json:"containerId" yaml:"containerId"`
	RegistryID         int               `json:"registryId" yaml:"registryId"`
	ContainerIPAddress *string           `json:"containerIpAddress,omitempty" yaml:"containerIpAddress,omitempty"`
	Rebuild            bool              `json:"rebuild" yaml:"rebuild"`
	HostNetworkMode    bool              `json:"hostNetworkMode" yaml:"hostNetworkMode"`
	IsPrivileged       bool              `json:"isPrivileged" yaml:"isPrivileged"`
	LogSize            int64             `json:"logSize" yaml:"logSize"`
	VolumeMappings     []*VolumeMapping  `json:"volumeMappings,omitempty" yaml:"volumeMappings,omitempty"`
	IsUpdating         bool              `json:"isUpdating" yaml:"isUpdating"`
	EnvVars            []*EnvVar         `json:"envVars,omitempty" yaml:"envVars,omitempty"`
	Args               []string          `json:"args,omitempty" yaml:"args,omitempty"`
	CdiDevs            []string          `json:"cdiDevs,omitempty" yaml:"cdiDevs,omitempty"`
	Annotations        *string           `json:"annotations,omitempty" yaml:"annotations,omitempty"`
	CapAdd             []string          `json:"capAdd,omitempty" yaml:"capAdd,omitempty"`
	CapDrop            []string          `json:"capDrop,omitempty" yaml:"capDrop,omitempty"`
	ExtraHosts         []string          `json:"extraHosts,omitempty" yaml:"extraHosts,omitempty"`
	IsRouter           bool              `json:"isRouter" yaml:"isRouter"`
	IsController       bool              `json:"isController" yaml:"isController"`
	IsSystem           bool              `json:"isSystem" yaml:"isSystem"`
	PidMode            *string           `json:"pidMode,omitempty" yaml:"pidMode,omitempty"`
	IpcMode            *string           `json:"ipcMode,omitempty" yaml:"ipcMode,omitempty"`
	ExecEnabled        bool              `json:"execEnabled" yaml:"execEnabled"`
	MicroserviceName   string            `json:"name" yaml:"name"`
	ApplicationName    string            `json:"application" yaml:"application"`
	Labels             map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	IsNats             bool              `json:"isNats" yaml:"isNats"`
	Schedule           int               `json:"schedule" yaml:"schedule"`
	CPUSetCpus         *string           `json:"cpuSetCpus,omitempty" yaml:"cpuSetCpus,omitempty"`
	MemoryLimit        *int64            `json:"memoryLimit,omitempty" yaml:"memoryLimit,omitempty"` // in bytes
	ServiceAccount     *ServiceAccount   `json:"serviceAccount,omitempty" yaml:"serviceAccount,omitempty"`

	// Internal state fields
	Delete            bool         `json:"delete" yaml:"delete"`
	DeleteWithCleanup bool         `json:"deleteWithCleanup" yaml:"deleteWithCleanup"`
	IsStuckInRestart  bool         `json:"isStuckInRestart" yaml:"isStuckInRestart"`
	Healthcheck       *Healthcheck `json:"healthcheck,omitempty" yaml:"healthcheck,omitempty"`
	// contains filtered or unexported fields
}

Microservice represents a microservice/container configuration

func BuildMicroserviceFromLocalManifest

func BuildMicroserviceFromLocalManifest(doc *LocalDeployManifest, deploymentID, image string) *Microservice

BuildMicroserviceFromLocalManifest converts a local deploy manifest into a runtime microservice model used by the container engine.

func NewMicroservice

func NewMicroservice(microserviceUUID, imageName string) *Microservice

NewMicroservice creates a new Microservice with required fields

func (*Microservice) Equals

func (m *Microservice) Equals(other *Microservice) bool

Equals checks if two Microservices are equal based on UUID

func (*Microservice) GetIsUpdating

func (m *Microservice) GetIsUpdating() bool

IsUpdating returns whether the microservice is currently updating (thread-safe)

func (*Microservice) GetMemoryLimitMB

func (m *Microservice) GetMemoryLimitMB() *int64

GetMemoryLimitMB returns the memory limit in MB

func (*Microservice) SetIsUpdating

func (m *Microservice) SetIsUpdating(updating bool)

SetIsUpdating sets the updating state (thread-safe)

func (*Microservice) SetMemoryLimitMB

func (m *Microservice) SetMemoryLimitMB(memoryLimitMB *int64)

SetMemoryLimitMB sets the memory limit from MB to bytes

func (*Microservice) Validate

func (m *Microservice) Validate() error

Validate validates the microservice configuration

type MicroserviceState

type MicroserviceState string

MicroserviceState represents the state of a microservice

const (
	MicroserviceStateQueued            MicroserviceState = "QUEUED"
	MicroserviceStatePulling           MicroserviceState = "PULLING"
	MicroserviceStateCreating          MicroserviceState = "CREATING"
	MicroserviceStateCreated           MicroserviceState = "CREATED"
	MicroserviceStateStarting          MicroserviceState = "STARTING"
	MicroserviceStateRunning           MicroserviceState = "RUNNING"
	MicroserviceStateUpdating          MicroserviceState = "UPDATING"
	MicroserviceStateRestarting        MicroserviceState = "RESTARTING"
	MicroserviceStateExiting           MicroserviceState = "EXITING"
	MicroserviceStateStuckInRestart    MicroserviceState = "STUCK_IN_RESTART"
	MicroserviceStateFailed            MicroserviceState = "FAILED"
	MicroserviceStateMarkedForDeletion MicroserviceState = "MARKED_FOR_DELETION"
	MicroserviceStateDeleting          MicroserviceState = "DELETING"
	MicroserviceStateDeleted           MicroserviceState = "DELETED"
	MicroserviceStateStopping          MicroserviceState = "STOPPING"
	MicroserviceStateStopped           MicroserviceState = "STOPPED"
	MicroserviceStateUnknown           MicroserviceState = "UNKNOWN"
)

func MicroserviceStateFromText

func MicroserviceStateFromText(value string) MicroserviceState

FromText converts a string to MicroserviceState

type MicroserviceStatus

type MicroserviceStatus struct {
	Status         MicroserviceState `json:"status" yaml:"status"`
	StartTime      int64             `json:"startTime" yaml:"startTime"`
	CPUUsage       float32           `json:"cpuUsage" yaml:"cpuUsage"`
	MemoryUsage    int64             `json:"memoryUsage" yaml:"memoryUsage"`
	ContainerID    string            `json:"containerId" yaml:"containerId"`
	Percentage     float32           `json:"percentage" yaml:"percentage"`
	ErrorMessage   *string           `json:"errorMessage,omitempty" yaml:"errorMessage,omitempty"`
	IPAddress      *string           `json:"ipAddress,omitempty" yaml:"ipAddress,omitempty"`
	ExecSessionIDs []string          `json:"execSessionIds,omitempty" yaml:"execSessionIds,omitempty"`
	HealthStatus   *string           `json:"healthStatus,omitempty" yaml:"healthStatus,omitempty"`
}

MicroserviceStatus represents the status of a microservice

func NewMicroserviceStatus

func NewMicroserviceStatus() *MicroserviceStatus

NewMicroserviceStatus creates a new MicroserviceStatus with UNKNOWN state

func NewMicroserviceStatusWithState

func NewMicroserviceStatusWithState(status MicroserviceState) *MicroserviceStatus

NewMicroserviceStatusWithState creates a new MicroserviceStatus with the given state

func (*MicroserviceStatus) AddExecSessionID

func (m *MicroserviceStatus) AddExecSessionID(execSessionID string)

AddExecSessionID adds an exec session ID

func (*MicroserviceStatus) Equals

func (m *MicroserviceStatus) Equals(other *MicroserviceStatus) bool

Equals checks if two MicroserviceStatuses are equal based on status

func (*MicroserviceStatus) GetExecSessionIDs

func (m *MicroserviceStatus) GetExecSessionIDs() []string

GetExecSessionIDs returns the exec session IDs (never nil)

func (*MicroserviceStatus) GetOperatingDuration

func (m *MicroserviceStatus) GetOperatingDuration() int64

GetOperatingDuration returns the operating duration in milliseconds

func (*MicroserviceStatus) RemoveExecSessionID

func (m *MicroserviceStatus) RemoveExecSessionID(execSessionID string)

RemoveExecSessionID removes an exec session ID

type ModuleStatus

type ModuleStatus string

ModuleStatus represents the status of a module

const (
	ModuleStatusStarting ModuleStatus = "STARTING"
	ModuleStatusRunning  ModuleStatus = "RUNNING"
	ModuleStatusStopped  ModuleStatus = "STOPPED"
	ModuleStatusWarning  ModuleStatus = "WARNING"
	ModuleStatusUnknown  ModuleStatus = "UNKNOWN"
)

type PortMapping

type PortMapping struct {
	Outside int  `json:"outside" yaml:"outside"`
	Inside  int  `json:"inside" yaml:"inside"`
	UDP     bool `json:"udp" yaml:"udp"`
}

PortMapping represents microservice port mappings

func NewPortMapping

func NewPortMapping(outside, inside int, udp bool) *PortMapping

NewPortMapping creates a new PortMapping

func (*PortMapping) CompareTo

func (p *PortMapping) CompareTo(other *PortMapping) int

CompareTo compares two PortMappings (for sorting) Returns: negative if p < other, zero if equal, positive if p > other

func (*PortMapping) Equals

func (p *PortMapping) Equals(other *PortMapping) bool

Equals checks if two PortMappings are equal

type ProcessManagerStatus

type ProcessManagerStatus struct {
	RunningMicroservicesCount int                            `json:"runningMicroservicesCount" yaml:"runningMicroservicesCount"` // Number of running microservices
	MicroservicesStatus       map[string]*MicroserviceStatus `json:"microservicesStatus" yaml:"microservicesStatus"`             // Status of each microservice
	RegistriesStatus          map[int]string                 `json:"registriesStatus" yaml:"registriesStatus"`                   // Status of each registry (registry ID -> status)
	// contains filtered or unexported fields
}

ProcessManagerStatus represents the Process Manager status

func NewProcessManagerStatus

func NewProcessManagerStatus() *ProcessManagerStatus

NewProcessManagerStatus creates a new ProcessManagerStatus

func (*ProcessManagerStatus) ClearMicroserviceStatuses

func (p *ProcessManagerStatus) ClearMicroserviceStatuses()

ClearMicroserviceStatuses clears all tracked microservice statuses and resets count.

func (*ProcessManagerStatus) GetJSONMicroservicesStatus

func (p *ProcessManagerStatus) GetJSONMicroservicesStatus() string

GetJSONMicroservicesStatus returns the microservices status as a JSON string

func (*ProcessManagerStatus) GetJSONRegistriesStatus

func (p *ProcessManagerStatus) GetJSONRegistriesStatus() string

GetJSONRegistriesStatus returns the registries status as a JSON string

func (*ProcessManagerStatus) GetMicroserviceStatus

func (p *ProcessManagerStatus) GetMicroserviceStatus(microserviceUUID string) *MicroserviceStatus

GetMicroserviceStatus gets the status of a microservice, creating it if it doesn't exist

func (*ProcessManagerStatus) GetRegistriesStatus

func (p *ProcessManagerStatus) GetRegistriesStatus() map[int]string

GetRegistriesStatus returns the registries status map

func (*ProcessManagerStatus) PruneMicroserviceStatus

func (p *ProcessManagerStatus) PruneMicroserviceStatus(predicate func(uuid string, status *MicroserviceStatus) bool)

PruneMicroserviceStatus removes entries matching predicate.

func (*ProcessManagerStatus) RemoveNotRunningMicroserviceStatus

func (p *ProcessManagerStatus) RemoveNotRunningMicroserviceStatus()

RemoveNotRunningMicroserviceStatus removes microservices that are not running

func (*ProcessManagerStatus) SetMicroservicesHealthStatus

func (p *ProcessManagerStatus) SetMicroservicesHealthStatus(microserviceUUID string, healthStatus *string) *ProcessManagerStatus

SetMicroservicesHealthStatus sets the health status for a microservice (e.g. "healthy", "unhealthy").

func (*ProcessManagerStatus) SetMicroservicesState

func (p *ProcessManagerStatus) SetMicroservicesState(microserviceUUID string, state MicroserviceState) *ProcessManagerStatus

SetMicroservicesState sets the state of a microservice and returns the status for chaining

func (*ProcessManagerStatus) SetMicroservicesStatePercentage

func (p *ProcessManagerStatus) SetMicroservicesStatePercentage(microserviceUUID string, percentage float32) *ProcessManagerStatus

SetMicroservicesStatePercentage sets the state percentage of a microservice and returns the status for chaining

func (*ProcessManagerStatus) SetMicroservicesStatus

func (p *ProcessManagerStatus) SetMicroservicesStatus(microserviceUUID string, status *MicroserviceStatus) *ProcessManagerStatus

SetMicroservicesStatus sets the status of a microservice and returns the status for chaining

func (*ProcessManagerStatus) SetMicroservicesStatusErrorMessage

func (p *ProcessManagerStatus) SetMicroservicesStatusErrorMessage(microserviceUUID string, message string) *ProcessManagerStatus

SetMicroservicesStatusErrorMessage sets the error message for a microservice and returns the status for chaining

func (*ProcessManagerStatus) SetRegistriesStatus

func (p *ProcessManagerStatus) SetRegistriesStatus(registryID int, status string) *ProcessManagerStatus

SetRegistriesStatus sets the status of a registry

func (*ProcessManagerStatus) SetRunningMicroservicesCount

func (p *ProcessManagerStatus) SetRunningMicroservicesCount(count int) *ProcessManagerStatus

SetRunningMicroservicesCount sets the running microservices count and returns the status for chaining

type ProfileConfig

type ProfileConfig struct {
	Properties map[string]string `json:"-" yaml:",inline"`
}

ProfileConfig represents a single profile's configuration Uses a map to store all properties for flexible YAML mapping

func NewProfileConfig

func NewProfileConfig() *ProfileConfig

NewProfileConfig creates a new ProfileConfig

func (*ProfileConfig) GetProperty

func (p *ProfileConfig) GetProperty(key string) string

GetProperty gets a property value

func (*ProfileConfig) MarshalYAML

func (p *ProfileConfig) MarshalYAML() (any, error)

MarshalYAML custom marshaling to output as map

func (*ProfileConfig) SetProperty

func (p *ProfileConfig) SetProperty(key, value string)

SetProperty sets a property value

func (*ProfileConfig) UnmarshalYAML

func (p *ProfileConfig) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML custom unmarshaling to handle flexible YAML structure

type RBACEnvelopeV1

type RBACEnvelopeV1 struct {
	Version      string                  `json:"version"`
	RulesByGroup map[string][]RBACRuleV1 `json:"rulesByGroup"`
}

type RBACRuleV1

type RBACRuleV1 struct {
	Resources     []string `json:"resources"`
	Verbs         []string `json:"verbs"`
	ResourceNames []string `json:"resourceNames,omitempty"`
}

func (RBACRuleV1) ToMap

func (r RBACRuleV1) ToMap() map[string]any

type Registry

type Registry struct {
	ID        int    `json:"id" yaml:"id"`
	URL       string `json:"url" yaml:"url"`
	IsPublic  bool   `json:"isPublic" yaml:"isPublic"`
	UserName  string `json:"userName,omitempty" yaml:"userName,omitempty"`
	Password  string `json:"password,omitempty" yaml:"password,omitempty"`
	UserEmail string `json:"userEmail,omitempty" yaml:"userEmail,omitempty"`
}

Registry represents Docker registry configuration

func NewRegistry

func NewRegistry(id int, url string, isPublic bool, userName, password, userEmail string) *Registry

NewRegistry creates a new Registry

func (*Registry) Equals

func (r *Registry) Equals(other *Registry) bool

Equals checks if two Registries are equal

type RegistryBuilder

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

RegistryBuilder is a builder for creating Registry instances

func NewRegistryBuilder

func NewRegistryBuilder() *RegistryBuilder

NewRegistryBuilder creates a new RegistryBuilder

func (*RegistryBuilder) Build

func (b *RegistryBuilder) Build() *Registry

Build creates a Registry from the builder

func (*RegistryBuilder) SetID

func (b *RegistryBuilder) SetID(id int) *RegistryBuilder

SetID sets the registry ID

func (*RegistryBuilder) SetIsPublic

func (b *RegistryBuilder) SetIsPublic(isPublic bool) *RegistryBuilder

SetIsPublic sets whether the registry is public

func (*RegistryBuilder) SetPassword

func (b *RegistryBuilder) SetPassword(password string) *RegistryBuilder

SetPassword sets the registry password

func (*RegistryBuilder) SetURL

func (b *RegistryBuilder) SetURL(url string) *RegistryBuilder

SetURL sets the registry URL

func (*RegistryBuilder) SetUserEmail

func (b *RegistryBuilder) SetUserEmail(userEmail string) *RegistryBuilder

SetUserEmail sets the registry user email

func (*RegistryBuilder) SetUserName

func (b *RegistryBuilder) SetUserName(userName string) *RegistryBuilder

SetUserName sets the registry username

type ResourceConsumptionManagerStatus

type ResourceConsumptionManagerStatus struct {
	MemoryUsage     float64 `json:"memoryUsage" yaml:"memoryUsage"`         // Memory usage in MiB
	DiskUsage       float64 `json:"diskUsage" yaml:"diskUsage"`             // Disk usage in GiB
	CPUUsage        float64 `json:"cpuUsage" yaml:"cpuUsage"`               // CPU usage percentage (0-100)
	MemoryViolation bool    `json:"memoryViolation" yaml:"memoryViolation"` // Whether memory limit is violated
	DiskViolation   bool    `json:"diskViolation" yaml:"diskViolation"`     // Whether disk limit is violated
	CPUViolation    bool    `json:"cpuViolation" yaml:"cpuViolation"`       // Whether CPU limit is violated
	AvailableMemory int64   `json:"availableMemory" yaml:"availableMemory"` // System available memory in bytes
	TotalCPU        float64 `json:"totalCpu" yaml:"totalCpu"`               // Total system CPU usage percentage
	AvailableDisk   int64   `json:"availableDisk" yaml:"availableDisk"`     // System available disk space in bytes
	TotalDiskSpace  int64   `json:"totalDiskSpace" yaml:"totalDiskSpace"`   // Total system disk space in bytes
}

ResourceConsumptionManagerStatus represents the Resource Consumption Manager status

func NewResourceConsumptionManagerStatus

func NewResourceConsumptionManagerStatus() *ResourceConsumptionManagerStatus

NewResourceConsumptionManagerStatus creates a new ResourceConsumptionManagerStatus

func (*ResourceConsumptionManagerStatus) SetAvailableDisk

func (r *ResourceConsumptionManagerStatus) SetAvailableDisk(availableDisk int64) *ResourceConsumptionManagerStatus

SetAvailableDisk sets the available disk space and returns the status for chaining

func (*ResourceConsumptionManagerStatus) SetAvailableMemory

func (r *ResourceConsumptionManagerStatus) SetAvailableMemory(availableMemory int64) *ResourceConsumptionManagerStatus

SetAvailableMemory sets the available memory and returns the status for chaining

func (*ResourceConsumptionManagerStatus) SetCPUUsage

SetCPUUsage sets the CPU usage and returns the status for chaining

func (*ResourceConsumptionManagerStatus) SetCPUViolation

SetCPUViolation sets the CPU violation flag and returns the status for chaining

func (*ResourceConsumptionManagerStatus) SetDiskUsage

SetDiskUsage sets the disk usage and returns the status for chaining

func (*ResourceConsumptionManagerStatus) SetDiskViolation

SetDiskViolation sets the disk violation flag and returns the status for chaining

func (*ResourceConsumptionManagerStatus) SetMemoryUsage

SetMemoryUsage sets the memory usage and returns the status for chaining

func (*ResourceConsumptionManagerStatus) SetMemoryViolation

SetMemoryViolation sets the memory violation flag and returns the status for chaining

func (*ResourceConsumptionManagerStatus) SetTotalCPU

SetTotalCPU sets the total CPU usage and returns the status for chaining

func (*ResourceConsumptionManagerStatus) SetTotalDiskSpace

func (r *ResourceConsumptionManagerStatus) SetTotalDiskSpace(totalDiskSpace int64) *ResourceConsumptionManagerStatus

SetTotalDiskSpace sets the total disk space and returns the status for chaining

type ResourceManagerStatus

type ResourceManagerStatus struct {
	HWInfo             string `json:"hwInfo" yaml:"hwInfo"`                         // Hardware information from HAL
	USBConnectionsInfo string `json:"usbConnectionsInfo" yaml:"usbConnectionsInfo"` // USB connections information from HAL
}

ResourceManagerStatus represents the Resource Manager status

func NewResourceManagerStatus

func NewResourceManagerStatus() *ResourceManagerStatus

NewResourceManagerStatus creates a new ResourceManagerStatus

func (*ResourceManagerStatus) SetHWInfo

func (r *ResourceManagerStatus) SetHWInfo(hwInfo string) *ResourceManagerStatus

SetHWInfo sets the hardware info and returns the status for chaining

func (*ResourceManagerStatus) SetUSBConnectionsInfo

func (r *ResourceManagerStatus) SetUSBConnectionsInfo(usbInfo string) *ResourceManagerStatus

SetUSBConnectionsInfo sets the USB connections info and returns the status for chaining

type Route

type Route struct {
	Receivers []string `json:"receivers" yaml:"receivers"`
}

Route represents microservice routings

func NewRoute

func NewRoute() *Route

NewRoute creates a new Route with empty receivers list

func (*Route) Equals

func (r *Route) Equals(other *Route) bool

Equals checks if two Routes are equal

func (*Route) SetReceivers

func (r *Route) SetReceivers(receivers []string)

SetReceivers sets the receivers list and sorts it

type SSHProxyManagerStatus

type SSHProxyManagerStatus struct {
	ProxyStatus map[string]any `json:"proxyStatus" yaml:"proxyStatus"` // Proxy status information
}

SSHProxyManagerStatus represents the SSH Proxy Manager status

func NewSSHProxyManagerStatus

func NewSSHProxyManagerStatus() *SSHProxyManagerStatus

NewSSHProxyManagerStatus creates a new SSHProxyManagerStatus

func (*SSHProxyManagerStatus) GetJSONProxyStatus

func (s *SSHProxyManagerStatus) GetJSONProxyStatus() string

GetJSONProxyStatus returns the proxy status as a JSON string

func (*SSHProxyManagerStatus) SetConnectionStatus

func (s *SSHProxyManagerStatus) SetConnectionStatus(status string) *SSHProxyManagerStatus

SetConnectionStatus sets the connection status

func (*SSHProxyManagerStatus) SetErrorMessage

func (s *SSHProxyManagerStatus) SetErrorMessage(errMsg string) *SSHProxyManagerStatus

SetErrorMessage sets the error message

func (*SSHProxyManagerStatus) SetProxyConfig

func (s *SSHProxyManagerStatus) SetProxyConfig(username, host string, remotePort, localPort int) *SSHProxyManagerStatus

SetProxyConfig sets the proxy configuration

func (*SSHProxyManagerStatus) SetProxyStatus

func (s *SSHProxyManagerStatus) SetProxyStatus(status map[string]any) *SSHProxyManagerStatus

SetProxyStatus sets the proxy status and returns the status for chaining

type ServiceAccount

type ServiceAccount struct {
	Name    string                `json:"name" yaml:"name"`
	RoleRef ServiceAccountRoleRef `json:"roleRef" yaml:"roleRef"`
	Rules   []ServiceAccountRule  `json:"rules" yaml:"rules"`
}

func (*ServiceAccount) CanonicalRBACV1

func (sa *ServiceAccount) CanonicalRBACV1() RBACEnvelopeV1

type ServiceAccountRoleRef

type ServiceAccountRoleRef struct {
	Kind string `json:"kind" yaml:"kind"`
	Name string `json:"name" yaml:"name"`
}

type ServiceAccountRule

type ServiceAccountRule struct {
	APIGroups     []string `json:"apiGroups" yaml:"apiGroups"`
	Resources     []string `json:"resources" yaml:"resources"`
	Verbs         []string `json:"verbs" yaml:"verbs"`
	ResourceNames []string `json:"resourceNames,omitempty" yaml:"resourceNames,omitempty"`
}

func (ServiceAccountRule) ToRBACRuleV1

func (r ServiceAccountRule) ToRBACRuleV1() RBACRuleV1

type ServiceAccountToken

type ServiceAccountToken struct {
	ID                 string
	TokenUse           string
	PrincipalType      string
	Subject            string
	MicroserviceUUID   string
	ApplicationName    string
	ServiceAccountName string
	RoleRefKind        string
	RoleRefName        string
	RBACVersion        string
	RulesByGroupJSON   string
	ClaimsJSON         string
	Issuer             string
	Audience           string
	Alg                string
	JTI                string
	TokenSHA256        string
	IssuedAt           int64
	NotBefore          int64
	ExpiresAt          int64
	RevokedAt          *int64
	RotatedFromJTI     string
}

ServiceAccountToken represents persisted token metadata for EdgeletAPI v3.

type StatusReporterStatus

type StatusReporterStatus struct {
	SystemTime int64 `json:"systemTime" yaml:"systemTime"`
	LastUpdate int64 `json:"lastUpdate" yaml:"lastUpdate"`
}

StatusReporterStatus represents the Status Reporter status

func NewStatusReporterStatus

func NewStatusReporterStatus() *StatusReporterStatus

NewStatusReporterStatus creates a new StatusReporterStatus with current time

func NewStatusReporterStatusWithTimes

func NewStatusReporterStatusWithTimes(systemTime, lastUpdate int64) *StatusReporterStatus

NewStatusReporterStatusWithTimes creates a new StatusReporterStatus with specified times

func (*StatusReporterStatus) SetLastUpdate

func (s *StatusReporterStatus) SetLastUpdate(lastUpdate int64) *StatusReporterStatus

SetLastUpdate sets the last update time and returns the status for chaining

func (*StatusReporterStatus) SetSystemTime

func (s *StatusReporterStatus) SetSystemTime(systemTime int64) *StatusReporterStatus

SetSystemTime sets the system time and returns the status for chaining

type SupervisorStatus

type SupervisorStatus struct {
	DaemonStatus      ModuleStatus   `json:"daemonStatus" yaml:"daemonStatus"`           // Daemon status
	ModulesStatus     []ModuleStatus `json:"modulesStatus" yaml:"modulesStatus"`         // Status of each module
	DaemonLastStart   int64          `json:"daemonLastStart" yaml:"daemonLastStart"`     // Timestamp of last start
	OperationDuration int64          `json:"operationDuration" yaml:"operationDuration"` // Operating duration in milliseconds
	WarningMessage    string         `json:"warningMessage" yaml:"warningMessage"`       // Warning message
}

SupervisorStatus represents the Supervisor status

func NewSupervisorStatus

func NewSupervisorStatus(numModules int) *SupervisorStatus

NewSupervisorStatus creates a new SupervisorStatus with default values

func (*SupervisorStatus) GetModuleStatus

func (s *SupervisorStatus) GetModuleStatus(moduleIndex int) ModuleStatus

GetModuleStatus gets the status of a module

func (*SupervisorStatus) GetOperationDuration

func (s *SupervisorStatus) GetOperationDuration() int64

GetOperationDuration returns the operation duration (current time - last start)

func (*SupervisorStatus) SetDaemonLastStart

func (s *SupervisorStatus) SetDaemonLastStart(timestamp int64) *SupervisorStatus

SetDaemonLastStart sets the daemon last start time and returns the status for chaining

func (*SupervisorStatus) SetDaemonStatus

func (s *SupervisorStatus) SetDaemonStatus(status ModuleStatus) *SupervisorStatus

SetDaemonStatus sets the daemon status and returns the status for chaining

func (*SupervisorStatus) SetModuleStatus

func (s *SupervisorStatus) SetModuleStatus(moduleIndex int, status ModuleStatus) *SupervisorStatus

SetModuleStatus sets the status of a module and returns the status for chaining

func (*SupervisorStatus) SetOperationDuration

func (s *SupervisorStatus) SetOperationDuration(duration int64) *SupervisorStatus

SetOperationDuration sets the operation duration and returns the status for chaining

func (*SupervisorStatus) SetWarningMessage

func (s *SupervisorStatus) SetWarningMessage(message string) *SupervisorStatus

SetWarningMessage sets the warning message and returns the status for chaining

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

ValidationError represents a validation error with field information

func (*ValidationError) Error

func (e *ValidationError) Error() string

type VolumeMapping

type VolumeMapping struct {
	HostDestination      string            `json:"hostDestination" yaml:"hostDestination"`
	ContainerDestination string            `json:"containerDestination" yaml:"containerDestination"`
	AccessMode           string            `json:"accessMode" yaml:"accessMode"`
	Type                 VolumeMappingType `json:"type" yaml:"type"`
}

VolumeMapping represents microservice volume mappings for Docker run options

func NewVolumeMapping

func NewVolumeMapping(hostDestination, containerDestination, accessMode string, volumeType VolumeMappingType) *VolumeMapping

NewVolumeMapping creates a new VolumeMapping

func (*VolumeMapping) Equals

func (v *VolumeMapping) Equals(other *VolumeMapping) bool

Equals checks if two VolumeMappings are equal

type VolumeMappingType

type VolumeMappingType string

VolumeMappingType represents the type of volume mapping

const (
	VolumeMappingTypeVolume      VolumeMappingType = "VOLUME"
	VolumeMappingTypeBind        VolumeMappingType = "BIND"
	VolumeMappingTypeVolumeMount VolumeMappingType = "VOLUME_MOUNT"
)

type VolumeMountManagerStatus

type VolumeMountManagerStatus struct {
	ActiveMounts int64 `json:"activeMounts" yaml:"activeMounts"` // Number of active volume mounts
	LastUpdate   int64 `json:"lastUpdate" yaml:"lastUpdate"`     // Timestamp of last update
}

VolumeMountManagerStatus represents the Volume Mount Manager status

func NewVolumeMountManagerStatus

func NewVolumeMountManagerStatus() *VolumeMountManagerStatus

NewVolumeMountManagerStatus creates a new VolumeMountManagerStatus

func (*VolumeMountManagerStatus) SetActiveMounts

func (v *VolumeMountManagerStatus) SetActiveMounts(count int64) *VolumeMountManagerStatus

SetActiveMounts sets the active mounts count and returns the status for chaining

func (*VolumeMountManagerStatus) SetLastUpdate

func (v *VolumeMountManagerStatus) SetLastUpdate(timestamp int64) *VolumeMountManagerStatus

SetLastUpdate sets the last update time and returns the status for chaining

type YamlConfig

type YamlConfig struct {
	CurrentProfile string                    `json:"currentProfile" yaml:"currentProfile"`
	Profiles       map[string]*ProfileConfig `json:"profiles" yaml:"profiles"`
}

YamlConfig represents the root YAML configuration structure

func NewYamlConfig

func NewYamlConfig() *YamlConfig

NewYamlConfig creates a new YamlConfig

func (*YamlConfig) GetProfile

func (y *YamlConfig) GetProfile(name string) *ProfileConfig

GetProfile gets a profile by name

Jump to

Keyboard shortcuts

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