feat(api): resolve provider class dynamically via the SDK resolver#11400
Open
StylusFrost wants to merge 1 commit into
Open
feat(api): resolve provider class dynamically via the SDK resolver#11400StylusFrost wants to merge 1 commit into
StylusFrost wants to merge 1 commit into
Conversation
- 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
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
return_prowler_providerhardcoded a 16-armmatchover the known provider types (with per-provider imports and a closed type union), raisingValueErrorfor 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
matchwithProvider.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_classraisesImportErrorfor unknown providers; it is wrapped into the existingValueErrorcontract.TYPE_CHECKINGprovider imports;return_prowler_provider -> type,initialize_prowler_provider -> SDKProvider.Steps to review
return_prowler_providerunit tests: built-in resolution (16 parametrized) + external resolution via the resolver + unknown →ValueError.local-templateprovider installed):POST /api/v1/providers/{id}/connectionno longer fails withProvider type ... not supported; resolution succeeds and the task completes.Checklist
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.