@kumori/aurora-backend-handler 1.0.78 → 1.0.79

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.
@@ -319,7 +319,7 @@ export const createAccount = async (account: Account, security: Security) => {
319
319
  },
320
320
  },
321
321
  };
322
- } else if (providerName === "oasix" || providerName === "cloudos") {
322
+ } else if (providerName === "oasix") {
323
323
  accountBody = {
324
324
  tenant: account.tenant,
325
325
  account: account.name,
@@ -335,7 +335,8 @@ export const createAccount = async (account: Account, security: Security) => {
335
335
  domain: account.cloudProvider?.domain || "",
336
336
  project_name: account.cloudProvider?.project_name || "",
337
337
  }
338
- : {
338
+ :
339
+ {
339
340
  method: providerName,
340
341
  // ovh: {
341
342
  // endpoint: "string",
@@ -431,7 +432,123 @@ export const createAccount = async (account: Account, security: Security) => {
431
432
  },
432
433
  },
433
434
  };
434
- } else if (providerName === "opennebula") {
435
+ }
436
+ else if (providerName === "cloudos") {
437
+ accountBody = {
438
+ tenant: account.tenant,
439
+ account: account.name,
440
+ provision_infrastructure: false,
441
+ spec: {
442
+ spec: {
443
+ api: providerName,
444
+ credentials:
445
+ // account.cloudProvider.password
446
+ // ? {
447
+ // username: account.cloudProvider.username || "",
448
+ // password: account.cloudProvider.password || "",
449
+ // region: account.cloudProvider?.region || "",
450
+ // domain: account.cloudProvider?.domain || "",
451
+ // project_name: account.cloudProvider?.project_name || "",
452
+ // }
453
+ // :
454
+ {
455
+ method: providerName,
456
+ // ovh: {
457
+ // endpoint: "string",
458
+ // application_key: "string",
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
+ },
477
+ },
478
+ highlyAvailable: true,
479
+ marks: {
480
+ vcpu: {
481
+ lowmark: account.usage.limit.cpu.min * 1000,
482
+ highmark: account.usage.limit.cpu.max * 1000,
483
+ unit: "m",
484
+ },
485
+ memory: {
486
+ lowmark: account.usage.limit.memory.min * 1000,
487
+ highmark: account.usage.limit.memory.max * 1000,
488
+ unit: "MB",
489
+ },
490
+ vstorage: {
491
+ lowmark: account.usage.limit.volatileStorage.min * 1000,
492
+ highmark: account.usage.limit.volatileStorage.max * 1000,
493
+ unit: "MB",
494
+ },
495
+ nrstorage: {
496
+ lowmark: account.usage.limit.nonReplicatedStorage.min * 1000,
497
+ highmark: account.usage.limit.nonReplicatedStorage.max * 1000,
498
+ unit: "MB",
499
+ },
500
+ rstorage: {
501
+ lowmark: account.usage.limit.persistentStorage.min * 1000,
502
+ highmark: account.usage.limit.persistentStorage.max * 1000,
503
+ unit: "MB",
504
+ },
505
+ storage: {
506
+ lowmark: account.usage.limit.storage.min * 1000,
507
+ highmark: account.usage.limit.storage.max * 1000,
508
+ unit: "MB",
509
+ },
510
+ cost: {
511
+ lowmark: account.usage.cost,
512
+ highmark: account.usage.cost,
513
+ unit: "EUR",
514
+ },
515
+ nodes: {
516
+ lowmark: account.nodes?.max || 0,
517
+ highmark: account.nodes?.max || 0,
518
+ unit: "",
519
+ },
520
+ },
521
+ iaasconfig: {
522
+ ...(account.flavors?.volatile?.[0] && {
523
+ volatile: account.flavors.volatile[0],
524
+ }),
525
+ ...(account.flavors?.persistent?.[0] && {
526
+ persistent: account.flavors.persistent[0],
527
+ }),
528
+ ...(account.flavors?.nonReplicated?.[0] && {
529
+ nonreplicated: account.flavors.nonReplicated[0],
530
+ }),
531
+ // shared: "classic",
532
+ ...(account.flavors?.small?.[0] && {
533
+ smallVMFlavor: account.flavors?.small?.[0],
534
+ }),
535
+ ...(account.flavors?.medium?.[0] && {
536
+ mediumVMFlavor: account.flavors.medium[0],
537
+ }),
538
+ // ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
539
+ },
540
+ },
541
+ meta: {
542
+ labels: {
543
+ additionalProp1: "string",
544
+ additionalProp2: "string",
545
+ additionalProp3: "string",
546
+ },
547
+ },
548
+ },
549
+ };
550
+ }
551
+ else if (providerName === "opennebula") {
435
552
  accountBody = {
436
553
  tenant: account.tenant,
437
554
  account: account.name,
@@ -615,7 +732,7 @@ export const deleteAccount = async (account: Account, security: Security) => {
615
732
  },
616
733
  },
617
734
  };
618
- } else if (providerName === "oasix" || providerName === "cloudos") {
735
+ } else if (providerName === "oasix") {
619
736
  payload = {
620
737
  tenant: account.tenant,
621
738
  account: account.name,
@@ -1088,7 +1205,7 @@ export const updateAccount = async (account: Account, security: Security) => {
1088
1205
  },
1089
1206
  },
1090
1207
  };
1091
- } else if (providerName === "oasix" || providerName === "cloudos") {
1208
+ } else if (providerName === "oasix") {
1092
1209
  accountBody = {
1093
1210
  tenant: account.tenant,
1094
1211
  account: account.name,
@@ -1198,7 +1315,121 @@ export const updateAccount = async (account: Account, security: Security) => {
1198
1315
  },
1199
1316
  },
1200
1317
  };
1201
- } else if (providerName === "opennebula") {
1318
+ }
1319
+ else if (providerName === "cloudos") {
1320
+ accountBody = {
1321
+ tenant: account.tenant,
1322
+ account: account.name,
1323
+ provision_infrastructure: false,
1324
+ spec: {
1325
+ api: providerName,
1326
+ credentials:
1327
+ // account.cloudProvider.password
1328
+ // ? {
1329
+ // username: account.cloudProvider.username || "",
1330
+ // password: account.cloudProvider.password || "",
1331
+ // region: account.cloudProvider?.region || "",
1332
+ // domain: account.cloudProvider?.domain || "",
1333
+ // project_name: account.cloudProvider?.project_name || "",
1334
+ // }
1335
+ // :
1336
+ {
1337
+ method: providerName,
1338
+ // ovh: {
1339
+ // endpoint: "string",
1340
+ // application_key: "string",
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
+ },
1359
+ },
1360
+ highlyAvailable: true,
1361
+ marks: {
1362
+ vcpu: {
1363
+ lowmark: account.usage.limit.cpu.min * 1000,
1364
+ highmark: account.usage.limit.cpu.max * 1000,
1365
+ unit: "m",
1366
+ },
1367
+ memory: {
1368
+ lowmark: account.usage.limit.memory.min * 1000,
1369
+ highmark: account.usage.limit.memory.max * 1000,
1370
+ unit: "MB",
1371
+ },
1372
+ vstorage: {
1373
+ lowmark: account.usage.limit.volatileStorage.min * 1000,
1374
+ highmark: account.usage.limit.volatileStorage.max * 1000,
1375
+ unit: "MB",
1376
+ },
1377
+ nrstorage: {
1378
+ lowmark: account.usage.limit.nonReplicatedStorage.min * 1000,
1379
+ highmark: account.usage.limit.nonReplicatedStorage.max * 1000,
1380
+ unit: "MB",
1381
+ },
1382
+ rstorage: {
1383
+ lowmark: account.usage.limit.persistentStorage.min * 1000,
1384
+ highmark: account.usage.limit.persistentStorage.max * 1000,
1385
+ unit: "MB",
1386
+ },
1387
+ storage: {
1388
+ lowmark: account.usage.limit.storage.min * 1000,
1389
+ highmark: account.usage.limit.storage.max * 1000,
1390
+ unit: "MB",
1391
+ },
1392
+ cost: {
1393
+ lowmark: account.usage.cost,
1394
+ highmark: account.usage.cost,
1395
+ unit: "EUR",
1396
+ },
1397
+ nodes: {
1398
+ lowmark: account.nodes?.min || 0,
1399
+ highmark: account.nodes?.max || 0,
1400
+ unit: "",
1401
+ },
1402
+ },
1403
+ iaasconfig: {
1404
+ ...(account.flavors?.volatile?.[0] && {
1405
+ volatile: account.flavors.volatile[0],
1406
+ }),
1407
+ ...(account.flavors?.persistent?.[0] && {
1408
+ persistent: account.flavors.persistent[0],
1409
+ }),
1410
+ ...(account.flavors?.nonReplicated?.[0] && {
1411
+ nonreplicated: account.flavors.nonReplicated[0],
1412
+ }),
1413
+ // shared: "classic",
1414
+ ...(account.flavors?.small?.[0] && {
1415
+ smallVMFlavor: account.flavors?.small?.[0],
1416
+ }),
1417
+ ...(account.flavors?.medium?.[0] && {
1418
+ mediumVMFlavor: account.flavors.medium[0],
1419
+ }),
1420
+ // ...(account.flavors?.large?.[0] && { largeVMFlavor: account.flavors.large[0] }),
1421
+ },
1422
+ },
1423
+ meta: {
1424
+ labels: {
1425
+ additionalProp1: "string",
1426
+ additionalProp2: "string",
1427
+ additionalProp3: "string",
1428
+ },
1429
+ },
1430
+ };
1431
+ }
1432
+ else if (providerName === "opennebula") {
1202
1433
  accountBody = {
1203
1434
  tenant: account.tenant,
1204
1435
  account: account.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.0.78",
3
+ "version": "1.0.79",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {