@kumori/aurora-backend-handler 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/account-api-service.ts +260 -174
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
import { Account, Notification } from "@kumori/aurora-interfaces";
|
|
3
2
|
import {
|
|
4
3
|
initializeGlobalWebSocketClient,
|
|
@@ -84,14 +83,24 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
84
83
|
},
|
|
85
84
|
},
|
|
86
85
|
iaasconfig: {
|
|
87
|
-
...(account.flavors?.volatile?.[0] && {
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
...(account.flavors?.volatile?.[0] && {
|
|
87
|
+
volatile: account.flavors.volatile[0],
|
|
88
|
+
}),
|
|
89
|
+
...(account.flavors?.persistent?.[0] && {
|
|
90
|
+
persistent: account.flavors.persistent[0],
|
|
91
|
+
}),
|
|
92
|
+
...(account.flavors?.nonReplicated?.[0] && {
|
|
93
|
+
nonreplicated: account.flavors.nonReplicated[0],
|
|
94
|
+
}),
|
|
90
95
|
// shared: "classic",
|
|
91
|
-
...(account.flavors?.small?.[0] && {
|
|
92
|
-
|
|
96
|
+
...(account.flavors?.small?.[0] && {
|
|
97
|
+
smallVMFlavor: account.flavors?.small?.[0],
|
|
98
|
+
}),
|
|
99
|
+
...(account.flavors?.medium?.[0] && {
|
|
100
|
+
mediumVMFlavor: account.flavors.medium[0],
|
|
101
|
+
}),
|
|
93
102
|
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
94
|
-
}
|
|
103
|
+
},
|
|
95
104
|
},
|
|
96
105
|
meta: {
|
|
97
106
|
labels: {
|
|
@@ -172,14 +181,24 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
172
181
|
},
|
|
173
182
|
},
|
|
174
183
|
iaasconfig: {
|
|
175
|
-
...(account.flavors?.volatile?.[0] && {
|
|
176
|
-
|
|
177
|
-
|
|
184
|
+
...(account.flavors?.volatile?.[0] && {
|
|
185
|
+
volatile: account.flavors.volatile[0],
|
|
186
|
+
}),
|
|
187
|
+
...(account.flavors?.persistent?.[0] && {
|
|
188
|
+
persistent: account.flavors.persistent[0],
|
|
189
|
+
}),
|
|
190
|
+
...(account.flavors?.nonReplicated?.[0] && {
|
|
191
|
+
nonreplicated: account.flavors.nonReplicated[0],
|
|
192
|
+
}),
|
|
178
193
|
// shared: "classic",
|
|
179
|
-
...(account.flavors?.small?.[0] && {
|
|
180
|
-
|
|
194
|
+
...(account.flavors?.small?.[0] && {
|
|
195
|
+
smallVMFlavor: account.flavors?.small?.[0],
|
|
196
|
+
}),
|
|
197
|
+
...(account.flavors?.medium?.[0] && {
|
|
198
|
+
mediumVMFlavor: account.flavors.medium[0],
|
|
199
|
+
}),
|
|
181
200
|
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
182
|
-
}
|
|
201
|
+
},
|
|
183
202
|
},
|
|
184
203
|
meta: {
|
|
185
204
|
labels: {
|
|
@@ -216,7 +235,7 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
216
235
|
region_name: account.cloudProvider?.region || "",
|
|
217
236
|
interface: account.cloudProvider?.interface || "",
|
|
218
237
|
identity_api_version: Number(
|
|
219
|
-
account.cloudProvider?.apiVersion || 3
|
|
238
|
+
account.cloudProvider?.apiVersion || 3,
|
|
220
239
|
),
|
|
221
240
|
auth_type: account.cloudProvider?.authType || "",
|
|
222
241
|
auth: {
|
|
@@ -272,14 +291,24 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
272
291
|
},
|
|
273
292
|
},
|
|
274
293
|
iaasconfig: {
|
|
275
|
-
...(account.flavors?.volatile?.[0] && {
|
|
276
|
-
|
|
277
|
-
|
|
294
|
+
...(account.flavors?.volatile?.[0] && {
|
|
295
|
+
volatile: account.flavors.volatile[0],
|
|
296
|
+
}),
|
|
297
|
+
...(account.flavors?.persistent?.[0] && {
|
|
298
|
+
persistent: account.flavors.persistent[0],
|
|
299
|
+
}),
|
|
300
|
+
...(account.flavors?.nonReplicated?.[0] && {
|
|
301
|
+
nonreplicated: account.flavors.nonReplicated[0],
|
|
302
|
+
}),
|
|
278
303
|
// shared: "classic",
|
|
279
|
-
...(account.flavors?.small?.[0] && {
|
|
280
|
-
|
|
304
|
+
...(account.flavors?.small?.[0] && {
|
|
305
|
+
smallVMFlavor: account.flavors?.small?.[0],
|
|
306
|
+
}),
|
|
307
|
+
...(account.flavors?.medium?.[0] && {
|
|
308
|
+
mediumVMFlavor: account.flavors.medium[0],
|
|
309
|
+
}),
|
|
281
310
|
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
282
|
-
}
|
|
311
|
+
},
|
|
283
312
|
},
|
|
284
313
|
meta: {
|
|
285
314
|
labels: {
|
|
@@ -290,8 +319,7 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
290
319
|
},
|
|
291
320
|
},
|
|
292
321
|
};
|
|
293
|
-
}
|
|
294
|
-
else if (providerName === "oasix") {
|
|
322
|
+
} else if (providerName === "oasix") {
|
|
295
323
|
accountBody = {
|
|
296
324
|
tenant: account.tenant,
|
|
297
325
|
account: account.name,
|
|
@@ -318,7 +346,7 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
318
346
|
region_name: account.cloudProvider?.region || "",
|
|
319
347
|
interface: account.cloudProvider?.interface || "",
|
|
320
348
|
identity_api_version: Number(
|
|
321
|
-
account.cloudProvider?.apiVersion || 3
|
|
349
|
+
account.cloudProvider?.apiVersion || 3,
|
|
322
350
|
),
|
|
323
351
|
auth_type: account.cloudProvider?.authType || "",
|
|
324
352
|
auth: {
|
|
@@ -374,14 +402,24 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
374
402
|
},
|
|
375
403
|
},
|
|
376
404
|
iaasconfig: {
|
|
377
|
-
...(account.flavors?.volatile?.[0] && {
|
|
378
|
-
|
|
379
|
-
|
|
405
|
+
...(account.flavors?.volatile?.[0] && {
|
|
406
|
+
volatile: account.flavors.volatile[0],
|
|
407
|
+
}),
|
|
408
|
+
...(account.flavors?.persistent?.[0] && {
|
|
409
|
+
persistent: account.flavors.persistent[0],
|
|
410
|
+
}),
|
|
411
|
+
...(account.flavors?.nonReplicated?.[0] && {
|
|
412
|
+
nonreplicated: account.flavors.nonReplicated[0],
|
|
413
|
+
}),
|
|
380
414
|
// shared: "classic",
|
|
381
|
-
...(account.flavors?.small?.[0] && {
|
|
382
|
-
|
|
415
|
+
...(account.flavors?.small?.[0] && {
|
|
416
|
+
smallVMFlavor: account.flavors?.small?.[0],
|
|
417
|
+
}),
|
|
418
|
+
...(account.flavors?.medium?.[0] && {
|
|
419
|
+
mediumVMFlavor: account.flavors.medium[0],
|
|
420
|
+
}),
|
|
383
421
|
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
384
|
-
}
|
|
422
|
+
},
|
|
385
423
|
},
|
|
386
424
|
meta: {
|
|
387
425
|
labels: {
|
|
@@ -392,8 +430,7 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
392
430
|
},
|
|
393
431
|
},
|
|
394
432
|
};
|
|
395
|
-
}
|
|
396
|
-
else if (providerName === "opennebula") {
|
|
433
|
+
} else if (providerName === "opennebula") {
|
|
397
434
|
accountBody = {
|
|
398
435
|
tenant: account.tenant,
|
|
399
436
|
account: account.name,
|
|
@@ -402,13 +439,13 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
402
439
|
spec: {
|
|
403
440
|
api: providerName,
|
|
404
441
|
credentials: {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
442
|
+
method: providerName,
|
|
443
|
+
opennebula: {
|
|
444
|
+
user: account.cloudProvider.username,
|
|
445
|
+
password: account.cloudProvider.password,
|
|
446
|
+
xmlrpc: account.cloudProvider.endpoint,
|
|
447
|
+
},
|
|
448
|
+
},
|
|
412
449
|
highlyAvailable: true,
|
|
413
450
|
marks: {
|
|
414
451
|
vcpu: {
|
|
@@ -453,14 +490,24 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
453
490
|
},
|
|
454
491
|
},
|
|
455
492
|
iaasconfig: {
|
|
456
|
-
...(account.flavors?.volatile?.[0] && {
|
|
457
|
-
|
|
458
|
-
|
|
493
|
+
...(account.flavors?.volatile?.[0] && {
|
|
494
|
+
volatile: account.flavors.volatile[0],
|
|
495
|
+
}),
|
|
496
|
+
...(account.flavors?.persistent?.[0] && {
|
|
497
|
+
persistent: account.flavors.persistent[0],
|
|
498
|
+
}),
|
|
499
|
+
...(account.flavors?.nonReplicated?.[0] && {
|
|
500
|
+
nonreplicated: account.flavors.nonReplicated[0],
|
|
501
|
+
}),
|
|
459
502
|
// shared: "classic",
|
|
460
|
-
...(account.flavors?.small?.[0] && {
|
|
461
|
-
|
|
503
|
+
...(account.flavors?.small?.[0] && {
|
|
504
|
+
smallVMFlavor: account.flavors?.small?.[0],
|
|
505
|
+
}),
|
|
506
|
+
...(account.flavors?.medium?.[0] && {
|
|
507
|
+
mediumVMFlavor: account.flavors.medium[0],
|
|
508
|
+
}),
|
|
462
509
|
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
463
|
-
}
|
|
510
|
+
},
|
|
464
511
|
},
|
|
465
512
|
meta: {
|
|
466
513
|
labels: {
|
|
@@ -471,10 +518,9 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
471
518
|
},
|
|
472
519
|
},
|
|
473
520
|
};
|
|
474
|
-
}
|
|
475
|
-
else {
|
|
521
|
+
} else {
|
|
476
522
|
throw new Error(
|
|
477
|
-
`Unsupported cloud provider: ${providerName}. Supported providers are: ovh, aws, azure
|
|
523
|
+
`Unsupported cloud provider: ${providerName}. Supported providers are: ovh, aws, azure`,
|
|
478
524
|
);
|
|
479
525
|
}
|
|
480
526
|
|
|
@@ -485,7 +531,7 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
485
531
|
"CREATE",
|
|
486
532
|
account.name,
|
|
487
533
|
"account",
|
|
488
|
-
account
|
|
534
|
+
account,
|
|
489
535
|
);
|
|
490
536
|
const updatedAccount: Account = { ...account, status: "pending" };
|
|
491
537
|
eventHelper.account.publish.created(updatedAccount);
|
|
@@ -548,56 +594,51 @@ export const deleteAccount = async (account: Account, security: Security) => {
|
|
|
548
594
|
await initializeGlobalWebSocketClient(security, "account", account.name);
|
|
549
595
|
const providerName = account.cloudProvider?.name?.toLowerCase();
|
|
550
596
|
let payload = {};
|
|
551
|
-
if(!account.credentials){
|
|
597
|
+
if (!account.credentials) {
|
|
552
598
|
payload = {
|
|
553
599
|
tenant: account.tenant,
|
|
554
600
|
account: account.name,
|
|
555
601
|
delete: true,
|
|
556
602
|
force: true,
|
|
557
603
|
};
|
|
558
|
-
}
|
|
559
|
-
else if (providerName === "ovh") {
|
|
604
|
+
} else if (providerName === "ovh") {
|
|
560
605
|
payload = {
|
|
561
606
|
tenant: account.tenant,
|
|
562
607
|
account: account.name,
|
|
563
608
|
delete: true,
|
|
564
609
|
force: true,
|
|
565
610
|
spec: {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
611
|
+
credentials: {
|
|
612
|
+
username: account.cloudProvider.username,
|
|
613
|
+
password: account.cloudProvider.password,
|
|
614
|
+
},
|
|
571
615
|
},
|
|
572
616
|
};
|
|
573
|
-
}
|
|
574
|
-
else if (providerName === "oasix") {
|
|
617
|
+
} else if (providerName === "oasix") {
|
|
575
618
|
payload = {
|
|
576
619
|
tenant: account.tenant,
|
|
577
620
|
account: account.name,
|
|
578
621
|
delete: true,
|
|
579
622
|
force: true,
|
|
580
623
|
spec: {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
624
|
+
credentials: {
|
|
625
|
+
username: account.cloudProvider.username,
|
|
626
|
+
password: account.cloudProvider.password,
|
|
627
|
+
domain: account.cloudProvider.domain,
|
|
628
|
+
},
|
|
587
629
|
},
|
|
588
630
|
};
|
|
589
|
-
}else if (providerName === "aws") {
|
|
631
|
+
} else if (providerName === "aws") {
|
|
590
632
|
payload = {
|
|
591
633
|
tenant: account.tenant,
|
|
592
634
|
account: account.name,
|
|
593
635
|
delete: true,
|
|
594
636
|
force: true,
|
|
595
637
|
spec: {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
638
|
+
credentials: {
|
|
639
|
+
admin_access_key: account.cloudProvider.username,
|
|
640
|
+
admin_secret_key: account.cloudProvider.password,
|
|
641
|
+
},
|
|
601
642
|
},
|
|
602
643
|
};
|
|
603
644
|
} else if (providerName === "azure") {
|
|
@@ -607,11 +648,10 @@ export const deleteAccount = async (account: Account, security: Security) => {
|
|
|
607
648
|
delete: true,
|
|
608
649
|
force: true,
|
|
609
650
|
spec: {
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
651
|
+
credentials: {
|
|
652
|
+
admin_client_id: account.cloudProvider.username,
|
|
653
|
+
admin_client_secret: account.cloudProvider.password,
|
|
654
|
+
},
|
|
615
655
|
},
|
|
616
656
|
};
|
|
617
657
|
}
|
|
@@ -623,7 +663,7 @@ export const deleteAccount = async (account: Account, security: Security) => {
|
|
|
623
663
|
"DELETE",
|
|
624
664
|
account.name,
|
|
625
665
|
"account",
|
|
626
|
-
account
|
|
666
|
+
account,
|
|
627
667
|
);
|
|
628
668
|
|
|
629
669
|
// const updatedAccount: Account = { ...account, status: "pending" };
|
|
@@ -692,7 +732,7 @@ export const clearAccount = async (account: Account, security: Security) => {
|
|
|
692
732
|
"CLEANUP",
|
|
693
733
|
account.name,
|
|
694
734
|
"account",
|
|
695
|
-
account
|
|
735
|
+
account,
|
|
696
736
|
);
|
|
697
737
|
|
|
698
738
|
const updatedAccount: Account = { ...account, status: "pending" };
|
|
@@ -816,14 +856,24 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
816
856
|
},
|
|
817
857
|
},
|
|
818
858
|
iaasconfig: {
|
|
819
|
-
...(account.flavors?.volatile?.[0] && {
|
|
820
|
-
|
|
821
|
-
|
|
859
|
+
...(account.flavors?.volatile?.[0] && {
|
|
860
|
+
volatile: account.flavors.volatile[0],
|
|
861
|
+
}),
|
|
862
|
+
...(account.flavors?.persistent?.[0] && {
|
|
863
|
+
persistent: account.flavors.persistent[0],
|
|
864
|
+
}),
|
|
865
|
+
...(account.flavors?.nonReplicated?.[0] && {
|
|
866
|
+
nonreplicated: account.flavors.nonReplicated[0],
|
|
867
|
+
}),
|
|
822
868
|
// shared: "classic",
|
|
823
|
-
...(account.flavors?.small?.[0] && {
|
|
824
|
-
|
|
869
|
+
...(account.flavors?.small?.[0] && {
|
|
870
|
+
smallVMFlavor: account.flavors?.small?.[0],
|
|
871
|
+
}),
|
|
872
|
+
...(account.flavors?.medium?.[0] && {
|
|
873
|
+
mediumVMFlavor: account.flavors.medium[0],
|
|
874
|
+
}),
|
|
825
875
|
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
826
|
-
}
|
|
876
|
+
},
|
|
827
877
|
},
|
|
828
878
|
meta: {
|
|
829
879
|
labels: {
|
|
@@ -901,14 +951,24 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
901
951
|
},
|
|
902
952
|
},
|
|
903
953
|
iaasconfig: {
|
|
904
|
-
...(account.flavors?.volatile?.[0] && {
|
|
905
|
-
|
|
906
|
-
|
|
954
|
+
...(account.flavors?.volatile?.[0] && {
|
|
955
|
+
volatile: account.flavors.volatile[0],
|
|
956
|
+
}),
|
|
957
|
+
...(account.flavors?.persistent?.[0] && {
|
|
958
|
+
persistent: account.flavors.persistent[0],
|
|
959
|
+
}),
|
|
960
|
+
...(account.flavors?.nonReplicated?.[0] && {
|
|
961
|
+
nonreplicated: account.flavors.nonReplicated[0],
|
|
962
|
+
}),
|
|
907
963
|
// shared: "classic",
|
|
908
|
-
...(account.flavors?.small?.[0] && {
|
|
909
|
-
|
|
964
|
+
...(account.flavors?.small?.[0] && {
|
|
965
|
+
smallVMFlavor: account.flavors?.small?.[0],
|
|
966
|
+
}),
|
|
967
|
+
...(account.flavors?.medium?.[0] && {
|
|
968
|
+
mediumVMFlavor: account.flavors.medium[0],
|
|
969
|
+
}),
|
|
910
970
|
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
911
|
-
}
|
|
971
|
+
},
|
|
912
972
|
},
|
|
913
973
|
meta: {
|
|
914
974
|
labels: {
|
|
@@ -943,7 +1003,7 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
943
1003
|
region_name: account.cloudProvider?.region || "",
|
|
944
1004
|
interface: account.cloudProvider?.interface || "",
|
|
945
1005
|
identity_api_version: Number(
|
|
946
|
-
account.cloudProvider?.apiVersion || 3
|
|
1006
|
+
account.cloudProvider?.apiVersion || 3,
|
|
947
1007
|
),
|
|
948
1008
|
auth_type: account.cloudProvider?.authType || "",
|
|
949
1009
|
auth: {
|
|
@@ -999,14 +1059,24 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
999
1059
|
},
|
|
1000
1060
|
},
|
|
1001
1061
|
iaasconfig: {
|
|
1002
|
-
...(account.flavors?.volatile?.[0] && {
|
|
1003
|
-
|
|
1004
|
-
|
|
1062
|
+
...(account.flavors?.volatile?.[0] && {
|
|
1063
|
+
volatile: account.flavors.volatile[0],
|
|
1064
|
+
}),
|
|
1065
|
+
...(account.flavors?.persistent?.[0] && {
|
|
1066
|
+
persistent: account.flavors.persistent[0],
|
|
1067
|
+
}),
|
|
1068
|
+
...(account.flavors?.nonReplicated?.[0] && {
|
|
1069
|
+
nonreplicated: account.flavors.nonReplicated[0],
|
|
1070
|
+
}),
|
|
1005
1071
|
// shared: "classic",
|
|
1006
|
-
...(account.flavors?.small?.[0] && {
|
|
1007
|
-
|
|
1072
|
+
...(account.flavors?.small?.[0] && {
|
|
1073
|
+
smallVMFlavor: account.flavors?.small?.[0],
|
|
1074
|
+
}),
|
|
1075
|
+
...(account.flavors?.medium?.[0] && {
|
|
1076
|
+
mediumVMFlavor: account.flavors.medium[0],
|
|
1077
|
+
}),
|
|
1008
1078
|
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
1009
|
-
}
|
|
1079
|
+
},
|
|
1010
1080
|
},
|
|
1011
1081
|
meta: {
|
|
1012
1082
|
labels: {
|
|
@@ -1042,7 +1112,7 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
1042
1112
|
region_name: account.cloudProvider?.region || "",
|
|
1043
1113
|
interface: account.cloudProvider?.interface || "",
|
|
1044
1114
|
identity_api_version: Number(
|
|
1045
|
-
account.cloudProvider?.apiVersion || 3
|
|
1115
|
+
account.cloudProvider?.apiVersion || 3,
|
|
1046
1116
|
),
|
|
1047
1117
|
auth_type: account.cloudProvider?.authType || "",
|
|
1048
1118
|
auth: {
|
|
@@ -1098,14 +1168,24 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
1098
1168
|
},
|
|
1099
1169
|
},
|
|
1100
1170
|
iaasconfig: {
|
|
1101
|
-
...(account.flavors?.volatile?.[0] && {
|
|
1102
|
-
|
|
1103
|
-
|
|
1171
|
+
...(account.flavors?.volatile?.[0] && {
|
|
1172
|
+
volatile: account.flavors.volatile[0],
|
|
1173
|
+
}),
|
|
1174
|
+
...(account.flavors?.persistent?.[0] && {
|
|
1175
|
+
persistent: account.flavors.persistent[0],
|
|
1176
|
+
}),
|
|
1177
|
+
...(account.flavors?.nonReplicated?.[0] && {
|
|
1178
|
+
nonreplicated: account.flavors.nonReplicated[0],
|
|
1179
|
+
}),
|
|
1104
1180
|
// shared: "classic",
|
|
1105
|
-
...(account.flavors?.small?.[0] && {
|
|
1106
|
-
|
|
1181
|
+
...(account.flavors?.small?.[0] && {
|
|
1182
|
+
smallVMFlavor: account.flavors?.small?.[0],
|
|
1183
|
+
}),
|
|
1184
|
+
...(account.flavors?.medium?.[0] && {
|
|
1185
|
+
mediumVMFlavor: account.flavors.medium[0],
|
|
1186
|
+
}),
|
|
1107
1187
|
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
1108
|
-
}
|
|
1188
|
+
},
|
|
1109
1189
|
},
|
|
1110
1190
|
meta: {
|
|
1111
1191
|
labels: {
|
|
@@ -1115,87 +1195,93 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
1115
1195
|
},
|
|
1116
1196
|
},
|
|
1117
1197
|
};
|
|
1118
|
-
}
|
|
1119
|
-
else if (providerName === "opennebula") {
|
|
1198
|
+
} else if (providerName === "opennebula") {
|
|
1120
1199
|
accountBody = {
|
|
1121
1200
|
tenant: account.tenant,
|
|
1122
1201
|
account: account.name,
|
|
1123
1202
|
provision_infrastructure: false,
|
|
1124
1203
|
spec: {
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
},
|
|
1133
|
-
},
|
|
1134
|
-
highlyAvailable: true,
|
|
1135
|
-
marks: {
|
|
1136
|
-
vcpu: {
|
|
1137
|
-
lowmark: account.usage.limit.cpu.min * 1000,
|
|
1138
|
-
highmark: account.usage.limit.cpu.max * 1000,
|
|
1139
|
-
unit: "m",
|
|
1140
|
-
},
|
|
1141
|
-
memory: {
|
|
1142
|
-
lowmark: account.usage.limit.memory.min * 1000,
|
|
1143
|
-
highmark: account.usage.limit.memory.max * 1000,
|
|
1144
|
-
unit: "MB",
|
|
1145
|
-
},
|
|
1146
|
-
vstorage: {
|
|
1147
|
-
lowmark: account.usage.limit.volatileStorage.min * 1000,
|
|
1148
|
-
highmark: account.usage.limit.volatileStorage.max * 1000,
|
|
1149
|
-
unit: "MB",
|
|
1150
|
-
},
|
|
1151
|
-
nrstorage: {
|
|
1152
|
-
lowmark: account.usage.limit.nonReplicatedStorage.min * 1000,
|
|
1153
|
-
highmark: account.usage.limit.nonReplicatedStorage.max * 1000,
|
|
1154
|
-
unit: "MB",
|
|
1155
|
-
},
|
|
1156
|
-
rstorage: {
|
|
1157
|
-
lowmark: account.usage.limit.persistentStorage.min * 1000,
|
|
1158
|
-
highmark: account.usage.limit.persistentStorage.max * 1000,
|
|
1159
|
-
unit: "MB",
|
|
1160
|
-
},
|
|
1161
|
-
storage: {
|
|
1162
|
-
lowmark: account.usage.limit.storage.min * 1000,
|
|
1163
|
-
highmark: account.usage.limit.storage.max * 1000,
|
|
1164
|
-
unit: "MB",
|
|
1165
|
-
},
|
|
1166
|
-
cost: {
|
|
1167
|
-
lowmark: account.usage.cost,
|
|
1168
|
-
highmark: account.usage.cost,
|
|
1169
|
-
unit: "EUR",
|
|
1170
|
-
},
|
|
1171
|
-
nodes: {
|
|
1172
|
-
lowmark: account.nodes?.max || 0,
|
|
1173
|
-
highmark: account.nodes?.max || 0,
|
|
1174
|
-
unit: "",
|
|
1175
|
-
},
|
|
1176
|
-
},
|
|
1177
|
-
iaasconfig: {
|
|
1178
|
-
...(account.flavors?.volatile?.[0] && { volatile: account.flavors.volatile[0] }),
|
|
1179
|
-
...(account.flavors?.persistent?.[0] && { persistent: account.flavors.persistent[0] }),
|
|
1180
|
-
...(account.flavors?.nonReplicated?.[0] && { nonreplicated: account.flavors.nonReplicated[0] }),
|
|
1181
|
-
// shared: "classic",
|
|
1182
|
-
...(account.flavors?.small?.[0] && { smallVMFlavor: account.flavors?.small?.[0] }),
|
|
1183
|
-
...(account.flavors?.medium?.[0] && { mediumVMFlavor: account.flavors.medium[0] }),
|
|
1184
|
-
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
1204
|
+
api: providerName,
|
|
1205
|
+
credentials: {
|
|
1206
|
+
method: providerName,
|
|
1207
|
+
opennebula: {
|
|
1208
|
+
user: account.cloudProvider.username,
|
|
1209
|
+
password: account.cloudProvider.password,
|
|
1210
|
+
xmlrpc: account.cloudProvider.endpoint,
|
|
1185
1211
|
},
|
|
1186
1212
|
},
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1213
|
+
highlyAvailable: true,
|
|
1214
|
+
marks: {
|
|
1215
|
+
vcpu: {
|
|
1216
|
+
lowmark: account.usage.limit.cpu.min * 1000,
|
|
1217
|
+
highmark: account.usage.limit.cpu.max * 1000,
|
|
1218
|
+
unit: "m",
|
|
1192
1219
|
},
|
|
1220
|
+
memory: {
|
|
1221
|
+
lowmark: account.usage.limit.memory.min * 1000,
|
|
1222
|
+
highmark: account.usage.limit.memory.max * 1000,
|
|
1223
|
+
unit: "MB",
|
|
1224
|
+
},
|
|
1225
|
+
vstorage: {
|
|
1226
|
+
lowmark: account.usage.limit.volatileStorage.min * 1000,
|
|
1227
|
+
highmark: account.usage.limit.volatileStorage.max * 1000,
|
|
1228
|
+
unit: "MB",
|
|
1229
|
+
},
|
|
1230
|
+
nrstorage: {
|
|
1231
|
+
lowmark: account.usage.limit.nonReplicatedStorage.min * 1000,
|
|
1232
|
+
highmark: account.usage.limit.nonReplicatedStorage.max * 1000,
|
|
1233
|
+
unit: "MB",
|
|
1234
|
+
},
|
|
1235
|
+
rstorage: {
|
|
1236
|
+
lowmark: account.usage.limit.persistentStorage.min * 1000,
|
|
1237
|
+
highmark: account.usage.limit.persistentStorage.max * 1000,
|
|
1238
|
+
unit: "MB",
|
|
1239
|
+
},
|
|
1240
|
+
storage: {
|
|
1241
|
+
lowmark: account.usage.limit.storage.min * 1000,
|
|
1242
|
+
highmark: account.usage.limit.storage.max * 1000,
|
|
1243
|
+
unit: "MB",
|
|
1244
|
+
},
|
|
1245
|
+
cost: {
|
|
1246
|
+
lowmark: account.usage.cost,
|
|
1247
|
+
highmark: account.usage.cost,
|
|
1248
|
+
unit: "EUR",
|
|
1249
|
+
},
|
|
1250
|
+
nodes: {
|
|
1251
|
+
lowmark: account.nodes?.max || 0,
|
|
1252
|
+
highmark: account.nodes?.max || 0,
|
|
1253
|
+
unit: "",
|
|
1254
|
+
},
|
|
1255
|
+
},
|
|
1256
|
+
iaasconfig: {
|
|
1257
|
+
...(account.flavors?.volatile?.[0] && {
|
|
1258
|
+
volatile: account.flavors.volatile[0],
|
|
1259
|
+
}),
|
|
1260
|
+
...(account.flavors?.persistent?.[0] && {
|
|
1261
|
+
persistent: account.flavors.persistent[0],
|
|
1262
|
+
}),
|
|
1263
|
+
...(account.flavors?.nonReplicated?.[0] && {
|
|
1264
|
+
nonreplicated: account.flavors.nonReplicated[0],
|
|
1265
|
+
}),
|
|
1266
|
+
...(account.flavors?.small?.[0] && {
|
|
1267
|
+
smallVMFlavor: account.flavors?.small?.[0],
|
|
1268
|
+
}),
|
|
1269
|
+
...(account.flavors?.medium?.[0] && {
|
|
1270
|
+
mediumVMFlavor: account.flavors.medium[0],
|
|
1271
|
+
}),
|
|
1193
1272
|
},
|
|
1273
|
+
},
|
|
1274
|
+
meta: {
|
|
1275
|
+
labels: {
|
|
1276
|
+
additionalProp1: "string",
|
|
1277
|
+
additionalProp2: "string",
|
|
1278
|
+
additionalProp3: "string",
|
|
1279
|
+
},
|
|
1280
|
+
},
|
|
1194
1281
|
};
|
|
1195
|
-
}
|
|
1196
|
-
else {
|
|
1282
|
+
} else {
|
|
1197
1283
|
throw new Error(
|
|
1198
|
-
`Unsupported cloud provider: ${providerName}. Supported providers are: ovh, aws, azure
|
|
1284
|
+
`Unsupported cloud provider: ${providerName}. Supported providers are: ovh, aws, azure`,
|
|
1199
1285
|
);
|
|
1200
1286
|
}
|
|
1201
1287
|
|
|
@@ -1206,7 +1292,7 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
1206
1292
|
"UPDATE",
|
|
1207
1293
|
account.name,
|
|
1208
1294
|
"account",
|
|
1209
|
-
account
|
|
1295
|
+
account,
|
|
1210
1296
|
);
|
|
1211
1297
|
return response;
|
|
1212
1298
|
} catch (error) {
|