[英]How do I list the custom EventGrid topics in a resource group in C# for azure?
Via the cli, you can run this: 通过cli,您可以运行以下命令:
az eventgrid topic list -g resource-group-name
I've been digging through the Azure C# SDK , but I can't find any way to do this via C#? 我一直在研究Azure C#SDK ,但是找不到通过C#做到这一点的方法吗?
What's the C# equivalent of the above code? 以上代码的C#等效项是什么?
For example, for listing resource groups, it would be: 例如,对于列出资源组,它将是:
IAzure azure = ...;
var resourceGroups = azure.ResourceGroups.List();
How do I do that for EventGrid topics? 如何为EventGrid主题做到这一点?
How do I get an EventGridManagementClient from an IAzure interface?
如何从IAzure接口获取EventGridManagementClient?
The feature of Event Grid service is coming soon with Azure Management Libraries for .NET. 事件网格服务的功能即将随.NET的Azure管理库一起提供。 So you could not get an
EventGridManagementClient
from an IAzure
interface. 所以,你不能让一个
EventGridManagementClient
从IAzure
接口。
You could use ListByResourceGroup
as Sajeetharan provided. 你可以使用
ListByResourceGroup
作为Sajeetharan提供。
Also there is rest api that list all the topics under a resource group. 另外还有rest api ,列出了资源组下的所有主题。
您可以使用下面的方法ListByResourceGroup
,
IPage<Topic> topicsInResourceGroupPage = this.EventGridManagementClient.Topics.ListByResourceGroupAsync(resourceGroup).Result;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.