1+ name : " Azure Stack HCI Edge Machine"
2+ label : " {{ LABELS.AzureStackEdgeMachine }}"
3+ table_name : " resources"
4+ resource_type : " microsoft.azurestackhci/edgemachines"
5+ properties :
6+ - " /id"
7+ - " /properties"
8+ index_properties :
9+ - " {{ LABELS.AzureStackEdgeMachine }}:cloudId"
10+ - " {{ LABELS.AzureStackEdgeMachineNic }}:machineId+adapterName"
11+ cypher : |
12+ UNWIND $batch AS row
13+ MERGE (obj:{{ LABELS.ArmResource }} {id: toLower(row.id)})
14+ SET obj:{{ LABELS.AzureStackEdgeMachine }}
15+ SET obj += {
16+
17+ // Not sure how to link these to other resources, so just storing the IDs for now
18+ arcMachineResourceGroupId: row.properties.arcMachineResourceGroupId,
19+ arcMachineResourceId: row.properties.arcMachineResourceId,
20+
21+ // The Cloud ID is a reference to the cloud this edge machine is registered with
22+ // It looks like it's a HybridMachine name but unsure of how to link it so just storing the ID for now
23+ cloudId: row.properties.cloudId,
24+
25+
26+ connectivityStatus: row.properties.connectivityStatus,
27+ devicePoolResourceId: row.properties.devicePoolResourceId,
28+ edgeMachineKind: row.properties.edgeMachineKind,
29+ lastUpdated: row.properties.lastUpdated,
30+ lastSyncTimestamp: row.properties.lastSyncTimestamp,
31+ machineState: row.properties.machineState
32+ }
33+
34+ CALL (obj, row) {
35+ WITH obj, row
36+ WHERE row.properties.objectId IS NOT NULL
37+ MERGE (s:{{ LABELS.GraphObject }} {id: toLower(row.properties.objectId)})
38+ MERGE (obj)-[:{{ REL.REGISTERED_BY }}]->(s)
39+ }
40+
41+ CALL (obj, row) {
42+ UNWIND coalesce(row.properties.networkProfile.nicDetails, []) AS nic
43+ MERGE (n:{{ LABELS.AzureStackEdgeMachineNic }} {machineId: toLower(row.id), adapterName: nic.adapterName})
44+ SET n += {
45+ adapterName: nic.adapterName,
46+ dnsServers: nic.dnsServers,
47+ ip4Address: nic.ip4Address,
48+ macAddress: nic.macAddress,
49+ rdmaCapability: nic.rdmaCapability,
50+ subnetMask: nic.subnetMask
51+ }
52+ MERGE (obj)-[:{{ REL.HAS_NIC }}]->(n)
53+ }
0 commit comments