Create Package

Creates a new package.

Requirements

requirements is an array of objects as with the following atributes:

weight

A number (positive or negative) or the string "must", "cant" for strong enforcement or "scale" and "random"

must, cant, and <number> rules

This 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

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

The value to check against, this can be a number, a string, or an array.

condition

One of:

  • >=, > - Checks if the value of attribute is larger (or equal) to the value
  • =<, < - Checks if the value of attribute is smaller (or equal) to the value
  • =:= - Checks if the value of attribute is equal to the value
  • =/= - Checks if the value of attribute is not equal to the value
  • "subset" - Checks if the value of attribute is a subset of value (requires value to be an array)
  • "superset" - Checks if the value of attribute is a superset of value (requires value to be an array)
  • "disjoint" - Checks if the value of attribute is disjoint with the value (requires value to be an array)
  • "element" - Checks if the value is contained in the attribute

scale rules

This rules linearly map an attributes value onto a given scale and give the result as points for hypervisor selection.

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

The lowest and highest number of the scale, to map against.

random rules

This 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

The lowest and highest number the random number is generated from.

exmaple

[{
  "weight":    "must",
  "attribute": "characteristics.colour",
  "condition": "=:=",
  "value":     "purple"
}]
Language
Click Try It! to start a request and see the response here!