@kumori/aurora-backend-handler 1.0.85 → 1.0.87
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 +75 -204
- package/package.json +1 -1
|
@@ -5,9 +5,15 @@ import {
|
|
|
5
5
|
makeGlobalWebSocketRequest,
|
|
6
6
|
} from "../websocket-manager";
|
|
7
7
|
import { eventHelper } from "../backend-handler";
|
|
8
|
-
import { parseJsonSourceFileConfigFileContent } from "typescript";
|
|
9
8
|
|
|
10
9
|
type Security = string;
|
|
10
|
+
function extractErrorInfo(error: unknown): { code: string; message: string } {
|
|
11
|
+
const err = (error as any)?.error;
|
|
12
|
+
return {
|
|
13
|
+
code: err?.code ?? "unknown_error",
|
|
14
|
+
message: err?.content ?? err?.message ?? "Unknown error",
|
|
15
|
+
};
|
|
16
|
+
}
|
|
11
17
|
|
|
12
18
|
export const createAccount = async (account: Account, security: Security) => {
|
|
13
19
|
try {
|
|
@@ -92,14 +98,12 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
92
98
|
...(account.flavors?.nonReplicated?.[0] && {
|
|
93
99
|
nonreplicated: account.flavors.nonReplicated[0],
|
|
94
100
|
}),
|
|
95
|
-
// shared: "classic",
|
|
96
101
|
...(account.flavors?.small?.[0] && {
|
|
97
102
|
smallVMFlavor: account.flavors?.small?.[0],
|
|
98
103
|
}),
|
|
99
104
|
...(account.flavors?.medium?.[0] && {
|
|
100
105
|
mediumVMFlavor: account.flavors.medium[0],
|
|
101
106
|
}),
|
|
102
|
-
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
103
107
|
},
|
|
104
108
|
},
|
|
105
109
|
meta: {
|
|
@@ -190,14 +194,12 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
190
194
|
...(account.flavors?.nonReplicated?.[0] && {
|
|
191
195
|
nonreplicated: account.flavors.nonReplicated[0],
|
|
192
196
|
}),
|
|
193
|
-
// shared: "classic",
|
|
194
197
|
...(account.flavors?.small?.[0] && {
|
|
195
198
|
smallVMFlavor: account.flavors?.small?.[0],
|
|
196
199
|
}),
|
|
197
200
|
...(account.flavors?.medium?.[0] && {
|
|
198
201
|
mediumVMFlavor: account.flavors.medium[0],
|
|
199
202
|
}),
|
|
200
|
-
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
201
203
|
},
|
|
202
204
|
},
|
|
203
205
|
meta: {
|
|
@@ -225,12 +227,6 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
225
227
|
}
|
|
226
228
|
: {
|
|
227
229
|
method: providerName,
|
|
228
|
-
// ovh: {
|
|
229
|
-
// endpoint: "string",
|
|
230
|
-
// application_key: "string",
|
|
231
|
-
// application_secret: "string",
|
|
232
|
-
// consumer_key: "string",
|
|
233
|
-
// },
|
|
234
230
|
openstack: {
|
|
235
231
|
region_name: account.cloudProvider?.region || "",
|
|
236
232
|
interface: account.cloudProvider?.interface || "",
|
|
@@ -300,14 +296,12 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
300
296
|
...(account.flavors?.nonReplicated?.[0] && {
|
|
301
297
|
nonreplicated: account.flavors.nonReplicated[0],
|
|
302
298
|
}),
|
|
303
|
-
// shared: "classic",
|
|
304
299
|
...(account.flavors?.small?.[0] && {
|
|
305
300
|
smallVMFlavor: account.flavors?.small?.[0],
|
|
306
301
|
}),
|
|
307
302
|
...(account.flavors?.medium?.[0] && {
|
|
308
303
|
mediumVMFlavor: account.flavors.medium[0],
|
|
309
304
|
}),
|
|
310
|
-
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
311
305
|
},
|
|
312
306
|
},
|
|
313
307
|
meta: {
|
|
@@ -335,15 +329,8 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
335
329
|
domain: account.cloudProvider?.domain || "",
|
|
336
330
|
project_name: account.cloudProvider?.project_name || "",
|
|
337
331
|
}
|
|
338
|
-
:
|
|
339
|
-
{
|
|
332
|
+
: {
|
|
340
333
|
method: providerName,
|
|
341
|
-
// ovh: {
|
|
342
|
-
// endpoint: "string",
|
|
343
|
-
// application_key: "string",
|
|
344
|
-
// application_secret: "string",
|
|
345
|
-
// consumer_key: "string",
|
|
346
|
-
// },
|
|
347
334
|
openstack: {
|
|
348
335
|
region_name: account.cloudProvider?.region || "",
|
|
349
336
|
interface: account.cloudProvider?.interface || "",
|
|
@@ -413,14 +400,12 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
413
400
|
...(account.flavors?.nonReplicated?.[0] && {
|
|
414
401
|
nonreplicated: account.flavors.nonReplicated[0],
|
|
415
402
|
}),
|
|
416
|
-
// shared: "classic",
|
|
417
403
|
...(account.flavors?.small?.[0] && {
|
|
418
404
|
smallVMFlavor: account.flavors?.small?.[0],
|
|
419
405
|
}),
|
|
420
406
|
...(account.flavors?.medium?.[0] && {
|
|
421
407
|
mediumVMFlavor: account.flavors.medium[0],
|
|
422
408
|
}),
|
|
423
|
-
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
424
409
|
},
|
|
425
410
|
},
|
|
426
411
|
meta: {
|
|
@@ -432,8 +417,7 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
432
417
|
},
|
|
433
418
|
},
|
|
434
419
|
};
|
|
435
|
-
}
|
|
436
|
-
else if (providerName === "cloudos") {
|
|
420
|
+
} else if (providerName === "cloudos") {
|
|
437
421
|
accountBody = {
|
|
438
422
|
tenant: account.tenant,
|
|
439
423
|
account: account.name,
|
|
@@ -441,40 +425,24 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
441
425
|
spec: {
|
|
442
426
|
spec: {
|
|
443
427
|
api: providerName,
|
|
444
|
-
credentials:
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
// application_secret: "string",
|
|
460
|
-
// consumer_key: "string",
|
|
461
|
-
// },
|
|
462
|
-
openstack: {
|
|
463
|
-
region_name: account.cloudProvider?.region || "",
|
|
464
|
-
interface: account.cloudProvider?.interface || "",
|
|
465
|
-
identity_api_version: Number(
|
|
466
|
-
account.cloudProvider?.apiVersion || 3,
|
|
467
|
-
),
|
|
468
|
-
auth_type: account.cloudProvider?.authType || "",
|
|
469
|
-
auth: {
|
|
470
|
-
auth_url: account.cloudProvider?.authUrl || "",
|
|
471
|
-
application_credential_id:
|
|
472
|
-
account.cloudProvider?.credentialId || "",
|
|
473
|
-
application_credential_secret:
|
|
474
|
-
account.cloudProvider?.credentialSecret || "",
|
|
475
|
-
},
|
|
476
|
-
},
|
|
428
|
+
credentials: {
|
|
429
|
+
method: providerName,
|
|
430
|
+
openstack: {
|
|
431
|
+
region_name: account.cloudProvider?.region || "",
|
|
432
|
+
interface: account.cloudProvider?.interface || "",
|
|
433
|
+
identity_api_version: Number(
|
|
434
|
+
account.cloudProvider?.apiVersion || 3,
|
|
435
|
+
),
|
|
436
|
+
auth_type: account.cloudProvider?.authType || "",
|
|
437
|
+
auth: {
|
|
438
|
+
auth_url: account.cloudProvider?.authUrl || "",
|
|
439
|
+
application_credential_id:
|
|
440
|
+
account.cloudProvider?.credentialId || "",
|
|
441
|
+
application_credential_secret:
|
|
442
|
+
account.cloudProvider?.credentialSecret || "",
|
|
477
443
|
},
|
|
444
|
+
},
|
|
445
|
+
},
|
|
478
446
|
highlyAvailable: true,
|
|
479
447
|
marks: {
|
|
480
448
|
vcpu: {
|
|
@@ -528,14 +496,12 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
528
496
|
...(account.flavors?.nonReplicated?.[0] && {
|
|
529
497
|
nonreplicated: account.flavors.nonReplicated[0],
|
|
530
498
|
}),
|
|
531
|
-
// shared: "classic",
|
|
532
499
|
...(account.flavors?.small?.[0] && {
|
|
533
500
|
smallVMFlavor: account.flavors?.small?.[0],
|
|
534
501
|
}),
|
|
535
502
|
...(account.flavors?.medium?.[0] && {
|
|
536
503
|
mediumVMFlavor: account.flavors.medium[0],
|
|
537
504
|
}),
|
|
538
|
-
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
539
505
|
},
|
|
540
506
|
},
|
|
541
507
|
meta: {
|
|
@@ -547,8 +513,7 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
547
513
|
},
|
|
548
514
|
},
|
|
549
515
|
};
|
|
550
|
-
}
|
|
551
|
-
else if (providerName === "opennebula") {
|
|
516
|
+
} else if (providerName === "opennebula") {
|
|
552
517
|
accountBody = {
|
|
553
518
|
tenant: account.tenant,
|
|
554
519
|
account: account.name,
|
|
@@ -617,14 +582,12 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
617
582
|
...(account.flavors?.nonReplicated?.[0] && {
|
|
618
583
|
nonreplicated: account.flavors.nonReplicated[0],
|
|
619
584
|
}),
|
|
620
|
-
// shared: "classic",
|
|
621
585
|
...(account.flavors?.small?.[0] && {
|
|
622
586
|
smallVMFlavor: account.flavors?.small?.[0],
|
|
623
587
|
}),
|
|
624
588
|
...(account.flavors?.medium?.[0] && {
|
|
625
589
|
mediumVMFlavor: account.flavors.medium[0],
|
|
626
590
|
}),
|
|
627
|
-
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
628
591
|
},
|
|
629
592
|
},
|
|
630
593
|
meta: {
|
|
@@ -653,18 +616,6 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
653
616
|
);
|
|
654
617
|
const updatedAccount: Account = { ...account, status: "pending" };
|
|
655
618
|
eventHelper.account.publish.created(updatedAccount);
|
|
656
|
-
// const accountNotification: Notification = {
|
|
657
|
-
// type: "success",
|
|
658
|
-
// subtype: "account-created",
|
|
659
|
-
// date: Date.now().toString(),
|
|
660
|
-
// status: "unread",
|
|
661
|
-
// callToAction: false,
|
|
662
|
-
// data: {
|
|
663
|
-
// account: account.name,
|
|
664
|
-
// tenant: account.tenant,
|
|
665
|
-
// },
|
|
666
|
-
// };
|
|
667
|
-
// eventHelper.notification.publish.creation(accountNotification);
|
|
668
619
|
return response;
|
|
669
620
|
} catch (error) {
|
|
670
621
|
console.error("Error creating account:", {
|
|
@@ -675,24 +626,14 @@ export const createAccount = async (account: Account, security: Security) => {
|
|
|
675
626
|
provider: account.cloudProvider?.name,
|
|
676
627
|
webSocketStatus: getWebSocketStatus(),
|
|
677
628
|
});
|
|
678
|
-
|
|
629
|
+
const { code, message } = extractErrorInfo(error);
|
|
679
630
|
|
|
680
|
-
if (
|
|
681
|
-
typeof error === "object" &&
|
|
682
|
-
error !== null &&
|
|
683
|
-
"error" in error &&
|
|
684
|
-
typeof (error as any).error === "object" &&
|
|
685
|
-
(error as any).error !== null &&
|
|
686
|
-
"content" in (error as any).error
|
|
687
|
-
) {
|
|
688
|
-
contentMessage = (error as any).error.code;
|
|
689
|
-
}
|
|
690
631
|
const accountErrorNotification: Notification = {
|
|
691
632
|
type: "error",
|
|
692
633
|
subtype: "account-creation-error",
|
|
693
634
|
info_content: {
|
|
694
|
-
code
|
|
695
|
-
message
|
|
635
|
+
code,
|
|
636
|
+
message,
|
|
696
637
|
},
|
|
697
638
|
date: Date.now().toString(),
|
|
698
639
|
status: "unread",
|
|
@@ -785,8 +726,6 @@ export const deleteAccount = async (account: Account, security: Security) => {
|
|
|
785
726
|
account,
|
|
786
727
|
);
|
|
787
728
|
|
|
788
|
-
// const updatedAccount: Account = { ...account, status: "pending" };
|
|
789
|
-
// eventHelper.account.publish.deleted(updatedAccount);
|
|
790
729
|
const accountNotification: Notification = {
|
|
791
730
|
type: "success",
|
|
792
731
|
subtype: "account-deleteing",
|
|
@@ -802,25 +741,16 @@ export const deleteAccount = async (account: Account, security: Security) => {
|
|
|
802
741
|
return response;
|
|
803
742
|
} catch (error) {
|
|
804
743
|
eventHelper.account.publish.deletionError(account);
|
|
805
|
-
let contentMessage = "Unknown error";
|
|
806
744
|
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
error !== null &&
|
|
810
|
-
"error" in error &&
|
|
811
|
-
typeof (error as any).error === "object" &&
|
|
812
|
-
(error as any).error !== null &&
|
|
813
|
-
"content" in (error as any).error
|
|
814
|
-
) {
|
|
815
|
-
contentMessage = (error as any).error.code;
|
|
816
|
-
}
|
|
745
|
+
const { code, message } = extractErrorInfo(error);
|
|
746
|
+
|
|
817
747
|
const accountErrorNotification: Notification = {
|
|
818
748
|
type: "error",
|
|
819
749
|
subtype: "account-deletion-error",
|
|
820
750
|
date: Date.now().toString(),
|
|
821
751
|
info_content: {
|
|
822
|
-
code
|
|
823
|
-
message
|
|
752
|
+
code,
|
|
753
|
+
message,
|
|
824
754
|
},
|
|
825
755
|
status: "unread",
|
|
826
756
|
callToAction: false,
|
|
@@ -871,25 +801,16 @@ export const clearAccount = async (account: Account, security: Security) => {
|
|
|
871
801
|
return response;
|
|
872
802
|
} catch (error) {
|
|
873
803
|
eventHelper.account.publish.cleanError(account);
|
|
874
|
-
let contentMessage = "Unknown error";
|
|
875
804
|
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
error !== null &&
|
|
879
|
-
"error" in error &&
|
|
880
|
-
typeof (error as any).error === "object" &&
|
|
881
|
-
(error as any).error !== null &&
|
|
882
|
-
"content" in (error as any).error
|
|
883
|
-
) {
|
|
884
|
-
contentMessage = (error as any).error.code;
|
|
885
|
-
}
|
|
805
|
+
const { code, message } = extractErrorInfo(error);
|
|
806
|
+
|
|
886
807
|
const accountErrorNotification: Notification = {
|
|
887
808
|
type: "error",
|
|
888
809
|
subtype: "account-clean-error",
|
|
889
810
|
date: Date.now().toString(),
|
|
890
811
|
info_content: {
|
|
891
|
-
code
|
|
892
|
-
message
|
|
812
|
+
code,
|
|
813
|
+
message,
|
|
893
814
|
},
|
|
894
815
|
status: "unread",
|
|
895
816
|
callToAction: false,
|
|
@@ -969,7 +890,7 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
969
890
|
unit: "EUR",
|
|
970
891
|
},
|
|
971
892
|
nodes: {
|
|
972
|
-
lowmark: account.nodes?.max || 0,
|
|
893
|
+
lowmark: account.nodes?.max || 0,
|
|
973
894
|
highmark: account.nodes?.max || 0,
|
|
974
895
|
unit: "",
|
|
975
896
|
},
|
|
@@ -984,14 +905,12 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
984
905
|
...(account.flavors?.nonReplicated?.[0] && {
|
|
985
906
|
nonreplicated: account.flavors.nonReplicated[0],
|
|
986
907
|
}),
|
|
987
|
-
// shared: "classic",
|
|
988
908
|
...(account.flavors?.small?.[0] && {
|
|
989
909
|
smallVMFlavor: account.flavors?.small?.[0],
|
|
990
910
|
}),
|
|
991
911
|
...(account.flavors?.medium?.[0] && {
|
|
992
912
|
mediumVMFlavor: account.flavors.medium[0],
|
|
993
913
|
}),
|
|
994
|
-
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
995
914
|
},
|
|
996
915
|
},
|
|
997
916
|
meta: {
|
|
@@ -1079,14 +998,12 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
1079
998
|
...(account.flavors?.nonReplicated?.[0] && {
|
|
1080
999
|
nonreplicated: account.flavors.nonReplicated[0],
|
|
1081
1000
|
}),
|
|
1082
|
-
// shared: "classic",
|
|
1083
1001
|
...(account.flavors?.small?.[0] && {
|
|
1084
1002
|
smallVMFlavor: account.flavors?.small?.[0],
|
|
1085
1003
|
}),
|
|
1086
1004
|
...(account.flavors?.medium?.[0] && {
|
|
1087
1005
|
mediumVMFlavor: account.flavors.medium[0],
|
|
1088
1006
|
}),
|
|
1089
|
-
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
1090
1007
|
},
|
|
1091
1008
|
},
|
|
1092
1009
|
meta: {
|
|
@@ -1112,12 +1029,6 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
1112
1029
|
}
|
|
1113
1030
|
: {
|
|
1114
1031
|
method: providerName,
|
|
1115
|
-
// ovh: {
|
|
1116
|
-
// endpoint: "string",
|
|
1117
|
-
// application_key: "string",
|
|
1118
|
-
// application_secret: "string",
|
|
1119
|
-
// consumer_key: "string",
|
|
1120
|
-
// },
|
|
1121
1032
|
openstack: {
|
|
1122
1033
|
region_name: account.cloudProvider?.region || "",
|
|
1123
1034
|
interface: account.cloudProvider?.interface || "",
|
|
@@ -1187,14 +1098,12 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
1187
1098
|
...(account.flavors?.nonReplicated?.[0] && {
|
|
1188
1099
|
nonreplicated: account.flavors.nonReplicated[0],
|
|
1189
1100
|
}),
|
|
1190
|
-
// shared: "classic",
|
|
1191
1101
|
...(account.flavors?.small?.[0] && {
|
|
1192
1102
|
smallVMFlavor: account.flavors?.small?.[0],
|
|
1193
1103
|
}),
|
|
1194
1104
|
...(account.flavors?.medium?.[0] && {
|
|
1195
1105
|
mediumVMFlavor: account.flavors.medium[0],
|
|
1196
1106
|
}),
|
|
1197
|
-
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
1198
1107
|
},
|
|
1199
1108
|
},
|
|
1200
1109
|
meta: {
|
|
@@ -1222,12 +1131,6 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
1222
1131
|
}
|
|
1223
1132
|
: {
|
|
1224
1133
|
method: providerName,
|
|
1225
|
-
// ovh: {
|
|
1226
|
-
// endpoint: "string",
|
|
1227
|
-
// application_key: "string",
|
|
1228
|
-
// application_secret: "string",
|
|
1229
|
-
// consumer_key: "string",
|
|
1230
|
-
// },
|
|
1231
1134
|
openstack: {
|
|
1232
1135
|
region_name: account.cloudProvider?.region || "",
|
|
1233
1136
|
interface: account.cloudProvider?.interface || "",
|
|
@@ -1297,14 +1200,12 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
1297
1200
|
...(account.flavors?.nonReplicated?.[0] && {
|
|
1298
1201
|
nonreplicated: account.flavors.nonReplicated[0],
|
|
1299
1202
|
}),
|
|
1300
|
-
// shared: "classic",
|
|
1301
1203
|
...(account.flavors?.small?.[0] && {
|
|
1302
1204
|
smallVMFlavor: account.flavors?.small?.[0],
|
|
1303
1205
|
}),
|
|
1304
1206
|
...(account.flavors?.medium?.[0] && {
|
|
1305
1207
|
mediumVMFlavor: account.flavors.medium[0],
|
|
1306
1208
|
}),
|
|
1307
|
-
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
1308
1209
|
},
|
|
1309
1210
|
},
|
|
1310
1211
|
meta: {
|
|
@@ -1315,48 +1216,31 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
1315
1216
|
},
|
|
1316
1217
|
},
|
|
1317
1218
|
};
|
|
1318
|
-
}
|
|
1319
|
-
else if (providerName === "cloudos") {
|
|
1219
|
+
} else if (providerName === "cloudos") {
|
|
1320
1220
|
accountBody = {
|
|
1321
1221
|
tenant: account.tenant,
|
|
1322
1222
|
account: account.name,
|
|
1323
1223
|
provision_infrastructure: false,
|
|
1324
1224
|
spec: {
|
|
1325
1225
|
api: providerName,
|
|
1326
|
-
credentials:
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
// application_secret: "string",
|
|
1342
|
-
// consumer_key: "string",
|
|
1343
|
-
// },
|
|
1344
|
-
openstack: {
|
|
1345
|
-
region_name: account.cloudProvider?.region || "",
|
|
1346
|
-
interface: account.cloudProvider?.interface || "",
|
|
1347
|
-
identity_api_version: Number(
|
|
1348
|
-
account.cloudProvider?.apiVersion || 3,
|
|
1349
|
-
),
|
|
1350
|
-
auth_type: account.cloudProvider?.authType || "",
|
|
1351
|
-
auth: {
|
|
1352
|
-
auth_url: account.cloudProvider?.authUrl || "",
|
|
1353
|
-
application_credential_id:
|
|
1354
|
-
account.cloudProvider?.credentialId || "",
|
|
1355
|
-
application_credential_secret:
|
|
1356
|
-
account.cloudProvider?.credentialSecret || "",
|
|
1357
|
-
},
|
|
1358
|
-
},
|
|
1226
|
+
credentials: {
|
|
1227
|
+
method: providerName,
|
|
1228
|
+
openstack: {
|
|
1229
|
+
region_name: account.cloudProvider?.region || "",
|
|
1230
|
+
interface: account.cloudProvider?.interface || "",
|
|
1231
|
+
identity_api_version: Number(
|
|
1232
|
+
account.cloudProvider?.apiVersion || 3,
|
|
1233
|
+
),
|
|
1234
|
+
auth_type: account.cloudProvider?.authType || "",
|
|
1235
|
+
auth: {
|
|
1236
|
+
auth_url: account.cloudProvider?.authUrl || "",
|
|
1237
|
+
application_credential_id:
|
|
1238
|
+
account.cloudProvider?.credentialId || "",
|
|
1239
|
+
application_credential_secret:
|
|
1240
|
+
account.cloudProvider?.credentialSecret || "",
|
|
1359
1241
|
},
|
|
1242
|
+
},
|
|
1243
|
+
},
|
|
1360
1244
|
highlyAvailable: true,
|
|
1361
1245
|
marks: {
|
|
1362
1246
|
vcpu: {
|
|
@@ -1410,14 +1294,12 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
1410
1294
|
...(account.flavors?.nonReplicated?.[0] && {
|
|
1411
1295
|
nonreplicated: account.flavors.nonReplicated[0],
|
|
1412
1296
|
}),
|
|
1413
|
-
// shared: "classic",
|
|
1414
1297
|
...(account.flavors?.small?.[0] && {
|
|
1415
1298
|
smallVMFlavor: account.flavors?.small?.[0],
|
|
1416
1299
|
}),
|
|
1417
1300
|
...(account.flavors?.medium?.[0] && {
|
|
1418
1301
|
mediumVMFlavor: account.flavors.medium[0],
|
|
1419
1302
|
}),
|
|
1420
|
-
// ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
|
|
1421
1303
|
},
|
|
1422
1304
|
},
|
|
1423
1305
|
meta: {
|
|
@@ -1428,8 +1310,7 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
1428
1310
|
},
|
|
1429
1311
|
},
|
|
1430
1312
|
};
|
|
1431
|
-
}
|
|
1432
|
-
else if (providerName === "opennebula") {
|
|
1313
|
+
} else if (providerName === "opennebula") {
|
|
1433
1314
|
accountBody = {
|
|
1434
1315
|
tenant: account.tenant,
|
|
1435
1316
|
account: account.name,
|
|
@@ -1538,34 +1419,24 @@ export const updateAccount = async (account: Account, security: Security) => {
|
|
|
1538
1419
|
provider: account.cloudProvider?.name,
|
|
1539
1420
|
});
|
|
1540
1421
|
eventHelper.account.publish.updateError(account);
|
|
1541
|
-
|
|
1422
|
+
// const { code, message } = extractErrorInfo(error);
|
|
1542
1423
|
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
message: (error as any).error.content,
|
|
1560
|
-
},
|
|
1561
|
-
status: "unread",
|
|
1562
|
-
callToAction: false,
|
|
1563
|
-
data: {
|
|
1564
|
-
account: account.name,
|
|
1565
|
-
tenant: account.tenant,
|
|
1566
|
-
},
|
|
1567
|
-
};
|
|
1568
|
-
eventHelper.notification.publish.creation(accountErrorNotification);
|
|
1424
|
+
// const accountErrorNotification: Notification = {
|
|
1425
|
+
// type: "error",
|
|
1426
|
+
// subtype: "account-update-error",
|
|
1427
|
+
// date: Date.now().toString(),
|
|
1428
|
+
// info_content: {
|
|
1429
|
+
// code,
|
|
1430
|
+
// message,
|
|
1431
|
+
// },
|
|
1432
|
+
// status: "unread",
|
|
1433
|
+
// callToAction: false,
|
|
1434
|
+
// data: {
|
|
1435
|
+
// account: account.name,
|
|
1436
|
+
// tenant: account.tenant,
|
|
1437
|
+
// },
|
|
1438
|
+
// };
|
|
1439
|
+
// eventHelper.notification.publish.creation(accountErrorNotification);
|
|
1569
1440
|
throw error;
|
|
1570
1441
|
}
|
|
1571
1442
|
};
|