Skip to content

feat(api): resolve provider class dynamically via the SDK resolver#11400

Open
StylusFrost wants to merge 1 commit into
PROWLER-1772-provider-type-storage-varcharfrom
PROWLER-1773-dynamic-provider-resolution
Open

feat(api): resolve provider class dynamically via the SDK resolver#11400
StylusFrost wants to merge 1 commit into
PROWLER-1772-provider-type-storage-varcharfrom
PROWLER-1773-dynamic-provider-resolution

Conversation

@StylusFrost
Copy link
Copy Markdown
Contributor

Context

return_prowler_provider hardcoded a 16-arm match over the known provider types (with per-provider imports and a closed type union), raising ValueError for anything else. This blocked external/entry-point providers from resolving in the API.

Stacked on #11399 (T2). Depends on the SDK resolver from #11398 (T1).

Description

  • Replace the match with Provider.get_class(provider.provider) (the SDK public resolver). Any provider the SDK discovers — built-in or external entry-point — now resolves without a per-provider branch.
  • get_class raises ImportError for unknown providers; it is wrapped into the existing ValueError contract.
  • Drop the closed provider-type union return annotations and the TYPE_CHECKING provider imports; return_prowler_provider -> type, initialize_prowler_provider -> SDKProvider.

Steps to review

  • return_prowler_provider unit tests: built-in resolution (16 parametrized) + external resolution via the resolver + unknown → ValueError.
  • Docker (SDK pinned to the T1 branch + an external local-template provider installed): POST /api/v1/providers/{id}/connection no longer fails with Provider type ... not supported; resolution succeeds and the task completes.

Checklist

  • All issue/task requirements work as expected on the API
  • Ensure new entries are added to api/CHANGELOG.md

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

- Replace the hardcoded provider match with Provider.get_class
- Drop the closed provider-type union and TYPE_CHECKING imports
- Cover built-in and external entry-point resolution in tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant