Json schema (prototype).
This commit is contained in:
parent
ab6bd56006
commit
2593743746
@ -31,6 +31,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-runtime": "^5.8.34",
|
"babel-runtime": "^5.8.34",
|
||||||
|
"cron": "^1.1.0",
|
||||||
"event-to-promise": "^0.6.0",
|
"event-to-promise": "^0.6.0",
|
||||||
"lodash.filter": "^4.2.0",
|
"lodash.filter": "^4.2.0",
|
||||||
"lodash.intersection": "^4.1.0",
|
"lodash.intersection": "^4.1.0",
|
||||||
|
@ -1,18 +1,62 @@
|
|||||||
import * as mapToArray from 'lodash.map'
|
|
||||||
import filter from 'lodash.filter'
|
import filter from 'lodash.filter'
|
||||||
import intersection from 'lodash.intersection'
|
import intersection from 'lodash.intersection'
|
||||||
import uniq from 'lodash.uniq'
|
import uniq from 'lodash.uniq'
|
||||||
import { CronJob } from 'cron'
|
import { CronJob } from 'cron'
|
||||||
|
import { default as mapToArray } from 'lodash.map'
|
||||||
|
|
||||||
export const configurationSchema = {
|
export const configurationSchema = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
|
plans: {
|
||||||
|
type: 'array',
|
||||||
|
title: 'plans',
|
||||||
|
description: 'an array of plans',
|
||||||
|
|
||||||
|
items: {
|
||||||
|
type: 'object',
|
||||||
|
title: 'plan',
|
||||||
|
|
||||||
|
properties: {
|
||||||
|
name: {
|
||||||
|
type: 'string'
|
||||||
|
},
|
||||||
|
mode: {
|
||||||
|
type: 'object',
|
||||||
|
|
||||||
|
properties: {
|
||||||
|
performance: { type: 'string' },
|
||||||
|
density: { type: 'string' }
|
||||||
|
},
|
||||||
|
|
||||||
|
oneOf: [
|
||||||
|
{ required: ['performance'] },
|
||||||
|
{ required: ['density'] }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
behavior: {
|
||||||
|
type: 'object',
|
||||||
|
|
||||||
|
properties: {
|
||||||
|
low: { type: 'string' },
|
||||||
|
normal: { type: 'string' },
|
||||||
|
aggressive: { type: 'string' }
|
||||||
|
},
|
||||||
|
|
||||||
|
oneOf: [
|
||||||
|
{ required: ['low'] },
|
||||||
|
{ required: ['normal'] },
|
||||||
|
{ required: ['aggressive'] }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
minItems: 1,
|
||||||
|
uniqueItems: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
additionalProperties: false,
|
additionalProperties: false
|
||||||
required: []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
@ -116,15 +160,7 @@ class LoadBalancerPlugin {
|
|||||||
throw new Error(`Pool(s) already included in an other plan: ${poolUuids}`)
|
throw new Error(`Pool(s) already included in an other plan: ${poolUuids}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const { xo } = this
|
this._plans.push(new Plan(this.xo, poolUuids))
|
||||||
|
|
||||||
// Test if each pool exists.
|
|
||||||
for (const poolUuid of poolUuids) {
|
|
||||||
console.log(poolUuid)
|
|
||||||
xo.getObject(poolUuid)
|
|
||||||
}
|
|
||||||
|
|
||||||
this._plans.push(new Plan(xo, poolUuids))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async _executePlans () {
|
async _executePlans () {
|
||||||
|
Loading…
Reference in New Issue
Block a user