feat: add Partner API client for distributor operations - #74
Merged
Merged
Conversation
diogomdo
force-pushed
the
aplumez/sc-139412/distributor-api-client-lib
branch
from
September 23, 2025 16:29
70a9428 to
568f23f
Compare
This commit adds a dynamic client generation from Partner API OpenAPI spec and reuses the authentication V2 client mechanism. Also add the GHA workflow to fetch the Partner API spec and documentation.
diogomdo
force-pushed
the
aplumez/sc-139412/distributor-api-client-lib
branch
from
October 8, 2025 11:31
568f23f to
79fa679
Compare
diogomdo
marked this pull request as ready for review
October 8, 2025 15:11
ste-m
approved these changes
Oct 14, 2025
pierre-emmanuelJ
approved these changes
Oct 14, 2025
brutasse
requested changes
Oct 15, 2025
| run: |- | ||
| curl https://openapi-v2.exoscale.com/source.json | ./.sort-enums.py | jq > exoscale/openapi.json | ||
|
|
||
| curl https://partner-api.exoscale.com/v1.alpha/openapi.json | jq > exoscale/partner-api.json |
Member
There was a problem hiding this comment.
Suggested change
| curl https://partner-api.exoscale.com/v1.alpha/openapi.json | jq > exoscale/partner-api.json | |
| curl https://partner-api.exoscale.com/v1.alpha/openapi.json | ./.sort-enums.py | jq > exoscale/partner-api.json |
This makes ordering deterministic: otherwise there can be noise in the git history if only the order of things change as part of an API update.
Comment on lines
+4
to
+5
| Next version | ||
| ------------ |
Member
There was a problem hiding this comment.
Suggested change
| Next version | |
| ------------ | |
| 0.15.0 (unreleased) | |
| ------------------- |
Comment on lines
+7
to
+12
| Installation | ||
| ------------ | ||
|
|
||
| The Partner API client is included in the main exoscale package:: | ||
|
|
||
| pip install exoscale |
Member
There was a problem hiding this comment.
This part would make more sense in docs/index.rst
Comment on lines
+86
to
+90
| The Partner API client methods are dynamically generated from the OpenAPI | ||
| specification. For a complete list of available methods, refer to the | ||
| Partner API documentation or use Python's built-in help:: | ||
|
|
||
| help(client) |
Member
There was a problem hiding this comment.
Suggested change
| The Partner API client methods are dynamically generated from the OpenAPI | |
| specification. For a complete list of available methods, refer to the | |
| Partner API documentation or use Python's built-in help:: | |
| help(client) | |
| .. autoclass:: exoscale.api.partner.Client | |
| :members: | |
| :inherited-members: |
This will expand all available operations.
|
|
||
| def __repr__(self): | ||
| return ( | ||
| f"<PartnerClient endpoint={self.endpoint} " |
Member
There was a problem hiding this comment.
Ideally the repr and type should match. Either both are Client or both are PartnerClient. I don't have a strong opinion either way.
Contributor
Author
|
@brutasse 2nd round? |
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.
This PR introduces a new Partner API client to
python-exoscale, enabling distributors to programmatically manage their sub-organizations under the newOpenAPIspec ofPartner API. The implementation follows the patterns from the V2 API client.The Partner API client is dynamically generated from the
OpenAPIspecification, similar to how the V2 client works.The GitHub Actions workflow has been updated to also fetch Partner API specifications hourly, maintaining them as static files within the package.