in src/eventSubscription/tree/EventSubscriptionProvider.ts [27:46]
public async loadMoreChildrenImpl(_clearCache: boolean): Promise<EventSubscriptionTreeItem[]> {
const client: EventGridManagementClient = createAzureClient(this.root, EventGridManagementClient);
// There is no "listAll" method - we have to list individually by location
const listByLocationTasks: Promise<EventSubscription[]>[] = (await listLocations(this.root)).map(async (location: Location) => {
try {
// tslint:disable-next-line:no-non-null-assertion
return await client.eventSubscriptions.listRegionalBySubscription(location.name!);
} catch (error) {
// Ignore errors for regions where EventGrid is not supported
if (parseError(error).errorType === 'NoRegisteredProviderFound') {
return [];
} else {
throw error;
}
}
});
const eventSubscriptions: EventSubscription[] = (<EventSubscription[]>[]).concat(...(await Promise.all([client.eventSubscriptions.listGlobalBySubscription()].concat(...listByLocationTasks))));
return eventSubscriptions.map((es: EventSubscription) => new EventSubscriptionTreeItem(this, es));
}