Creates a new package.
Requirements
requirements
is an array of objects as with the following atributes:
weight
weight
A number (positive or negative) or the string "must"
, "cant
" for strong enforcement or "scale"
and "random"
must
, cant
, and <number>
rules
must
, cant
, and <number>
rulesThis rules simply compare an attribute of the hypervisor against a value and either enforces a the rule (must
/cant
) or gives out points, both positive and negative to rate the found hypervisors.
attribute
attribute
The attribute to check on the hypervisors, this can be a json like path so for example "characteristics.colour"
will look up colour
in the hypervisors characteristics
value
value
The value to check against, this can be a number, a string, or an array.
condition
condition
One of:
>=
,>
- Checks if the value ofattribute
is larger (or equal) to the value=<
,<
- Checks if the value ofattribute
is smaller (or equal) to the value=:=
- Checks if the value ofattribute
is equal to the value=/=
- Checks if the value ofattribute
is not equal to the value"subset"
- Checks if the value ofattribute
is a subset of value (requires value to be an array)"superset"
- Checks if the value ofattribute
is a superset of value (requires value to be an array)"disjoint"
- Checks if the value ofattribute
is disjoint with the value (requires value to be an array)"element"
- Checks if the value is contained in theattribute
scale
rules
scale
rulesThis rules linearly map an attributes value onto a given scale and give the result as points for hypervisor selection.
attribute
attribute
The attribute to check on the hypervisors, this can be a json like path so for example "characteristics.cores"
will look up cores
in the hypervisors characteristics
This must be an numeric value towork
low
, and high
low
, and high
The lowest and highest number of the scale, to map against.
random
rules
random
rulesThis rules simply generate a random number on a given scale, this allows making non deterministic rules. The resulting number is used as points for hypervisor selection.
low
, and high
low
, and high
The lowest and highest number the random number is generated from.
exmaple
[{
"weight": "must",
"attribute": "characteristics.colour",
"condition": "=:=",
"value": "purple"
}]