domain/architecture/environment/inventory/ops.bend
near-v-framework@0.4.0.0 · 21 lines · 3 definitions
1import Base
2import near-v-framework@0.4.0.0/domain/architecture/environment/inventory/type.bend as I
3
4def owns.go(xs: List<&2, I.Device>, +key: String, +name: String) -> Bool:
5 match xs:
6 case []:
7 False{}
8 case I.Device{+k, +n, _} <> rest:
9 (String.eq(key, k) && String.eq(name, n)) || owns.go(rest, key, name)
10
11
12def owns(inv: I.Inventory, +key: String, +name: String) -> Bool:
13 match inv:
14 case I.Inventory{_, devices}:
15 owns.go(devices, key, name)
16
17
18def cloud_ok(inv: I.Inventory, +provider: String) -> Bool:
19 match inv:
20 case I.Inventory{I.Vendor{_, cloud}, _}:
21 String.eq(provider, cloud)