Files
buque/internal/models/models.go
2025-11-02 01:39:56 +01:00

93 líneas
2.7 KiB
Go

package models
import "time"
// Environment represents a Docker Compose environment
type Environment struct {
Name string `yaml:"name"`
Path string `yaml:"path"`
ComposeFile string `yaml:"compose_file"`
Enabled bool `yaml:"enabled"`
Labels map[string]string `yaml:"labels,omitempty"`
CreatedAt time.Time `yaml:"created_at"`
UpdatedAt time.Time `yaml:"updated_at"`
}
// Service represents a Docker service/container
type Service struct {
ID string
Name string
Image string
Status string
State string
Environment string
Ports []string
Networks []string
CreatedAt time.Time
RestartCount int
}
// ContainerStats represents statistics for a running container
type ContainerStats struct {
ID string
Name string
Environment string
CPUPercentage float64
MemoryUsage uint64
MemoryLimit uint64
MemoryPercent float64
NetworkRx uint64
NetworkTx uint64
BlockRead uint64
BlockWrite uint64
PIDs uint64
}
// Config represents the buque configuration
type Config struct {
ConfigPath string `yaml:"config_path"`
Environments []Environment `yaml:"environments"`
NginxProxy NginxProxyConfig `yaml:"nginx_proxy"`
Docker DockerConfig `yaml:"docker"`
UpdateSchedule string `yaml:"update_schedule,omitempty"`
}
// NginxProxyConfig represents nginx-proxy configuration
type NginxProxyConfig struct {
Enabled bool `yaml:"enabled"`
NetworkName string `yaml:"network_name"`
ContainerName string `yaml:"container_name"`
Path string `yaml:"path"`
HTTPPort int `yaml:"http_port"`
HTTPSPort int `yaml:"https_port"`
SSLEnabled bool `yaml:"ssl_enabled"`
Labels map[string]string `yaml:"labels,omitempty"`
}
// DockerConfig represents Docker-related configuration
type DockerConfig struct {
Host string `yaml:"host,omitempty"`
APIVersion string `yaml:"api_version,omitempty"`
ComposeVersion string `yaml:"compose_version,omitempty"`
}
// EnvironmentStatus represents the status of an environment
type EnvironmentStatus struct {
Environment Environment
Services []Service
Running int
Stopped int
Error error
}
// UpdateResult represents the result of an update operation
type UpdateResult struct {
Environment string
Service string
OldImage string
NewImage string
Success bool
Error error
UpdatedAt time.Time
}