forked from weaveworks/weave-gitops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.proto
570 lines (488 loc) · 14.3 KB
/
core.proto
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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
/**
* This file holds the protobuf definitions for the Weave GitOps gRPC API.
* Messages and enums are defined in types.proto.
*/
syntax = "proto3";
package gitops_core.v1;
import "google/api/annotations.proto";
import "google/protobuf/any.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "api/core/types.proto";
option go_package = "github.com/weaveworks/weave-gitops/core/api";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "Weave GitOps Core API",
version: "0.1";
description: "The API handles operations for Weave GitOps Core";
};
consumes: "application/json";
produces: "application/json";
};
/**
* Weave GitOps Core API service definition
*/
service Core {
/*
* GetObject gets data about a single primary object from a cluster.
*/
rpc GetObject(GetObjectRequest) returns (GetObjectResponse) {
option (google.api.http) = {
get: "/v1/object/{name}"
};
}
/*
* ListObjects gets data about primary objects.
*/
rpc ListObjects(ListObjectsRequest) returns (ListObjectsResponse) {
option (google.api.http) = {
post: "/v1/objects"
body: "*"
};
}
// Misc
/*
* ListFluxRuntimeObjects lists the flux runtime deployments from a cluster.
*/
rpc ListFluxRuntimeObjects(ListFluxRuntimeObjectsRequest)
returns (ListFluxRuntimeObjectsResponse) {
option (google.api.http) = {
get: "/v1/flux_runtime_objects"
};
}
rpc ListFluxCrds(ListFluxCrdsRequest) returns (ListFluxCrdsResponse) {
option (google.api.http) = {
get: "/v1/flux_crds"
};
}
/*
* ListRuntimeObjects lists Weave GitOps runtime components.
* Weave GitOps runtime is composed of Flux runtime but also other components
* in the ecosystem like TF-controller or Policy Agent.
*/
rpc ListRuntimeObjects(ListRuntimeObjectsRequest)
returns (ListRuntimeObjectsResponse) {
option (google.api.http) = {
get: "/v1/runtime_objects"
};
}
/*
* ListRuntimeCrds lists Weave GitOps runtime components CRDs.
* Weave GitOps runtime is composed of Flux runtime but also other components
* in the ecosystem like TF-controller or Policy Agent.
*/
rpc ListRuntimeCrds(ListRuntimeCrdsRequest)
returns (ListRuntimeCrdsResponse) {
option (google.api.http) = {
get: "/v1/runtime_crds"
};
}
/*
* GetReconciledObjects returns a list of objects that were created
* as a result of reconciling a Flux automation.
* This list is derived by looking at the Kustomization or HelmRelease
* specified in the request body.
*/
rpc GetReconciledObjects(GetReconciledObjectsRequest)
returns (GetReconciledObjectsResponse) {
option (google.api.http) = {
post: "/v1/reconciled_objects"
body: "*"
};
};
/*
* GetChildObjects returns the children of a given object,
* specified by a GroupVersionKind.
* Not all Kubernets objects have children. For example, a Deployment
* has a child ReplicaSet, but a Service has no child objects.
*/
rpc GetChildObjects(GetChildObjectsRequest)
returns (GetChildObjectsResponse) {
option (google.api.http) = {
post: "/v1/child_objects"
body: "*"
};
};
/*
* GetFluxNamespace returns with a namespace with a specific label.
*/
rpc GetFluxNamespace(GetFluxNamespaceRequest)
returns (GetFluxNamespaceResponse) {
option (google.api.http) = {
post: "/v1/namespace/flux"
body: "*"
};
}
/*
* ListNamespaces returns with the list of available namespaces.
*/
rpc ListNamespaces(ListNamespacesRequest) returns (ListNamespacesResponse) {
option (google.api.http) = {
get: "/v1/namespaces"
};
}
/*
* ListEvents returns with a list of events
*/
rpc ListEvents(ListEventsRequest) returns (ListEventsResponse) {
option (google.api.http) = {
get: "/v1/events"
};
}
/*
* SyncResource forces a reconciliation of a Flux resource
*/
rpc SyncFluxObject(SyncFluxObjectRequest) returns (SyncFluxObjectResponse) {
option (google.api.http) = {
post: "/v1/sync"
body: "*"
};
}
/*
* GetVersion returns version information about the server
*/
rpc GetVersion(GetVersionRequest) returns (GetVersionResponse){
option (google.api.http) = {
get: "/v1/version"
};
}
/*
* GetFeatureFlags returns configuration information about the server
*/
rpc GetFeatureFlags(GetFeatureFlagsRequest)
returns (GetFeatureFlagsResponse) {
option (google.api.http) = {
get: "/v1/featureflags"
};
}
/*
* ToggleSuspendResource suspends or resumes a flux object.
*/
rpc ToggleSuspendResource(ToggleSuspendResourceRequest)
returns (ToggleSuspendResourceResponse) {
option (google.api.http) = {
post: "/v1/suspend"
body: "*"
};
}
/*
* GetSessionLogs returns the logs for a given session
*/
rpc GetSessionLogs(GetSessionLogsRequest) returns (GetSessionLogsResponse) {
option (google.api.http) = {
post: "/v1/session_logs"
body: "*"
};
}
/*
* IsCRDAvailable returns with a hashmap where the keys are the names of
* the clusters, and the value is a boolean indicating whether given CRD is
* installed or not on that cluster.
*/
rpc IsCRDAvailable(IsCRDAvailableRequest) returns (IsCRDAvailableResponse) {
option (google.api.http) = {
get : "/v1/crd/is_available",
};
}
rpc GetInventory(GetInventoryRequest) returns (GetInventoryResponse) {
option (google.api.http) = {
get : "/v1/inventory",
};
}
// ListPolicies list policies available on the cluster
rpc ListPolicies(ListPoliciesRequest) returns (ListPoliciesResponse) {
option (google.api.http) = {
get : "/v1/policies"
};
}
// GetPolicy gets a policy by name
rpc GetPolicy(GetPolicyRequest) returns (GetPolicyResponse) {
option (google.api.http) = {
get : "/v1/policies/{policyName}"
};
}
/*
* ListPolicyValidations lists policy validations
*/
rpc ListPolicyValidations(ListPolicyValidationsRequest)
returns (ListPolicyValidationsResponse) {
option (google.api.http) = {
post : "/v1/policyvalidations"
body : "*"
};
}
/*
* GetPolicyValidation gets a policy validation by id
*/
rpc GetPolicyValidation(GetPolicyValidationRequest)
returns (GetPolicyValidationResponse) {
option (google.api.http) = {
get : "/v1/policyvalidations/{validationId}"
};
}
}
message GetInventoryRequest {
string kind = 1;
string name = 2;
string namespace = 3;
string clusterName = 4;
bool withChildren = 5;
}
message GetInventoryResponse {
repeated InventoryEntry entries = 1;
}
message PolicyValidation {
string id = 1;
string message = 2;
string clusterId = 3;
string category = 4;
string severity = 5;
string createdAt = 6;
string entity = 7;
string entityKind = 8;
string namespace = 9;
string violatingEntity = 10;
string description = 11;
string howToSolve = 12;
string name = 13;
string clusterName = 14;
repeated PolicyValidationOccurrence occurrences = 15;
string policyId = 16;
repeated PolicyValidationParam parameters = 17;
}
message ListPolicyValidationsRequest {
string clusterName = 1;
Pagination pagination = 2;
string application = 3;
string namespace = 4;
string kind = 5;
string policyId = 6;
string validationType = 7;
}
message ListPolicyValidationsResponse {
repeated PolicyValidation violations = 1;
int32 total = 2;
string nextPageToken = 3;
repeated ListError errors = 4;
}
message GetPolicyValidationRequest {
string validationId = 1;
string clusterName = 2;
string validationType = 3;
}
message GetPolicyValidationResponse {
PolicyValidation validation = 1;
}
message PolicyValidationOccurrence {
string message = 1;
}
message PolicyValidationParam {
string name = 1;
string type = 2;
google.protobuf.Any value = 3;
bool required = 4;
string configRef = 5;
}
message PolicyParamRepeatedString {
repeated string value = 1;
}
message Pagination {
int32 pageSize = 1;
string pageToken = 2;
}
message ListError {
string clusterName = 1;
string namespace = 2;
string message = 3;
}
message ListFluxRuntimeObjectsRequest {
string namespace = 1;
string clusterName = 2;
}
message ListFluxRuntimeObjectsResponse {
repeated Deployment deployments = 1;
repeated ListError errors = 2;
}
message ListRuntimeObjectsRequest {
string namespace = 1;
string clusterName = 2;
}
message ListRuntimeObjectsResponse {
repeated Deployment deployments = 1;
repeated ListError errors = 2;
}
message ListFluxCrdsRequest {
string clusterName = 1;
}
message ListFluxCrdsResponse {
repeated Crd crds = 1;
repeated ListError errors = 2;
}
message ListRuntimeCrdsRequest {
string clusterName = 1;
}
message ListRuntimeCrdsResponse {
repeated Crd crds = 1;
repeated ListError errors = 2;
}
message GetObjectRequest {
string name = 1;
string namespace = 2;
string kind = 3;
string clusterName = 4;
}
message GetObjectResponse {
Object object = 1;
}
message ListObjectsRequest {
string namespace = 1;
string kind = 2;
string clusterName = 3;
map<string, string> labels = 4;
}
message ClusterNamespaceList {
string clusterName = 1;
repeated string namespaces = 2;
}
message ListObjectsResponse {
repeated Object objects = 1;
repeated ListError errors = 2;
repeated ClusterNamespaceList searchedNamespaces = 3;
}
message GetReconciledObjectsRequest {
string automationName = 1;
string namespace = 2;
string automationKind = 3;
repeated GroupVersionKind kinds = 4;
string clusterName = 5;
}
message GetReconciledObjectsResponse {
repeated Object objects = 1;
}
message GetChildObjectsRequest {
GroupVersionKind groupVersionKind = 1;
string namespace = 2;
string parentUid = 3;
string clusterName = 4;
}
message GetChildObjectsResponse {
repeated Object objects = 1;
}
message GetFluxNamespaceRequest {}
message GetFluxNamespaceResponse {
string name = 1;
}
message ListNamespacesRequest {}
message ListNamespacesResponse {
repeated Namespace namespaces = 1;
}
message ListEventsRequest {
ObjectRef involvedObject = 1;
}
message ListEventsResponse {
repeated Event events = 1;
}
message SyncFluxObjectRequest {
repeated ObjectRef objects = 1;
bool withSource = 2;
}
message SyncFluxObjectResponse {
}
message GetVersionRequest {}
message GetVersionResponse {
string semver = 1;
string commit = 2;
string branch = 3;
string buildTime = 4;
string kubeVersion = 5;
}
message GetFeatureFlagsRequest {}
message GetFeatureFlagsResponse {
map<string, string> flags = 1;
}
message ToggleSuspendResourceRequest {
repeated ObjectRef objects = 1;
bool suspend = 2;
string comment = 3;
}
message ToggleSuspendResourceResponse {
}
message GetSessionLogsRequest {
string sessionNamespace = 1;
string sessionId = 2;
string token = 3;
string logSourceFilter = 4;
string logLevelFilter = 5;
}
message LogEntry {
string timestamp = 1;
string source = 2;
string level = 3;
string message = 4;
string sortingKey = 5;
}
message GetSessionLogsResponse {
repeated LogEntry logs = 1;
string nextToken = 2;
string error = 3;
repeated string logSources = 4;
}
message IsCRDAvailableRequest {
string name = 1;
}
message IsCRDAvailableResponse {
map<string,bool> clusters = 1;
}
message ListPoliciesRequest {
string clusterName = 1;
Pagination pagination = 2;
}
message ListPoliciesResponse {
repeated PolicyObj policies = 1;
int32 total = 2;
string nextPageToken = 3;
repeated ListError errors = 4;
}
message GetPolicyRequest {
string policyName = 1;
string clusterName = 2;
}
message GetPolicyResponse {
PolicyObj policy = 1;
string clusterName = 2;
}
message PolicyObj {
string name = 1;
string id = 2;
string code = 3;
string description = 4;
string howToSolve = 5;
string category = 6;
repeated string tags = 7;
string severity = 8;
repeated PolicyStandard standards = 9;
string gitCommit = 10;
repeated PolicyParam parameters = 11;
PolicyTargets targets = 12;
string createdAt = 13;
string clusterName = 14;
string tenant = 15;
repeated string modes = 16;
}
message PolicyStandard {
string id = 1;
repeated string controls = 2;
}
message PolicyParam {
string name = 1;
string type = 2;
// value is a generic value that can be a string, int, bool and array of
// strings
google.protobuf.Any value = 3;
bool required = 4;
}
message PolicyTargets {
repeated string kinds = 1;
repeated PolicyTargetLabel labels = 2;
repeated string namespaces = 3;
}
message PolicyTargetLabel { map<string, string> values = 1; }