def get_split_content()

in azext_edge/edge/providers/orchestration/clone.py [0:0]


    def get_split_content(self) -> List[dict]:
        """
        Used with the instance restore client. The root template and template for each
        nested deployment (in consideration) gets separated and added to a queue to be deployed serially.
        """
        content = self.content
        result = [content]
        parameters = content.get("parameters", {})
        resources: Dict[str, Dict[str, dict]] = content.get("resources", {})
        for key in list(resources.keys()):
            if resources[key].get("type", "").lower() != "microsoft.resources/deployments":
                continue
            nested_resources: List[dict] = resources[key]["properties"]["template"].get("resources", [])
            if not nested_resources:
                continue
            nested_type = nested_resources[0].get("type", "").lower()
            if nested_type not in self.linked_type_map:
                continue

            for param in self.copy_params:
                resources[key]["properties"]["template"]["parameters"][param] = parameters[param]

            result.append(resources[key]["properties"].pop("template"))
            del resources[key]
        return result