Skip to content

feat: add Partner API client for distributor operations - #74

Merged
diogomdo merged 3 commits into
masterfrom
aplumez/sc-139412/distributor-api-client-lib
Oct 27, 2025
Merged

diogomdo merged 3 commits into
masterfrom
aplumez/sc-139412/distributor-api-client-lib

Conversation

@diogomdo

Copy link
Copy Markdown
Contributor

This PR introduces a new Partner API client to python-exoscale, enabling distributors to programmatically manage their sub-organizations under the new OpenAPI spec of Partner API. The implementation follows the patterns from the V2 API client.

The Partner API client is dynamically generated from the OpenAPI specification, 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.

@diogomdo
diogomdo force-pushed the aplumez/sc-139412/distributor-api-client-lib branch from 70a9428 to 568f23f Compare September 23, 2025 16:29
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
diogomdo force-pushed the aplumez/sc-139412/distributor-api-client-lib branch from 568f23f to 79fa679 Compare October 8, 2025 11:31
@diogomdo
diogomdo marked this pull request as ready for review October 8, 2025 15:11
Comment thread .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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread docs/changes.rst Outdated
Comment on lines +4 to +5
Next version
------------

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Next version
------------
0.15.0 (unreleased)
-------------------

Comment thread docs/partner.rst Outdated
Comment on lines +7 to +12
Installation
------------

The Partner API client is included in the main exoscale package::

pip install exoscale

Copy link
Copy Markdown
Member

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

Comment thread docs/partner.rst Outdated
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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread exoscale/api/partner.py Outdated

def __repr__(self):
return (
f"<PartnerClient endpoint={self.endpoint} "

Copy link
Copy Markdown
Member

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.

@diogomdo

Copy link
Copy Markdown
Contributor Author

@brutasse 2nd round?

@brutasse brutasse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@diogomdo
diogomdo merged commit 3a97dc5 into master Oct 27, 2025
6 checks passed
@diogomdo
diogomdo deleted the aplumez/sc-139412/distributor-api-client-lib branch October 27, 2025 16:16
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.

4 participants