1package cli
2
3import (
4 "context"
5
6 "github.com/bnema/gordon/internal/adapters/dto"
7 "github.com/bnema/gordon/internal/adapters/in/cli/remote"
8 "github.com/bnema/gordon/internal/domain"
9)
10
11// ControlPlane defines command operations available to CLI execution paths.
12// *remote.Client implements it for both the explicit remote and the
13// owner-only local admin socket; tests substitute the generated mock.
14type ControlPlane interface {
15 // App lifecycle and reads. App mutations are daemon-owned for both
16 // the explicit remote and the owner-only local admin socket.
17 ApplyApp(ctx context.Context, req dto.AppApplyRequest) (*dto.AppApplyResponse, error)
18 ListApps(ctx context.Context) ([]dto.AppSummaryDTO, error)
19 ShowApp(ctx context.Context, app string) (*dto.AppShowResponse, error)
20 DiffApp(ctx context.Context, app string) (*dto.AppDiffResponse, error)
21 DeployApp(ctx context.Context, app string, req dto.AppDeployRequest) (*dto.AppDeployResponse, string, error)
22 StopApp(ctx context.Context, app string) (*dto.AppDeployResponse, string, error)
23 StartApp(ctx context.Context, app string) (*dto.AppDeployResponse, string, error)
24 RestartApp(ctx context.Context, app, service string, all bool) (*dto.AppDeployResponse, string, error)
25 RemoveApp(ctx context.Context, app string) (*dto.AppDeployResponse, string, error)
26 OperationByKey(ctx context.Context, app, key string) (*dto.AppDeployResponse, error)
27 ListAppSecrets(ctx context.Context, app, service string) ([]dto.AppSecretMetadataDTO, error)
28 SetAppSecrets(ctx context.Context, app string, req dto.AppSecretSetRequest) error
29 DeleteAppSecret(ctx context.Context, app string, req dto.AppSecretDeleteRequest) error
30
31 GetStatus(ctx context.Context) (*remote.Status, error)
32 GetTLSStatus(ctx context.Context) (*dto.TLSStatusResponse, error)
33 GetTrafficStatus(ctx context.Context) (*dto.TrafficStatusResponse, error)
34 Reload(ctx context.Context) error
35 ListNetworks(ctx context.Context) ([]*domain.NetworkInfo, error)
36 GetConfig(ctx context.Context) (*remote.Config, error)
37 ListTags(ctx context.Context, repository string) ([]string, error)
38
39 ListBackups(ctx context.Context, app string) ([]dto.BackupJob, error)
40 BackupStatus(ctx context.Context) ([]dto.BackupJob, error)
41 RunBackup(ctx context.Context, app, service, database string) (*dto.BackupRunResponse, error)
42 ListVolumeBackups(ctx context.Context, app string) ([]dto.VolumeBackupJob, error)
43 VolumeBackupStatus(ctx context.Context) ([]dto.VolumeBackupJob, error)
44 RunVolumeBackups(ctx context.Context, app, service, volume string) (*dto.VolumeBackupRunResponse, error)
45
46 GetProcessLogs(ctx context.Context, lines int) ([]string, error)
47 StreamProcessLogs(ctx context.Context, lines int) (<-chan string, error)
48
49 ListVolumes(ctx context.Context) ([]dto.Volume, error)
50 PruneVolumes(ctx context.Context, req dto.VolumePruneRequest) (*dto.VolumePruneResponse, error)
51}
52
53var _ ControlPlane = (*remote.Client)(nil)