@kumori/aurora-backend-handler 1.0.14 → 1.0.15

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.
@@ -6,6 +6,7 @@ import {
6
6
  makeGlobalWebSocketRequest,
7
7
  } from "../websocket-manager";
8
8
  import { eventHelper } from "../backend-handler";
9
+ import { parseJsonSourceFileConfigFileContent } from "typescript";
9
10
 
10
11
  type Security = string;
11
12
 
@@ -391,7 +392,87 @@ export const createAccount = async (account: Account, security: Security) => {
391
392
  },
392
393
  },
393
394
  };
394
- } else {
395
+ }
396
+ else if (providerName === "opennebula") {
397
+ accountBody = {
398
+ tenant: account.tenant,
399
+ account: account.name,
400
+ provision_infrastructure: false,
401
+ spec: {
402
+ spec: {
403
+ api: providerName,
404
+ credentials: {
405
+ method: providerName,
406
+ opennebula: {
407
+ user: account.cloudProvider.username,
408
+ password: account.cloudProvider.password,
409
+ xmlrpc: account.cloudProvider.endpoint
410
+ },
411
+ },
412
+ highlyAvailable: true,
413
+ marks: {
414
+ vcpu: {
415
+ lowmark: account.usage.limit.cpu.min * 1000,
416
+ highmark: account.usage.limit.cpu.max * 1000,
417
+ unit: "m",
418
+ },
419
+ memory: {
420
+ lowmark: account.usage.limit.memory.min * 1000,
421
+ highmark: account.usage.limit.memory.max * 1000,
422
+ unit: "MB",
423
+ },
424
+ vstorage: {
425
+ lowmark: account.usage.limit.volatileStorage.min * 1000,
426
+ highmark: account.usage.limit.volatileStorage.max * 1000,
427
+ unit: "MB",
428
+ },
429
+ nrstorage: {
430
+ lowmark: account.usage.limit.nonReplicatedStorage.min * 1000,
431
+ highmark: account.usage.limit.nonReplicatedStorage.max * 1000,
432
+ unit: "MB",
433
+ },
434
+ rstorage: {
435
+ lowmark: account.usage.limit.persistentStorage.min * 1000,
436
+ highmark: account.usage.limit.persistentStorage.max * 1000,
437
+ unit: "MB",
438
+ },
439
+ storage: {
440
+ lowmark: account.usage.limit.storage.min * 1000,
441
+ highmark: account.usage.limit.storage.max * 1000,
442
+ unit: "MB",
443
+ },
444
+ cost: {
445
+ lowmark: account.usage.cost,
446
+ highmark: account.usage.cost,
447
+ unit: "EUR",
448
+ },
449
+ nodes: {
450
+ lowmark: account.nodes?.max || 0,
451
+ highmark: account.nodes?.max || 0,
452
+ unit: "",
453
+ },
454
+ },
455
+ iaasconfig: {
456
+ ...(account.flavors?.volatile?.[0] && { volatile: account.flavors.volatile[0] }),
457
+ ...(account.flavors?.persistent?.[0] && { persistent: account.flavors.persistent[0] }),
458
+ ...(account.flavors?.nonReplicated?.[0] && { nonreplicated: account.flavors.nonReplicated[0] }),
459
+ // shared: "classic",
460
+ ...(account.flavors?.small?.[0] && { smallVMFlavor: account.flavors?.small?.[0] }),
461
+ ...(account.flavors?.medium?.[0] && { mediumVMFlavor: account.flavors.medium[0] }),
462
+ // ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
463
+ }
464
+ },
465
+ meta: {
466
+ labels: {
467
+ additionalProp1: "string",
468
+ additionalProp2: "string",
469
+ additionalProp3: "string",
470
+ },
471
+ },
472
+ },
473
+ };
474
+ }
475
+ else {
395
476
  throw new Error(
396
477
  `Unsupported cloud provider: ${providerName}. Supported providers are: ovh, aws, azure`
397
478
  );
@@ -1034,7 +1115,87 @@ export const updateAccount = async (account: Account, security: Security) => {
1034
1115
  },
1035
1116
  },
1036
1117
  };
1037
- } else {
1118
+ }
1119
+ else if (providerName === "opennebula") {
1120
+ accountBody = {
1121
+ tenant: account.tenant,
1122
+ account: account.name,
1123
+ provision_infrastructure: false,
1124
+ spec: {
1125
+ spec: {
1126
+ api: providerName,
1127
+ credentials: {
1128
+ method: providerName,
1129
+ opennebula: {
1130
+ user: account.cloudProvider.username,
1131
+ password: account.cloudProvider.password,
1132
+ xmlrpc: account.cloudProvider.endpoint
1133
+ },
1134
+ },
1135
+ highlyAvailable: true,
1136
+ marks: {
1137
+ vcpu: {
1138
+ lowmark: account.usage.limit.cpu.min * 1000,
1139
+ highmark: account.usage.limit.cpu.max * 1000,
1140
+ unit: "m",
1141
+ },
1142
+ memory: {
1143
+ lowmark: account.usage.limit.memory.min * 1000,
1144
+ highmark: account.usage.limit.memory.max * 1000,
1145
+ unit: "MB",
1146
+ },
1147
+ vstorage: {
1148
+ lowmark: account.usage.limit.volatileStorage.min * 1000,
1149
+ highmark: account.usage.limit.volatileStorage.max * 1000,
1150
+ unit: "MB",
1151
+ },
1152
+ nrstorage: {
1153
+ lowmark: account.usage.limit.nonReplicatedStorage.min * 1000,
1154
+ highmark: account.usage.limit.nonReplicatedStorage.max * 1000,
1155
+ unit: "MB",
1156
+ },
1157
+ rstorage: {
1158
+ lowmark: account.usage.limit.persistentStorage.min * 1000,
1159
+ highmark: account.usage.limit.persistentStorage.max * 1000,
1160
+ unit: "MB",
1161
+ },
1162
+ storage: {
1163
+ lowmark: account.usage.limit.storage.min * 1000,
1164
+ highmark: account.usage.limit.storage.max * 1000,
1165
+ unit: "MB",
1166
+ },
1167
+ cost: {
1168
+ lowmark: account.usage.cost,
1169
+ highmark: account.usage.cost,
1170
+ unit: "EUR",
1171
+ },
1172
+ nodes: {
1173
+ lowmark: account.nodes?.max || 0,
1174
+ highmark: account.nodes?.max || 0,
1175
+ unit: "",
1176
+ },
1177
+ },
1178
+ iaasconfig: {
1179
+ ...(account.flavors?.volatile?.[0] && { volatile: account.flavors.volatile[0] }),
1180
+ ...(account.flavors?.persistent?.[0] && { persistent: account.flavors.persistent[0] }),
1181
+ ...(account.flavors?.nonReplicated?.[0] && { nonreplicated: account.flavors.nonReplicated[0] }),
1182
+ // shared: "classic",
1183
+ ...(account.flavors?.small?.[0] && { smallVMFlavor: account.flavors?.small?.[0] }),
1184
+ ...(account.flavors?.medium?.[0] && { mediumVMFlavor: account.flavors.medium[0] }),
1185
+ // ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
1186
+ }
1187
+ },
1188
+ meta: {
1189
+ labels: {
1190
+ additionalProp1: "string",
1191
+ additionalProp2: "string",
1192
+ additionalProp3: "string",
1193
+ },
1194
+ },
1195
+ },
1196
+ };
1197
+ }
1198
+ else {
1038
1199
  throw new Error(
1039
1200
  `Unsupported cloud provider: ${providerName}. Supported providers are: ovh, aws, azure`
1040
1201
  );
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  },
5
5
  "dependencies": {
6
6
  "@jest/globals": "^29.7.0",
7
- "@kumori/aurora-interfaces": "^1.0.0",
7
+ "@kumori/aurora-interfaces": "^1.0.1",
8
8
  "@kumori/kumori-dsl-generator": "^1.0.3",
9
9
  "@kumori/kumori-module-generator": "^1.1.6",
10
10
  "jest": "^29.7.0",
@@ -23,7 +23,7 @@
23
23
  "ws": "^8.18.2"
24
24
  },
25
25
  "name": "@kumori/aurora-backend-handler",
26
- "version": "1.0.14",
26
+ "version": "1.0.15",
27
27
  "description": "backend handler",
28
28
  "main": "backend-handler.ts",
29
29
  "repository": {