-
Notifications
You must be signed in to change notification settings - Fork 4
/
api.proto
2973 lines (2596 loc) · 86.5 KB
/
api.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
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/// Please use the following editor setup for this file:
// Tab size=4; Tabs as spaces; Clean up trailing whitepsace
// 'make proto' will run clang-format to fix formatiing
syntax = "proto3";
option go_package = "api";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "pkg/apis/v1/common.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option (gogoproto.populate_all) = true;
option (gogoproto.equal_all) = true;
option (gogoproto.testgen_all) = true;
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
security_definitions : {
security : {
key : "bearer"
value : {
type : TYPE_API_KEY
in : IN_HEADER
name : "Authorization"
description : "Authentication token, prefixed by Bearer: "
"Bearer <token>"
}
}
}
security : {security_requirement : {key : "bearer"}}
};
message OrganizationObject {
Metadata metadata = 1 [ (gogoproto.embed) = true ];
}
message ClusterInfo {
PXConfig px_config = 1 [ (gogoproto.jsontag) = "pxconfig" ];
string kubeconfig = 2 [
(gogoproto.jsontag) = "kubeconfig",
(gogoproto.moretags) = "secure:\"true\""
];
// cloud_credential is deprecated, not to be used.
string cloud_credential = 3;
StatusInfo status = 4;
// delete_backups indicates whether backups created by cluster owner that belong to the cluster need to
// be deleted or retained. This flag can be set by cluster owner with any role during cluster deletion
bool delete_backups = 5;
// delete_restores will determine whether the restore
// belong to given cluster needs to be deleted or not.
bool delete_restores = 6;
string stork_version = 7;
ObjectRef cloud_credential_ref = 8;
BackupShare add_backup_share = 9;
BackupShare del_backup_share = 10;
BackupShareStatusInfo backup_share_status_info = 11;
repeated string owner_group_list = 12;
ObjectRef platform_credential_ref = 13;
// Teleport cluster ID
string teleport_cluster_id = 14;
// Tenant ID
string tenant_id = 15;
string service_token = 16 [
(gogoproto.jsontag) = "servicetoken",
(gogoproto.moretags) = "secure:\"true\""
];
Provider provider = 17;
string k8s_version = 18;
// map[user]BackupShare details for shared user of the cluster
// contains cluster level backup shared by non owner of the cluster
map<string, BackupShare> add_user_backup_share = 19;
// contains map[user]BackupShare details to be deleted for cluster level backups of
// non owner of the cluster
map<string, BackupShare> del_user_backup_share = 20;
// deleted_by uid of the user who initiated cluster delete
string deleted_by = 21;
// delete_all_cluster_backups indicates whether all the backups(created by cluster owner, super admins and all the shared users)
// on the cluster need to be deleted or retained. This flag can be set only by SuperAdmin while deleting the cluster
bool delete_all_cluster_backups = 22;
// Message for maintaining status of the cluster.
message StatusInfo {
enum Status {
Invalid = 0;
Online = 1;
Offline = 2;
DeletePending = 3;
// Pending If a cluster addition is in pending state
Pending = 4;
// Failed If a cluster failed to be added
Failed = 5;
// Success If cluster was successfully added but not Online yet
Success = 6;
}
Status status = 1;
string reason = 2;
}
// Message for maintaining status of the backup share.
message BackupShareStatusInfo {
Status status = 1;
string reason = 2;
enum Status {
Invalid = 0;
// InProgress if backupshare is going on for backups belonging to
// the cluster
InProgress = 1;
// Failed if backupshare fails for some backups belonging to the
// cluster
Failed = 2;
// Success if backupshare is successful for all current backups
// belonging to the cluster
Success = 3;
// Parital Success if backupshare is successful for only few
// backups.
PartialSuccess = 4;
}
}
// Cloud provider type
enum Provider {
Invalid = 0;
AWS = 1;
Azure = 2;
Google = 3;
IBM = 4;
Rancher = 5;
}
}
message ClusterObject {
Metadata metadata = 1 [ (gogoproto.embed) = true ];
ClusterInfo clusterInfo = 2
[ (gogoproto.jsontag) = "clusterinfo", (gogoproto.embed) = true ];
}
message PXConfig {
string access_token = 1 [ (gogoproto.jsontag) = "accesstoken" ];
}
message AWSConfig {
string access_key = 1 [ (gogoproto.jsontag) = "accesskey" ];
string secret_key = 2 [
(gogoproto.jsontag) = "secretkey",
(gogoproto.moretags) = "secure:\"true\""
];
}
message IBMConfig {
string api_key = 1 [
(gogoproto.jsontag) = "api_key",
(gogoproto.moretags) = "secure:\"true\""
];
}
message RancherConfig {
string endpoint = 1 [ (gogoproto.jsontag) = "endpoint" ];
string token = 2 [
(gogoproto.jsontag) = "token",
(gogoproto.moretags) = "secure:\"true\""
];
}
message S3Config {
string endpoint = 1;
string region = 2;
bool disable_ssl = 3;
bool disable_path_style = 4;
string storage_class = 5;
// Server side encryption type name
// Currently supporting only SSE-S3 and SSE-KMS type alone.
Sse sse_type = 6;
// Azure environment type
// Currently supporting only AZURE_GLOBAL and AZURE_CHINA
AzureEnvironmentType azure_environment = 7;
// Azure resource group name. This is needed in the case of azure immutable bucket to get the retention period (optional)
string azure_resource_group_name = 8;
message AzureEnvironmentType {
Type type = 1;
enum Type {
Invalid = 0;
// Azure public environment
AZURE_GLOBAL = 1;
// Azure china environment
AZURE_CHINA = 2;
}
}
enum Sse {
Invalid = 0;
// Server-side encryption with AWS S3 managed keys
SSE_S3 = 1;
// Server-side encryption with AWS Key Management Service
SSE_KMS = 2;
}
}
message AzureConfig {
string account_name = 1;
string account_key = 2 [
(gogoproto.jsontag) = "accountkey",
(gogoproto.moretags) = "secure:\"true\""
];
string client_secret = 3 [
(gogoproto.jsontag) = "clientsecret",
(gogoproto.moretags) = "secure:\"true\""
];
string client_id = 4 [
(gogoproto.jsontag) = "clientid",
(gogoproto.moretags) = "secure:\"true\""
];
string tenant_id = 5 [
(gogoproto.jsontag) = "tenantid",
(gogoproto.moretags) = "secure:\"true\""
];
// TODO: Need to see if this has to be here or in the backup object.
string subscription_id = 6 [
(gogoproto.jsontag) = "subscriptionid",
(gogoproto.moretags) = "secure:\"true\""
];
}
message GoogleConfig {
string project_id = 1;
string json_key = 2 [
(gogoproto.jsontag) = "jsonkey",
(gogoproto.moretags) = "secure:\"true\""
];
}
message CloudCredentialInfo {
Type type = 1;
enum Type {
Invalid = 0;
AWS = 1;
Azure = 2;
Google = 3;
IBM = 4;
Rancher = 5;
}
oneof config {
AWSConfig aws_config = 100;
AzureConfig azure_config = 101;
GoogleConfig google_config = 102;
IBMConfig ibm_config = 103;
RancherConfig rancher_config = 104;
}
}
message CloudCredentialObject {
Metadata metadata = 1
[ (gogoproto.jsontag) = "metadata", (gogoproto.embed) = true ];
CloudCredentialInfo cloud_credential_info = 2;
}
message SchedulePolicyInfo {
IntervalPolicy interval = 1;
DailyPolicy daily = 2;
WeeklyPolicy weekly = 3;
MonthlyPolicy monthly = 4;
// list of backup schedule object that uses this schedule policy.
repeated string backup_schedule = 5;
// for_object_lock should be set, if this policy is planned to be used with
// locked bucket while taking backup.
bool for_object_lock = 6;
// auto-delete - this option is to indicate, whether the backup
// should be deleted after the retention of the backup object is expired
bool auto_delete = 7;
message IncrementalCount {
uint64 count = 1 [ (gogoproto.jsontag) = "count" ];
}
message IntervalPolicy {
// Interval in minutes at which an action should be triggered.
int64 minutes = 1;
// Number of objects to retain for interval policy, default value is 10.
int64 retain = 2;
// Number of incremental snapshots to take before taking a full
// snapshot.
IncrementalCount incremental_count = 3;
}
message DailyPolicy {
// Time, when the policy should be triggered. Expected format is
// time.Kitchen eg 12:04PM or 12:04pm.
string time = 1;
// Number of objects to retain for daily policy, default value is 10.
int64 retain = 2;
// Number of incremental snapshots to take before taking a full
// snapshot.
IncrementalCount incremental_count = 3;
}
message WeeklyPolicy {
// Day of the week when the policy should be triggered.
// For example, sunday or sun
string day = 1;
// Time, when the policy should be triggered. Expected format is
// time.Kitchen eg 12:04PM or 12:04pm.
string time = 2;
// Number of objects to retain for weekly policy, default value is 10.
int64 retain = 3;
// Number of incremental snapshots to take before taking a full
// snapshot.
IncrementalCount incremental_count = 4;
}
message MonthlyPolicy {
// Date of the month when the policy should be triggered. If a given
// date
// doesn't exist in a month it'll rollover to the next date of the
// month.
// For example if 31 is specified, it'll trigger on either 1st or 2nd
// March
// depending on if it is a leap year.
int64 date = 1;
// Time, when the policy should be triggered. Expected format is
// time.Kitchen eg 12:04PM or 12:04pm.
string time = 2;
// Number of objects to retain for monthly policy, default value is 10.
int64 retain = 3;
// Number of incremental snapshots to take before taking a full
// snapshot.
IncrementalCount incremental_count = 4;
}
}
message SchedulePolicyObject {
Metadata metadata = 1
[ (gogoproto.jsontag) = "metadata", (gogoproto.embed) = true ];
SchedulePolicyInfo schedule_policy_info = 2 [ (gogoproto.embed) = true ];
}
message BackupScheduleInfo {
// schedule_policy is deprecated, not to be used.
string schedule_policy = 1;
bool suspend = 2;
ReclaimPolicyType reclaim_policy = 3;
map<string, StatusInfoList> backup_status = 4;
// Name of BackupLocation, is deprecated. Not to be used.
string backup_location = 5;
// Name of Cluster
string cluster = 6;
// Namespaces to backup. Only an admin can provide multiple namespaces
repeated string namespaces = 7;
// Label selectors to choose resources
map<string, string> label_selectors = 8;
// pre_exec_rule and post_exec_rule is deprecated. Not to be used.
string pre_exec_rule = 9;
string post_exec_rule = 10;
bool delete_backups = 11;
StatusInfo status = 12;
SuspendedBy suspended_by = 13;
repeated ResourceInfo include_resources = 14;
string stork_version = 15;
// deprecated, not to be used.
string csi_snapshot_class_name = 16;
repeated string resource_types = 17;
ObjectRef schedule_policy_ref = 18;
ObjectRef backup_location_ref = 19;
ObjectRef pre_exec_rule_ref = 20;
ObjectRef post_exec_rule_ref = 21;
// To get type of backup (generic or non-generic)
BackupType backup_type = 22;
// Label selectors to choose namespaces
string ns_label_selectors = 23;
// Target namespace of CR
string target_namespace = 24;
ObjectRef cluster_ref = 25;
// backup object type is all namespace or virtualMachine specific backup
BackupObjectType backup_object_type = 26;
// Skip auto rules for VirtualMachine Backup Object type
bool skip_vm_auto_exec_rules = 27;
// volume snapshot class mapping for csi based backup <provisioner(string), volumesnapshotclass(string)> (optional)
map<string, string> volume_snapshot_class_mapping = 28;
// option to take backup as direct kdmp
bool direct_kdmp = 29;
message BackupType {
Type type = 1;
enum Type {
Invalid = 0;
Generic = 1;
Normal = 2;
}
}
message SuspendedBy {
Source source = 1;
enum Source {
Invalid = 0;
User = 1;
LicenseCheck = 2;
}
}
message StatusInfoList { repeated StatusInfo status = 1; }
message StatusInfo {
// backup name
string backup_name = 1;
google.protobuf.Timestamp create_time = 2;
google.protobuf.Timestamp finish_time = 3;
Status status = 4;
string Reason = 5;
enum Status {
Invalid = 0;
Pending = 1;
InProgress = 2;
Aborted = 3;
Failed = 4;
Deleting = 5;
Success = 6;
Captured = 7;
PartialSuccess = 8;
DeletePending = 9;
}
}
enum ReclaimPolicyType {
Invalid = 0;
Delete = 1;
Retain = 2;
}
message BackupObjectType {
Type type = 1;
enum Type {
Invalid = 0;
All = 1; // for All application backup
VirtualMachine = 2; // virtualMachine for VirtualMachine specific backup
}
}
}
message BackupScheduleObject {
Metadata metadata = 1
[ (gogoproto.jsontag) = "metadata", (gogoproto.embed) = true ];
BackupScheduleInfo backup_schedule_info = 2 [ (gogoproto.embed) = true ];
}
message NFSConfig {
string server_addr = 1;
string sub_path = 2;
string mount_option = 3;
}
message completionTimeInfo {
// This will store timestamp for the completion of volumes
google.protobuf.Timestamp volumes_completion_time = 1;
// This will store timestamp for the completion of resources
google.protobuf.Timestamp resources_completion_time = 2;
// This will store the total completion time of the entire backup/restore
google.protobuf.Timestamp total_completion_time = 3;
}
message BackupLocationInfo {
Type type = 1;
string path = 2;
string encryption_key = 3 [
(gogoproto.jsontag) = "encryptionkey",
(gogoproto.moretags) = "secure:\"true\""
];
// cloud_credential is deprecated, not to be used.
string cloud_credential = 4;
StatusInfo status = 5;
bool delete_backups = 6;
bool validate_cloud_credential = 7;
ObjectRef cloud_credential_ref = 8;
bool object_lock_enabled = 9;
// Message for maintaining status of the object.
message StatusInfo {
Status status = 1;
string reason = 2;
enum Status {
Invalid = 0;
Valid = 1;
DeletePending = 2;
ValidationInProgress = 3;
ValidationFailed = 4;
// If a BL is being used for partial backup, mark it as LimitedAvailability.
LimitedAvailability = 5;
}
}
enum Type {
Invalid = 0;
S3 = 1;
Azure = 2;
Google = 3;
NFS = 4;
}
oneof config {
S3Config s3_config = 100;
NFSConfig nfs_config = 101;
}
}
message BackupLocationObject {
Metadata metadata = 1
[ (gogoproto.jsontag) = "metadata", (gogoproto.embed) = true ];
BackupLocationInfo backup_location_info = 2;
}
message ResourceInfo {
string name = 1;
string namespace = 2;
string group = 3;
string kind = 4;
string version = 5;
}
message BackupInfo {
// Name of BackupLocation, deprecated. Not to be used.
string backup_location = 1;
// Name of Cluster
string cluster = 2;
// Namespaces to backup. Only an admin can provide multiple namespaces
repeated string namespaces = 3;
// Label selectors to choose resources
map<string, string> label_selectors = 4;
StatusInfo status = 5;
repeated ResourceInfo resources = 6;
repeated Volume volumes = 7;
string backup_path = 8;
Stage stage = 9;
// pre_exec_rule and post_exec_rule are deprecated, not to be used,
string pre_exec_rule = 10;
string post_exec_rule = 11;
// Name of the backup schedule, if the backup was taken by schedule through
// px-backup.
// Otherwise it will be empty.
BackupSchedule backup_schedule = 12;
string cr_name = 13;
uint64 total_size = 14;
// Reference to cloud credential object used for backup.
// cloud_credential is deprecated, not to be used.
string cloud_credential = 15;
repeated ResourceInfo include_resources = 16;
uint64 resource_count = 17;
string stork_version = 18;
// deprecated, not to be used.
string csi_snapshot_class_name = 19;
repeated string resource_types = 20;
ObjectRef backup_location_ref = 21;
ObjectRef pre_exec_rule_ref = 22;
ObjectRef post_exec_rule_ref = 23;
ObjectRef cloud_credential_ref = 24;
// To get type of backup (generic or non-generic)
BackupType backup_type = 25;
string cr_uid = 26;
int64 retention_period = 27;
BackupShare backup_share = 28;
BackupShare.AccessType user_backupshare_access = 29;
ObjectRef cluster_ref = 30;
string ns_label_selectors = 31;
// Name of rancher projects associated with resources
map<string, string> rancher_projects = 32;
// Target namespace of CR
string target_namespace = 33;
// this flag signifies if the backup involves large number of resources or not
bool large_resource_enabled = 34;
// backup object type is all namespace or virtualMachine specific backup
BackupObjectType backup_object_type = 35;
// Skip auto rules for VirtualMachine Backup Object type
bool skip_vm_auto_exec_rules = 36;
// volume snapshot class mapping for csi based backup <provisioner(string), volumesnapshotclass(string)> (optional)
map<string, string> volume_snapshot_class_mapping = 37;
// option to take backup as direct kdmp
bool direct_kdmp = 38;
// this will store the timestamp, when the retention period of locked backup will be expired
google.protobuf.Timestamp retention_time = 39;
// this will store the completion time of the volumes, resources and total backup
completionTimeInfo completion_time_info = 40;
message BackupType {
Type type = 1;
enum Type {
Invalid = 0;
Generic = 1;
Normal = 2;
}
}
message BackupSchedule {
string uid = 1;
string name = 2;
}
message Volume {
string name = 1;
string namespace = 2;
string pvc = 3;
string backup_id = 4;
StatusInfo status = 5;
string driver_name = 6;
repeated string zones = 7;
map<string, string> options = 8;
uint64 total_size = 9;
// actual size of the backup
// incase of incremental, it's the incremental backup size
uint64 actual_size = 10;
string storage_class = 11;
string pvc_id = 12;
string provisioner = 13;
string volumesnapshot = 14;
// As part of restrictive PSA setting, if an UID or GID is used during backup then same value should be used during restore (optional)
JobSecurityContext job_security_context = 15;
message JobSecurityContext {
int64 runAsUser = 1;
int64 runAsGroup = 2;
}
}
// Message for maintaining status of the object.
message StatusInfo {
Status status = 1;
string reason = 2;
enum Status {
Invalid = 0;
Pending = 1;
InProgress = 2;
Aborted = 3;
Failed = 4;
Deleting = 5;
Success = 6;
Captured = 7;
PartialSuccess = 8;
DeletePending = 9;
CloudBackupMissing = 10;
}
}
enum Stage {
Invalid = 0;
Initial = 1;
PreExecRule = 2;
PostExecRule = 3;
Volumes = 4;
Applications = 5;
Final = 6;
}
message BackupObjectType {
Type type= 1;
enum Type {
Invalid = 0;
All = 1; // for All application backup
VirtualMachine = 2; // virtualMachine for VirtualMachine specific backup
}
}
}
// Message for Backup object which will be stored in Datastore.
message BackupObject {
Metadata metadata = 1 [ (gogoproto.embed) = true ];
BackupInfo backup_info = 2 [ (gogoproto.embed) = true ];
}
// Message for passing pre and post exec rules for backup
message RulesInfo {
repeated RuleItem rules = 1 [ (gogoproto.moretags) = "yaml:\"rules\"" ];
message RuleItem {
map<string, string> pod_selector = 1
[ (gogoproto.moretags) = "yaml:\"podSelector\"" ];
repeated Action actions = 2
[ (gogoproto.moretags) = "yaml:\"actions\"" ];
string container = 3;
}
message Action {
bool background = 1 [ (gogoproto.moretags) = "yaml:\"background\"" ];
bool run_in_single_pod = 2
[ (gogoproto.moretags) = "yaml:\"runInSinglePod\"" ];
string value = 3;
}
}
message RuleObject {
Metadata metadata = 1 [ (gogoproto.embed) = true ];
RulesInfo rules_info = 2 [ (gogoproto.embed) = true ];
}
message ReplacePolicy {
enum Type {
Invalid = 0;
Retain = 1;
Delete = 2;
}
}
// Message for restore info
message RestoreInfo {
// backup is deprecated, not to be used.
string backup = 1;
// Name of backup location to restore from.
// backup_location is deprecated, not to be used.
string backup_location = 2;
// Label selectors to choose resources
map<string, string> label_selectors = 3;
// Namespace Mapping
map<string, string> namespace_mapping = 4;
// Restore replace policy type ("delete"/"retain")
ReplacePolicy.Type replace_policy = 5;
StatusInfo status = 6;
repeated RestoredResource resources = 7;
repeated Volume volumes = 8;
// Name of the cluster
string cluster = 9;
repeated string include_optional_resource_types = 10;
uint64 total_size = 11;
repeated ResourceInfo include_resources = 12;
uint64 resource_count = 13;
string stork_version = 14;
ObjectRef backup_location_ref = 15;
// storage class mapping for generic backup <source, destination>
map<string, string> storage_class_mapping = 16;
// backup to restore from
ObjectRef backup_ref = 17;
// mapping of the rancher projects from the backup to which restore should
// be done
map<string, string> rancher_project_mapping = 18;
// mapping of source rancher project display names to target rancher project display names
map<string, string> rancher_project_name_mapping = 19;
// flag signifies if the restored backup involves large number of resources or not
bool large_resource_enabled = 20;
// counter to show number of already restored resources
uint64 restored_resource_count = 21;
// current activity while doing resource restore
RestoreResourceState restore_status = 22;
ObjectRef cluster_ref = 23;
// backup object type is all namespace or virtualMachine specific backup
BackupObjectType backup_object_type = 24;
message RestoreResourceState {
ResourceStatus restore_status = 1;
enum ResourceStatus {
Preparing = 0;
Deleting = 1;
Verifying = 2;
Applying = 3;
}
}
message RestoredResource {
string name = 1;
string namespace = 2;
string group = 3;
string kind = 4;
string version = 5;
StatusInfo status = 6;
}
message Volume {
string pvc = 1;
string source_namespace = 2;
string source_volume = 3;
string restore_volume = 4;
StatusInfo status = 5;
string driver_name = 6;
repeated string zones = 7;
map<string, string> options = 8;
uint64 total_size = 9;
}
// Message for maintaining status of the object.
message StatusInfo {
enum Status {
Invalid = 0;
Pending = 1;
InProgress = 2;
Aborted = 3;
Failed = 4;
Deleting = 5;
Success = 6;
Retained = 7;
PartialSuccess = 8;
}
Status status = 1;
string reason = 2;
}
message BackupObjectType {
Type type = 1;
enum Type {
Invalid = 0;
All = 1; // for All application backup
VirtualMachine = 2; // virtualMachine for VirtualMachine specific backup
}
}
}
// Message for Restore object which will be stored in Datastore.
message RestoreObject {
Metadata metadata = 1 [ (gogoproto.embed) = true ];
RestoreInfo restore_info = 2 [ (gogoproto.embed) = true ];
}
message HealthStatusRequest {}
message HealthStatusResponse {}
service Health {
// Status checks the health of the server
rpc Status(HealthStatusRequest) returns (HealthStatusResponse) {
option (google.api.http) = {
get : "/v1/health"
};
}
}
message TimeRange {
google.protobuf.Timestamp start_time = 1;
google.protobuf.Timestamp end_time = 2;
}
message EnumerateOptions {
// label selectors for the object for filtering
map<string, string> labels = 1;
// max objects to fetch
uint64 max_objects = 2;
// Time range for which to return objects
TimeRange time_range = 3;
// Filter to use for name of objects. Any object that contains the filter
// will be returned
string name_filter = 4;
// Filter to use for cluster name of objects. Any object that contains the
// filter will be returned
string cluster_name_filter = 5;
uint64 object_index = 6;
// Ths option will be set to true by the caller, when they want to have
// complete backup object. That means the backupObject's
// resource list will be set to complete list of resources.
// If this option is set to false, resource list will be
// set to nil and rest of the backupObject details will be returned in the
// response.
bool include_detailed_resources = 7;
// Filter to use with cluster uid on objects. Any object that contains the
// filter will be returned
// Currently backup enumerate request should pass this along with cluster
// name.
string cluster_uid_filter = 8;
// Filter to use owner uids on objects. Any object that contains the
// filter will be returned
repeated string owners = 9;
// filter to use backupObjectType on object
string backup_object_type = 10;
// filter based on the object status.
// Need to pass the string value of the status field of the object ( backup /restore )
// For example, {"Success", "Failed"}
repeated string status = 11;
}
service SchedulePolicy {
// Creates new schedule policy.
rpc Create(SchedulePolicyCreateRequest)
returns (SchedulePolicyCreateResponse) {
option (google.api.http) = {
post : "/v1/schedulepolicy"
body : "*"
};
}
// Update given schedule policy details
rpc Update(SchedulePolicyUpdateRequest)
returns (SchedulePolicyUpdateResponse) {
option (google.api.http) = {
put : "/v1/schedulepolicy"
body : "*"
};
}
// Enumerate returns a list of schedule policy
rpc Enumerate(SchedulePolicyEnumerateRequest)
returns (SchedulePolicyEnumerateResponse) {
option (google.api.http) = {
get : "/v1/schedulepolicy/{org_id}"
};
}
// Inspect returns detail information about a specified schedule policy
rpc Inspect(SchedulePolicyInspectRequest)
returns (SchedulePolicyInspectResponse) {
option (google.api.http) = {
get : "/v1/schedulepolicy/{org_id}/{name}/{uid}"
};
}
// Delete removes a schedule policy
rpc Delete(SchedulePolicyDeleteRequest)
returns (SchedulePolicyDeleteResponse) {
option (google.api.http) = {
delete : "/v1/schedulepolicy/{org_id}/{name}/{uid}"
};
}
// UpdateOwnership updates ownership of existing object
rpc UpdateOwnership(SchedulePolicyOwnershipUpdateRequest)
returns (SchedulePolicyOwnershipUpdateResponse) {
option (google.api.http) = {
put : "/v1/schedulepolicy/updateownership"
body : "*"
};
}
}
// Define SchedulePolicyCreateRequest struct
message SchedulePolicyCreateRequest {
CreateMetadata metadata = 1 [ (gogoproto.embed) = true ];
SchedulePolicyInfo schedule_policy = 2;
}
// Define SchedulePolicyCreateResponse struct
message SchedulePolicyCreateResponse {}
// Define SchedulePolicyUpdateRequest struct
message SchedulePolicyUpdateRequest {
CreateMetadata metadata = 1 [ (gogoproto.embed) = true ];
SchedulePolicyInfo schedule_policy = 2;
}
// Define SchedulePolicyUpdateResponse struct
message SchedulePolicyUpdateResponse {}
// Define SchedulePolicyEnumerateRequest struct
message SchedulePolicyEnumerateRequest {
string org_id = 1;
// label selectors for the object for filtering
map<string, string> labels = 2;
}
// Define SchedulePolicyEnumerateResponse struct
message SchedulePolicyEnumerateResponse {
repeated SchedulePolicyObject schedule_policies = 1;
}
// Define SchedulePolicyInspectRequest struct
message SchedulePolicyInspectRequest {
string org_id = 1;
string name = 2;
string uid = 3;
}
// Define SchedulePolicyInspectResponse struct
message SchedulePolicyInspectResponse {
SchedulePolicyObject schedule_policy = 1;
}
// Define SchedulePolicyDeleteRequest struct
message SchedulePolicyDeleteRequest {
string org_id = 1;
string name = 2;
string uid = 3;
}
// Define SchedulePolicyDeleteResponse struct
message SchedulePolicyDeleteResponse {}
message SchedulePolicyOwnershipUpdateRequest {
string org_id = 1;
string name = 2;
Ownership ownership = 3;
string uid = 4;
}
message SchedulePolicyOwnershipUpdateResponse {}
service BackupSchedule {
// Creates new backup schedule
rpc Create(BackupScheduleCreateRequest)
returns (BackupScheduleCreateResponse) {
option (google.api.http) = {
post : "/v1/backupschedule"
body : "*"
};
}
// Updates a backup schedule
rpc Update(BackupScheduleUpdateRequest)
returns (BackupScheduleUpdateResponse) {
option (google.api.http) = {
put : "/v1/backupschedule"
body : "*"
};