v2.30.0-pre3 63e7f3a

controlplane_remote.go RawHistoryFolder

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
11type remoteControlPlane struct {
12	client *remote.Client
13}
14
15func NewRemoteControlPlane(client *remote.Client) ControlPlane {
16	return &remoteControlPlane{client: client}
17}
18
19func (r *remoteControlPlane) ListRoutesWithDetails(ctx context.Context) ([]remote.RouteInfo, error) {
20	return r.client.ListRoutesWithDetails(ctx)
21}
22
23func (r *remoteControlPlane) GetHealth(ctx context.Context) (map[string]*remote.RouteHealth, error) {
24	return r.client.GetHealth(ctx)
25}
26
27func (r *remoteControlPlane) GetRoute(ctx context.Context, routeDomain string) (*domain.Route, error) {
28	return r.client.GetRoute(ctx, routeDomain)
29}
30
31func (r *remoteControlPlane) FindRoutesByImage(ctx context.Context, imageName string) ([]domain.Route, error) {
32	return r.client.FindRoutesByImage(ctx, imageName)
33}
34
35func (r *remoteControlPlane) AddRoute(ctx context.Context, route domain.Route) error {
36	return r.client.AddRoute(ctx, route)
37}
38
39func (r *remoteControlPlane) UpdateRoute(ctx context.Context, route domain.Route) error {
40	return r.client.UpdateRoute(ctx, route)
41}
42
43func (r *remoteControlPlane) RemoveRoute(ctx context.Context, routeDomain string) error {
44	return r.client.RemoveRoute(ctx, routeDomain)
45}
46
47func (r *remoteControlPlane) Bootstrap(ctx context.Context, req dto.BootstrapRequest) (*dto.BootstrapResponse, error) {
48	return r.client.Bootstrap(ctx, req)
49}
50
51func (r *remoteControlPlane) ListSecretsWithAttachments(ctx context.Context, secretDomain string) (*remote.SecretsListResult, error) {
52	return r.client.ListSecretsWithAttachments(ctx, secretDomain)
53}
54
55func (r *remoteControlPlane) SetSecrets(ctx context.Context, secretDomain string, secrets map[string]string) error {
56	return r.client.SetSecrets(ctx, secretDomain, secrets)
57}
58
59func (r *remoteControlPlane) DeleteSecret(ctx context.Context, secretDomain, key string) error {
60	return r.client.DeleteSecret(ctx, secretDomain, key)
61}
62
63func (r *remoteControlPlane) SetAttachmentSecrets(ctx context.Context, domainName, service string, secrets map[string]string) error {
64	return r.client.SetAttachmentSecrets(ctx, domainName, service, secrets)
65}
66
67func (r *remoteControlPlane) DeleteAttachmentSecret(ctx context.Context, domainName, service, key string) error {
68	return r.client.DeleteAttachmentSecret(ctx, domainName, service, key)
69}
70
71func (r *remoteControlPlane) GetAllAttachmentsConfig(ctx context.Context) (map[string][]string, error) {
72	return r.client.GetAllAttachmentsConfig(ctx)
73}
74
75func (r *remoteControlPlane) GetAttachmentsConfig(ctx context.Context, domainOrGroup string) ([]string, error) {
76	return r.client.GetAttachmentsConfig(ctx, domainOrGroup)
77}
78
79func (r *remoteControlPlane) FindAttachmentTargetsByImage(ctx context.Context, imageName string) ([]string, error) {
80	return r.client.FindAttachmentTargetsByImage(ctx, imageName)
81}
82
83func (r *remoteControlPlane) AddAttachment(ctx context.Context, domainOrGroup, image string) error {
84	return r.client.AddAttachment(ctx, domainOrGroup, image)
85}
86
87func (r *remoteControlPlane) RemoveAttachment(ctx context.Context, domainOrGroup, image string) error {
88	return r.client.RemoveAttachment(ctx, domainOrGroup, image)
89}
90
91func (r *remoteControlPlane) GetAutoRouteAllowedDomains(ctx context.Context) ([]string, error) {
92	return r.client.GetAutoRouteAllowedDomains(ctx)
93}
94
95func (r *remoteControlPlane) AddAutoRouteAllowedDomain(ctx context.Context, pattern string) error {
96	return r.client.AddAutoRouteAllowedDomain(ctx, pattern)
97}
98
99func (r *remoteControlPlane) RemoveAutoRouteAllowedDomain(ctx context.Context, pattern string) error {
100	return r.client.RemoveAutoRouteAllowedDomain(ctx, pattern)
101}
102
103func (r *remoteControlPlane) GetStatus(ctx context.Context) (*remote.Status, error) {
104	return r.client.GetStatus(ctx)
105}
106
107func (r *remoteControlPlane) Reload(ctx context.Context) error {
108	return r.client.Reload(ctx)
109}
110
111func (r *remoteControlPlane) ListNetworks(ctx context.Context) ([]*domain.NetworkInfo, error) {
112	return r.client.ListNetworks(ctx)
113}
114
115func (r *remoteControlPlane) GetConfig(ctx context.Context) (*remote.Config, error) {
116	return r.client.GetConfig(ctx)
117}
118
119func (r *remoteControlPlane) DeployIntent(ctx context.Context, imageName string) error {
120	return r.client.DeployIntent(ctx, imageName)
121}
122
123func (r *remoteControlPlane) Deploy(ctx context.Context, deployDomain string) (*remote.DeployResult, error) {
124	return r.client.Deploy(ctx, deployDomain)
125}
126
127func (r *remoteControlPlane) Restart(ctx context.Context, restartDomain string, withAttachments bool) (*remote.RestartResult, error) {
128	return r.client.Restart(ctx, restartDomain, withAttachments)
129}
130
131func (r *remoteControlPlane) ListTags(ctx context.Context, repository string) ([]string, error) {
132	return r.client.ListTags(ctx, repository)
133}
134
135func (r *remoteControlPlane) ListBackups(ctx context.Context, backupDomain string) ([]dto.BackupJob, error) {
136	return r.client.ListBackups(ctx, backupDomain)
137}
138
139func (r *remoteControlPlane) BackupStatus(ctx context.Context) ([]dto.BackupJob, error) {
140	return r.client.BackupStatus(ctx)
141}
142
143func (r *remoteControlPlane) RunBackup(ctx context.Context, backupDomain, dbName string) (*dto.BackupRunResponse, error) {
144	return r.client.RunBackup(ctx, backupDomain, dbName)
145}
146
147func (r *remoteControlPlane) DetectDatabases(ctx context.Context, backupDomain string) ([]dto.DatabaseInfo, error) {
148	return r.client.DetectDatabases(ctx, backupDomain)
149}
150
151func (r *remoteControlPlane) GetProcessLogs(ctx context.Context, lines int) ([]string, error) {
152	return r.client.GetProcessLogs(ctx, lines)
153}
154
155func (r *remoteControlPlane) GetContainerLogs(ctx context.Context, logDomain string, lines int) ([]string, error) {
156	return r.client.GetContainerLogs(ctx, logDomain, lines)
157}
158
159func (r *remoteControlPlane) StreamProcessLogs(ctx context.Context, lines int) (<-chan string, error) {
160	return r.client.StreamProcessLogs(ctx, lines)
161}
162
163func (r *remoteControlPlane) StreamContainerLogs(ctx context.Context, logDomain string, lines int) (<-chan string, error) {
164	return r.client.StreamContainerLogs(ctx, logDomain, lines)
165}
166
167func (r *remoteControlPlane) ListVolumes(ctx context.Context) ([]dto.Volume, error) {
168	return r.client.ListVolumes(ctx)
169}
170
171func (r *remoteControlPlane) PruneVolumes(ctx context.Context, req dto.VolumePruneRequest) (*dto.VolumePruneResponse, error) {
172	return r.client.PruneVolumes(ctx, req)
173}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close