本文整理汇总了Python中Utils.LadDiagnosticUtil.getResourceIdFromLadCfg方法的典型用法代码示例。如果您正苦于以下问题:Python LadDiagnosticUtil.getResourceIdFromLadCfg方法的具体用法?Python LadDiagnosticUtil.getResourceIdFromLadCfg怎么用?Python LadDiagnosticUtil.getResourceIdFromLadCfg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils.LadDiagnosticUtil
的用法示例。
在下文中一共展示了LadDiagnosticUtil.getResourceIdFromLadCfg方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getResourceId
# 需要导入模块: from Utils import LadDiagnosticUtil [as 别名]
# 或者: from Utils.LadDiagnosticUtil import getResourceIdFromLadCfg [as 别名]
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
示例2: get_resource_id
# 需要导入模块: from Utils import LadDiagnosticUtil [as 别名]
# 或者: from Utils.LadDiagnosticUtil import getResourceIdFromLadCfg [as 别名]
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
示例3: test_getResourceIdFromLadCfg
# 需要导入模块: from Utils import LadDiagnosticUtil [as 别名]
# 或者: from Utils.LadDiagnosticUtil import getResourceIdFromLadCfg [as 别名]
def test_getResourceIdFromLadCfg(self):
self.assertIsNone(LadUtil.getResourceIdFromLadCfg(self.missing_from_config))
res_id = LadUtil.getResourceIdFromLadCfg(self.valid_config)
self.assertIsNotNone(res_id)
self.assertIn("1111-2222-3333-4444", res_id)