models

package
v0.0.0-...-bd1a880 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package models provides data structures used throughout the application

Package models provides data structures used throughout the application

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidJSON            = errors.New("invalid JSON value")
	ErrInvalidDockerID        = errors.New("invalid Docker ID")
	ErrInvalidContainerStatus = errors.New("invalid container status")
)

Functions

func IsValidContainerStatus

func IsValidContainerStatus(status ContainerStatus) bool

func IsValidNetworkMode

func IsValidNetworkMode(mode NetworkMode) bool

func IsValidRestartPolicy

func IsValidRestartPolicy(policy RestartPolicy) bool

func RedactSensitiveData

func RedactSensitiveData(data map[string]interface{}, sensitiveKeys ...string) map[string]interface{}

RedactSensitiveData recursively redacts sensitive keys in a map

func SanitizeDockerName

func SanitizeDockerName(name string) string

SanitizeDockerName sanitizes a Docker resource name

func ValidateAlphaNumDash

func ValidateAlphaNumDash(fl validator.FieldLevel) bool

ValidateAlphaNumDash validates that a string contains only alphanumeric characters, dashes, underscores, and dots

func ValidateContainerStatus

func ValidateContainerStatus(fl validator.FieldLevel) bool

ValidateContainerStatus validates a container status

func ValidateNetworkMode

func ValidateNetworkMode(fl validator.FieldLevel) bool

ValidateNetworkMode validates a network mode

func ValidateRestartPolicy

func ValidateRestartPolicy(fl validator.FieldLevel) bool

ValidateRestartPolicy validates a restart policy

Types

type AdminCreateUserRequest

type AdminCreateUserRequest struct {
	// Email is the new user's email address.
	// required: true
	// example: newuser@example.com
	Email string `json:"email" binding:"required,email" example:"newuser@example.com"`

	// Password is the initial password for the new user (min 8 characters).
	// required: true
	// example: InitialP@ssw0rd!
	Password string `json:"password" binding:"required,min=8" example:"InitialP@ssw0rd!"`

	// Name is the new user's display name.
	// required: true
	// example: Jane Smith
	Name string `json:"name" binding:"required" example:"Jane Smith"`

	// Roles is an optional list of roles to assign to the new user.
	// example: ["user", "editor"]
	Roles []string `json:"roles" example:"user,editor"` // Optional: roles to assign (e.g., ["user", "admin"])

	// Active specifies if the new user account should be active immediately. Defaults to true if omitted.
	// example: true
	Active bool `json:"active" example:"true"` // Optional: defaults to true if omitted

	// EmailVerified specifies if the new user's email should be marked as verified. Defaults to false.
	// example: false
	EmailVerified bool `json:"email_verified" example:"false"` // Optional: defaults to false
}

AdminCreateUserRequest represents a request by an admin to create a new user @description Data required for an administrator to create a new user account.

type AdminUpdateUserRequest

type AdminUpdateUserRequest struct {
	// Name is the user's updated display name.
	// example: "Johnathan Doe"
	Name *string `json:"name" example:"Johnathan Doe"` // Optional: Pointer to allow omitting

	// Email is the user's updated email address. If changed, email verification status might be reset.
	// example: "john.doe.updated@example.com"
	Email *string `json:"email" example:"john.doe.updated@example.com"` // Optional: Pointer to allow omitting

	// Roles is the updated list of roles for the user. An empty slice clears existing roles.
	// example: ["user", "admin"]
	Roles *[]string `json:"roles" example:"user,admin"` // Optional: Pointer to allow omitting (empty slice means clear roles)

	// Active specifies whether the user account should be active.
	// example: false
	Active *bool `json:"active" example:"false"` // Optional: Pointer to allow omitting

	// EmailVerified specifies whether the user's email address is verified.
	// example: true
	EmailVerified *bool `json:"email_verified" example:"true"` // Optional: Pointer to allow omitting
}

AdminUpdateUserRequest represents a request by an admin to update a user @description Data for an administrator to update an existing user's details. All fields are optional.

type ChangeItemResponse

type ChangeItemResponse struct {
	// Path is the path to the file or directory that has changed.
	// required: true
	// example: "/app/config.json"
	Path string `json:"path" example:"/etc/nginx/nginx.conf"`

	// Kind indicates the type of change: 0 for Modified, 1 for Added, 2 for Deleted.
	// required: true
	// example: 1
	Kind int `json:"kind"` // 0: Modified, 1: Added, 2: Deleted
}

ChangeItemResponse represents a single change detected in a container's filesystem. @description Details about a file or directory that has been modified, added, or deleted compared to the container's image.

type ChangePasswordRequest

type ChangePasswordRequest struct {
	// CurrentPassword is the user's existing password.
	// required: true
	// example: OldP@ssw0rd!
	CurrentPassword string `json:"current_password" binding:"required" example:"OldP@ssw0rd!"`

	// NewPassword is the desired new password (min 8 characters).
	// required: true
	// example: NewStrongP@ssw0rd!
	NewPassword string `json:"new_password" binding:"required,min=8" example:"NewStrongP@ssw0rd!"`
}

ChangePasswordRequest represents a password change request @description Data required for a user to change their own password.

type ComposeDeployment

type ComposeDeployment struct {
	DockerResource
	ProjectName  string           `json:"project_name" gorm:"uniqueIndex;size:255" validate:"required,max=255,alphanumdash"`
	FilePath     string           `json:"file_path" validate:"omitempty,filepath"`
	Content      string           `json:"-" gorm:"type:text"` // Store raw compose content
	EnvVars      JSONMap          `json:"env_vars" gorm:"type:text"`
	Status       string           `json:"status" gorm:"index;size:64" validate:"required,max=64"`
	ServiceCount int              `json:"service_count"`
	RunningCount int              `json:"running_count"`
	Services     []ComposeService `json:"services" gorm:"foreignKey:DeploymentID"`
	LastDeployed time.Time        `json:"last_deployed"`
	LastUpdated  time.Time        `json:"last_updated"`
}

ComposeDeployment represents a Docker Compose deployment in the database

func (*ComposeDeployment) SanitizeComposeEnvironment

func (cd *ComposeDeployment) SanitizeComposeEnvironment()

SanitizeComposeEnvironment redacts sensitive environment variables

func (*ComposeDeployment) Validate

func (cd *ComposeDeployment) Validate() error

Validate checks if the compose deployment is valid

type ComposeDeploymentResponse

type ComposeDeploymentResponse struct {
	ID           uint                     `json:"id" example:"1"`
	Name         string                   `json:"name"`
	ProjectName  string                   `json:"project_name" example:"my-web-app"`
	FilePath     string                   `json:"file_path,omitempty"`
	Status       string                   `json:"status" example:"running"`
	ServiceCount int                      `json:"service_count"`
	RunningCount int                      `json:"running_count"`
	Services     []ComposeServiceResponse `json:"services"`
	Networks     []NetworkResponse        `json:"networks,omitempty"`
	Volumes      []VolumeResponse         `json:"volumes,omitempty"`
	Labels       map[string]string        `json:"labels,omitempty"`
	Notes        string                   `json:"notes,omitempty"`
	LastDeployed time.Time                `json:"last_deployed" example:"2023-10-27T12:00:00Z"`
	LastUpdated  time.Time                `json:"last_updated"`
	UserID       uint                     `json:"user_id"`
	CreatedAt    time.Time                `json:"created_at"`
	UpdatedAt    time.Time                `json:"updated_at"`
}

ComposeDeploymentResponse represents a compose deployment response

type ComposeDownOptions

type ComposeDownOptions struct {
	RemoveVolumes  bool   `json:"removeVolumes,omitempty"`
	RemoveImages   string `json:"removeImages,omitempty"` // e.g., "all", "local"
	RemoveOrphans  bool   `json:"removeOrphans,omitempty"`
	TimeoutSeconds int    `json:"timeoutSeconds,omitempty"` // Renamed for clarity
}

ComposeDownOptions represents options for shutting down a Compose stack Based on fields used in pkg/client/compose.go ComposeDown function

type ComposeDownRequest

type ComposeDownRequest struct {
	// RemoveVolumes removes named volumes declared in the 'volumes' section of the Compose file and anonymous volumes attached to containers.
	// example: false
	RemoveVolumes bool `form:"remove_volumes"`

	// RemoveOrphans removes containers for services not defined in the Compose file.
	// example: false
	RemoveOrphans bool `form:"remove_orphans"`

	// Force forces the removal of containers.
	// example: false
	Force bool `form:"force"`
}

ComposeDownRequest represents parameters for removing a compose project. @description Query parameters specifying options for taking down a Compose deployment.

type ComposeFile

type ComposeFile struct {
	// Version is the version of the Compose file format
	Version string `yaml:"version" json:"version"`

	// Services is a map of service definitions
	Services map[string]ServiceConfig `yaml:"services" json:"services"`

	// Networks is a map of network definitions
	Networks map[string]NetworkConfig `yaml:"networks,omitempty" json:"networks,omitempty"`

	// Volumes is a map of volume definitions
	Volumes map[string]VolumeConfig `yaml:"volumes,omitempty" json:"volumes,omitempty"`

	// Secrets is a map of secret definitions
	Secrets map[string]SecretConfig `yaml:"secrets,omitempty" json:"secrets,omitempty"`

	// Configs is a map of config definitions
	Configs map[string]ConfigConfig `yaml:"configs,omitempty" json:"configs,omitempty"`

	// Extensions stores extension fields
	Extensions map[string]interface{} `yaml:"extensions,omitempty" json:"extensions,omitempty"` // Removed ,inline tag
}

ComposeFile represents a Docker Compose file

type ComposeListRequest

type ComposeListRequest struct {
	PaginationRequest // Embeds Page and PageSize
	SortRequest       // Embeds SortBy and SortOrder
	FilterRequest     // Embeds Search, Filters, StartDate, EndDate
	// Status filters deployments by their current status (e.g., running, stopped, error).
	// example: running
	Status string `json:"status" form:"status" example:"running"`
}

Removed duplicate definition ComposeListRequest represents parameters for listing compose deployments. @description Query parameters for filtering, sorting, and paginating the list of Compose deployments managed by the application.

type ComposeListResponse

type ComposeListResponse struct {
	Deployments []ComposeDeploymentResponse `json:"deployments"`
	Metadata    MetadataResponse            `json:"metadata"`
}

ComposeListResponse represents a list of compose deployments

type ComposeRestartRequest

type ComposeRestartRequest struct {
	// Timeout specifies the shutdown timeout in seconds before restarting containers.
	// example: 10
	Timeout int `form:"timeout" binding:"omitempty,gte=0" example:"10"` // Timeout in seconds
}

ComposeRestartRequest represents parameters for restarting a compose project's services. @description Query parameters for restarting services in a Compose deployment.

type ComposeScaleRequest

type ComposeScaleRequest struct {
	// Service is the name of the service to scale.
	// required: true
	// example: "worker"
	Service string `json:"service" binding:"required" example:"worker"`

	// Replicas is the desired number of containers for the service.
	// required: true
	// example: 3
	Replicas int `json:"replicas" binding:"required,gte=0" example:"3"`
}

ComposeScaleRequest represents a request to scale a specific service within a compose project. @description Specifies the service and the desired number of replicas.

type ComposeService

type ComposeService struct {
	ID           uint            `json:"id" gorm:"primaryKey"`
	DeploymentID uint            `json:"-" gorm:"index" validate:"required"` // Link back to ComposeDeployment
	Name         string          `json:"name" gorm:"index;size:255" validate:"required,max=255,alphanumdash"`
	ImageName    string          `json:"image_name" validate:"required,max=512"`
	Status       ContainerStatus `json:"status" gorm:"index;size:32" validate:"containerStatus"`
	Replicas     int             `json:"replicas" validate:"min=0"`
	RunningCount int             `json:"running_count" validate:"min=0"`
	Ports        JSONMap         `json:"ports" gorm:"type:text"`
	Volumes      JSONMap         `json:"volumes" gorm:"type:text"`
	Networks     StringArray     `json:"networks" gorm:"type:text"`
	Environment  StringArray     `json:"environment" gorm:"type:text"`
	Command      string          `json:"command" validate:"max=1024"`
	Depends      StringArray     `json:"depends" gorm:"type:text"`
	Labels       JSONMap         `json:"labels" gorm:"type:text"`
	Build        JSONMap         `json:"build" gorm:"type:text"` // Store build context/args as JSON
	Healthcheck  JSONMap         `json:"healthcheck" gorm:"type:text"`
	Secrets      StringArray     `json:"secrets" gorm:"type:text" validate:"-"`
	Configs      StringArray     `json:"configs" gorm:"type:text" validate:"-"`
	Deploy       JSONMap         `json:"deploy" gorm:"type:text"` // Store deploy options (replicas, resources, etc.)
	LastUpdated  time.Time       `json:"last_updated"`
	CreatedAt    time.Time       `json:"created_at"`
	UpdatedAt    time.Time       `json:"updated_at"`
	DeletedAt    gorm.DeletedAt  `json:"-" gorm:"index"`
}

ComposeService represents a service within a Docker Compose deployment

func (*ComposeService) SanitizeServiceEnvVars

func (cs *ComposeService) SanitizeServiceEnvVars()

SanitizeServiceEnvVars redacts sensitive environment variables for a service

func (*ComposeService) Validate

func (cs *ComposeService) Validate() error

Validate checks if the compose service is valid

type ComposeServiceResponse

type ComposeServiceResponse struct {
	ID           uint                  `json:"id"`
	Name         string                `json:"name" example:"web"`
	ContainerID  string                `json:"container_id,omitempty"`
	ImageName    string                `json:"image_name"`
	Status       ContainerStatus       `json:"status"`
	Replicas     int                   `json:"replicas"`
	RunningCount int                   `json:"running_count"`
	Ports        []PortMapping         `json:"ports,omitempty"`
	Volumes      []VolumeMountResponse `json:"volumes,omitempty"`
	Networks     []string              `json:"networks,omitempty"`
	Environment  []string              `json:"environment,omitempty"`
	Command      string                `json:"command,omitempty"`
	Depends      []string              `json:"depends,omitempty"`
	LastUpdated  time.Time             `json:"last_updated"`
	CreatedAt    time.Time             `json:"created_at"`
	UpdatedAt    time.Time             `json:"updated_at"`
}

ComposeServiceResponse represents a compose service response

type ComposeServiceStatus

type ComposeServiceStatus struct {
	ID           string        `json:"id"` // Container ID if running
	Name         string        `json:"name"`
	State        string        `json:"state"` // e.g., "running", "exited(0)", "starting"
	Health       string        `json:"health,omitempty"`
	ExitCode     int           `json:"exit_code,omitempty"`
	Ports        []PortMapping `json:"ports,omitempty"`         // Reusing PortMapping from docker_entities.go
	DesiredState string        `json:"desired_state,omitempty"` // e.g. "running"
}

ComposeServiceStatus represents the status of a single service within a deployment

type ComposeStartRequest

type ComposeStartRequest struct {
}

ComposeStartRequest represents a request to start a compose project's services. @description Currently has no specific options, but acts as a placeholder.

type ComposeStatus

type ComposeStatus struct {
	DeploymentID string                 `json:"deploymentId"`
	ProjectName  string                 `json:"projectName"`
	Status       string                 `json:"status"` // e.g., "running", "exited", "degraded"
	Services     []ComposeServiceStatus `json:"services"`
	Message      string                 `json:"message,omitempty"`
	LastUpdated  time.Time              `json:"lastUpdated"`
}

ComposeStatus represents the overall status of a Compose deployment

type ComposeStopRequest

type ComposeStopRequest struct {
	// Timeout specifies the shutdown timeout in seconds for containers.
	// example: 10
	Timeout int `form:"timeout" binding:"omitempty,gte=0"` // Timeout in seconds
}

ComposeStopRequest represents parameters for stopping a compose project's services. @description Query parameters for stopping services in a Compose deployment.

type ComposeUpOptions

type ComposeUpOptions struct {
	ProjectName          string            `json:"projectName"` // Used in API call logic, though not directly in SDK options
	EnvironmentVariables map[string]string `json:"environmentVariables,omitempty"`
	Recreate             string            `json:"recreate,omitempty"` // e.g., "never", "diverged", "always"
	NoStart              bool              `json:"noStart,omitempty"`
	ForceRecreate        bool              `json:"forceRecreate,omitempty"`
	NoBuild              bool              `json:"noBuild,omitempty"`
	ForceBuild           bool              `json:"forceBuild,omitempty"`
	TimeoutSeconds       int               `json:"timeoutSeconds,omitempty"` // Renamed for clarity
	QuietPull            bool              `json:"quietPull,omitempty"`      // Common compose option
}

ComposeUpOptions represents options for deploying a Compose stack Based on fields used in pkg/client/compose.go ComposeUp function

type ComposeUpRequest

type ComposeUpRequest struct {
	// ProjectName is the name to assign to the Compose project.
	// required: true
	// example: "my-web-app"
	ProjectName string `json:"project_name" binding:"required"`

	// ComposeFileContent is the raw YAML content of the Docker Compose file.
	// required: true
	// example: "version: '3.8'\nservices:\n  web:\n    image: nginx:latest\n"
	ComposeFileContent string `` /* 150-byte string literal not displayed */

	// ForceRecreate forces the recreation of containers even if their configuration hasn't changed.
	// example: false
	ForceRecreate bool `json:"force_recreate" example:"false"`

	// NoBuild disables building images before starting containers.
	// example: false
	NoBuild bool `json:"no_build" example:"false"`

	// NoStart creates containers but does not start them.
	// example: false
	NoStart bool `json:"no_start"`

	// Pull attempts to pull newer versions of images before starting containers.
	// example: true
	Pull bool `json:"pull"`

	// RemoveOrphans removes containers for services not defined in the Compose file.
	// example: false
	RemoveOrphans bool `json:"remove_orphans" example:"false"`
}

ComposeUpRequest represents a request to deploy a compose project. @description Contains the Docker Compose file content and options for deploying a project.

type ComposeValidateRequest

type ComposeValidateRequest struct {
	// ComposeFileContent is the raw YAML content of the Docker Compose file.
	// required: true
	// example: "version: '3.8'\nservices:\n  web:\n    image: nginx:latest\n"
	ComposeFileContent string `` /* 150-byte string literal not displayed */
}

ComposeValidateRequest represents a request to validate compose file content. @description Contains the Docker Compose file content (YAML) to be validated.

type ComposeValidationResponse

type ComposeValidationResponse struct {
	Valid    bool     `json:"valid"`
	Warnings []string `json:"warnings,omitempty"`
	Errors   []string `json:"errors,omitempty" example:"service 'db' depends on undefined network 'external_net'"`
	Services []string `json:"services,omitempty"`
	Networks []string `json:"networks,omitempty"`
	Volumes  []string `json:"volumes,omitempty"`
}

ComposeValidationResponse represents a compose validation response

type ConfigConfig

type ConfigConfig struct {
	// Name is the name of the config
	Name string `yaml:"-" json:"name"`

	// File is the file containing the config
	File string `yaml:"file,omitempty" json:"file,omitempty"`

	// External indicates whether the config is external
	External interface{} `yaml:"external,omitempty" json:"external,omitempty"`

	// Labels are labels to apply to the config
	Labels interface{} `yaml:"labels,omitempty" json:"labels,omitempty"`

	// Extensions stores extension fields
	Extensions map[string]interface{} `yaml:",inline" json:"extensions,omitempty"`
}

ConfigConfig represents a config in a Docker Compose file

type Container

type Container struct {
	DockerResource
	ContainerID         string                     `json:"container_id" gorm:"index;size:64" validate:"len=64,alphanum"`
	ImageID             string                     `json:"image_id" gorm:"index;size:64" validate:"required"`
	Command             string                     `json:"command" validate:"max=1024"`
	Status              ContainerStatus            `json:"status" gorm:"index;size:32" validate:"containerStatus"`
	Ports               JSONMap                    `json:"ports" gorm:"type:text"`
	Volumes             JSONMap                    `json:"volumes" gorm:"type:text"`
	Networks            JSONMap                    `json:"networks" gorm:"type:text"`
	IPAddress           string                     `json:"ip_address" validate:"omitempty,ip"`
	ExitCode            int                        `json:"exit_code"`
	RestartPolicy       RestartPolicy              `json:"restart_policy" validate:"required,restartPolicy"`
	NetworkMode         NetworkMode                `json:"network_mode" validate:"required,networkMode"`
	Privileged          bool                       `json:"privileged"`
	HasChanged          bool                       `json:"has_changed" gorm:"default:false"`
	LastInspected       time.Time                  `json:"last_inspected"`
	SecurityOptions     StringArray                `json:"security_options" gorm:"type:text"`
	SecurityProfile     string                     `json:"security_profile" gorm:"size:255"`
	AutoRemove          bool                       `json:"auto_remove"`
	ReadOnly            bool                       `json:"read_only"`
	HostIPC             bool                       `json:"host_ipc"`
	HostPID             bool                       `json:"host_pid"`
	CapAdd              StringArray                `json:"cap_add" gorm:"type:text"`
	CapDrop             StringArray                `json:"cap_drop" gorm:"type:text"`
	UsernsMode          string                     `json:"userns_mode" gorm:"size:255"`
	Resources           JSONMap                    `json:"resources" gorm:"type:text"`
	Healthcheck         JSONMap                    `json:"healthcheck" gorm:"type:text"`
	EnvVars             StringArray                `json:"env_vars" gorm:"type:text"`
	Secrets             StringArray                `json:"secrets" gorm:"type:text" validate:"-"`
	Stats               ContainerStats             `json:"stats" gorm:"-"`
	Processes           []Process                  `json:"processes" gorm:"-"`
	DetailedNetworkInfo map[string]DetailedNetwork `json:"detailed_network_info" gorm:"-"`
	DetailedVolumeInfo  map[string]DetailedVolume  `json:"detailed_volume_info" gorm:"-"`
	// Fields from list item conversion (might be redundant with inspect)
	Names      []string `json:"names" gorm:"-"`
	Image      string   `json:"image" gorm:"-"`
	State      string   `json:"state" gorm:"-"` // Raw state string
	SizeRw     int64    `json:"size_rw,omitempty" gorm:"-"`
	SizeRootFs int64    `json:"size_root_fs,omitempty" gorm:"-"`
	// Fields from inspect conversion (might be redundant)
	Entrypoint     []string       `json:"entrypoint" gorm:"-"`
	WorkingDir     string         `json:"working_dir" gorm:"-"`
	User           string         `json:"user" gorm:"-"`
	ExposedPorts   []string       `json:"exposed_ports" gorm:"-"`
	RestartCount   int            `json:"restart_count" gorm:"-"`
	Platform       string         `json:"platform" gorm:"-"`
	Health         string         `json:"health,omitempty" gorm:"-"`
	HealthLog      string         `json:"health_log,omitempty" gorm:"-"`
	Running        bool           `json:"running" gorm:"-"`
	Paused         bool           `json:"paused" gorm:"-"`
	Restarting     bool           `json:"restarting" gorm:"-"`
	OOMKilled      bool           `json:"oom_killed" gorm:"-"`
	Dead           bool           `json:"dead" gorm:"-"`
	StartedAt      time.Time      `json:"started_at,omitempty" gorm:"-"`
	FinishedAt     time.Time      `json:"finished_at,omitempty" gorm:"-"`
	UpTime         string         `json:"up_time,omitempty" gorm:"-"`
	Mounts         []MountPoint   `json:"mounts" gorm:"-"`
	ResourceLimits ResourceLimits `json:"resource_limits" gorm:"-"`
	SecurityInfo   SecurityInfo   `json:"security_info" gorm:"-"`
}

Container represents a Docker container in the database

func FromDockerContainerJSON

func FromDockerContainerJSON(containerJSON *types.ContainerJSON) *Container

FromDockerContainerJSON converts a types.ContainerJSON to our internal Container model It attempts to populate as many fields as possible.

func (*Container) SanitizeSecurityFields

func (c *Container) SanitizeSecurityFields()

SanitizeSecurityFields redacts sensitive information from container fields

func (*Container) Validate

func (c *Container) Validate() error

Validate checks if the container is valid

type ContainerCreateRequest

type ContainerCreateRequest struct {
	// Name is the name to assign to the new container.
	// required: true
	// example: "my-nginx-container"
	Name string `json:"name" binding:"required" example:"my-nginx-container"`

	// Image is the name or ID of the Docker image to use.
	// required: true
	// example: "nginx:latest"
	Image string `json:"image" binding:"required" example:"nginx:latest"`

	// Command is the command to run when the container starts.
	// example: ["nginx", "-g", "daemon off;"]
	Command []string `json:"command" example:"nginx,-g,daemon off;"`

	// Entrypoint overrides the default entrypoint of the image.
	// example: ["/docker-entrypoint.sh"]
	Entrypoint []string `json:"entrypoint" example:"/docker-entrypoint.sh"`

	// Env is a list of environment variables to set in the container (e.g., "VAR=value").
	// example: ["NGINX_HOST=example.com", "NGINX_PORT=80"]
	Env []string `json:"env" example:"NGINX_HOST=example.com,NGINX_PORT=80"`

	// Labels are key-value pairs to apply to the container.
	// example: {"environment": "development", "app": "webserver"}
	Labels map[string]string `json:"labels" example:"environment:development,app:webserver"`

	// Ports specifies the port mappings between the host and the container.
	Ports []PortMapping `json:"ports"`

	// Volumes specifies the volume mappings between the host/named volumes and the container.
	Volumes []VolumeMapping `json:"volumes"`

	// Networks is a list of network names or IDs to connect the container to.
	// example: ["my-app-network"]
	Networks []string `json:"networks" example:"my-app-network"`

	// RestartPolicy defines the container's behavior when it exits.
	// example: "unless-stopped"
	RestartPolicy string `json:"restart_policy" binding:"omitempty,oneof=no on-failure always unless-stopped" example:"unless-stopped"`

	// MemoryLimit is the maximum amount of memory the container can use (in bytes).
	// example: 104857600 (100MB)
	MemoryLimit int64 `json:"memory_limit" example:"104857600"` // 100MB

	// CPULimit specifies the CPU quota for the container (e.g., 1.5 means 1.5 CPU cores). Docker uses NanoCPUs (1e9 per core).
	// example: 1.5
	CPULimit float64 `json:"cpu_limit" example:"1.5"` // 1.5 CPU cores

	// Privileged gives the container extended privileges on the host. Use with caution.
	// example: false
	Privileged bool `json:"privileged" example:"false"`

	// AutoRemove automatically removes the container when it exits.
	// example: false
	AutoRemove bool `json:"auto_remove" example:"false"`

	// Notes are user-defined notes for the container (stored in application DB).
	// example: "Main web server container."
	Notes string `json:"notes" example:"Main web server container."`
}

ContainerCreateRequest represents a container creation request. @description Configuration details for creating a new Docker container.

type ContainerExecCreateRequest

type ContainerExecCreateRequest struct {
	// Command is the command to execute in the container, with arguments.
	// required: true
	// example: ["/bin/bash", "-c", "echo hello"]
	Command []string `json:"command" binding:"required" example:"/bin/bash,-c,echo hello"`

	// AttachStdin specifies whether to attach stdin to the exec command.
	// example: false
	AttachStdin bool `json:"attach_stdin" example:"false"`

	// AttachStdout specifies whether to attach stdout to the exec command.
	// example: true
	AttachStdout bool `json:"attach_stdout" example:"true"`

	// AttachStderr specifies whether to attach stderr to the exec command.
	// example: true
	AttachStderr bool `json:"attach_stderr" example:"true"`

	// DetachKeys specifies the key sequence for detaching from the exec session.
	// example: "ctrl-p,ctrl-q"
	DetachKeys string `json:"detach_keys" example:"ctrl-p,ctrl-q"`

	// Tty specifies whether to allocate a pseudo-TTY for the exec command. Required for interactive sessions.
	// example: false
	Tty bool `json:"tty" example:"false"`

	// Env specifies environment variables to set in the exec command's environment.
	// example: ["VAR1=value1", "VAR2=value2"]
	Env []string `json:"env" example:"VAR1=value1,VAR2=value2"`

	// Privileged specifies whether to run the exec command in privileged mode.
	// example: false
	Privileged bool `json:"privileged" example:"false"`

	// WorkingDir specifies the working directory inside the container for the exec command.
	// example: "/app"
	WorkingDir string `json:"working_dir" example:"/app"`
}

ContainerExecCreateRequest represents a container exec creation request @description Configuration for creating a new exec instance in a container.

type ContainerExecResizeRequest

type ContainerExecResizeRequest struct {
	ExecID string `json:"exec_id" binding:"required" example:"a1b2c3d4e5f6"`
	Height int    `json:"height" binding:"required,gt=0" example:"24"`
	Width  int    `json:"width" binding:"required,gt=0" example:"80"`
}

ContainerExecResizeRequest represents a request to resize an exec instance's TTY

type ContainerExecResponse

type ContainerExecResponse struct {
	// ID is the unique identifier of the exec instance.
	// required: true
	// example: "a1b2c3d4e5f6..."
	ID string `json:"id" example:"a1b2c3d4e5f6"`

	// Running indicates whether the exec process is currently running.
	// required: true
	// example: false
	Running bool `json:"running" example:"false"`

	// ExitCode is the exit code of the exec process. Only available after the process has finished.
	// example: 0
	ExitCode int `json:"exit_code" example:"0"`

	// ProcessConfig holds the configuration of the process executed.
	ProcessConfig struct {
		// EntryPoint is the entry point for the executed command.
		// example: "/bin/sh"
		EntryPoint string `json:"entrypoint" example:"/bin/sh"`
		// Arguments are the arguments passed to the command.
		// example: ["-c", "echo hello"]
		Arguments []string `json:"arguments" example:"-c,echo hello"`
		// Tty indicates if a TTY was allocated for the process.
		// example: false
		Tty bool `json:"tty" example:"false"`
		// Privileged indicates if the process ran with elevated privileges.
		// example: false
		Privileged bool `json:"privileged" example:"false"`
	} `json:"process_config"`

	// OpenStdin indicates if stdin was attached to the process.
	// required: true
	// example: false
	OpenStdin bool `json:"open_stdin" example:"false"`

	// OpenStderr indicates if stderr was attached to the process.
	// required: true
	// example: true
	OpenStderr bool `json:"open_stderr" example:"true"`

	// OpenStdout indicates if stdout was attached to the process.
	// required: true
	// example: true
	OpenStdout bool `json:"open_stdout" example:"true"`

	// ContainerID is the ID of the container where the exec instance ran.
	// required: true
	// example: "f7d9e8c7b6a5..."
	ContainerID string `json:"container_id" example:"f7d9e8c7b6a5"`

	// CreatedAt is the timestamp when the exec instance was created (Note: Docker API might not provide this directly in inspect).
	// example: "2023-10-27T10:00:00Z"
	CreatedAt time.Time `json:"created_at,omitempty"`
}

ContainerExecResponse represents the state of an exec instance in a container. @description Details about an exec instance created within a container.

type ContainerExecStartRequest

type ContainerExecStartRequest struct {
	ExecID      string `json:"exec_id" binding:"required" example:"a1b2c3d4e5f6"`
	Tty         bool   `json:"tty" example:"true"`
	DetachKeys  string `json:"detach_keys" example:"ctrl-p,ctrl-q"`
	StdinBase64 string `json:"stdin_base64" example:"aGVsbG8gd29ybGQK"` // Base64 encoded input for non-websocket start
}

ContainerExecStartRequest represents a request to start an exec instance

type ContainerExecStartResponse

type ContainerExecStartResponse struct {
	ExecID   string `json:"exec_id"`
	Output   string `json:"output"` // Base64 encoded stdout
	Error    string `json:"error"`  // Base64 encoded stderr
	ExitCode int    `json:"exit_code"`
	Running  bool   `json:"running"`
}

ContainerExecStartResponse represents the response for starting an exec instance (non-websocket)

type ContainerHealth

type ContainerHealth struct {
	Status        string      `json:"status"`
	FailingStreak int         `json:"failing_streak"`
	Log           []HealthLog `json:"log"`
}

ContainerHealth represents the health of a container

type ContainerListRequest

type ContainerListRequest struct {
	PaginationRequest
	SortRequest
	FilterRequest
	All       bool   `json:"all" form:"all" example:"false"`
	Status    string `` /* 134-byte string literal not displayed */
	ImageID   string `json:"image_id" form:"image_id" example:"sha256:a1b2c3d4..."`
	NetworkID string `json:"network_id" form:"network_id" example:"net_abc123"`
	VolumeID  string `json:"volume_id" form:"volume_id" example:"vol_def456"`
}

ContainerListRequest represents a container list request

type ContainerListResponse

type ContainerListResponse struct {
	// Containers is the list of container objects returned for the current page.
	// required: true
	Containers []ContainerResponse `json:"containers"`

	// Metadata contains pagination and other metadata for the response.
	// required: true
	Metadata MetadataResponse `json:"metadata"`
}

ContainerListResponse represents a paginated list of containers. @description Contains a list of container details along with pagination information.

type ContainerLogResponse

type ContainerLogResponse struct {
	Logs       string    `json:"logs" example:"Log line 1\nLog line 2"`
	Timestamps bool      `json:"timestamps" example:"true"`
	Since      time.Time `json:"since,omitempty" example:"2023-10-27T10:00:00Z"`
	Until      time.Time `json:"until,omitempty" example:"2023-10-27T11:00:00Z"`
	Tail       string    `json:"tail,omitempty" example:"100"`
}

ContainerLogResponse represents container logs

type ContainerLogsRequest

type ContainerLogsRequest struct {
	// Follow streams the logs in real-time.
	// example: false
	Follow bool `json:"follow" form:"follow" example:"false"`

	// Since shows logs since a specific timestamp (RFC3339 or Unix timestamp) or relative duration (e.g., "10m").
	// example: "2023-10-27T10:00:00Z"
	Since time.Time `json:"since" form:"since" time_format:"rfc3339" example:"2023-10-27T10:00:00Z"` // Added time_format

	// Until shows logs before a specific timestamp (RFC3339 or Unix timestamp) or relative duration (e.g., "5m").
	// example: "2023-10-27T11:00:00Z"
	Until time.Time `json:"until" form:"until" time_format:"rfc3339" example:"2023-10-27T11:00:00Z"` // Added time_format

	// Timestamps includes timestamps for each log line.
	// example: true
	Timestamps bool `json:"timestamps" form:"timestamps" example:"true"`

	// Tail specifies the number of lines to show from the end of the logs (e.g., "100" or "all").
	// example: "100"
	Tail string `json:"tail" form:"tail" example:"100"`

	// ShowStdout includes stdout logs. Defaults to true if neither stdout nor stderr is specified.
	// example: true
	ShowStdout bool `json:"stdout" form:"stdout" example:"true"`

	// ShowStderr includes stderr logs. Defaults to true if neither stdout nor stderr is specified.
	// example: true
	ShowStderr bool `json:"stderr" form:"stderr" example:"true"`
}

ContainerLogsRequest represents parameters for retrieving container logs. @description Query parameters to control log retrieval, including filtering and streaming.

type ContainerRenameRequest

type ContainerRenameRequest struct {
	// Name is the new name to assign to the container. Must be unique.
	// required: true
	// example: "my-renamed-nginx"
	Name string `json:"name" binding:"required" example:"my-renamed-nginx"`
}

ContainerRenameRequest represents a request to rename a container. @description Specifies the new name for an existing container.

type ContainerResponse

type ContainerResponse struct {
	// ID is the internal database ID (if managed by the application).
	// example: 101
	ID uint `json:"id" example:"101"`

	// ContainerID is the unique identifier assigned by Docker.
	// required: true
	// example: "f7d9e8c7b6a5..."
	ContainerID string `json:"container_id" example:"f7d9e8c7b6a5"`

	// Name is the user-defined name of the container.
	// required: true
	// example: "my-nginx-container"
	Name string `json:"name" example:"my-nginx-container"`

	// Image is the name of the image used by the container.
	// required: true
	// example: "nginx:latest"
	Image string `json:"image" example:"nginx:latest"`

	// ImageID is the ID of the image used by the container.
	// required: true
	// example: "sha256:a1b2c3d4..."
	ImageID string `json:"image_id" example:"sha256:a1b2c3d4..."`

	// Command is the command executed when the container started.
	// example: "nginx -g daemon off;"
	Command string `json:"command" example:"nginx -g daemon off;"`

	// Status is a simplified status string (e.g., running, stopped).
	// required: true
	// example: "running"
	Status ContainerStatus `json:"status" example:"running"`

	// State is the detailed state string from Docker (e.g., "running", "exited (0)").
	// required: true
	// example: "running"
	State string `json:"state" example:"running"`

	// Created is the timestamp when the container was created by Docker.
	// required: true
	// example: "2023-10-27T10:00:00Z"
	Created time.Time `json:"created" example:"2023-10-27T10:00:00Z"`

	// Started is the timestamp when the container was last started.
	// example: "2023-10-27T10:01:00Z"
	Started time.Time `json:"started,omitempty" example:"2023-10-27T10:01:00Z"`

	// Finished is the timestamp when the container last finished.
	// example: "2023-10-27T11:00:00Z"
	Finished time.Time `json:"finished,omitempty" example:"2023-10-27T11:00:00Z"`

	// Ports lists the port mappings for the container.
	Ports []PortMapping `json:"ports"`

	// Volumes lists the volume mounts for the container.
	Volumes []VolumeMountResponse `json:"volumes"`

	// Networks lists the network connections for the container.
	Networks []NetworkConnectionResponse `json:"networks"`

	// Labels are the labels applied to the container.
	// example: {"environment": "development"}
	Labels map[string]string `json:"labels" example:"environment:development"`

	// RestartPolicy is the restart policy applied to the container.
	// example: "unless-stopped"
	RestartPolicy string `json:"restart_policy" example:"unless-stopped"`

	// Platform is the platform string (e.g., "linux/amd64").
	// example: "linux/amd64"
	Platform string `json:"platform" example:"linux/amd64"`

	// HostConfig contains details about the container's host configuration.
	HostConfig *HostConfigResponse `json:"host_config,omitempty"`

	// Stats contains the latest resource usage statistics (if requested/available).
	Stats *ContainerStatsResponse `json:"stats,omitempty"`

	// Notes are user-defined notes stored in the application database.
	// example: "Main web server container."
	Notes string `json:"notes" example:"Main web server container."`

	// UserID is the ID of the user who owns/created this container record in the application database.
	// required: true
	// example: 1
	UserID uint `json:"user_id" example:"1"`

	// CreatedAt is the timestamp when the container record was created in the application database.
	// required: true
	// example: "2023-10-27T10:00:05Z"
	CreatedAt time.Time `json:"created_at" example:"2023-10-27T10:00:05Z"`

	// UpdatedAt is the timestamp when the container record was last updated in the application database.
	// required: true
	// example: "2023-10-27T10:05:00Z"
	UpdatedAt time.Time `json:"updated_at" example:"2023-10-27T10:05:00Z"`
}

ContainerResponse represents detailed information about a Docker container. @description Contains comprehensive details of a Docker container, including configuration, state, and associated resources.

type ContainerStartRequest

type ContainerStartRequest struct {
	CheckpointID string `json:"checkpoint_id" example:"my-checkpoint"`
}

ContainerStartRequest represents a container start request

type ContainerStats

type ContainerStats struct {
	Time             time.Time `json:"time"`
	CPUPercentage    float64   `json:"cpu_percentage"`
	CPUUsage         uint64    `json:"cpu_usage"`
	SystemCPUUsage   uint64    `json:"system_cpu_usage"`
	OnlineCPUs       uint32    `json:"online_cpus"`
	MemoryUsage      uint64    `json:"memory_usage"`
	MemoryMaxUsage   uint64    `json:"memory_max_usage"`
	MemoryLimit      uint64    `json:"memory_limit"`
	MemoryPercentage float64   `json:"memory_percentage"`
	NetworkRx        int64     `json:"network_rx"`
	NetworkTx        int64     `json:"network_tx"`
	BlockRead        int64     `json:"block_read"`
	BlockWrite       int64     `json:"block_write"`
	PIDs             uint64    `json:"pids"`
}

ContainerStats holds resource usage statistics for a container

func FromDockerStatsJSON

func FromDockerStatsJSON(v *container.Stats) *ContainerStats

FromDockerStatsJSON converts Docker stats JSON to our internal ContainerStats model Note: The input type is now *container.Stats as provided by the Docker SDK stream

type ContainerStatsResponse

type ContainerStatsResponse struct {
	// CPUPercentage is the container's CPU usage percentage across all cores.
	// required: true
	// example: 12.34
	CPUPercentage float64 `json:"cpu_percentage" example:"12.34"`

	// MemoryUsage is the current memory usage in bytes.
	// required: true
	// example: 52428800
	MemoryUsage int64 `json:"memory_usage" example:"52428800"`

	// MemoryLimit is the memory limit for the container in bytes.
	// required: true
	// example: 104857600
	MemoryLimit int64 `json:"memory_limit" example:"104857600"`

	// MemoryPercentage is the current memory usage as a percentage of the limit.
	// required: true
	// example: 50.0
	MemoryPercentage float64 `json:"memory_percentage" example:"50.0"`

	// NetworkRx is the total bytes received over the network by the container.
	// required: true
	// example: 1024000
	NetworkRx int64 `json:"network_rx" example:"1024000"`

	// NetworkTx is the total bytes transmitted over the network by the container.
	// required: true
	// example: 512000
	NetworkTx int64 `json:"network_tx" example:"512000"`

	// BlockRead is the total bytes read from block devices by the container.
	// required: true
	// example: 204800
	BlockRead int64 `json:"block_read" example:"204800"`

	// BlockWrite is the total bytes written to block devices by the container.
	// required: true
	// example: 102400
	BlockWrite int64 `json:"block_write" example:"102400"`

	// PIDs is the number of processes currently running in the container.
	// required: true
	// example: 5
	PIDs int `json:"pids" example:"5"`

	// Timestamp is the time when the stats were collected.
	// required: true
	// example: "2023-10-27T10:15:00Z"
	Timestamp time.Time `json:"timestamp" example:"2023-10-27T10:15:00Z"`
}

ContainerStatsResponse represents real-time resource usage statistics for a container. @description Snapshot of CPU, memory, network, and block I/O usage for a container.

type ContainerStatus

type ContainerStatus string

ContainerStatus represents the status of a container

const (
	ContainerStatusRunning    ContainerStatus = "running"
	ContainerStatusStopped    ContainerStatus = "stopped"
	ContainerStatusCreated    ContainerStatus = "created"
	ContainerStatusPaused     ContainerStatus = "paused"
	ContainerStatusRestarting ContainerStatus = "restarting"
	ContainerStatusRemoving   ContainerStatus = "removing"
	ContainerStatusExited     ContainerStatus = "exited"
	ContainerStatusDead       ContainerStatus = "dead"
	ContainerStatusUnknown    ContainerStatus = "unknown"
)

func FormatContainerStatus

func FormatContainerStatus(state, health string) ContainerStatus

formatContainerStatus combines state and health into a single status string FormatContainerStatus determines a more specific status based on state and health.

type ContainerStopRequest

type ContainerStopRequest struct {
	Timeout int `json:"timeout" binding:"omitempty,gte=0" example:"10"` // Seconds
}

ContainerStopRequest represents a container stop request

type DeployOptions

type DeployOptions struct {
	ProjectName           string
	Timeout               time.Duration
	ForceRecreate         bool
	NoBuild               bool
	NoStart               bool
	Pull                  bool
	RemoveOrphans         bool
	DependencyTimeout     time.Duration
	AdjustNetworkSettings bool
	Logger                *logrus.Logger
}

DeployOptions defines options for deploying a Docker Compose project

type DeploymentInfo

type DeploymentInfo struct {
	// ProjectName is the name of the Compose project.
	// required: true
	// example: "my-web-app"
	ProjectName string `json:"projectName"`

	// Status is the overall status of the deployment.
	// required: true
	// example: "running"
	Status DeploymentStatus `json:"status"`

	// Services maps service names to their detailed status information.
	// required: true
	Services map[string]*ServiceInfo `json:"services"`

	// Operation describes the currently active operation (e.g., up, down), if any.
	Operation *OperationInfo `json:"operation,omitempty"`

	// StartTime is the timestamp when the deployment was first tracked or started.
	// required: true
	// example: "2023-10-27T10:00:00Z"
	StartTime time.Time `json:"startTime"`

	// UpdateTime is the timestamp when the deployment status was last updated.
	// required: true
	// example: "2023-10-27T10:05:00Z"
	UpdateTime time.Time `json:"updateTime"`

	// Error contains the last error message associated with the deployment, if any.
	// example: "Failed to pull image 'nonexistent:latest'"
	Error string `json:"error,omitempty"` // Store error message as string

	// ComposeFile is the parsed representation of the compose file (excluded from JSON).
	ComposeFile *ComposeFile `json:"-"` // Avoid recursion in JSON, maybe store path?
}

DeploymentInfo contains status information about a Docker Compose deployment. @description Detailed status of a Compose project, including its services and any ongoing operations.

type DeploymentStatus

type DeploymentStatus string

DeploymentStatus represents the status of a compose deployment

const (
	// DeploymentStatusUnknown indicates that the deployment status is unknown
	DeploymentStatusUnknown DeploymentStatus = "unknown"

	// DeploymentStatusPending indicates that the deployment is pending
	DeploymentStatusPending DeploymentStatus = "pending"

	// DeploymentStatusDeploying indicates that the deployment is in progress
	DeploymentStatusDeploying DeploymentStatus = "deploying"

	// DeploymentStatusRunning indicates that the deployment is running
	DeploymentStatusRunning DeploymentStatus = "running"

	// DeploymentStatusPartial indicates that the deployment is partially running
	DeploymentStatusPartial DeploymentStatus = "partial"

	// DeploymentStatusStopping indicates that the deployment is stopping
	DeploymentStatusStopping DeploymentStatus = "stopping"

	// DeploymentStatusStopped indicates that the deployment is stopped
	DeploymentStatusStopped DeploymentStatus = "stopped"

	// DeploymentStatusRemoving indicates that the deployment is being removed
	DeploymentStatusRemoving DeploymentStatus = "removing"

	// DeploymentStatusRemoved indicates that the deployment is removed
	DeploymentStatusRemoved DeploymentStatus = "removed"

	// DeploymentStatusFailed indicates that the deployment has failed
	DeploymentStatusFailed DeploymentStatus = "failed"
)

Deployment status constants

type DeploymentUpdate

type DeploymentUpdate struct {
	ProjectName string      `json:"project_name"`
	ServiceName string      `json:"service_name,omitempty"` // Empty if it's a project-level update
	Status      interface{} `json:"status"`                 // Can be DeploymentStatus or ServiceStatus
	Timestamp   time.Time   `json:"timestamp"`
	Error       string      `json:"error,omitempty"`
	Details     interface{} `json:"details,omitempty"` // Additional details (e.g., health status)
}

DeploymentUpdate represents a status update for a deployment or service

type DetailedNetwork

type DetailedNetwork struct {
	Name       string  `json:"name"`
	ID         string  `json:"id"`
	Driver     string  `json:"driver"`
	Scope      string  `json:"scope"`
	Internal   bool    `json:"internal"`
	IPAMConfig IPAM    `json:"ipam_config"` // Use local models.IPAM
	Options    JSONMap `json:"options"`
	Labels     JSONMap `json:"labels"`
}

DetailedNetwork represents detailed network information

type DetailedVolume

type DetailedVolume struct {
	Name       string  `json:"name"`
	Driver     string  `json:"driver"`
	Mountpoint string  `json:"mountpoint"`
	Status     JSONMap `json:"status"`
	Labels     JSONMap `json:"labels"`
	Options    JSONMap `json:"options"`
	Scope      string  `json:"scope"`
}

DetailedVolume represents detailed volume information

type DockerContainer

type DockerContainer struct {
	ID              string                    `json:"id"`
	Name            string                    `json:"name"`
	Image           string                    `json:"image"`
	ImageID         string                    `json:"image_id"`
	Command         string                    `json:"command"`
	Created         time.Time                 `json:"created"`
	Started         time.Time                 `json:"started,omitempty"`
	Finished        time.Time                 `json:"finished,omitempty"`
	State           *types.ContainerState     `json:"state,omitempty"` // Use pointer to Docker SDK State struct from types package
	Status          string                    `json:"status"`
	Health          *ContainerHealth          `json:"health,omitempty"` // Assuming this is a custom local type
	ExitCode        int                       `json:"exit_code"`
	Error           string                    `json:"error,omitempty"`
	Ports           []PortMapping             `json:"ports"` // Use PortMapping from docker_entities.go
	Labels          map[string]string         `json:"labels"`
	Mounts          []MountPoint              `json:"mounts"` // Use MountPoint from docker_entities.go
	NetworkSettings NetworkSettings           `json:"network_settings"`
	Config          *container.Config         `json:"config,omitempty"`
	HostConfig      *container.HostConfig     `json:"host_config,omitempty"`
	NetworkConfig   *network.NetworkingConfig `json:"network_config,omitempty"`
	Platform        *specs.Platform           `json:"platform,omitempty"`
	Stats           *ContainerStats           `json:"stats,omitempty"` // Use ContainerStats from docker_entities.go
	LogsSize        int64                     `json:"logs_size,omitempty"`
	SizeRw          int64                     `json:"size_rw,omitempty"`
	SizeRootFs      int64                     `json:"size_root_fs,omitempty"`
	RestartCount    int                       `json:"restart_count"`
	IsManaged       bool                      `json:"is_managed"`
	IsMonitored     bool                      `json:"is_monitored"`
	ComposeProject  string                    `json:"compose_project,omitempty"`
	ComposeService  string                    `json:"compose_service,omitempty"`
}

DockerContainer represents a Docker container for API operations Note: This struct might be redundant or conflict with models.Container defined in docker_entities.go. Consider consolidating.

func FromDockerContainer

func FromDockerContainer(c types.Container) DockerContainer

FromDockerContainer converts a Docker container list item (types.Container) to a model container (DockerContainer) This is likely used by the inspector's list conversion.

type DockerEvent

type DockerEvent struct {
	ID           uint      `json:"id" gorm:"primaryKey"`
	Type         string    `json:"type" gorm:"index;size:64" validate:"required,max=64"`
	Action       string    `json:"action" gorm:"index;size:64" validate:"required,max=64"`
	Actor        string    `json:"actor" gorm:"index;size:64" validate:"required,max=64"` // Usually container ID
	ActorID      string    `json:"actor_id" gorm:"index;size:64" validate:"required,max=64"`
	Attributes   JSONMap   `json:"attributes" gorm:"type:text"`
	Scope        string    `json:"scope" gorm:"index;size:64" validate:"max=64"`
	Timestamp    time.Time `json:"timestamp" gorm:"index"`
	TimeNano     int64     `json:"time_nano"`
	HostID       uint      `json:"host_id" gorm:"index"` // Link to DockerHost if managing multiple hosts
	HostName     string    `json:"host_name" gorm:"size:255"`
	Acknowledged bool      `json:"acknowledged" gorm:"index;default:false"`
	CreatedAt    time.Time `json:"created_at"`
}

DockerEvent represents a Docker event stored in the database

func (*DockerEvent) Validate

func (de *DockerEvent) Validate() error

Validate checks if the Docker event is valid

type DockerHost

type DockerHost struct {
	ID            uint           `json:"id" gorm:"primaryKey"`
	Name          string         `json:"name" gorm:"uniqueIndex;size:255" validate:"required,max=255,alphanumdash"`
	Host          string         `json:"host" validate:"required"` // e.g., "unix:///var/run/docker_test.sock" or "tcp://192.168.1.100:2376"
	TLSEnabled    bool           `json:"tls_enabled"`
	TLSCertPath   string         `json:"tls_cert_path" validate:"omitempty,filepath"`
	TLSKeyPath    string         `json:"tls_key_path" validate:"omitempty,filepath"`
	TLSCACertPath string         `json:"tls_ca_cert_path" validate:"omitempty,filepath"`
	TLSVerify     bool           `json:"tls_verify"`
	Username      string         `json:"username" validate:"omitempty,max=255"`
	Password      string         `json:"-" validate:"omitempty"` // Store securely, don't expose in JSON
	RegistryToken string         `json:"-" validate:"omitempty"` // Store securely
	Status        string         `json:"status" gorm:"size:64" validate:"max=64"`
	LastChecked   time.Time      `json:"last_checked"`
	Version       string         `json:"version" gorm:"size:64" validate:"max=64"`
	APIVersion    string         `json:"api_version" gorm:"size:64" validate:"max=64"`
	Default       bool           `json:"default" gorm:"index"`
	Notes         string         `json:"notes" gorm:"type:text" validate:"max=5000"`
	CreatedAt     time.Time      `json:"created_at"`
	UpdatedAt     time.Time      `json:"updated_at"`
	DeletedAt     gorm.DeletedAt `json:"-" gorm:"index"`
}

DockerHost represents a connection to a Docker host

func (*DockerHost) SanitizeHostCredentials

func (dh *DockerHost) SanitizeHostCredentials()

SanitizeHostCredentials clears sensitive credential fields

func (*DockerHost) Validate

func (dh *DockerHost) Validate() error

Validate checks if the Docker host configuration is valid

type DockerResource

type DockerResource struct {
	ID        uint           `json:"id" gorm:"primaryKey"`
	UserID    uint           `json:"user_id" gorm:"index" validate:"required"`
	User      User           `json:"-" gorm:"foreignKey:UserID"`
	Name      string         `json:"name" gorm:"index;size:255" validate:"required,max=255,alphanumdash"`
	Labels    JSONMap        `json:"labels" gorm:"type:text"`
	Notes     string         `json:"notes" gorm:"type:text" validate:"max=5000"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
}

DockerResource represents common fields for all Docker resources

func (*DockerResource) SanitizeName

func (r *DockerResource) SanitizeName()

SanitizeName sanitizes a resource name

func (*DockerResource) Validate

func (r *DockerResource) Validate() error

Validate checks if the resource is valid

type EndpointIPAMConfigRequest

type EndpointIPAMConfigRequest struct {
	// IPv4Address is the static IPv4 address to assign to the container.
	// example: 172.28.5.10
	IPv4Address string `json:"ipv4_address" example:"172.20.10.5"`

	// IPv6Address is the static IPv6 address to assign to the container.
	// example: "2001:db8:abcd::10"
	IPv6Address string `json:"ipv6_address" example:"2001:db8:abcd::5"`
}

EndpointIPAMConfigRequest represents endpoint IPAM config for connecting a container. @description Specifies static IP addresses for a container's network endpoint.

type EndpointResource

type EndpointResource struct {
	Name        string `json:"name"`
	EndpointID  string `json:"endpoint_id"`
	MacAddress  string `json:"mac_address"`
	IPv4Address string `json:"ipv4_address"`
	IPv6Address string `json:"ipv6_address"`
}

EndpointResource represents a network endpoint resource

type EndpointSettings

type EndpointSettings struct {
	IPAddress           string   `json:"ip_address"`
	IPPrefixLen         int      `json:"ip_prefix_len"`
	Gateway             string   `json:"gateway"`
	MacAddress          string   `json:"mac_address"`
	NetworkID           string   `json:"network_id"`
	EndpointID          string   `json:"endpoint_id"`
	GlobalIPv6Address   string   `json:"global_ipv6_address"`
	GlobalIPv6PrefixLen int      `json:"global_ipv6_prefix_len"`
	IPv6Gateway         string   `json:"ipv6_gateway"`
	Links               []string `json:"links"`
	Aliases             []string `json:"aliases"`
}

EndpointSettings represents endpoint settings

type EndpointSettingsRequest

type EndpointSettingsRequest struct {
	// IPAMConfig allows specifying a static IP address for the container in this network.
	IPAMConfig *EndpointIPAMConfigRequest `json:"ipam_config"`

	// Aliases are network-scoped aliases for the container.
	// example: ["web", "frontend"]
	Aliases []string `json:"aliases" example:"app,web"`
}

EndpointSettingsRequest represents endpoint settings for connecting a container to a network. @description Configuration for the container's endpoint within the network.

type ErrorInfo

type ErrorInfo struct {
	// Code is a machine-readable error code identifying the specific error type.
	// required: true
	// example: RESOURCE_NOT_FOUND
	Code string `json:"code" example:"RESOURCE_NOT_FOUND"`

	// Message is a human-readable description of the error.
	// required: true
	// example: The requested container was not found.
	Message string `json:"message" example:"The requested container was not found."`

	// Details provides optional additional information about the error, such as validation failures.
	// example: {"field": "command", "error": "cannot be empty"}
	Details interface{} `json:"details,omitempty"`
}

ErrorInfo represents the details of an API error. @description Detailed information about an error that occurred during an API request.

type ErrorResponse

type ErrorResponse struct {
	// Success indicates if the request was successful (always false for errors).
	// required: true
	// example: false
	Success bool `json:"success" example:"false"`

	// Error contains the detailed error information.
	// required: true
	Error ErrorInfo `json:"error"`

	// Meta contains metadata about the response.
	// required: true
	Meta MetadataResponse `json:"meta"`
}

ErrorResponse represents a standard error API response structure. @description Standard structure for returning errors from the API.

type EventListResponse

type EventListResponse struct {
	Events   []EventResponse  `json:"events"`
	Metadata MetadataResponse `json:"metadata"`
}

EventListResponse represents a list of Docker events

type EventResponse

type EventResponse struct {
	ID           uint              `json:"id"`
	Type         string            `json:"type" example:"container"` // e.g., container, image, volume, network
	Action       string            `json:"action" example:"start"`   // e.g., create, start, stop, die, pull, tag, prune
	Actor        string            `json:"actor"`
	ActorID      string            `json:"actor_id"`
	Attributes   map[string]string `json:"attributes,omitempty"`
	Scope        string            `json:"scope"`
	Timestamp    time.Time         `json:"timestamp" example:"2023-10-27T10:01:00Z"`
	TimeNano     int64             `json:"time_nano"`
	HostID       uint              `json:"host_id"`
	HostName     string            `json:"host_name"`
	Acknowledged bool              `json:"acknowledged"`
}

EventResponse represents a Docker event

type FileEditRequest

type FileEditRequest struct {
	// Path is the absolute path to the file inside the container.
	// required: true
	// example: "/app/config.json"
	Path string `json:"path" binding:"required" example:"/app/config.json"`

	// Content is the new content for the file, encoded in Base64.
	// required: true
	// example: "ewogICJhcGlLZXkiOiAiYWJjMTIzIgp9Cg=="
	Content string `json:"content" binding:"required" example:"ewogICJhcGlLZXkiOiAiYWJjMTIzIgp9Cg=="` // Base64 encoded content

	// Create specifies whether to create the file if it doesn't exist. Defaults to false.
	// example: false
	Create bool `json:"create" example:"false"` // Flag to create the file if it doesn't exist
}

FileEditRequest represents a request to edit or create a file within a container. @description Data required to modify or create a file inside a container.

type FilterRequest

type FilterRequest struct {
	Search    string            `json:"search" form:"search" example:"my-app"`
	Filters   map[string]string `json:"filters" form:"filters" example:"label=production,status=running"`
	StartDate *time.Time        `json:"start_date" form:"start_date" format:"date-time" example:"2023-10-26T00:00:00Z"`
	EndDate   *time.Time        `json:"end_date" form:"end_date" format:"date-time" example:"2023-10-27T23:59:59Z"`
}

FilterRequest represents filtering parameters for API requests

type HealthInfo

type HealthInfo struct {
	// Status indicates the current health status (e.g., "healthy", "unhealthy", "starting").
	// required: true
	// example: "healthy"
	Status string `json:"status"`

	// FailingStreak is the number of consecutive failed health checks.
	// required: true
	// example: 0
	FailingStreak int `json:"failingStreak"`

	// Log contains recent health check probe results.
	Log []HealthLogEntry `json:"log,omitempty"`
}

HealthInfo contains health check information for a service container. @description Details about the health status based on Docker health checks.

type HealthLog

type HealthLog struct {
	Start    time.Time `json:"start"`
	End      time.Time `json:"end"`
	ExitCode int       `json:"exit_code"`
	Output   string    `json:"output"`
}

HealthLog represents a health log

type HealthLogEntry

type HealthLogEntry struct {
	// Start is the timestamp when the health check probe started.
	// required: true
	// example: "2023-10-27T10:05:50Z"
	Start time.Time `json:"start"`

	// End is the timestamp when the health check probe ended.
	// required: true
	// example: "2023-10-27T10:05:51Z"
	End time.Time `json:"end"`

	// ExitCode is the exit code of the health check command. 0 typically indicates success.
	// required: true
	// example: 0
	ExitCode int `json:"exitCode"`

	// Output contains the stdout/stderr output from the health check command.
	// example: "OK"
	Output string `json:"output,omitempty"`
}

HealthLogEntry represents a single health check probe result. @description Log entry detailing the outcome of one health check attempt.

type HostConfigResponse

type HostConfigResponse struct {
	// CPUShares is the relative CPU weight (vs. other containers).
	// example: 1024
	CPUShares int64 `json:"cpu_shares,omitempty" example:"1024"`

	// Memory is the memory limit in bytes. 0 means no limit.
	// example: 104857600
	Memory int64 `json:"memory,omitempty" example:"104857600"`

	// MemorySwap is the total memory (memory + swap). -1 means unlimited swap.
	// example: -1
	MemorySwap int64 `json:"memory_swap,omitempty" example:"-1"`

	// CPUPeriod is the CPU CFS period in microseconds.
	// example: 100000
	CPUPeriod int64 `json:"cpu_period,omitempty" example:"100000"`

	// CPUQuota is the CPU CFS quota in microseconds.
	// example: 50000
	CPUQuota int64 `json:"cpu_quota,omitempty" example:"50000"`

	// CpusetCpus specifies the CPUs the container can use (e.g., "0-3", "0,1").
	// example: "0,1"
	CpusetCpus string `json:"cpuset_cpus,omitempty" example:"0,1"`

	// CpusetMems specifies the memory nodes the container can use.
	// example: "0"
	CpusetMems string `json:"cpuset_mems,omitempty" example:"0"`

	// BlkioWeight is the block I/O weight (relative weight).
	// example: 500
	BlkioWeight uint16 `json:"blkio_weight,omitempty" example:"500"`

	// Privileged indicates if the container runs in privileged mode.
	// required: true
	// example: false
	Privileged bool `json:"privileged" example:"false"`

	// ReadonlyRootfs indicates if the container's root filesystem is read-only.
	// required: true
	// example: false
	ReadonlyRootfs bool `json:"readonly_rootfs" example:"false"`

	// SecurityOpt lists the security options applied to the container.
	// example: ["seccomp=unconfined"]
	SecurityOpt []string `json:"security_opt,omitempty" example:"seccomp=unconfined"`

	// CapAdd lists the capabilities added to the container.
	// example: ["NET_ADMIN"]
	CapAdd []string `json:"cap_add,omitempty" example:"NET_ADMIN"`

	// CapDrop lists the capabilities dropped from the container.
	// example: ["MKNOD"]
	CapDrop []string `json:"cap_drop,omitempty" example:"MKNOD"`

	// RestartPolicy is the full restart policy string (e.g., "unless-stopped").
	// required: true
	// example: "unless-stopped"
	RestartPolicy string `json:"restart_policy" example:"unless-stopped"`

	// NetworkMode is the network mode used by the container (e.g., "bridge", "host").
	// required: true
	// example: "bridge"
	NetworkMode string `json:"network_mode" example:"bridge"`
}

HostConfigResponse represents a subset of the container's host configuration relevant to the API response. @description Key host configuration settings applied to the container.

type IPAM

type IPAM struct {
	Driver  string       `json:"driver"`
	Options JSONMap      `json:"options"`
	Config  []IPAMConfig `json:"config"`
}

IPAM represents IP Address Management configuration

type IPAMConfig

type IPAMConfig struct {
	Subnet     string  `json:"subnet"`
	IPRange    string  `json:"ip_range"`
	Gateway    string  `json:"gateway"`
	AuxAddress JSONMap `json:"aux_address"`
}

IPAMConfig represents IPAM configuration details

type IPAMConfigRequest

type IPAMConfigRequest struct {
	// Subnet in CIDR format that represents a network segment.
	// example: 172.28.0.0/16
	Subnet string `json:"subnet" example:"172.20.0.0/16"`

	// IPRange specifies a range of IP addresses for containers in CIDR format.
	// example: 172.28.5.0/24
	IPRange string `json:"ip_range" example:"172.20.10.0/24"`

	// Gateway is the IPv4 or IPv6 gateway for the subnet.
	// example: 172.28.5.254
	Gateway string `json:"gateway" example:"172.20.0.1"`

	// AuxAddress is a map of auxiliary addresses used by the IPAM driver.
	// example: {"host1": "172.28.1.5"}
	AuxAddress map[string]string `json:"aux_address"`
}

IPAMConfigRequest represents IPAM config details for network creation. @description Specific IPAM configuration block defining subnet, gateway, etc.

type IPAMCreateRequest

type IPAMCreateRequest struct {
	// Driver specifies the IPAM driver to use (e.g., "default").
	// example: default
	Driver string `json:"driver" example:"default"`

	// Options are IPAM driver specific options.
	Options map[string]string `json:"options"` // Example removed due to swag parsing issues

	// Config is a list of IPAM configurations, each specifying subnet, gateway, etc.
	Config []IPAMConfigRequest `json:"config"`
}

IPAMCreateRequest represents IPAM (IP Address Management) configuration for network creation. @description Detailed IPAM settings for a new Docker network.

type Image

type Image struct {
	DockerResource
	ImageID         string      `json:"image_id" gorm:"index;size:128" validate:"required"` // Docker Image ID (sha256:...) - Increased size
	Repository      string      `json:"repository" gorm:"index;size:255" validate:"required,max=255"`
	Tag             string      `json:"tag" gorm:"index;size:128" validate:"required,max=128"`
	Digest          string      `json:"digest" gorm:"index;size:255" validate:"omitempty,max=255"`
	Size            int64       `json:"size" validate:"min=0"`
	Created         time.Time   `json:"created"`
	Author          string      `json:"author" validate:"max=255"`
	Architecture    string      `json:"architecture" validate:"max=64"`
	OS              string      `json:"os" validate:"max=64"`
	Containers      []Container `json:"-" gorm:"foreignKey:ImageID;references:ImageID"`
	LastInspected   time.Time   `json:"last_inspected"`
	ContentTrust    bool        `json:"content_trust"`
	SignatureInfo   JSONMap     `json:"signature_info" gorm:"type:text"`
	Vulnerabilities JSONMap     `json:"vulnerabilities" gorm:"type:text"`
}

Image represents a Docker image in the database

func (*Image) SanitizeImageFields

func (i *Image) SanitizeImageFields()

SanitizeImageFields redacts sensitive information from image fields (if any)

func (*Image) Validate

func (i *Image) Validate() error

Validate checks if the image is valid

func (*Image) ValidateImageDigest

func (i *Image) ValidateImageDigest() error

ValidateImageDigest validates the image digest format

type ImageBuildRequest

type ImageBuildRequest struct {
	Repository    string                `json:"repository" binding:"required" example:"my-custom-app"`
	Tag           string                `json:"tag" example:"v1.0"`
	Dockerfile    string                `json:"dockerfile" example:"Dockerfile.prod"`
	Context       string                `json:"context" example:"."`               // Path to build context (directory)
	ContextFile   *multipart.FileHeader `json:"context_file" swaggerignore:"true"` // Use multipart form for context upload
	BuildArgs     map[string]string     `json:"build_args" example:"VERSION=1.0,API_KEY=abcdef"`
	Labels        map[string]string     `json:"labels" example:"maintainer=devteam,project=webapp"`
	NoCache       bool                  `json:"no_cache" example:"false"`
	Pull          bool                  `json:"pull" example:"true"` // Attempt to pull newer image layers
	RemoteContext string                `json:"remote_context" example:"git://github.com/user/repo.git#main:subdir"`
}

ImageBuildRequest represents an image build request

type ImageBuildResponse

type ImageBuildResponse struct {
	// Success indicates if the build operation completed successfully (may not mean the image is usable if errors occurred during build).
	// required: true
	// example: true
	Success bool `json:"success"`

	// ImageID is the Docker Image ID (SHA256 digest) of the built image, if successful.
	// example: "sha256:c3d4e5f6..."
	ImageID string `json:"image_id,omitempty" example:"sha256:b1c2d3e4..."`

	// Repository is the repository name used for tagging.
	// example: "my-custom-app"
	Repository string `json:"repository,omitempty"`

	// Tag is the tag applied to the built image.
	// example: "v1.1"
	Tag string `json:"tag,omitempty"`

	// Logs contains the output stream from the Docker build process.
	Logs []string `json:"logs,omitempty"`

	// ErrorDetail contains specific error information if the build failed.
	// example: "failed to solve: rpc error: code = Unknown desc = executor failed running..."
	ErrorDetail string `json:"error_detail,omitempty"`

	// StartTime is the timestamp when the build process started.
	// required: true
	// example: "2023-10-27T11:00:00Z"
	StartTime time.Time `json:"start_time"`

	// EndTime is the timestamp when the build process finished.
	// required: true
	// example: "2023-10-27T11:05:00Z"
	EndTime time.Time `json:"end_time"`

	// Duration is the total duration of the build process in a human-readable format.
	// required: true
	// example: "5m0s"
	Duration string `json:"duration"`
}

ImageBuildResponse represents the result of an image build operation. @description Provides details about the image build process, including logs and timing.

type ImageDeleteResponseItem

type ImageDeleteResponseItem struct {
	Untagged string `json:"untagged,omitempty"`
	Deleted  string `json:"deleted,omitempty" example:"sha256:a1b2c3d4..."`
}

ImageDeleteResponseItem represents an item in the ImagesDeleted list for prune/remove responses Based on types.ImageDeleteResponseItem

type ImageHistoryItem

type ImageHistoryItem struct {
	// ID is the identifier for this history record (often the layer ID or <missing>).
	// required: true
	// example: "sha256:b1c2d3e4..."
	ID string `json:"id" example:"sha256:a1b2c3d4..."`

	// Created is the timestamp when this layer was created.
	// required: true
	// example: "2023-10-26T13:50:00Z"
	Created time.Time `json:"created" example:"2023-09-15T14:00:00Z"`

	// CreatedBy is the command used to create this layer.
	// required: true
	// example: "/bin/sh -c #(nop) ADD file:abc in /"
	CreatedBy string `json:"created_by" example:"/bin/sh -c #(nop) CMD [\"nginx\" \"-g\" \"daemon off;\"]"`

	// Size is the size of this layer in bytes.
	// required: true
	// example: 5242880
	Size int64 `json:"size" example:"0"` // Size of this layer

	// SizeHuman is the size of this layer in a human-readable format.
	// required: true
	// example: "5MB"
	SizeHuman string `json:"size_human"`

	// Comment is an optional comment associated with the layer creation.
	// example: "Added base filesystem"
	Comment string `json:"comment,omitempty"`

	// Tags lists the tags associated with this specific history entry (usually empty).
	Tags []string `json:"tags,omitempty"`
}

ImageHistoryItem represents a single layer in the history of a Docker image. @description Details about a specific layer, including how it was created and its size. (Note: This is functionally the same as ImageHistoryResponse but used for clarity in some contexts).

type ImageHistoryResponse

type ImageHistoryResponse struct {
	// ID is the identifier for this history record (often the layer ID or <missing>).
	// required: true
	// example: "sha256:b1c2d3e4..."
	ID string `json:"id" example:"sha256:a1b2c3d4..."`

	// Created is the timestamp when this layer was created.
	// required: true
	// example: "2023-10-26T13:50:00Z"
	Created time.Time `json:"created" example:"2023-09-15T14:00:00Z"`

	// CreatedBy is the command used to create this layer.
	// required: true
	// example: "/bin/sh -c #(nop) ADD file:abc in /"
	CreatedBy string `json:"created_by" example:"/bin/sh -c #(nop) CMD [\"nginx\" \"-g\" \"daemon off;\"]"`

	// Size is the size of this layer in bytes.
	// required: true
	// example: 5242880
	Size int64 `json:"size"`

	// SizeHuman is the size of this layer in a human-readable format.
	// required: true
	// example: "5MB"
	SizeHuman string `json:"size_human"`

	// Comment is an optional comment associated with the layer creation.
	// example: "Added base filesystem"
	Comment string `json:"comment,omitempty"`

	// Tags lists the tags associated with this specific history entry (usually empty).
	Tags []string `json:"tags,omitempty"`
}

ImageHistoryResponse represents a single layer in the history of a Docker image. @description Details about a specific layer, including how it was created and its size.

type ImageListRequest

type ImageListRequest struct {
	PaginationRequest
	SortRequest
	FilterRequest
	All        bool   `json:"all" form:"all" example:"false"`
	Repository string `json:"repository" form:"repository" example:"nginx"`
	Tag        string `json:"tag" form:"tag" example:"latest"`
	Digest     string `json:"digest" form:"digest" example:"sha256:a1b2c3d4..."`
}

ImageListRequest represents an image list request

type ImageListResponse

type ImageListResponse struct {
	// Images is the list of image objects returned for the current page.
	// required: true
	Images []ImageResponse `json:"images"`

	// Metadata contains pagination and other metadata for the response.
	// required: true
	Metadata MetadataResponse `json:"metadata"`
}

ImageListResponse represents a paginated list of Docker images. @description Contains a list of image details along with pagination information.

type ImagePullRequest

type ImagePullRequest struct {
	// Image is the name of the image to pull (e.g., "nginx", "myregistry.com/myapp").
	// required: true
	// example: "nginx"
	Image string `json:"image" binding:"required" example:"nginx"`

	// Tag is the specific tag of the image to pull. Defaults to "latest" if omitted.
	// example: "1.21-alpine"
	Tag string `json:"tag" example:"1.21-alpine"`

	// Credentials contains optional username and password for authenticating with a private registry.
	Credentials struct {
		// Username for the private registry.
		// example: "dockerhub_user"
		Username string `json:"username" example:"dockerhub_user"`
		// Password or access token for the private registry.
		// example: "mysecretpassword"
		Password string `json:"password" example:"mysecretpassword"`
	} `json:"credentials"`
}

ImagePullRequest represents a request to pull a Docker image from a registry. @description Specifies the image to pull and optional credentials for private registries.

type ImagePullResponse

type ImagePullResponse struct {
	// Success indicates if the pull operation was successful (note: Docker pull itself doesn't return success/fail easily, this might be application-level).
	// required: true
	// example: true
	Success bool `json:"success"`

	// Image is the full name (repo:tag) of the image that was pulled.
	// required: true
	// example: "nginx:latest"
	Image string `json:"image"`

	// ID is the Docker Image ID (SHA256 digest) of the pulled image.
	// example: "sha256:a1b2c3d4..."
	ID string `json:"id,omitempty"`

	// Size is the size of the pulled image in bytes.
	// example: 135234567
	Size int64 `json:"size,omitempty"`

	// CreatedAt is the creation timestamp of the pulled image (from image inspect).
	// example: "2023-10-26T14:00:00Z"
	CreatedAt string `json:"created_at,omitempty"` // Keep as string from Docker API? Or parse?

	// Time is the timestamp when the pull operation completed on the server.
	// required: true
	// example: "2023-10-27T10:30:00Z"
	Time time.Time `json:"time"`
}

ImagePullResponse represents the result of an image pull operation. @description Provides details about the image that was pulled.

type ImageRemoveRequest

type ImageRemoveRequest struct {
	Force         bool `json:"force" example:"false"`
	PruneChildren bool `json:"prune_children" example:"false"`
}

ImageRemoveRequest represents an image remove request

type ImageRemoveResponse

type ImageRemoveResponse struct {
	// Deleted is the count of deleted image layers/references.
	// example: 5
	Deleted int `json:"deleted"`

	// SpaceReclaimed is the total disk space freed in bytes.
	// example: 150000000
	SpaceReclaimed int64 `json:"space_reclaimed"`

	// Items provides details on untagged or deleted items (structure may vary based on Docker API).
	// example: [{"Untagged": "myimage:latest"}, {"Deleted": "sha256:a1b2..."}]
	Items []map[string]interface{} `json:"items"` // Use map for flexibility as DeleteResponse structure varies
}

ImageRemoveResponse represents the result of an image remove operation. @description Summarizes the outcome of removing an image, including untagged and deleted layers. Note: This structure might need adjustment based on the actual Docker API response format for removal.

type ImageResponse

type ImageResponse struct {
	// ID is the internal database ID (if managed by the application).
	// example: 25
	ID uint `json:"id,omitempty"`

	// ImageID is the unique identifier assigned by Docker (SHA256 digest).
	// required: true
	// example: "sha256:a1b2c3d4e5f6..."
	ImageID string `json:"image_id"`

	// Name is the primary repository:tag associated with the image.
	// example: "nginx:latest"
	Name string `json:"name,omitempty"`

	// Repository is the repository part of the image name.
	// example: "nginx"
	Repository string `json:"repository"`

	// Tag is the tag part of the image name.
	// example: "latest"
	Tag string `json:"tag"`

	// Digest is the repository digest (SHA256) if available.
	// example: "sha256:f6d669c..."
	Digest string `json:"digest,omitempty"`

	// Created is the timestamp when the image was created.
	// required: true
	// example: "2023-10-26T14:00:00Z"
	Created time.Time `json:"created" example:"2023-09-15T14:00:00Z"`

	// Size is the total size of the image layers in bytes.
	// required: true
	// example: 135234567
	Size int64 `json:"size" example:"133000000"` // Bytes

	// SizeHuman is the total size in a human-readable format.
	// required: true
	// example: "129MB"
	SizeHuman string `json:"size_human"`

	// Architecture is the CPU architecture the image was built for.
	// example: "amd64"
	Architecture string `json:"architecture" example:"amd64"`

	// OS is the operating system the image was built for.
	// example: "linux"
	OS string `json:"os"`

	// Author is the author specified in the image metadata.
	// example: "Nginx Maintainers <nginx-devel@nginx.org>"
	Author string `json:"author,omitempty"`

	// Labels are the labels applied to the image.
	// example: {"maintainer": "Nginx Maintainers"}
	Labels map[string]string `json:"labels,omitempty"`

	// Containers lists the IDs of containers currently using this image.
	// example: ["f7d9e8c7b6a5"]
	Containers []string `json:"containers,omitempty"`

	// History provides details about the layers that make up the image.
	History []ImageHistoryResponse `json:"history,omitempty"`

	// Notes are user-defined notes stored in the application database.
	// example: "Base image for web servers."
	Notes string `json:"notes,omitempty"`

	// UserID is the ID of the user who owns/created this image record in the application database.
	// example: 1
	UserID uint `json:"user_id,omitempty"`

	// CreatedAt is the timestamp when the image record was created in the application database.
	// example: "2023-10-27T09:00:00Z"
	CreatedAt time.Time `json:"created_at,omitempty"`

	// UpdatedAt is the timestamp when the image record was last updated in the application database.
	// example: "2023-10-27T09:05:00Z"
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

ImageResponse represents detailed information about a Docker image. @description Contains comprehensive details of a Docker image, including tags, size, and history.

type ImageTagRequest

type ImageTagRequest struct {
	// SourceImage is the ID or current name:tag of the image to tag.
	// required: true
	// example: "nginx:latest" or "sha256:a1b2c3d4..."
	SourceImage string `json:"source_image" binding:"required" example:"nginx:latest"` // Image ID or Name:Tag to tag

	// Repository is the repository name for the new tag.
	// required: true
	// example: "my-custom-nginx"
	Repository string `json:"repository" binding:"required" example:"my-custom-nginx"`

	// Tag is the tag name for the new tag.
	// required: true
	// example: "v1.0"
	Tag string `json:"tag" binding:"required" example:"v1.0"`
}

ImageTagRequest represents a request to tag an existing Docker image. @description Specifies the source image and the new repository/tag to apply.

type ImageTagResponse

type ImageTagResponse struct {
	Success    bool   `json:"success"`
	SourceID   string `json:"source_id"`
	Repository string `json:"repository"`
	Tag        string `json:"tag"`
	FullTag    string `json:"full_tag"`
}

ImageTagResponse represents an image tag response

type JSONMap

type JSONMap map[string]interface{}

JSONMap represents a map that can be stored as JSON in a database column

func (*JSONMap) Scan

func (m *JSONMap) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database deserialization

func (JSONMap) StringMap

func (m JSONMap) StringMap() map[string]string

StringMap returns the JSONMap as a map of strings

func (JSONMap) Value

func (m JSONMap) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database serialization

type LoginRequest

type LoginRequest struct {
	// Email is the user's registered email address.
	// required: true
	// example: user@example.com
	Email string `json:"email" binding:"required,email" example:"user@example.com"`

	// Password is the user's password.
	// required: true
	// example: StrongP@ssw0rd!
	Password string `json:"password" binding:"required" example:"StrongP@ssw0rd!"`
}

LoginRequest represents a user login request @description Credentials required for user login.

type MetadataResponse

type MetadataResponse struct {
	Timestamp  time.Time           `json:"timestamp" example:"2023-10-27T10:30:00Z"`
	RequestID  string              `json:"request_id,omitempty" example:"req-12345"`
	Pagination *PaginationResponse `json:"pagination,omitempty"`
}

MetadataResponse represents common metadata for API responses

type MountPoint

type MountPoint struct {
	Type        string `json:"type"`
	Name        string `json:"name"`
	Source      string `json:"source"`
	Destination string `json:"destination"`
	Mode        string `json:"mode"`
	RW          bool   `json:"rw"`
	Propagation string `json:"propagation"`
}

MountPoint represents a mount point for a container

type Network

type Network struct {
	DockerResource
	NetworkID     string    `json:"network_id" gorm:"index;size:64" validate:"required,alphanumdash"`
	Driver        string    `json:"driver" validate:"max=255"`
	Scope         string    `json:"scope" validate:"max=64"`
	Created       time.Time `json:"created"`
	Gateway       string    `json:"gateway" validate:"omitempty,ip"`
	Subnet        string    `json:"subnet" validate:"omitempty,cidr"`
	IPRange       string    `json:"ip_range" validate:"omitempty,cidr"`
	Internal      bool      `json:"internal"`
	EnableIPv6    bool      `json:"enable_ipv6"`
	Attachable    bool      `json:"attachable"`
	Ingress       bool      `json:"ingress"`
	ConfigOnly    bool      `json:"config_only"`
	Containers    JSONMap   `json:"containers" gorm:"type:text"` // Store container connections as JSON
	LastInspected time.Time `json:"last_inspected"`
	Options       JSONMap   `json:"options" gorm:"type:text"`
	IPAMOptions   JSONMap   `json:"ip_am_options" gorm:"type:text"` // Store IPAM config as JSON
	Security      JSONMap   `json:"security" gorm:"type:text"`
	ConfigFrom    string    `json:"config_from" gorm:"size:255"` // Name of network this config is from
}

Network represents a Docker network in the database

func (*Network) Validate

func (n *Network) Validate() error

Validate checks if the network is valid

func (*Network) ValidateNetworkAddressing

func (n *Network) ValidateNetworkAddressing() error

ValidateNetworkAddressing performs specific validation for network addressing fields

type NetworkConfig

type NetworkConfig struct {
	// Name is the name of the network
	Name string `yaml:"-" json:"name"`

	// Driver is the network driver
	Driver string `yaml:"driver,omitempty" json:"driver,omitempty"`

	// DriverOpts are driver-specific options
	DriverOpts map[string]string `yaml:"driver_opts,omitempty" json:"driver_opts,omitempty"`

	// IPAM is the IPAM configuration
	IPAM map[string]interface{} `yaml:"ipam,omitempty" json:"ipam,omitempty"` // Map structure

	// External indicates whether the network is external
	External interface{} `yaml:"external,omitempty" json:"external,omitempty"`

	// Internal indicates whether the network is internal
	Internal bool `yaml:"internal,omitempty" json:"internal,omitempty"`

	// Attachable indicates whether the network is attachable
	Attachable bool `yaml:"attachable,omitempty" json:"attachable,omitempty"`

	// Labels are labels to apply to the network
	Labels interface{} `yaml:"labels,omitempty" json:"labels,omitempty"`

	// Extensions stores extension fields
	Extensions map[string]interface{} `yaml:",inline" json:"extensions,omitempty"`
}

NetworkConfig represents a network in a Docker Compose file

type NetworkConnectRequest

type NetworkConnectRequest struct {
	// Container is the ID or name of the container to connect.
	// required: true
	// example: my-web-container
	Container string `json:"container" binding:"required" example:"my-app-container"` // Container ID or Name

	// EndpointConfig provides custom network settings for the container within this network.
	EndpointConfig *EndpointSettingsRequest `json:"endpoint_config"` // Added
}

NetworkConnectRequest represents a request to connect a container to a network. @description Specifies the container and optional endpoint settings for connecting to a network.

type NetworkConnectionResponse

type NetworkConnectionResponse struct {
	// NetworkID is the ID of the network the container is connected to.
	// required: true
	// example: "b7cda8f3e9a1..."
	NetworkID string `json:"network_id" example:"b7cda8f3e9a1"`

	// NetworkName is the name of the network.
	// required: true
	// example: "my-app-network"
	NetworkName string `json:"network_name" example:"my-app-network"`

	// IPAddress is the IPv4 address assigned to the container within this network.
	// example: "172.28.0.3"
	IPAddress string `json:"ip_address" example:"172.28.0.3"`

	// Gateway is the gateway address for this network connection.
	// example: "172.28.0.1"
	Gateway string `json:"gateway" example:"172.28.0.1"`

	// MacAddress is the MAC address assigned to the container's endpoint in this network.
	// example: "02:42:ac:1c:00:03"
	MacAddress string `json:"mac_address" example:"02:42:ac:1c:00:03"`

	// Aliases are network-scoped aliases for the container within this network.
	// example: ["nginx", "webserver"]
	Aliases []string `json:"aliases,omitempty" example:"nginx,webserver"`
}

NetworkConnectionResponse represents details about a container's connection to a specific network. @description Information about a container's endpoint within a Docker network.

type NetworkContainerResponse

type NetworkContainerResponse struct {
	// Name is the name of the connected container.
	// required: true
	// example: "my-web-container"
	Name string `json:"name" example:"my-app-container"`

	// EndpointID is the ID of the network endpoint for this container.
	// required: true
	// example: "ep-a1b2c3d4e5f6..."
	EndpointID string `json:"endpoint_id" example:"ep-a1b2c3d4..."`

	// MacAddress is the MAC address assigned to the container's endpoint.
	// required: true
	// example: "02:42:ac:1c:00:02"
	MacAddress string `json:"mac_address" example:"02:42:ac:1c:00:03"`

	// IPv4Address is the IPv4 address assigned to the container's endpoint.
	// example: "172.28.0.2"
	IPv4Address string `json:"ipv4_address,omitempty"`

	// IPv6Address is the IPv6 address assigned to the container's endpoint.
	// example: "2001:db8:abcd::2"
	IPv6Address string `json:"ipv6_address,omitempty"`

	// Aliases are network-scoped aliases for the container within this network.
	// example: ["web", "frontend"]
	Aliases []string `json:"aliases,omitempty"`
}

NetworkContainerResponse represents details about a container connected to a network. @description Information about a specific container's endpoint within a network.

type NetworkCreateOptions

type NetworkCreateOptions struct {
	Name       string            `json:"Name" binding:"required"` // Match Docker API field name
	Driver     string            `json:"Driver,omitempty"`
	Internal   bool              `json:"Internal,omitempty"`
	Attachable bool              `json:"Attachable,omitempty"`
	Ingress    bool              `json:"Ingress,omitempty"` // Common overlay option
	EnableIPv6 bool              `json:"EnableIPv6,omitempty"`
	IPAM       *IPAM             `json:"IPAM,omitempty"` // Reusing IPAM struct from docker_entities.go
	Options    map[string]string `json:"Options,omitempty"`
	Labels     map[string]string `json:"Labels,omitempty"`
}

NetworkCreateOptions represents options for creating a network Based on fields used in pkg/client/networks.go CreateNetwork function

type NetworkCreateRequest

type NetworkCreateRequest struct {
	// Name is the name for the new network.
	// required: true
	// example: my-app-network
	Name string `json:"name" binding:"required" example:"my-app-network"`

	// Driver specifies the network driver to use (e.g., bridge, overlay). Defaults to bridge.
	// example: bridge
	Driver string `json:"driver" example:"bridge"`

	// Internal restricts external access to the network.
	// example: false
	Internal bool `json:"internal" example:"false"`

	// Labels are key-value pairs to apply to the network.
	// example: {"environment": "production", "project": "webapp"}
	Labels map[string]string `json:"labels" example:"project:myapp,tier:backend"`

	// Options are driver-specific options.
	// example: {"com.docker.network.bridge.name": "mybridge0"}
	Options map[string]string `json:"options"` // Example removed due to swag parsing issues

	// EnableIPv6 enables IPv6 support for the network.
	// example: false
	EnableIPv6 bool `json:"enable_ipv6" example:"false"`

	// Attachable allows non-service containers to attach to this network (useful for overlay networks).
	// example: true
	Attachable bool `json:"attachable" example:"true"`

	// Ingress indicates the network provides the routing-mesh in swarm mode.
	// example: false
	Ingress bool `json:"ingress"` // Added

	// ConfigOnly specifies that the network configuration is only used for services.
	// example: false
	ConfigOnly bool `json:"config_only"` // Added

	// Scope specifies the network scope (e.g., local, swarm).
	// example: local
	Scope string `json:"scope"` // Added

	// IPAM provides custom IP Address Management configuration.
	IPAM *IPAMCreateRequest `json:"ipam"` // Added

	// Notes are user-defined notes for the network (stored in the application DB).
	// example: "Main network for the web application stack."
	Notes string `json:"notes" example:"Network for backend services."`
}

NetworkCreateRequest represents a network creation request. @description Configuration details for creating a new Docker network.

type NetworkDisconnectRequest

type NetworkDisconnectRequest struct {
	// Container is the ID or name of the container to disconnect.
	// required: true
	// example: my-web-container
	Container string `json:"container" binding:"required" example:"my-app-container"` // Container ID or Name

	// Force disconnects the container even if it is running.
	// example: false
	Force bool `json:"force" example:"false"`
}

NetworkDisconnectRequest represents a request to disconnect a container from a network. @description Specifies the container to disconnect from a network.

type NetworkListRequest

type NetworkListRequest struct {
	PaginationRequest // Embeds Page and PageSize
	SortRequest       // Embeds SortBy and SortOrder
	FilterRequest     // Embeds Search, Filters, StartDate, EndDate
	// Driver filters networks by the specified driver name.
	// example: bridge
	Driver string `json:"driver" form:"driver"`
}

NetworkListRequest represents parameters for listing Docker networks. @description Query parameters for filtering, sorting, and paginating the list of Docker networks.

type NetworkListResponse

type NetworkListResponse struct {
	// Networks is the list of network objects returned for the current page.
	// required: true
	Networks []NetworkResponse `json:"networks"`

	// Metadata contains pagination and other metadata for the response.
	// required: true
	Metadata MetadataResponse `json:"metadata"`
}

NetworkListResponse represents a paginated list of Docker networks. @description Contains a list of network details along with pagination information.

type NetworkMode

type NetworkMode string

NetworkMode represents a container network mode

const (
	NetworkModeNone      NetworkMode = "none"
	NetworkModeBridge    NetworkMode = "bridge"
	NetworkModeHost      NetworkMode = "host"
	NetworkModeContainer NetworkMode = "container"
)

type NetworkPruneRequest

type NetworkPruneRequest struct {
	FilterRequest // Embeds Search, Filters, StartDate, EndDate
}

NetworkPruneRequest represents parameters for pruning unused Docker networks. @description Query parameters for filtering which networks to prune.

type NetworkPruneResponse

type NetworkPruneResponse struct {
	NetworksDeleted []string `json:"networks_deleted"`
}

NetworkPruneResponse represents the response from a network prune operation

type NetworkResponse

type NetworkResponse struct {
	// ID is the internal database ID (if managed by the application).
	// example: 5
	ID uint `json:"id,omitempty"`

	// NetworkID is the unique identifier assigned by Docker.
	// required: true
	// example: "b7cda8f3e9a1..."
	NetworkID string `json:"network_id"`

	// Name is the user-defined name of the network.
	// required: true
	// example: "my-app-network"
	Name string `json:"name" example:"my-app-network"`

	// Driver is the network driver used (e.g., bridge, overlay).
	// required: true
	// example: "bridge"
	Driver string `json:"driver" example:"bridge"`

	// Scope indicates the scope of the network (e.g., local, swarm).
	// required: true
	// example: "local"
	Scope string `json:"scope" example:"local"`

	// Created is the timestamp when the network was created by Docker.
	// required: true
	// example: "2023-10-27T09:00:00Z"
	Created time.Time `json:"created" example:"2023-10-25T09:00:00Z"`

	// Gateway is the IPv4 gateway for the network's subnet.
	// example: "172.28.0.1"
	Gateway string `json:"gateway,omitempty"`

	// Subnet is the primary IPv4 subnet for the network in CIDR notation.
	// example: "172.28.0.0/16"
	Subnet string `json:"subnet,omitempty"`

	// IPRange is the range of IPs available within the subnet.
	// example: "172.28.5.0/24"
	IPRange string `json:"ip_range,omitempty"`

	// Internal indicates if the network is internal (restricts external access).
	// required: true
	// example: false
	Internal bool `json:"internal" example:"false"`

	// EnableIPv6 indicates if IPv6 is enabled for the network.
	// required: true
	// example: false
	EnableIPv6 bool `json:"enable_ipv6" example:"false"`

	// Attachable indicates if non-service containers can attach to the network.
	// required: true
	// example: true
	Attachable bool `json:"attachable" example:"true"`

	// Ingress indicates if the network provides the routing-mesh in swarm mode.
	// required: true
	// example: false
	Ingress bool `json:"ingress" example:"false"`

	// ConfigOnly indicates if the network configuration is only used for services.
	// required: true
	// example: false
	ConfigOnly bool `json:"config_only" example:"false"`

	// Labels are the labels applied to the network.
	// example: {"environment": "production"}
	Labels map[string]string `json:"labels,omitempty"`

	// Options are driver-specific options for the network.
	// example: {"com.docker.network.bridge.name": "mybridge0"}
	Options map[string]string `json:"options,omitempty"`

	// Containers lists the containers connected to this network and their endpoint details.
	Containers map[string]NetworkContainerResponse `json:"containers,omitempty"`

	// Notes are user-defined notes stored in the application database.
	// example: "Main network for the web application stack."
	Notes string `json:"notes,omitempty"`

	// UserID is the ID of the user who owns/created this network record in the application database.
	// example: 1
	UserID uint `json:"user_id,omitempty"`

	// CreatedAt is the timestamp when the network record was created in the application database.
	// example: "2023-10-27T09:05:00Z"
	CreatedAt time.Time `json:"created_at,omitempty"`

	// UpdatedAt is the timestamp when the network record was last updated in the application database.
	// example: "2023-10-27T09:10:00Z"
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

NetworkResponse represents detailed information about a Docker network. @description Contains comprehensive details of a Docker network, including configuration and connected containers.

type NetworkSettings

type NetworkSettings struct {
	Networks    map[string]EndpointSettings `json:"networks"`
	IPAddress   string                      `json:"ip_address"`
	IPPrefixLen int                         `json:"ip_prefix_len"`
	Gateway     string                      `json:"gateway"`
	Bridge      string                      `json:"bridge"`
	Ports       nat.PortMap                 `json:"ports"`
	MacAddress  string                      `json:"mac_address"`
	DNS         []string                    `json:"dns"`
	DNSOptions  []string                    `json:"dns_options"`
	DNSSearch   []string                    `json:"dns_search"`
}

NetworkSettings represents network settings

type NetworkUpdateOptions

type NetworkUpdateOptions struct {
}

NetworkUpdateOptions represents options for updating a network (Placeholder) pkg/client/networks.go UpdateNetwork currently takes this, but its fields aren't defined. Add fields as needed based on API requirements.

type OperationInfo

type OperationInfo struct {
	// Type indicates the type of operation being performed.
	// required: true
	// example: "up"
	Type OperationType `json:"type"`

	// Status indicates the current status of the operation.
	// required: true
	// example: "in_progress"
	Status OperationStatus `json:"status"`

	// StartTime is the timestamp when the operation began.
	// required: true
	// example: "2023-10-27T10:04:30Z"
	StartTime time.Time `json:"startTime"`

	// EndTime is the timestamp when the operation finished (only present if Status is 'complete' or 'failed').
	// example: "2023-10-27T10:05:15Z"
	EndTime time.Time `json:"endTime,omitempty"`

	// Error contains the error message if the operation failed.
	// example: "Failed to create service 'db': network 'shared' not found"
	Error string `json:"error,omitempty"` // Store error message as string

	// Details provides additional context or progress information about the operation.
	// example: {"step": "Creating service web", "progress": 0.5}
	Details map[string]interface{} `json:"details,omitempty"`
}

OperationInfo contains information about an ongoing or completed Compose operation. @description Details about a long-running operation like 'up', 'down', 'start', etc.

type OperationStatus

type OperationStatus string

OperationStatus represents the status of an operation

const (
	// OperationStatusPending indicates that the operation is pending
	OperationStatusPending OperationStatus = "pending"

	// OperationStatusInProgress indicates that the operation is in progress
	OperationStatusInProgress OperationStatus = "in_progress"

	// OperationStatusComplete indicates that the operation is complete
	OperationStatusComplete OperationStatus = "complete"

	// OperationStatusFailed indicates that the operation has failed
	OperationStatusFailed OperationStatus = "failed"
)

Operation status constants

type OperationType

type OperationType string

OperationType represents the type of operation being performed

const (
	// OperationTypeUp indicates an 'up' operation
	OperationTypeUp OperationType = "up"

	// OperationTypeDown indicates a 'down' operation
	OperationTypeDown OperationType = "down"

	// OperationTypeStart indicates a 'start' operation
	OperationTypeStart OperationType = "start"

	// OperationTypeStop indicates a 'stop' operation
	OperationTypeStop OperationType = "stop"

	// OperationTypeRestart indicates a 'restart' operation
	OperationTypeRestart OperationType = "restart"

	// OperationTypePull indicates a 'pull' operation
	OperationTypePull OperationType = "pull"

	// OperationTypeBuild indicates a 'build' operation
	OperationTypeBuild OperationType = "build"

	// OperationTypeCreate indicates a 'create' operation
	OperationTypeCreate OperationType = "create"

	// OperationTypeRemove indicates a 'remove' operation
	OperationTypeRemove OperationType = "remove"

	// OperationTypeScale indicates a 'scale' operation
	OperationTypeScale OperationType = "scale"
)

Operation type constants

type PaginatedResponse

type PaginatedResponse struct {
	Success bool             `json:"success" example:"true"`
	Data    interface{}      `json:"data"` // Should hold the slice of items
	Meta    MetadataResponse `json:"meta"`
}

PaginatedResponse is a generic structure for paginated list responses. Use specific list response types embedding this for Swagger documentation.

type PaginationRequest

type PaginationRequest struct {
	Page     int `json:"page" form:"page" binding:"gte=1" example:"1"`
	PageSize int `json:"page_size" form:"page_size" binding:"gte=1,lte=100" example:"10"`
}

PaginationRequest represents pagination parameters for API requests

func (*PaginationRequest) GetOffset

func (p *PaginationRequest) GetOffset() int

GetOffset returns the offset for the pagination request

func (*PaginationRequest) SetDefaults

func (p *PaginationRequest) SetDefaults()

SetDefaults sets default values for the pagination request

type PaginationResponse

type PaginationResponse struct {
	Page       int `json:"page" example:"1"`
	PageSize   int `json:"page_size" example:"10"`
	TotalPages int `json:"total_pages" example:"5"`
	TotalItems int `json:"total_items" example:"42"`
}

PaginationResponse represents pagination metadata for API responses

type ParseOptions

type ParseOptions struct {
	WorkingDir  string // Working directory for resolving relative paths
	EnvFile     string // Optional path to an environment file
	ProjectName string // Optional project name override

}

ParseOptions defines options for parsing compose files

type PingResponse

type PingResponse struct {
	APIVersion     string `json:"api_version"`
	OSType         string `json:"os_type"`
	Experimental   bool   `json:"experimental"`
	BuilderVersion string `json:"builder_version"`
}

PingResponse represents the response from the Docker daemon ping endpoint

type PortMapping

type PortMapping struct {
	// HostIP is the IP address on the host to bind the port to. Defaults to 0.0.0.0 (all interfaces).
	// example: "127.0.0.1"
	HostIP string `json:"host_ip"`

	// HostPort is the port number on the host. If empty or "0", Docker assigns a random ephemeral port.
	// example: "8080"
	HostPort string `json:"host_port"`

	// ContainerPort is the port number inside the container.
	// required: true
	// example: "80"
	ContainerPort string `json:"container_port"`

	// Type is the protocol (e.g., "tcp", "udp", "sctp"). Defaults to "tcp".
	// example: "tcp"
	Type string `json:"type"`
}

PortMapping represents a port mapping configuration for a container. @description Defines how a container port is exposed on the host machine.

type Process

type Process struct {
	PID     int    `json:"pid"`
	User    string `json:"user"`
	Time    string `json:"time"`
	Command string `json:"command"`
	CPU     string `json:"cpu"`
	Memory  string `json:"memory"`
}

Process represents a running process inside a container

type RefreshTokenRequest

type RefreshTokenRequest struct {
	// RefreshToken is the valid refresh token previously issued to the user.
	// required: true
	// example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... (long token string)
	RefreshToken string `json:"refresh_token" binding:"required" example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."`
}

RefreshTokenRequest represents a token refresh request @description Contains the refresh token needed to obtain a new access token.

type RegisterRequest

type RegisterRequest struct {
	// Email is the user's email address, used for login.
	// required: true
	// example: user@example.com
	Email string `json:"email" binding:"required,email" example:"user@example.com"`

	// Password is the user's desired password (min 8 characters).
	// required: true
	// example: StrongP@ssw0rd!
	Password string `json:"password" binding:"required,min=8" example:"StrongP@ssw0rd!"`

	// Name is the user's display name.
	// required: true
	// example: John Doe
	Name string `json:"name" binding:"required" example:"John Doe"`

	// InviteCode is an optional code required for registration if the system is configured for invite-only.
	// example: ABC-123
	InviteCode string `json:"invite_code" example:"ABC-123"` // Optional, depends on system configuration
}

RegisterRequest represents a user registration request @description Data required for registering a new user account.

type RegistryAuth

type RegistryAuth struct {
	Username      string `json:"username"`
	Password      string `json:"password"`
	ServerAddress string `json:"server_address"`
	Email         string `json:"email,omitempty"`
	IdentityToken string `json:"identity_token,omitempty"`
	Auth          string `json:"auth,omitempty"` // Base64 encoded username:password
}

RegistryAuth holds authentication details for a Docker registry.

type RemoveOptions

type RemoveOptions struct {
	ProjectName       string
	Timeout           time.Duration
	RemoveVolumes     bool
	RemoveImages      string // e.g., "all", "local"
	RemoveOrphans     bool
	Force             bool
	DependencyTimeout time.Duration
	Logger            *logrus.Logger
}

RemoveOptions defines options for removing a Docker Compose deployment

type ResourceLimits

type ResourceLimits struct {
	Memory            int64  `json:"memory"`
	MemorySwap        int64  `json:"memory_swap"`
	MemoryReservation int64  `json:"memory_reservation"`
	CPUShares         int64  `json:"cpu_shares"`
	CPUPeriod         int64  `json:"cpu_period"`
	CPUQuota          int64  `json:"cpu_quota"`
	CpusetCpus        string `json:"cpuset_cpus"`
	CpusetMems        string `json:"cpuset_mems"`
	PidsLimit         int64  `json:"pids_limit"`
	BlkioWeight       uint16 `json:"blkio_weight"`
}

ResourceLimits represents resource limits for a container

type ResourceStat

type ResourceStat struct {
	Name string      `json:"name"`
	Size int64       `json:"size"`
	Mode os.FileMode `json:"mode"` // Use os.FileMode (uint32)
	// ModTime is NOT available from CopyFromContainer stat
	LinkTarget string `json:"link_target"`
}

ResourceStat holds information about a file or directory in a container

type RestartOptions

type RestartOptions struct {
	ProjectName       string
	Timeout           time.Duration
	DependencyTimeout time.Duration
	Logger            *logrus.Logger
}

RestartOptions defines options for restarting a Docker Compose deployment

type RestartPolicy

type RestartPolicy string

RestartPolicy represents a container restart policy

const (
	RestartPolicyNo            RestartPolicy = "no"
	RestartPolicyAlways        RestartPolicy = "always"
	RestartPolicyOnFailure     RestartPolicy = "on-failure"
	RestartPolicyUnlessStopped RestartPolicy = "unless-stopped"
)

type Role

type Role string

Role represents a user role

const (
	// RoleAdmin represents an admin user
	RoleAdmin Role = "admin"
	// RoleUser represents a regular user
	RoleUser Role = "user"
	// RoleGuest represents a guest user
	RoleGuest Role = "guest"
)

type ScaleOptions

type ScaleOptions struct {
	ProjectName       string
	Service           string
	Replicas          int
	Timeout           time.Duration
	DependencyTimeout time.Duration
	Logger            *logrus.Logger
}

ScaleOptions defines options for scaling services in a Docker Compose deployment

type ScanSummary

type ScanSummary struct {
	TotalVulnerabilities int `json:"total_vulnerabilities"`
	CriticalCount        int `json:"critical_count"`
	HighCount            int `json:"high_count"`
	MediumCount          int `json:"medium_count"`
	LowCount             int `json:"low_count"`
	UnknownCount         int `json:"unknown_count"`
}

ScanSummary provides a summary of the scan results.

type SecretConfig

type SecretConfig struct {
	// Name is the name of the secret
	Name string `yaml:"-" json:"name"`

	// File is the file containing the secret
	File string `yaml:"file,omitempty" json:"file,omitempty"`

	// External indicates whether the secret is external
	External interface{} `yaml:"external,omitempty" json:"external,omitempty"`

	// Labels are labels to apply to the secret
	Labels interface{} `yaml:"labels,omitempty" json:"labels,omitempty"`

	// Extensions stores extension fields
	Extensions map[string]interface{} `yaml:",inline" json:"extensions,omitempty"`
}

SecretConfig represents a secret in a Docker Compose file

type SecurityInfo

type SecurityInfo struct {
	Privileged      bool     `json:"privileged"`
	ReadOnlyRootfs  bool     `json:"read_only_rootfs"`
	CapAdd          []string `json:"cap_add"`
	CapDrop         []string `json:"cap_drop"`
	SecurityOpt     []string `json:"security_opt"`
	NetworkMode     string   `json:"network_mode"`
	PidMode         string   `json:"pid_mode"`
	IpcMode         string   `json:"ipc_mode"`
	UTSMode         string   `json:"uts_mode"`
	UsernsMode      string   `json:"userns_mode"`
	SensitiveMounts []string `json:"sensitive_mounts"`
}

SecurityInfo holds security-related information about a container

type SecurityScanResult

type SecurityScanResult struct {
	Target          string          `json:"target"`  // e.g., image name, container ID
	Scanner         string          `json:"scanner"` // Name of the scanner used
	ScanTimestamp   time.Time       `json:"scan_timestamp"`
	Summary         ScanSummary     `json:"summary"`
	Vulnerabilities []Vulnerability `json:"vulnerabilities"`
	Error           string          `json:"error,omitempty"` // Any error during the scan
}

SecurityScanResult holds the results of a security scan for an image or container.

type ServiceConfig

type ServiceConfig struct {
	// Name is the name of the service
	Name string `yaml:"-" json:"name"`

	// Image is the image to use
	Image string `yaml:"image,omitempty" json:"image,omitempty"`

	// Build is the build configuration
	Build interface{} `yaml:"build,omitempty" json:"build,omitempty"`

	// Command is the command to run
	Command interface{} `yaml:"command,omitempty" json:"command,omitempty"`

	// Environment is a list of environment variables
	Environment interface{} `yaml:"environment,omitempty" json:"environment,omitempty"`

	// EnvFile is a list of environment files
	EnvFile interface{} `yaml:"env_file,omitempty" json:"env_file,omitempty"`

	// Ports is a list of port mappings
	Ports []interface{} `yaml:"ports,omitempty" json:"ports,omitempty"` // Can be list of strings or maps

	// Expose is a list of exposed ports
	Expose []interface{} `yaml:"expose,omitempty" json:"expose,omitempty"` // Can be list of strings/numbers

	// Volumes is a list of volume mappings
	Volumes interface{} `yaml:"volumes,omitempty" json:"volumes,omitempty"` // Reverted back to interface{} again

	// VolumesFrom is a list of services to mount volumes from
	VolumesFrom []string `yaml:"volumes_from,omitempty" json:"volumes_from,omitempty"` // List of strings

	// Networks is a list of networks to connect to
	Networks interface{} `yaml:"networks,omitempty" json:"networks,omitempty"`

	// NetworkMode is the network mode
	NetworkMode string `yaml:"network_mode,omitempty" json:"network_mode,omitempty"`

	// DependsOn is a list of services that this service depends on
	DependsOn interface{} `yaml:"depends_on,omitempty" json:"depends_on,omitempty"`

	// HealthCheck is the health check configuration
	HealthCheck map[string]interface{} `yaml:"healthcheck,omitempty" json:"healthcheck,omitempty"` // Map structure

	// Deploy is the deployment configuration
	Deploy map[string]interface{} `yaml:"deploy,omitempty" json:"deploy,omitempty"` // Map structure

	// Restart is the restart policy
	Restart string `yaml:"restart,omitempty" json:"restart,omitempty"`

	// Labels are labels to apply to the container
	Labels interface{} `yaml:"labels,omitempty" json:"labels,omitempty"`

	// Extensions stores extension fields
	Extensions map[string]interface{} `json:"extensions,omitempty"` // Removed yaml tag entirely
}

ServiceConfig represents a service in a Docker Compose file

type ServiceInfo

type ServiceInfo struct {
	// Name is the name of the service as defined in the Compose file.
	// required: true
	// example: "web"
	Name string `json:"name"`

	// ContainerIDs lists the Docker container IDs associated with this service instance(s).
	// example: ["f7d9e8c7b6a5", "a1b2c3d4e5f6"]
	ContainerIDs []string `json:"containerIDs"`

	// Status is the current status of the service.
	// required: true
	// example: "running"
	Status ServiceStatus `json:"status"`

	// StartTime is the timestamp when the service (or its first container) was started.
	// required: true
	// example: "2023-10-27T10:01:00Z"
	StartTime time.Time `json:"startTime"`

	// UpdateTime is the timestamp when the service status was last updated.
	// required: true
	// example: "2023-10-27T10:06:00Z"
	UpdateTime time.Time `json:"updateTime"`

	// Error contains the last error message associated with the service, if any.
	// example: "Container exited with code 1"
	Error string `json:"error,omitempty"` // Store error message as string

	// Health provides details about the service's health check status, if configured.
	Health *HealthInfo `json:"health,omitempty"`
}

ServiceInfo contains status information about a specific service within a Compose deployment. @description Detailed status of a single service, including its containers and health.

type ServiceStatus

type ServiceStatus string

ServiceStatus represents the status of a compose service

const (
	// ServiceStatusUnknown indicates that the service status is unknown
	ServiceStatusUnknown ServiceStatus = "unknown"

	// ServiceStatusPending indicates that the service is pending creation
	ServiceStatusPending ServiceStatus = "pending"

	// ServiceStatusCreating indicates that the service is being created
	ServiceStatusCreating ServiceStatus = "creating"

	// ServiceStatusStarting indicates that the service is starting
	ServiceStatusStarting ServiceStatus = "starting" // Added constant

	// ServiceStatusCreated indicates that the service has been created but may not be running yet
	ServiceStatusCreated ServiceStatus = "created" // Added constant

	// ServiceStatusRunning indicates that the service is running
	ServiceStatusRunning ServiceStatus = "running"

	// ServiceStatusPaused indicates that the service is paused
	ServiceStatusPaused ServiceStatus = "paused"

	// ServiceStatusRestarting indicates that the service is restarting
	ServiceStatusRestarting ServiceStatus = "restarting"

	// ServiceStatusStopping indicates that the service is stopping
	ServiceStatusStopping ServiceStatus = "stopping" // Added constant

	// ServiceStatusRemoving indicates that the service is being removed
	ServiceStatusRemoving ServiceStatus = "removing"

	// ServiceStatusStopped indicates that the service has stopped (similar to exited but explicitly stopped)
	ServiceStatusStopped ServiceStatus = "stopped" // Added constant

	// ServiceStatusExited indicates that the service has exited
	ServiceStatusExited ServiceStatus = "exited"

	// ServiceStatusDead indicates that the service is dead
	ServiceStatusDead ServiceStatus = "dead"

	// ServiceStatusFailed indicates that the service has failed
	ServiceStatusFailed ServiceStatus = "failed"

	// ServiceStatusComplete indicates that the service has completed successfully
	ServiceStatusComplete ServiceStatus = "complete"

	// ServiceStatusRemoved indicates that the service is removed
	ServiceStatusRemoved ServiceStatus = "removed"

	// ServiceStatusUnhealthy indicates that the service is running but unhealthy
	ServiceStatusUnhealthy ServiceStatus = "unhealthy" // Added constant

	// ServiceStatusPartial indicates that the service is partially running (some containers running, some not)
	ServiceStatusPartial ServiceStatus = "partial" // Added constant

	// ServiceStatusScalingUp indicates that the service is scaling up
	ServiceStatusScalingUp ServiceStatus = "scaling_up"

	// ServiceStatusScalingDown indicates that the service is scaling down
	ServiceStatusScalingDown ServiceStatus = "scaling_down"
)

Service status constants

type ServiceStatusInfo

type ServiceStatusInfo struct {
	Name         string        `json:"name"`
	Status       ServiceStatus `json:"status"`
	ContainerIDs []string      `json:"container_ids"`
	HealthStatus string        `json:"health_status,omitempty"` // e.g., healthy, unhealthy, starting
	Error        string        `json:"error,omitempty"`
	UpdateTime   time.Time     `json:"update_time"`
}

ServiceStatusInfo provides detailed status information for a service

type Setting

type Setting struct {
	ID        uint           `json:"id" gorm:"primaryKey"`
	Key       string         `json:"key" gorm:"uniqueIndex;not null"`
	Value     string         `json:"value" gorm:"type:text;not null"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
}

Setting represents a key-value setting in the system

func (Setting) TableName

func (Setting) TableName() string

TableName returns the table name for the Setting model

type SortRequest

type SortRequest struct {
	SortBy    string `json:"sort_by" form:"sort_by" example:"name"`
	SortOrder string `json:"sort_order" form:"sort_order" binding:"omitempty,oneof=asc desc" example:"asc"`
}

SortRequest represents sorting parameters for API requests

func (*SortRequest) SetDefaults

func (s *SortRequest) SetDefaults(defaultSortBy string)

SetDefaults sets default values for the sort request

type StartOptions

type StartOptions struct {
	ProjectName       string
	Timeout           time.Duration
	DependencyTimeout time.Duration
	Logger            *logrus.Logger
}

StartOptions defines options for starting a Docker Compose deployment

type StopOptions

type StopOptions struct {
	ProjectName       string
	Timeout           time.Duration
	DependencyTimeout time.Duration
	Logger            *logrus.Logger
}

StopOptions defines options for stopping a Docker Compose deployment

type StringArray

type StringArray []string

StringArray represents a slice that can be stored as JSON in a database column

func (*StringArray) Scan

func (a *StringArray) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database deserialization

func (StringArray) Value

func (a StringArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database serialization

type SuccessResponse

type SuccessResponse struct {
	Success bool             `json:"success" example:"true"`
	Data    interface{}      `json:"data,omitempty"`    // Use omitempty if data might be nil/empty
	Message string           `json:"message,omitempty"` // Optional success message
	Meta    MetadataResponse `json:"meta"`
}

SuccessResponse represents a standard successful API response structure.

type SystemInfoResponse

type SystemInfoResponse struct {
	ID                 string                 `json:"id" example:"system-id-123"`
	Name               string                 `json:"name"`
	ServerVersion      string                 `json:"server_version" example:"24.0.5"`
	APIVersion         string                 `json:"api_version"`
	KernelVersion      string                 `json:"kernel_version" example:"5.15.0-87-generic"`
	OperatingSystem    string                 `json:"operating_system" example:"Docker Desktop"`
	OSType             string                 `json:"os_type"`
	Architecture       string                 `json:"architecture" example:"aarch64"`
	CPUs               int                    `json:"cpus"`
	Memory             int64                  `json:"memory"`
	MemoryHuman        string                 `json:"memory_human"`
	ContainersRunning  int                    `json:"containers_running"`
	ContainersPaused   int                    `json:"containers_paused"`
	ContainersStopped  int                    `json:"containers_stopped"`
	Images             int                    `json:"images" example:"50"`
	Driver             string                 `json:"driver" example:"overlay2"`
	DriverStatus       [][]string             `json:"driver_status,omitempty"`
	DockerRootDir      string                 `json:"docker_root_dir"`
	ExperimentalBuild  bool                   `json:"experimental_build"`
	ServerTime         time.Time              `json:"server_time"`
	HTTPProxy          string                 `json:"http_proxy,omitempty"`
	HTTPSProxy         string                 `json:"https_proxy,omitempty"`
	NoProxy            string                 `json:"no_proxy,omitempty"`
	SecurityOptions    []string               `json:"security_options,omitempty"`
	RegistryConfig     map[string]interface{} `json:"registry_config,omitempty"`
	LiveRestoreEnabled bool                   `json:"live_restore_enabled"`
	Debug              bool                   `json:"debug"`
	NFd                int                    `json:"n_fd"`
	NGoroutines        int                    `json:"n_goroutines"`
	SystemTime         time.Time              `json:"system_time"`
	LoggingDriver      string                 `json:"logging_driver"`
	CgroupDriver       string                 `json:"cgroup_driver"`
	CgroupVersion      string                 `json:"cgroup_version"`
	NEventsListener    int                    `json:"n_events_listener"`
	KernelMemory       bool                   `json:"kernel_memory"`
	MemoryLimit        bool                   `json:"memory_limit"`
	SwapLimit          bool                   `json:"swap_limit"`
	KernelMemoryTCP    bool                   `json:"kernel_memory_tcp"`
	CPUCfsPeriod       bool                   `json:"cpu_cfs_period"`
	CPUCfsQuota        bool                   `json:"cpu_cfs_quota"`
	CPUShares          bool                   `json:"cpu_shares"`
	CPUSet             bool                   `json:"cpu_set"`
	PidsLimit          bool                   `json:"pids_limit"`
	IPv4Forwarding     bool                   `json:"ipv4_forwarding"`
	BridgeNfIptables   bool                   `json:"bridge_nf_iptables"`
	BridgeNfIp6tables  bool                   `json:"bridge_nf_ip6tables"`
	Debug0             bool                   `json:"debug0"`
	OomKillDisable     bool                   `json:"oom_kill_disable"`
}

SystemInfoResponse represents system information

type SystemPruneRequest

type SystemPruneRequest struct {
	Containers bool              `json:"containers" example:"true"`               // Prune containers
	Images     bool              `json:"images" example:"false"`                  // Prune images
	Networks   bool              `json:"networks" example:"true"`                 // Prune networks
	Volumes    bool              `json:"volumes" example:"true"`                  // Prune volumes
	BuildCache bool              `json:"build_cache" example:"true"`              // Prune build cache
	Filters    map[string]string `json:"filters" example:"label:mylabel=myvalue"` // Filters to apply (e.g., {"label": ["key=value"]}) - Note: Docker API uses map[string][]string, adjust if needed
}

SystemPruneRequest represents a system prune request

type SystemPruneResponse

type SystemPruneResponse struct {
	ContainersDeleted []string                  `json:"containers_deleted,omitempty"`  // Renamed from ContainersPruned
	ImagesDeleted     []ImageDeleteResponseItem `json:"images_deleted,omitempty"`      // Renamed from ImagesPruned, changed type
	NetworksDeleted   []string                  `json:"networks_deleted,omitempty"`    // Renamed from NetworksPruned
	VolumesDeleted    []string                  `json:"volumes_deleted,omitempty"`     // Renamed from VolumesPruned
	BuildCacheDeleted []string                  `json:"build_cache_deleted,omitempty"` // Keep this field
	SpaceReclaimed    int64                     `json:"space_reclaimed"`
}

SystemPruneResponse represents the results of a system prune operation

type SystemSettings

type SystemSettings struct {
	DockerHost           string `json:"docker_host"`
	DockerTLSVerify      bool   `json:"docker_tls_verify"`
	DockerCertPath       string `json:"docker_cert_path"`
	DefaultCPULimit      string `json:"default_cpu_limit"`
	DefaultMemoryLimit   string `json:"default_memory_limit"`
	DefaultStorageLimit  string `json:"default_storage_limit"`
	EnableLogging        bool   `json:"enable_logging"`
	LogLevel             string `json:"log_level"`
	EnableNotifications  bool   `json:"enable_notifications"`
	NotificationEndpoint string `json:"notification_endpoint"`
	EnableScheduling     bool   `json:"enable_scheduling"`
	EnableAudit          bool   `json:"enable_audit"`
	UITheme              string `json:"ui_theme"`
	SessionTimeout       int    `json:"session_timeout"` // In minutes
	EnableRegistration   bool   `json:"enable_registration"`
	MaxContainers        int    `json:"max_containers"`
	MaxImages            int    `json:"max_images"`
	MaxVolumes           int    `json:"max_volumes"`
	MaxNetworks          int    `json:"max_networks"`
}

SystemSettings represents the global system settings

func DefaultSystemSettings

func DefaultSystemSettings() SystemSettings

DefaultSystemSettings returns the default system settings

type Token

type Token struct {
	ID        uint           `json:"-" gorm:"primaryKey"`
	UUID      string         `json:"-" gorm:"unique;index"`
	UserID    uint           `json:"-" gorm:"index"`
	Token     string         `json:"-"`
	Type      string         `json:"-"` // "access" or "refresh"
	Blacklist bool           `json:"-" gorm:"default:false;index"`
	ExpiresAt time.Time      `json:"-" gorm:"index"`
	CreatedAt time.Time      `json:"-"`
	UpdatedAt time.Time      `json:"-"`
	DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
}

Token represents a JWT token in the database

type TokenResponse

type TokenResponse struct {
	// AccessToken is the JWT token used for authenticating subsequent requests.
	// required: true
	// example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... (long token string)
	AccessToken string `json:"access_token" example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."`

	// RefreshToken is the token used to obtain a new access token when the current one expires.
	// required: true
	// example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... (different long token string)
	RefreshToken string `json:"refresh_token" example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."`

	// TokenType indicates the type of token (always "Bearer").
	// required: true
	// example: Bearer
	TokenType string `json:"token_type" example:"Bearer"`

	// ExpiresIn is the duration in seconds until the access token expires.
	// required: true
	// example: 3600
	ExpiresIn int `json:"expires_in" example:"3600"` // seconds

	// ExpiresAt is the exact timestamp when the access token expires.
	// required: true
	// example: 2023-10-27T11:00:00Z
	ExpiresAt time.Time `json:"expires_at" example:"2023-10-27T11:00:00Z"`

	// UserID is the unique identifier of the logged-in user.
	// required: true
	// example: 1
	UserID uint `json:"user_id" example:"1"`

	// Roles is the list of roles assigned to the user.
	// required: true
	// example: ["user", "admin"]
	Roles []string `json:"roles" example:"user,admin"`
}

TokenResponse represents a token response for login and refresh operations @description Contains the JWT access and refresh tokens along with user details.

type TopResponse

type TopResponse struct {
	// Titles are the column headers for the process list (e.g., "PID", "USER", "%CPU", "COMMAND").
	// required: true
	// example: ["PID", "USER", "COMMAND"]
	Titles []string `json:"titles"` // Process list titles (e.g., PID, USER, COMMAND)

	// Processes is a list of arrays, where each inner array represents a process and its corresponding column values.
	// required: true
	// example: [["1", "root", "/usr/sbin/nginx"], ["6", "nginx", "nginx: worker process"]]
	Processes [][]string `json:"processes"` // List of process information arrays
}

TopResponse represents the output of the 'top' or 'ps' command run inside a container. @description Lists the running processes within a container.

type User

type User struct {
	ID            uint           `json:"id" gorm:"primaryKey"`
	Email         string         `json:"email" gorm:"unique;not null"`
	Password      string         `json:"-" gorm:"not null"` // Password is never returned in JSON
	Name          string         `json:"name"`
	Roles         []UserRole     `json:"roles" gorm:"foreignKey:UserID"`
	LastLogin     *time.Time     `json:"last_login,omitempty"`
	EmailVerified bool           `json:"email_verified" gorm:"default:false"`
	Active        bool           `json:"active" gorm:"default:true"`
	CreatedAt     time.Time      `json:"created_at"`
	UpdatedAt     time.Time      `json:"updated_at"`
	DeletedAt     gorm.DeletedAt `json:"-" gorm:"index"`
}

User represents a user in the system

func (*User) GetRoleNames

func (u *User) GetRoleNames() []string

GetRoleNames returns the role names for a user

func (*User) HasRole

func (u *User) HasRole(role Role) bool

HasRole checks if a user has a specific role

func (*User) IsAdmin

func (u *User) IsAdmin() bool

IsAdmin checks if a user is an admin

type UserListResponse

type UserListResponse struct {
	// Users is the list of user objects returned for the current page.
	// required: true
	Users []UserResponse `json:"users"`

	// Metadata contains pagination and other metadata for the response.
	// required: true
	Metadata MetadataResponse `json:"metadata"`
}

UserListResponse represents the response for listing users, including pagination metadata. @description Contains a list of user details along with pagination information.

type UserResponse

type UserResponse struct {
	// ID is the unique identifier for the user.
	// required: true
	// example: 1
	ID uint `json:"id" example:"1"`

	// Email is the user's email address.
	// required: true
	// example: user@example.com
	Email string `json:"email" example:"user@example.com"`

	// Name is the user's display name.
	// required: true
	// example: John Doe
	Name string `json:"name" example:"John Doe"`

	// Roles is the list of roles assigned to the user.
	// required: true
	// example: ["user", "admin"]
	Roles []string `json:"roles" example:"user,admin"`

	// LastLogin is the timestamp of the user's last login. Omitted if the user has never logged in.
	// example: 2023-10-27T10:00:00Z
	LastLogin time.Time `json:"last_login,omitempty" example:"2023-10-27T10:00:00Z"`

	// EmailVerified indicates whether the user's email address has been verified.
	// required: true
	// example: true
	EmailVerified bool `json:"email_verified" example:"true"`

	// Active indicates whether the user account is currently active.
	// required: true
	// example: true
	Active bool `json:"active" example:"true"`

	// CreatedAt is the timestamp when the user account was created.
	// required: true
	// example: 2023-01-15T09:30:00Z
	CreatedAt time.Time `json:"created_at" example:"2023-01-15T09:30:00Z"`

	// UpdatedAt is the timestamp when the user account was last updated.
	// required: true
	// example: 2023-10-26T15:45:00Z
	UpdatedAt time.Time `json:"updated_at" example:"2023-10-26T15:45:00Z"`
}

UserResponse represents a user response, excluding sensitive information like password. @description Detailed information about a user account.

type UserRole

type UserRole struct {
	ID        uint      `json:"-" gorm:"primaryKey"`
	UserID    uint      `json:"-" gorm:"index"`
	Role      Role      `json:"role" gorm:"index"`
	CreatedAt time.Time `json:"-"`
	UpdatedAt time.Time `json:"-"`
}

UserRole represents a user's role

func (UserRole) TableName

func (UserRole) TableName() string

TableName returns the table name for the UserRole model

type UserSettings

type UserSettings struct {
	UITheme              string `json:"ui_theme"`
	ContainersPerPage    int    `json:"containers_per_page"`
	ImagesPerPage        int    `json:"images_per_page"`
	VolumesPerPage       int    `json:"volumes_per_page"`
	NetworksPerPage      int    `json:"networks_per_page"`
	DefaultView          string `json:"default_view"`
	ShowTerminated       bool   `json:"show_terminated"`
	NotificationsEnabled bool   `json:"notifications_enabled"`
	RefreshInterval      int    `json:"refresh_interval"` // In seconds
}

UserSettings represents user-specific settings

func DefaultUserSettings

func DefaultUserSettings() UserSettings

DefaultUserSettings returns the default user settings

type VersionedSetting

type VersionedSetting struct {
	ID        uint      `json:"id" gorm:"primaryKey"`
	Key       string    `json:"key" gorm:"index;not null"`
	Value     string    `json:"value" gorm:"type:text;not null"`
	Version   int       `json:"version" gorm:"not null"`
	Metadata  string    `json:"metadata" gorm:"type:text"`
	CreatedAt time.Time `json:"created_at"`
}

VersionedSetting represents a versioned key-value setting Used for settings that require versioning/history

func (VersionedSetting) TableName

func (VersionedSetting) TableName() string

TableName returns the table name for the VersionedSetting model

type Volume

type Volume struct {
	DockerResource
	VolumeID      string           `json:"volume_id" gorm:"index;size:64" validate:"required,alphanumdash"`
	Driver        string           `json:"driver" validate:"max=255"`
	Mountpoint    string           `json:"mountpoint" validate:"required"`
	Scope         string           `json:"scope" validate:"max=64"`
	InUse         bool             `json:"in_use"`
	LastInspected time.Time        `json:"last_inspected"`
	Options       JSONMap          `json:"options" gorm:"type:text"`
	DriverOpts    JSONMap          `json:"driver_opts" gorm:"type:text"`
	Security      JSONMap          `json:"security" gorm:"type:text"`
	Status        JSONMap          `json:"status" gorm:"type:text"`
	UsageData     *VolumeUsageData `json:"usage_data" gorm:"-"` // Exclude from DB, populate on demand
	Containers    []Container      `json:"-" gorm:"many2many:container_volumes;"`
}

Volume represents a Docker volume in the database

func (*Volume) SanitizeMountpoint

func (v *Volume) SanitizeMountpoint()

SanitizeMountpoint cleans the volume mountpoint path

func (*Volume) Validate

func (v *Volume) Validate() error

Validate checks if the volume is valid

type VolumeCloneRequest

type VolumeCloneRequest struct {
	TargetName string            `json:"target_name" binding:"required"`
	Labels     map[string]string `json:"labels" example:"backup=true,environment=production"`
}

VolumeCloneRequest represents a volume clone request

type VolumeConfig

type VolumeConfig struct {
	// Name is the name of the volume
	Name string `yaml:"-" json:"name"`

	// Driver is the volume driver
	Driver string `yaml:"driver,omitempty" json:"driver,omitempty"`

	// DriverOpts are driver-specific options
	DriverOpts map[string]string `yaml:"driver_opts,omitempty" json:"driver_opts,omitempty"`

	// External indicates whether the volume is external
	External interface{} `yaml:"external,omitempty" json:"external,omitempty"`

	// Labels are labels to apply to the volume
	Labels interface{} `yaml:"labels,omitempty" json:"labels,omitempty"`

	// Extensions stores extension fields
	Extensions map[string]interface{} `yaml:",inline" json:"extensions,omitempty"`
}

VolumeConfig represents a volume in a Docker Compose file

type VolumeCreateOptions

type VolumeCreateOptions struct {
	Name       string            `json:"Name" binding:"required"` // Match Docker API field name
	Driver     string            `json:"Driver,omitempty"`
	DriverOpts map[string]string `json:"DriverOpts,omitempty"`
	Labels     map[string]string `json:"Labels,omitempty"`
}

VolumeCreateOptions represents options for creating a volume Based on fields used in pkg/client/volumes.go CreateVolume function

type VolumeCreateRequest

type VolumeCreateRequest struct {
	// Name is the name for the new volume.
	// required: true
	// example: my-app-data
	Name string `json:"name" binding:"required" example:"my-app-data"`

	// Driver specifies the volume driver to use. Defaults to "local".
	// example: local
	Driver string `json:"driver" example:"local"`

	// DriverOpts are driver-specific options.
	// example: {"type": "nfs", "o": "addr=192.168.1.1,rw"}
	DriverOpts map[string]string `json:"driver_opts"` // Example removed due to swag parsing issues

	// Labels are key-value pairs to apply to the volume.
	// example: {"environment": "production", "backup": "true"}
	Labels map[string]string `json:"labels" example:"backup=true,environment=production"`

	// Notes are user-defined notes for the volume (stored in the application DB).
	// example: "Persistent data for the main database."
	Notes string `json:"notes" example:"Persistent data for the main application."`
}

VolumeCreateRequest represents a volume creation request. @description Configuration details for creating a new Docker volume.

type VolumeListRequest

type VolumeListRequest struct {
	PaginationRequest // Embeds Page and PageSize
	SortRequest       // Embeds SortBy and SortOrder
	FilterRequest     // Embeds Search, Filters, StartDate, EndDate
	// Driver filters volumes by the specified driver name.
	// example: local
	Driver string `json:"driver" form:"driver" example:"local"`
}

VolumeListRequest represents parameters for listing Docker volumes. @description Query parameters for filtering, sorting, and paginating the list of Docker volumes.

type VolumeListResponse

type VolumeListResponse struct {
	// Volumes is the list of volume objects returned for the current page.
	// required: true
	Volumes []VolumeResponse `json:"volumes"`

	// Metadata contains pagination and other metadata for the response.
	// required: true
	Metadata MetadataResponse `json:"metadata"`
}

VolumeListResponse represents a paginated list of Docker volumes. @description Contains a list of volume details along with pagination information.

type VolumeMapping

type VolumeMapping struct {
	// Source is the name of the volume or the path on the host machine.
	// required: true
	// example: "my-app-data" or "/path/on/host"
	Source string `json:"source" binding:"required" example:"my-app-data"` // or "/path/on/host"

	// Destination is the absolute path inside the container where the volume is mounted.
	// required: true
	// example: "/var/www/html"
	Destination string `json:"destination" binding:"required" example:"/var/www/html"`

	// ReadOnly specifies whether the mount should be read-only within the container.
	// example: false
	ReadOnly bool `json:"read_only" example:"false"`
}

VolumeMapping represents a volume mount configuration for a container. @description Defines how a host path or named volume is mounted into a container.

type VolumeMountResponse

type VolumeMountResponse struct {
	// Source is the source path on the host or the name of the Docker volume.
	// required: true
	// example: "/path/on/host" or "my-app-data"
	Source string `json:"source" example:"my-app-data"` // or "/path/on/host"

	// Destination is the absolute path inside the container where the volume is mounted.
	// required: true
	// example: "/data"
	Destination string `json:"destination" example:"/data"`

	// Mode provides driver-specific options, often includes SELinux labels like 'z' or 'Z'.
	// example: "z"
	Mode string `json:"mode" example:"z"`

	// RW indicates if the mount is read-write.
	// required: true
	// example: true
	RW bool `json:"rw" example:"true"`

	// VolumeID is the name of the Docker volume (if Source refers to a named volume).
	// example: "my-app-data"
	VolumeID string `json:"volume_id,omitempty" example:"my-app-data"`
}

VolumeMountResponse represents details about a volume mounted within a container. @description Information about a specific volume mount point inside a container.

type VolumePermissionsRequest

type VolumePermissionsRequest struct {
	// UserID is the ID of the user who will become the new owner of the volume record in the application database.
	// required: true
	// example: 2
	UserID uint `json:"user_id" binding:"required"` // ID of the user to transfer ownership to
}

VolumePermissionsRequest represents a request to update volume ownership (currently only supports transferring ownership). @description Specifies the user ID to whom the volume ownership should be transferred. This is an application-level concept, not a Docker feature.

type VolumePruneRequest

type VolumePruneRequest struct {
	FilterRequest // Embeds Search, Filters, StartDate, EndDate
}

VolumePruneRequest represents parameters for pruning unused Docker volumes. @description Query parameters for filtering which volumes to prune.

type VolumeResponse

type VolumeResponse struct {
	// ID is the internal database ID (if managed by the application).
	// example: 12
	ID uint `json:"id,omitempty"`

	// VolumeID is the unique identifier assigned by Docker (often the same as Name).
	// required: true
	// example: "my-app-data"
	VolumeID string `json:"volume_id"`

	// Name is the user-defined name of the volume.
	// required: true
	// example: "my-app-data"
	Name string `json:"name" example:"my-app-data"`

	// Driver is the volume driver used (e.g., local).
	// required: true
	// example: "local"
	Driver string `json:"driver" example:"local"`

	// Mountpoint is the path on the host where the volume data is stored.
	// required: true
	// example: "/var/lib/docker/volumes/my-app-data/_data"
	Mountpoint string `json:"mountpoint" example:"/var/lib/docker/volumes/my-app-data/_data"`

	// CreatedAt is the timestamp when the volume was created by Docker. Note: Docker API might return this as 'CreatedAt' string, needs parsing.
	// required: true
	// example: "2023-10-27T08:00:00Z"
	CreatedAt time.Time `json:"created_at" example:"2023-10-26T12:00:00Z"`

	// Scope indicates the scope of the volume (e.g., local, global).
	// required: true
	// example: "local"
	Scope string `json:"scope" example:"local"`

	// Labels are the labels applied to the volume.
	// example: {"environment": "production", "backup": "true"}
	Labels map[string]string `json:"labels,omitempty"`

	// Options are driver-specific options for the volume.
	Options map[string]string `json:"options,omitempty"`

	// Status provides low-level status information about the volume (driver-specific).
	Status map[string]string `json:"status,omitempty"`

	// InUse indicates whether the volume is currently used by any containers. Requires UsageData from Docker API.
	// example: true
	InUse bool `json:"in_use"`

	// Containers lists the IDs of containers currently using this volume. Requires UsageData from Docker API.
	// example: ["f7d9e8c7b6a5", "a1b2c3d4e5f6"]
	Containers []string `json:"containers,omitempty"`

	// Size is the calculated size of the volume in bytes. Requires UsageData from Docker API.
	// example: 104857600
	Size int64 `json:"size,omitempty"`

	// SizeHuman is the calculated size of the volume in a human-readable format.
	// example: "100MB"
	SizeHuman string `json:"size_human,omitempty"`

	// Notes are user-defined notes stored in the application database.
	// example: "Persistent data for the main database."
	Notes string `json:"notes,omitempty"`

	// UserID is the ID of the user who owns/created this volume record in the application database.
	// example: 1
	UserID uint `json:"user_id,omitempty"`

	// UpdatedAt is the timestamp when the volume record was last updated in the application database.
	// example: "2023-10-27T08:10:00Z"
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

VolumeResponse represents detailed information about a Docker volume. @description Contains comprehensive details of a Docker volume, including configuration and usage.

type VolumeUsageData

type VolumeUsageData struct {
	Size     int64 `json:"size"`
	RefCount int64 `json:"ref_count"` // Changed to int64 to match Docker SDK
}

VolumeUsageData holds usage information for a volume

type Vulnerability

type Vulnerability struct {
	ID          string   `json:"id"`       // e.g., CVE-2023-1234
	Severity    string   `json:"severity"` // e.g., HIGH, MEDIUM, LOW, CRITICAL
	PackageName string   `json:"package_name"`
	Version     string   `json:"version"`
	FixVersion  string   `json:"fix_version,omitempty"`
	Description string   `json:"description,omitempty"`
	URLs        []string `json:"urls,omitempty"`       // Links to advisories, etc.
	CVSSScore   float64  `json:"cvss_score,omitempty"` // CVSS score if available
}

Vulnerability represents a single security vulnerability found.

Jump to

Keyboard shortcuts

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