in azext_edge/edge/providers/orchestration/resource_map.py [0:0]
def build_tree(self, include_dependencies: bool = True, category_color: str = "cyan") -> Tree:
tree = Tree(f"[green]{self.connected_cluster.cluster_name}")
extensions_node = tree.add(label=f"[{category_color}]extensions")
if not include_dependencies:
# only show aio extension
# TODO: @c-ryan-k hacky
aio_ext_obj = self.connected_cluster.get_extensions_by_type(EXTENSION_TYPE_OPS).get(
EXTENSION_TYPE_OPS, {}
)
if aio_ext_obj:
aio_ext_id: str = aio_ext_obj.get("id", "")
aio_ext = next((ext for ext in self.extensions if ext.resource_id.lower() == aio_ext_id.lower()), None)
if aio_ext:
extensions_node.add(aio_ext.display_name)
else:
[extensions_node.add(ext.display_name) for ext in self.extensions]
custom_locations = self.custom_locations
if custom_locations:
root_cl_node = tree.add(label=f"[{category_color}]customLocations")
for cl in custom_locations:
cl_node = root_cl_node.add(cl.display_name)
resource_sync_rules = self.get_resource_sync_rules(cl.resource_id)
rsr_node = cl_node.add(f"[{category_color}]resourceSyncRules")
if resource_sync_rules:
[rsr_node.add(rsr.display_name) for rsr in resource_sync_rules]
resource_node = cl_node.add(f"[{category_color}]resources")
cl_resources = self.get_resources(cl.resource_id)
if cl_resources:
[resource_node.add(resource.display_name) for resource in cl_resources]
return tree