简体   繁体   中英

How do I list the custom EventGrid topics in a resource group in C# for azure?

Via the cli, you can run this:

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#?

What's the C# equivalent of the above code?

For example, for listing resource groups, it would be:

IAzure azure = ...;
var resourceGroups = azure.ResourceGroups.List();

How do I do that for EventGrid topics?

How do I get an EventGridManagementClient from an IAzure interface?

The feature of Event Grid service is coming soon with Azure Management Libraries for .NET. So you could not get an EventGridManagementClient from an IAzure interface.

You could use ListByResourceGroup as Sajeetharan provided.

Also there is rest api that list all the topics under a resource group.

您可以使用下面的方法ListByResourceGroup

 IPage<Topic> topicsInResourceGroupPage = this.EventGridManagementClient.Topics.ListByResourceGroupAsync(resourceGroup).Result;

Complete Code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM