Skip to content

Service Relations

Service Relations allow for a Service schema to specify a dependancy or requirement on another ServiceItem from another type of Service.

Scenario

A simple example of when a Service relation could be used would be when an organisation is offering a load-balancing service. For this load-balancing service to exist, it always needs to point to some virtual machines that the Consumer owns and are in existance.

There for the Service Owner for the load-balancer Service would specify in their Schema that the user must include a reference to the virtual-machine ServiceItems that they have already requested.

This would allow the load-balancer ServiceOwner to leverage NetOrcas validating to ensure the Consumer is making the right request upfront.

In this scenario the load-balancer ServiceOwner team would be dependant on another ServiceOwner team to define and offer the virtual-machine service.

Specifying a relation

Reference list

You can use a reference list to require the Consumers to specify multiple other ServiceItems of the same Service type.

In the example below the Service that the Consumer must refer to is the 'VM' service

"related_vms": {
    "type": "array",
    "format": "reference_list",
    "reference_method": "list",
    "service_reference": "VM"
}

An example of this in use from the Consumer side would be within their application yaml file, in the following format:

services:
  vm:
    - name: vm1
      cpus: 2
    - name: vm2
      cpus: 4
  load_balancer:
    - name: lb1
      related_vms:
        - vm1
        - vm2