Documentation
¶
Index ¶
- type AccessControl
- type App
- type AppAuditLogEntry
- type AppFilter
- type AppOptions
- type AppState
- type AppStatus
- type ContainerManager
- type DeploymentStatus
- type Manager
- func (m *Manager) Close() error
- func (m *Manager) CreateApp(ctx context.Context, options AppOptions) (*AppStatus, error)
- func (m *Manager) CreateTenant(ctx context.Context, name, description, owner string) (*Tenant, error)
- func (m *Manager) DeleteApp(id string) error
- func (m *Manager) DeleteAppWithOptions(ctx context.Context, id, userID, tenantID string) error
- func (m *Manager) DeleteTenant(ctx context.Context, id string) error
- func (m *Manager) DeployApp(ctx context.Context, image, name, service string, volumes []string, ...) (string, error)
- func (m *Manager) ExecInApp(ctx context.Context, id string, command []string, userID, tenantID string) (string, error)
- func (m *Manager) GetAppAuditLogs(appID string) []AppAuditLogEntry
- func (m *Manager) GetAppLogs(ctx context.Context, id, userID, tenantID string) (string, error)
- func (m *Manager) GetAppStatus(id string) (*AppStatus, error)
- func (m *Manager) GetApps() ([]*AppStatus, error)
- func (m *Manager) GetAppsByFilter(filter AppFilter) ([]*AppStatus, error)
- func (m *Manager) GetContainerByID(ctx context.Context, containerID string) (api.Container, error)
- func (m *Manager) GetContainersByNode(ctx context.Context, nodeID string) ([]api.Container, error)
- func (m *Manager) GetDeploymentStatus(ctx context.Context, deploymentID string) (*DeploymentStatus, error)
- func (m *Manager) GetService(ctx context.Context, name string) (*Service, error)
- func (m *Manager) GetTenant(ctx context.Context, id string) (*Tenant, error)
- func (m *Manager) GetTenantAppStats(tenantID string) (*TenantAppStats, error)
- func (m *Manager) ListServices(ctx context.Context) ([]*Service, error)
- func (m *Manager) ListTenants(ctx context.Context) ([]Tenant, error)
- func (m *Manager) MonitorAppHealth(ctx context.Context, id string) error
- func (m *Manager) RestartApp(ctx context.Context, id, userID, tenantID string) error
- func (m *Manager) RestartAppSimple(ctx context.Context, id string) error
- func (m *Manager) RollbackDeployment(ctx context.Context, deploymentID string) error
- func (m *Manager) SaveApp(app *AppStatus) error
- func (m *Manager) ScaleApp(ctx context.Context, id string, replicas int, userID ...string) error
- func (m *Manager) ScaleAppWithTenant(ctx context.Context, id string, replicas int, userID, tenantID string) error
- func (m *Manager) StartApp(ctx context.Context, id, userID, tenantID string) error
- func (m *Manager) StartAppHealthMonitoring(ctx context.Context, interval time.Duration)
- func (m *Manager) StopApp(ctx context.Context, id, userID, tenantID string) error
- func (m *Manager) UpdateApp(ctx context.Context, id string, options AppOptions, userID, tenantID string) (*AppStatus, error)
- func (m *Manager) UpdateAppExitCode(id string, exitCode int) error
- func (m *Manager) UpdateAppNodeID(id, nodeID string) error
- func (m *Manager) UpdateAppRestartCount(id string, restartCount int) error
- func (m *Manager) UpdateAppState(id string, state AppState) error
- func (m *Manager) UpdateTenant(ctx context.Context, id, name, status string) (*Tenant, error)
- func (m *Manager) WithAccessControl(accessControl AccessControl) *Manager
- func (m *Manager) WithContainerManager(containerManager ContainerManager) *Manager
- func (m *Manager) WithNetworkManager(networkManager NetworkManager) *Manager
- func (m *Manager) WithStorageManager(storageManager StorageManager) *Manager
- func (m *Manager) WithTenantManager(tenantManager interface{}) *Manager
- func (m *Manager) ZeroDowntimeDeploy(ctx context.Context, name, image, service string) (string, error)
- type NetworkManager
- type ResourceRequirements
- type Service
- type StorageManager
- type Tenant
- type TenantAppStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessControl ¶
type AccessControl interface {
CheckAccess(userID, tenantID, resource, action string) bool
LogAccess(userID, tenantID, resource, action, details string)
GetAuditLogs() []AppAuditLogEntry
GetTenantAuditLogs(tenantID string) []AppAuditLogEntry
GetAppAuditLogs(appID string) []AppAuditLogEntry
}
AccessControl handles access control for applications
type App ¶
type App struct {
ID string
Name string
Image string
Command []string
Env map[string]string
Volumes []string
Ports map[string]string
Resources ResourceRequirements
State AppState
NodeID string
CreatedAt time.Time
StartedAt *time.Time
StoppedAt *time.Time
TenantID string
UserID string
Metadata map[string]string
}
App represents an application in the system
type AppAuditLogEntry ¶
type AppAuditLogEntry struct {
Timestamp int64
Action string
UserID string
TenantID string
AppID string
Details string
}
AppAuditLogEntry represents an entry in the application audit log
type AppOptions ¶
type AppOptions struct {
Name string
Image string
Command []string
Env map[string]string
Volumes []string
Ports map[string]string
Resources ResourceRequirements
TenantID string
UserID string
Metadata map[string]string
}
AppOptions represents options for creating an application
type AppState ¶
type AppState string
AppState represents the state of an application
const ( // AppStatePending indicates the application is pending AppStatePending AppState = "pending" // AppStateRunning indicates the application is running AppStateRunning AppState = "running" // AppStateStopped indicates the application is stopped AppStateStopped AppState = "stopped" // AppStateFailed indicates the application has failed AppStateFailed AppState = "failed" )
type AppStatus ¶
type AppStatus struct {
ID string
Name string
Image string
Command []string
Env map[string]string
Volumes []string
Ports map[string]string
Resources ResourceRequirements
State AppState
NodeID string
CreatedAt int64
StartedAt int64
FinishedAt int64
RestartCount int
ExitCode int
TenantID string
UserID string
}
AppStatus represents the status of an application
type ContainerManager ¶
type ContainerManager interface {
CreateContainer(ctx context.Context, name, image string, command []string, env map[string]string, volumes []string, ports map[string]string) (string, error)
StartContainer(ctx context.Context, id string) error
StopContainer(ctx context.Context, id string) error
RemoveContainer(ctx context.Context, id string) error
GetContainerStatus(ctx context.Context, id string) (string, error)
GetContainerLogs(ctx context.Context, id string) (string, error)
ExecInContainer(ctx context.Context, id string, command []string) (string, error)
ListContainers(ctx context.Context) ([]api.Container, error)
}
ContainerManager handles container operations
type DeploymentStatus ¶
type DeploymentStatus struct {
ID string
Status string
Progress int
Details string
CreatedAt time.Time
UpdatedAt time.Time
Completed bool
Success bool
}
DeploymentStatus represents the status of a deployment
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles application operations
func NewManager ¶
NewManager creates a new application manager
func (*Manager) CreateTenant ¶
func (m *Manager) CreateTenant(ctx context.Context, name, description, owner string) (*Tenant, error)
CreateTenant creates a new tenant
func (*Manager) DeleteAppWithOptions ¶
DeleteAppWithOptions deletes an application with options
func (*Manager) DeleteTenant ¶
DeleteTenant deletes a tenant
func (*Manager) DeployApp ¶
func (m *Manager) DeployApp(ctx context.Context, image, name, service string, volumes []string, env map[string]string) (string, error)
DeployApp deploys a new application
func (*Manager) ExecInApp ¶
func (m *Manager) ExecInApp(ctx context.Context, id string, command []string, userID, tenantID string) (string, error)
ExecInApp executes a command in an application
func (*Manager) GetAppAuditLogs ¶
func (m *Manager) GetAppAuditLogs(appID string) []AppAuditLogEntry
GetAppAuditLogs returns audit logs for an application
func (*Manager) GetAppLogs ¶
GetAppLogs returns the logs of an application
func (*Manager) GetAppStatus ¶
GetAppStatus returns the status of an application
func (*Manager) GetAppsByFilter ¶
GetAppsByFilter returns applications filtered by criteria
func (*Manager) GetContainerByID ¶
GetContainerByID returns a container by its ID
func (*Manager) GetContainersByNode ¶
GetContainersByNode returns containers for a specific node
func (*Manager) GetDeploymentStatus ¶
func (m *Manager) GetDeploymentStatus(ctx context.Context, deploymentID string) (*DeploymentStatus, error)
GetDeploymentStatus returns the status of a deployment
func (*Manager) GetService ¶
GetService returns a service by its name
func (*Manager) GetTenantAppStats ¶
func (m *Manager) GetTenantAppStats(tenantID string) (*TenantAppStats, error)
GetTenantAppStats returns application statistics for a tenant
func (*Manager) ListServices ¶
ListServices returns a list of services
func (*Manager) ListTenants ¶
ListTenants returns a list of tenants
func (*Manager) MonitorAppHealth ¶
MonitorAppHealth monitors the health of an application
func (*Manager) RestartApp ¶
RestartApp restarts an application
func (*Manager) RestartAppSimple ¶
RestartAppSimple restarts an application without requiring user and tenant IDs
func (*Manager) RollbackDeployment ¶
RollbackDeployment rolls back a deployment
func (*Manager) ScaleAppWithTenant ¶
func (m *Manager) ScaleAppWithTenant(ctx context.Context, id string, replicas int, userID, tenantID string) error
ScaleAppWithTenant scales an application with tenant information
func (*Manager) StartAppHealthMonitoring ¶
StartAppHealthMonitoring starts monitoring the health of all applications
func (*Manager) UpdateApp ¶
func (m *Manager) UpdateApp(ctx context.Context, id string, options AppOptions, userID, tenantID string) (*AppStatus, error)
UpdateApp updates an application
func (*Manager) UpdateAppExitCode ¶
UpdateAppExitCode updates the exit code of an application
func (*Manager) UpdateAppNodeID ¶
UpdateAppNodeID updates the node ID of an application
func (*Manager) UpdateAppRestartCount ¶
UpdateAppRestartCount updates the restart count of an application
func (*Manager) UpdateAppState ¶
UpdateAppState updates the state of an application
func (*Manager) UpdateTenant ¶
UpdateTenant updates a tenant
func (*Manager) WithAccessControl ¶
func (m *Manager) WithAccessControl(accessControl AccessControl) *Manager
WithAccessControl sets the access control
func (*Manager) WithContainerManager ¶
func (m *Manager) WithContainerManager(containerManager ContainerManager) *Manager
WithContainerManager sets the container manager
func (*Manager) WithNetworkManager ¶
func (m *Manager) WithNetworkManager(networkManager NetworkManager) *Manager
WithNetworkManager sets the network manager
func (*Manager) WithStorageManager ¶
func (m *Manager) WithStorageManager(storageManager StorageManager) *Manager
WithStorageManager sets the storage manager
func (*Manager) WithTenantManager ¶
WithTenantManager sets the tenant manager
type NetworkManager ¶
type NetworkManager interface {
CreateNetwork(ctx context.Context, name string) (string, error)
DeleteNetwork(ctx context.Context, id string) error
ConnectContainerToNetwork(ctx context.Context, containerID, networkID string) error
DisconnectContainerFromNetwork(ctx context.Context, containerID, networkID string) error
}
NetworkManager handles network operations
type ResourceRequirements ¶
ResourceRequirements represents the resource requirements of an application
type Service ¶
type Service struct {
ID string
Name string
Image string
Command []string
Env map[string]string
Volumes []string
Ports map[string]string
Resources ResourceRequirements
Replicas int
TenantID string
UserID string
CreatedAt int64
UpdatedAt int64
State AppState
Metadata map[string]string
Domain string
ContainerIDs []string
}
Service represents a service in the application
type StorageManager ¶
type StorageManager interface {
CreateVolume(ctx context.Context, options interface{}) (interface{}, error)
DeleteVolume(ctx context.Context, name string) error
MountVolume(ctx context.Context, volumeName, containerID, mountPath string) error
UnmountVolume(ctx context.Context, volumeName, containerID string) error
ListVolumes(ctx context.Context) ([]interface{}, error)
CreateVolumeSimple(ctx context.Context, name string, size int64) (interface{}, error)
}
StorageManager handles storage operations