当前位置: 首页>>代码示例>>Python>>正文


Python XmlUtil.removeElement方法代码示例

本文整理汇总了Python中Utils.XmlUtil.removeElement方法的典型用法代码示例。如果您正苦于以下问题:Python XmlUtil.removeElement方法的具体用法?Python XmlUtil.removeElement怎么用?Python XmlUtil.removeElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utils.XmlUtil的用法示例。


在下文中一共展示了XmlUtil.removeElement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _update_account_settings

# 需要导入模块: from Utils import XmlUtil [as 别名]
# 或者: from Utils.XmlUtil import removeElement [as 别名]
    def _update_account_settings(self, account, key, token, endpoint, aikey=None):
        """
        Update the MDSD configuration Account element with Azure table storage properties.
        Exactly one of (key, token) must be provided. If an aikey is passed, then add a new Account element for Application
        Insights with the application insights key.
        :param account: Storage account to which LAD should write data
        :param key: Shared key secret for the storage account, if present
        :param token: SAS token to access the storage account, if present
        :param endpoint: Identifies the Azure instance (public or specific sovereign cloud) where the storage account is
        :param aikey: Key for accessing AI, if present
        """
        assert key or token, "Either key or token must be given."
        assert self._mdsd_config_xml_tree is not None

        handler_cert_path, handler_pkey_path = self._get_handler_cert_pkey_paths(self._ext_settings.get_handler_settings())
        if key:
            key = self._encrypt_secret_with_cert(handler_cert_path, key)
            XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/Account',
                                "account", account, ['isDefault', 'true'])
            XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/Account',
                                "key", key, ['isDefault', 'true'])
            XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/Account',
                                "decryptKeyPath", handler_pkey_path, ['isDefault', 'true'])
            XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/Account',
                                "tableEndpoint", endpoint, ['isDefault', 'true'])
            XmlUtil.removeElement(self._mdsd_config_xml_tree, 'Accounts', 'SharedAccessSignature')
        else:  # token
            token = self._encrypt_secret_with_cert(handler_cert_path, token)
            XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
                                "account", account, ['isDefault', 'true'])
            XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
                                "key", token, ['isDefault', 'true'])
            XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
                                "decryptKeyPath", handler_pkey_path, ['isDefault', 'true'])
            XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
                                "tableEndpoint", endpoint, ['isDefault', 'true'])
            XmlUtil.removeElement(self._mdsd_config_xml_tree, 'Accounts', 'Account')

        if aikey:
            AIUtil.createAccountElement(self._mdsd_config_xml_tree, aikey)
开发者ID:vityagi,项目名称:azure-linux-extensions,代码行数:42,代码来源:config_mdsd_rsyslog.py

示例2: _update_account_settings

# 需要导入模块: from Utils import XmlUtil [as 别名]
# 或者: from Utils.XmlUtil import removeElement [as 别名]
    def _update_account_settings(self, account, token, endpoint):
        """
        Update the MDSD configuration Account element with Azure table storage properties.
        Exactly one of (key, token) must be provided.
        :param account: Storage account to which LAD should write data
        :param token: SAS token to access the storage account
        :param endpoint: Identifies the Azure instance (public or specific sovereign cloud) where the storage account is
        """
        assert token, "Token must be given."
        assert self._mdsd_config_xml_tree is not None

        token = self._encrypt_secret_with_cert(token)
        assert token, "Could not encrypt token"
        XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
                            "account", account, ['isDefault', 'true'])
        XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
                            "key", token, ['isDefault', 'true'])
        XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
                            "decryptKeyPath", self._pkey_path, ['isDefault', 'true'])
        XmlUtil.setXmlValue(self._mdsd_config_xml_tree, 'Accounts/SharedAccessSignature',
                            "tableEndpoint", endpoint, ['isDefault', 'true'])
        XmlUtil.removeElement(self._mdsd_config_xml_tree, 'Accounts', 'Account')
开发者ID:SuperScottz,项目名称:azure-linux-extensions,代码行数:24,代码来源:lad_config_all.py


注:本文中的Utils.XmlUtil.removeElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。