-
Notifications
You must be signed in to change notification settings - Fork 8
feat: add Partner API client for distributor operations #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add Partner API client for distributor operations #74
Conversation
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.
568f23f to
79fa679
Compare
.github/workflows/openapi.yaml
Outdated
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
docs/changes.rst
Outdated
| Next version | ||
| ------------ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Next version | |
| ------------ | |
| 0.15.0 (unreleased) | |
| ------------------- |
docs/partner.rst
Outdated
| Installation | ||
| ------------ | ||
|
|
||
| The Partner API client is included in the main exoscale package:: | ||
|
|
||
| pip install exoscale |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part would make more sense in docs/index.rst
docs/partner.rst
Outdated
| 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
exoscale/api/partner.py
Outdated
|
|
||
| def __repr__(self): | ||
| return ( | ||
| f"<PartnerClient endpoint={self.endpoint} " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally the repr and type should match. Either both are Client or both are PartnerClient. I don't have a strong opinion either way.
|
@brutasse 2nd round? |
brutasse
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![]()
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.