简体   繁体   English

在 Azure 的 Python 服务总线 SDK 中,如何查询命名空间的共享访问策略?

[英]In Azure's Python service bus SDK, how do I query the shared access policies of a namespace?

I'm using Python 3.8 and Azure's service bus SDK (azure-servicebus==0.50.3).我正在使用 Python 3.8 和 Azure 的服务总线 SDK (azure-servicebus==0.50.3)。 Currently, I can use the below code to get a shared access policy rule (and key/value) for a specific topic within a namespace目前,我可以使用以下代码为命名空间中的特定主题获取共享访问策略规则(和键/值)

from azure.mgmt.servicebus import ServiceBusManagementClient
...
    self._sb_client = ServiceBusManagementClient(credential, subscription)
    ...
        rule = self._sb_client.topics.list_keys(
            self._resource_group_name,
            self._namespace,
            self._topic_name,
            SB_SAS_POLICY_LISTEN
        )

How do I make the logic a little more general so that I can query policies at the namespace level?如何使逻辑更通用,以便我可以在命名空间级别查询策略? We have a root shared access policy and I wanted to see if there's a programmatic way to get the rule similar to the above.我们有一个 root 共享访问策略,我想看看是否有一种编程方式来获得与上述类似的规则。 I've tried excluding the topic parameter, but I'm unable it is required.我试过排除主题参数,但我不能要求它。

Aha.啊哈。 It appears you're specifically using azure-mgmt-servicebus for the tooling you're leveraging, which is exactly the right thing, and has the functionality you're looking for:您似乎专门将azure-mgmt-servicebus用于您正在利用的工具,这完全正确,并且具有您正在寻找的功能:

There is a comparable list_keys method present on the namespace as well as on a given topic, which would be called via client.namespaces.list_keys( .在命名空间和给定主题上存在一个类似的list_keys方法,该方法将通过client.namespaces.list_keys(调用。

Don't hesitate to shout if I've misunderstood or if any of this is unclear.如果我误解或其中任何一个不清楚,请不要犹豫,大声喊叫。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何创建/连接到 Docker Azure 服务总线(使用 Python SDK)? - How do I create/connect to a Docker Azure service bus (using Python SDK)? 在 Azure 函数 Python SDK 中,如何获取给定命名空间的主题数? - In the Azure functions Python SDK, how do I get the number of topics for a given namespace? 使用新的 Azure 服务总线 SDK (7.0.0),创建主题、订阅和授权规则的正确方法是什么? - With the new Azure service bus SDK (7.0.0), what's the proper way to create a topic, subscription, and authorization rule? 如何使用 Python 从 Azure 服务总线读取消息? - How to read message from Azure Service Bus using Python? 使用python在Azure服务总线中实现队列 - Implementation of a queue in Azure service bus using python 如何使用 python SDK 访问 azure AD - How to access azure AD using python SDK 如何在 Azure App Service 环境中执行长时间运行的 python 服务总线轮询作业 - How to execute a long running python service bus polling job in Azure App Service environment 如何从 Azure 服务总线读取大量消息 - 使用 Python 订阅? - How to read bunch of message from Azure Service Bus - subscription using Python? 如何使用 Python 从 Azure 服务总线主题读取所有消息? - How to read all message from Azure Service Bus topic using Python? 如何使用 Python SDK 为我在 Azure 数据湖中创建的文件设置到期日期? - How do I set an expiration date on a file I create in the Azure Data lake using the Python SDK?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM