def getResourceId(): ladCfg = readPublicConfig('ladCfg') resourceId = LadUtil.getResourceIdFromLadCfg(ladCfg) if not resourceId: encodedXmlCfg = readPublicConfig('xmlCfg').strip() if encodedXmlCfg: xmlCfg = base64.b64decode(encodedXmlCfg) resourceId = XmlUtil.getXmlValue(XmlUtil.createElement(xmlCfg),'diagnosticMonitorConfiguration/metrics','resourceId') # Azure portal uses xmlCfg which contains WadCfg which is pascal case, Currently we will support both casing and deprecate one later if not resourceId: resourceId = XmlUtil.getXmlValue(XmlUtil.createElement(xmlCfg),'DiagnosticMonitorConfiguration/Metrics','resourceId') return resourceId
def get_resource_id(self): """ Try to get resourceId from LadCfg. If not present, try to fetch from xmlCfg. """ lad_cfg = self.read_public_config('ladCfg') resource_id = LadUtil.getResourceIdFromLadCfg(lad_cfg) if not resource_id: encoded_xml_cfg = self.read_public_config('xmlCfg').strip() if encoded_xml_cfg: xml_cfg = base64.b64decode(encoded_xml_cfg) resource_id = XmlUtil.getXmlValue(XmlUtil.createElement(xml_cfg), 'diagnosticMonitorConfiguration/metrics', 'resourceId') # Azure portal uses xmlCfg which contains WadCfg which is pascal case # Currently we will support both casing and deprecate one later if not resource_id: resource_id = XmlUtil.getXmlValue(XmlUtil.createElement(xml_cfg), 'DiagnosticMonitorConfiguration/Metrics', 'resourceId') return resource_id