vmtypes to dbinit
This commit is contained in:
62
server/cronjobs/data/vmtypes.json
Normal file
62
server/cronjobs/data/vmtypes.json
Normal file
@@ -0,0 +1,62 @@
|
||||
[
|
||||
{
|
||||
"_id": "5e73a211710f74000640cbf2",
|
||||
"type": "Standard_B1ms",
|
||||
"desc": "1 CPUs - 2GiB RAM",
|
||||
"costHour": 0.0207
|
||||
},
|
||||
{
|
||||
"_id": "5e73a220710f74000640cbf4",
|
||||
"type": "Standard_B2s",
|
||||
"desc": "2 CPUs - 4GiB RAM",
|
||||
"costHour": 0.0416
|
||||
},
|
||||
{
|
||||
"_id": "5e73a22b710f74000640cbf6",
|
||||
"type": "Standard_D2s_v3",
|
||||
"desc": "2 CPUs - 8GiB RAM",
|
||||
"costHour": 0.096
|
||||
},
|
||||
{
|
||||
"_id": "5e73a240710f74000640cbfa",
|
||||
"type": "Standard_D4s_v3",
|
||||
"desc": "4 CPUs - 16GiB RAM",
|
||||
"costHour": 0.192
|
||||
},
|
||||
{
|
||||
"_id": "5e73a251710f74000640cbfe",
|
||||
"type": "Standard_D8s_v3",
|
||||
"desc": "8 CPUs - 32GiB RAM",
|
||||
"costHour": 0.384
|
||||
},
|
||||
{
|
||||
"_id": "5e73a262710f74000640cc02",
|
||||
"type": "Standard_D16s_v3",
|
||||
"desc": "16 CPUs - 64GiB RAM",
|
||||
"costHour": 0.768
|
||||
},
|
||||
{
|
||||
"_id": "5e92c98ce7b19100066153ab",
|
||||
"type": "Standard_D32s_v3",
|
||||
"desc": "32 CPUs - 128GiB RAM",
|
||||
"costHour": 1.536
|
||||
},
|
||||
{
|
||||
"_id": "5ea9016970653300063fbd17",
|
||||
"type": "Standard_E16s_v3",
|
||||
"desc": "16 CPUs - 128 GiB RAM - Mem. optimized",
|
||||
"costHour": 1.008
|
||||
},
|
||||
{
|
||||
"_id": "5ea901bd70653300063fbd19",
|
||||
"type": "Standard_E20s_v3",
|
||||
"desc": "20 CPUs - 160 GiB RAM - Mem. optimized",
|
||||
"costHour": 1.26
|
||||
},
|
||||
{
|
||||
"_id": "5ea901d670653300063fbd1b",
|
||||
"type": "Standard_E32s_v3",
|
||||
"desc": "32 CPUs - 256GiB RAM - Mem. optimized",
|
||||
"costHour": 2.016
|
||||
}
|
||||
]
|
||||
@@ -2,6 +2,7 @@ var db = require("../mongo");
|
||||
var initDataSubscriptions = require("./data/subscriptions.json");
|
||||
var scenarios1 = require("./data/scenariosQMI-Automation.json");
|
||||
var scenarios2 = require("./data/scenariosQlik-Secure.json");
|
||||
var vmTypes = require("./data/vmtypes.json");
|
||||
|
||||
|
||||
|
||||
@@ -12,12 +13,19 @@ async function asyncForEach(array, callback) {
|
||||
}
|
||||
|
||||
async function init() {
|
||||
// Adding VmTypes
|
||||
await asyncForEach(vmTypes, async function(v){
|
||||
await db.vmtype.add(v);
|
||||
});
|
||||
|
||||
// Adding Subscriptions
|
||||
await asyncForEach(initDataSubscriptions, async function(s){
|
||||
await db.subscription.add(s);
|
||||
});
|
||||
|
||||
|
||||
var subscription;
|
||||
//QMI Automation
|
||||
var subscription = await db.subscription.getOne({"description": "QMI Automation"});
|
||||
subscription = await db.subscription.getOne({"description": "QMI Automation"});
|
||||
await asyncForEach(scenarios1, async function(s){
|
||||
s.subscription = subscription._id;
|
||||
await db.scenario.add(s);
|
||||
|
||||
@@ -58,7 +58,11 @@ const getNewTimeRunning = function (provision) {
|
||||
|
||||
|
||||
const get = async (model, filter, select, skip, limit, populates, reply) => {
|
||||
var sort = {created: -1};
|
||||
var sort = {};
|
||||
var modelAttributes = Object.keys(model.schema.tree);
|
||||
if ( modelAttributes.indexOf("created") !== -1) {
|
||||
sort = {created: -1};
|
||||
}
|
||||
try {
|
||||
var exec = model.find(filter, select).sort(sort);
|
||||
var totalDocs = await model.countDocuments(filter);
|
||||
|
||||
Reference in New Issue
Block a user