confluentinc / confluentinc/vscode
Implement ResourceLoader.getClusterForTopic(topic: KafkaTopic): KafkaCluster | undefined
- Dominant language
- TypeScript
- Stars
- 34
- Forks
- 17
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 8
Description
Implement `ResourceLoader` method to conveniently get at the KafkaCluster instance given one of its topics.
When completed, patch up `resourceScaffoldProjectRequest()`'s determination of topic -> cluster, plus probably any remaining callers to `ResourceManager..getClusterForTopic()` (and the kill that old API off entirely).
Any caller to `ResourceManager.getClusterForTopic()` is vulnerable to failure if calling with a direct-connection-based KafkaTopic, hence the bug qualification.
Should be pretty simple:
1. Validate topic's connection id matches the loader's.
2. Call this.getKafkaClustersForEnvironmentId(topic.environmentId)
3. Find + return the one matching topic.clusterId, otherwise undefined.
Semi-related, if `resourceScaffoldProjectRequest()` cannot find kafka cluster for the topic, it should raise a Sentry error for this unexpected condition using `logError()`. Then we would have known if happening in the wild.
Contributor guide
Assessment
This issue has not been assessed yet.