-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathendpoints.go
More file actions
261 lines (236 loc) · 8.82 KB
/
endpoints.go
File metadata and controls
261 lines (236 loc) · 8.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
// Code generated by goa v3.19.1, DO NOT EDIT.
//
// control-plane endpoints
//
// Command:
// $ goa gen github.com/pgEdge/control-plane/api/design
package controlplane
import (
"context"
goa "goa.design/goa/v3/pkg"
)
// Endpoints wraps the "control-plane" service endpoints.
type Endpoints struct {
InitCluster goa.Endpoint
JoinCluster goa.Endpoint
GetJoinToken goa.Endpoint
GetJoinOptions goa.Endpoint
InspectCluster goa.Endpoint
ListHosts goa.Endpoint
InspectHost goa.Endpoint
RemoveHost goa.Endpoint
ListDatabases goa.Endpoint
CreateDatabase goa.Endpoint
GetDatabase goa.Endpoint
UpdateDatabase goa.Endpoint
DeleteDatabase goa.Endpoint
BackupDatabaseNode goa.Endpoint
ListDatabaseTasks goa.Endpoint
InspectDatabaseTask goa.Endpoint
GetDatabaseTaskLog goa.Endpoint
RestoreDatabase goa.Endpoint
GetVersion goa.Endpoint
}
// NewEndpoints wraps the methods of the "control-plane" service with endpoints.
func NewEndpoints(s Service) *Endpoints {
return &Endpoints{
InitCluster: NewInitClusterEndpoint(s),
JoinCluster: NewJoinClusterEndpoint(s),
GetJoinToken: NewGetJoinTokenEndpoint(s),
GetJoinOptions: NewGetJoinOptionsEndpoint(s),
InspectCluster: NewInspectClusterEndpoint(s),
ListHosts: NewListHostsEndpoint(s),
InspectHost: NewInspectHostEndpoint(s),
RemoveHost: NewRemoveHostEndpoint(s),
ListDatabases: NewListDatabasesEndpoint(s),
CreateDatabase: NewCreateDatabaseEndpoint(s),
GetDatabase: NewGetDatabaseEndpoint(s),
UpdateDatabase: NewUpdateDatabaseEndpoint(s),
DeleteDatabase: NewDeleteDatabaseEndpoint(s),
BackupDatabaseNode: NewBackupDatabaseNodeEndpoint(s),
ListDatabaseTasks: NewListDatabaseTasksEndpoint(s),
InspectDatabaseTask: NewInspectDatabaseTaskEndpoint(s),
GetDatabaseTaskLog: NewGetDatabaseTaskLogEndpoint(s),
RestoreDatabase: NewRestoreDatabaseEndpoint(s),
GetVersion: NewGetVersionEndpoint(s),
}
}
// Use applies the given middleware to all the "control-plane" service
// endpoints.
func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint) {
e.InitCluster = m(e.InitCluster)
e.JoinCluster = m(e.JoinCluster)
e.GetJoinToken = m(e.GetJoinToken)
e.GetJoinOptions = m(e.GetJoinOptions)
e.InspectCluster = m(e.InspectCluster)
e.ListHosts = m(e.ListHosts)
e.InspectHost = m(e.InspectHost)
e.RemoveHost = m(e.RemoveHost)
e.ListDatabases = m(e.ListDatabases)
e.CreateDatabase = m(e.CreateDatabase)
e.GetDatabase = m(e.GetDatabase)
e.UpdateDatabase = m(e.UpdateDatabase)
e.DeleteDatabase = m(e.DeleteDatabase)
e.BackupDatabaseNode = m(e.BackupDatabaseNode)
e.ListDatabaseTasks = m(e.ListDatabaseTasks)
e.InspectDatabaseTask = m(e.InspectDatabaseTask)
e.GetDatabaseTaskLog = m(e.GetDatabaseTaskLog)
e.RestoreDatabase = m(e.RestoreDatabase)
e.GetVersion = m(e.GetVersion)
}
// NewInitClusterEndpoint returns an endpoint function that calls the method
// "init-cluster" of service "control-plane".
func NewInitClusterEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
return s.InitCluster(ctx)
}
}
// NewJoinClusterEndpoint returns an endpoint function that calls the method
// "join-cluster" of service "control-plane".
func NewJoinClusterEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
p := req.(*ClusterJoinToken)
return nil, s.JoinCluster(ctx, p)
}
}
// NewGetJoinTokenEndpoint returns an endpoint function that calls the method
// "get-join-token" of service "control-plane".
func NewGetJoinTokenEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
return s.GetJoinToken(ctx)
}
}
// NewGetJoinOptionsEndpoint returns an endpoint function that calls the method
// "get-join-options" of service "control-plane".
func NewGetJoinOptionsEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
p := req.(*ClusterJoinRequest)
return s.GetJoinOptions(ctx, p)
}
}
// NewInspectClusterEndpoint returns an endpoint function that calls the method
// "inspect-cluster" of service "control-plane".
func NewInspectClusterEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
return s.InspectCluster(ctx)
}
}
// NewListHostsEndpoint returns an endpoint function that calls the method
// "list-hosts" of service "control-plane".
func NewListHostsEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
return s.ListHosts(ctx)
}
}
// NewInspectHostEndpoint returns an endpoint function that calls the method
// "inspect-host" of service "control-plane".
func NewInspectHostEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
p := req.(*InspectHostPayload)
return s.InspectHost(ctx, p)
}
}
// NewRemoveHostEndpoint returns an endpoint function that calls the method
// "remove-host" of service "control-plane".
func NewRemoveHostEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
p := req.(*RemoveHostPayload)
return nil, s.RemoveHost(ctx, p)
}
}
// NewListDatabasesEndpoint returns an endpoint function that calls the method
// "list-databases" of service "control-plane".
func NewListDatabasesEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
res, err := s.ListDatabases(ctx)
if err != nil {
return nil, err
}
vres := NewViewedDatabaseCollection(res, "abbreviated")
return vres, nil
}
}
// NewCreateDatabaseEndpoint returns an endpoint function that calls the method
// "create-database" of service "control-plane".
func NewCreateDatabaseEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
p := req.(*CreateDatabaseRequest)
return s.CreateDatabase(ctx, p)
}
}
// NewGetDatabaseEndpoint returns an endpoint function that calls the method
// "get-database" of service "control-plane".
func NewGetDatabaseEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
p := req.(*GetDatabasePayload)
res, err := s.GetDatabase(ctx, p)
if err != nil {
return nil, err
}
vres := NewViewedDatabase(res, "default")
return vres, nil
}
}
// NewUpdateDatabaseEndpoint returns an endpoint function that calls the method
// "update-database" of service "control-plane".
func NewUpdateDatabaseEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
p := req.(*UpdateDatabasePayload)
return s.UpdateDatabase(ctx, p)
}
}
// NewDeleteDatabaseEndpoint returns an endpoint function that calls the method
// "delete-database" of service "control-plane".
func NewDeleteDatabaseEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
p := req.(*DeleteDatabasePayload)
return s.DeleteDatabase(ctx, p)
}
}
// NewBackupDatabaseNodeEndpoint returns an endpoint function that calls the
// method "backup-database-node" of service "control-plane".
func NewBackupDatabaseNodeEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
p := req.(*BackupDatabaseNodePayload)
return s.BackupDatabaseNode(ctx, p)
}
}
// NewListDatabaseTasksEndpoint returns an endpoint function that calls the
// method "list-database-tasks" of service "control-plane".
func NewListDatabaseTasksEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
p := req.(*ListDatabaseTasksPayload)
return s.ListDatabaseTasks(ctx, p)
}
}
// NewInspectDatabaseTaskEndpoint returns an endpoint function that calls the
// method "inspect-database-task" of service "control-plane".
func NewInspectDatabaseTaskEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
p := req.(*InspectDatabaseTaskPayload)
return s.InspectDatabaseTask(ctx, p)
}
}
// NewGetDatabaseTaskLogEndpoint returns an endpoint function that calls the
// method "get-database-task-log" of service "control-plane".
func NewGetDatabaseTaskLogEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
p := req.(*GetDatabaseTaskLogPayload)
return s.GetDatabaseTaskLog(ctx, p)
}
}
// NewRestoreDatabaseEndpoint returns an endpoint function that calls the
// method "restore-database" of service "control-plane".
func NewRestoreDatabaseEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
p := req.(*RestoreDatabasePayload)
return s.RestoreDatabase(ctx, p)
}
}
// NewGetVersionEndpoint returns an endpoint function that calls the method
// "get-version" of service "control-plane".
func NewGetVersionEndpoint(s Service) goa.Endpoint {
return func(ctx context.Context, req any) (any, error) {
return s.GetVersion(ctx)
}
}