[英]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.