v2.31.0-dev18 7b9923f

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	_, err := r.RemoveRouteWithCleanup(ctx, routeDomain)
45	return err
46}
47
48func (r *remoteControlPlane) RemoveRouteWithCleanup(ctx context.Context, routeDomain string) (*dto.RouteDeleteResponse, error) {
49	return r.client.RemoveRouteWithCleanup(ctx, routeDomain)
50}
51
52func (r *remoteControlPlane) Bootstrap(ctx context.Context, req dto.BootstrapRequest) (*dto.BootstrapResponse, error) {
53	return r.client.Bootstrap(ctx, req)
54}
55
56func (r *remoteControlPlane) ListSecretsWithAttachments(ctx context.Context, secretDomain string) (*remote.SecretsListResult, error) {
57	return r.client.ListSecretsWithAttachments(ctx, secretDomain)
58}
59
60func (r *remoteControlPlane) SetSecrets(ctx context.Context, secretDomain string, secrets map[string]string) error {
61	return r.client.SetSecrets(ctx, secretDomain, secrets)
62}
63
64func (r *remoteControlPlane) DeleteSecret(ctx context.Context, secretDomain, key string) error {
65	return r.client.DeleteSecret(ctx, secretDomain, key)
66}
67
68func (r *remoteControlPlane) SetAttachmentSecrets(ctx context.Context, domainName, service string, secrets map[string]string) error {
69	return r.client.SetAttachmentSecrets(ctx, domainName, service, secrets)
70}
71
72func (r *remoteControlPlane) DeleteAttachmentSecret(ctx context.Context, domainName, service, key string) error {
73	return r.client.DeleteAttachmentSecret(ctx, domainName, service, key)
74}
75
76func (r *remoteControlPlane) ListOrphanedAttachments(ctx context.Context) ([]domain.CleanupAttachment, error) {
77	return r.client.ListOrphanedAttachments(ctx)
78}
79
80func (r *remoteControlPlane) CleanupOrphanedAttachments(ctx context.Context, owner string, stop bool) (*domain.CleanupReport, error) {
81	return r.client.CleanupOrphanedAttachments(ctx, owner, stop)
82}
83
84func (r *remoteControlPlane) GetAllAttachmentsConfig(ctx context.Context) (map[string][]string, error) {
85	return r.client.GetAllAttachmentsConfig(ctx)
86}
87
88func (r *remoteControlPlane) GetAttachmentsConfig(ctx context.Context, domainOrGroup string) ([]string, error) {
89	return r.client.GetAttachmentsConfig(ctx, domainOrGroup)
90}
91
92func (r *remoteControlPlane) FindAttachmentTargetsByImage(ctx context.Context, imageName string) ([]string, error) {
93	return r.client.FindAttachmentTargetsByImage(ctx, imageName)
94}
95
96func (r *remoteControlPlane) AddAttachment(ctx context.Context, domainOrGroup, image string) error {
97	return r.client.AddAttachment(ctx, domainOrGroup, image)
98}
99
100func (r *remoteControlPlane) RemoveAttachment(ctx context.Context, domainOrGroup, image string) error {
101	return r.client.RemoveAttachment(ctx, domainOrGroup, image)
102}
103
104func (r *remoteControlPlane) GetAutoRouteAllowedDomains(ctx context.Context) ([]string, error) {
105	return r.client.GetAutoRouteAllowedDomains(ctx)
106}
107
108func (r *remoteControlPlane) AddAutoRouteAllowedDomain(ctx context.Context, pattern string) error {
109	return r.client.AddAutoRouteAllowedDomain(ctx, pattern)
110}
111
112func (r *remoteControlPlane) RemoveAutoRouteAllowedDomain(ctx context.Context, pattern string) error {
113	return r.client.RemoveAutoRouteAllowedDomain(ctx, pattern)
114}
115
116func (r *remoteControlPlane) GetStatus(ctx context.Context) (*remote.Status, error) {
117	return r.client.GetStatus(ctx)
118}
119
120func (r *remoteControlPlane) GetTLSStatus(ctx context.Context) (*dto.TLSStatusResponse, error) {
121	return r.client.GetTLSStatus(ctx)
122}
123
124func (r *remoteControlPlane) Reload(ctx context.Context) error {
125	return r.client.Reload(ctx)
126}
127
128func (r *remoteControlPlane) ListNetworks(ctx context.Context) ([]*domain.NetworkInfo, error) {
129	return r.client.ListNetworks(ctx)
130}
131
132func (r *remoteControlPlane) GetConfig(ctx context.Context) (*remote.Config, error) {
133	return r.client.GetConfig(ctx)
134}
135
136func (r *remoteControlPlane) DeployIntent(ctx context.Context, imageName string) error {
137	return r.client.DeployIntent(ctx, imageName)
138}
139
140func (r *remoteControlPlane) Deploy(ctx context.Context, deployDomain string) (*remote.DeployResult, error) {
141	return r.client.Deploy(ctx, deployDomain)
142}
143
144func (r *remoteControlPlane) Restart(ctx context.Context, restartDomain string, withAttachments bool) (*remote.RestartResult, error) {
145	return r.client.Restart(ctx, restartDomain, withAttachments)
146}
147
148func (r *remoteControlPlane) ListTags(ctx context.Context, repository string) ([]string, error) {
149	return r.client.ListTags(ctx, repository)
150}
151
152func (r *remoteControlPlane) ListBackups(ctx context.Context, backupDomain string) ([]dto.BackupJob, error) {
153	return r.client.ListBackups(ctx, backupDomain)
154}
155
156func (r *remoteControlPlane) BackupStatus(ctx context.Context) ([]dto.BackupJob, error) {
157	return r.client.BackupStatus(ctx)
158}
159
160func (r *remoteControlPlane) RunBackup(ctx context.Context, backupDomain, dbName string) (*dto.BackupRunResponse, error) {
161	return r.client.RunBackup(ctx, backupDomain, dbName)
162}
163
164func (r *remoteControlPlane) DetectDatabases(ctx context.Context, backupDomain string) ([]dto.DatabaseInfo, error) {
165	return r.client.DetectDatabases(ctx, backupDomain)
166}
167
168func (r *remoteControlPlane) GetProcessLogs(ctx context.Context, lines int) ([]string, error) {
169	return r.client.GetProcessLogs(ctx, lines)
170}
171
172func (r *remoteControlPlane) GetContainerLogs(ctx context.Context, logDomain string, lines int) ([]string, error) {
173	return r.client.GetContainerLogs(ctx, logDomain, lines)
174}
175
176func (r *remoteControlPlane) StreamProcessLogs(ctx context.Context, lines int) (<-chan string, error) {
177	return r.client.StreamProcessLogs(ctx, lines)
178}
179
180func (r *remoteControlPlane) StreamContainerLogs(ctx context.Context, logDomain string, lines int) (<-chan string, error) {
181	return r.client.StreamContainerLogs(ctx, logDomain, lines)
182}
183
184func (r *remoteControlPlane) ListVolumes(ctx context.Context) ([]dto.Volume, error) {
185	return r.client.ListVolumes(ctx)
186}
187
188func (r *remoteControlPlane) PruneVolumes(ctx context.Context, req dto.VolumePruneRequest) (*dto.VolumePruneResponse, error) {
189	return r.client.PruneVolumes(ctx, req)
190}

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