Feat/async typed sdk#225
Conversation
| super().__init__( | ||
| os.path.join(os.path.dirname(__file__), "resources/outscale.yaml"), **kwargs | ||
|
|
||
| class AsyncOpenAPIActionAPI(OpenAPIActionAPI): |
| self.close() | ||
|
|
||
|
|
||
| class AsyncOpenAPIPathAPI(OpenAPIPathAPI): |
| request: GetKubernetesVersionsRequest | None = None, | ||
| ) -> KubernetesVersionsResponse: | ||
| if request is None: | ||
| request = GetKubernetesVersionsRequest() |
| request: GetCPSubregionsRequest | None = None, | ||
| ) -> CPSubregionsResponse: | ||
| if request is None: | ||
| request = GetCPSubregionsRequest() |
| request: GetControlPlanePlansRequest | None = None, | ||
| ) -> ControlPlanesResponse: | ||
| if request is None: | ||
| request = GetControlPlanePlansRequest() |
| request: GetNetPeeringRequestTemplateRequest | None = None, | ||
| ) -> TemplateResponse_NetPeeringRequest: | ||
| if request is None: | ||
| request = GetNetPeeringRequestTemplateRequest() |
| request: GetNetPeeringAcceptanceTemplateRequest | None = None, | ||
| ) -> TemplateResponse_NetPeeringAcceptance: | ||
| if request is None: | ||
| request = GetNetPeeringAcceptanceTemplateRequest() |
| request: GetQuotasRequest | None = None, | ||
| ) -> quotas__quota_schema__QuotasResponse: | ||
| if request is None: | ||
| request = GetQuotasRequest() |
| request: GetClientIPRequest | None = None, | ||
| ) -> IPResponse: | ||
| if request is None: | ||
| request = GetClientIPRequest() |
| import asyncio | ||
| import copy | ||
| import os | ||
| import sys |
jobs62
left a comment
There was a problem hiding this comment.
Good start. Despite all comments i made, it whould be nice that public facing methods raise only "owned" exception. also string enum support whould be nice in the generator (that may need support for overlays as well)
| api_version: | ||
| description: 'Outscale API version' | ||
| required: true | ||
| oks_api_url: |
There was a problem hiding this comment.
Both services can have different release plan, so we should be able to build and release one without the other
| env: | ||
| OSC_ACCESS_KEY: ${{ secrets.OSC_ACCESS_KEY }} | ||
| OSC_SECRET_KEY: ${{ secrets.OSC_SECRET_KEY }} | ||
| OSC_ACCESS_KEY_V2: ${{ secrets.OSC_ACCESS_KEY_V2 }} |
|
|
||
|
|
||
| async def main(): | ||
| async with AsyncClient(profile="profile_1") as client: |
There was a problem hiding this comment.
we should have one client per service
| async def main(): | ||
| async with AsyncGateway() as gw: | ||
| # Example: list VMs | ||
| vms = await gw.ReadVms() |
There was a problem hiding this comment.
method name should by OperationId converted in snake case
| json_body: dict | list | None = None | ||
| query_params: dict = field(default_factory=dict) | ||
|
|
||
| def resolved_path(self, path_params: dict | None = None) -> str: |
There was a problem hiding this comment.
this should probably throw an error if one or more placeholders are not remplaced
| @@ -1 +1 @@ | |||
| import datetime | |||
There was a problem hiding this comment.
all that file could be removed and remplaced by a httpx middleware
| from datetime import datetime, timezone, timedelta | ||
| import asyncio | ||
| import time | ||
|
|
There was a problem hiding this comment.
same as authentication, limiter should be a httpx middleware
| @@ -0,0 +1,131 @@ | |||
| import asyncio | |||
| import json | |||
There was a problem hiding this comment.
should be a httpx middleware as well
| from ..request import RequestSpec | ||
|
|
||
|
|
||
| class AsyncCall(object): |
There was a problem hiding this comment.
you can probably get ride of Call/Requester. i never understood why we had that much boilerplate for parameters of transports (should be in the session or a middleware ?)
| dependencies = [ | ||
| "httpx>=0.28.0", | ||
| "pydantic>=2.0.0", | ||
| "requests>=2.20.0", |
There was a problem hiding this comment.
requests should not be used anymore
Updated README and docs examples to use Client / AsyncClient and async snake_case operation methods. Added unresolved path placeholder validation in RequestSpec with unit tests. Removed unnecessary IAM v2 secret injection from the CI workflow while keeping SDK credential support unchanged.
Description
Implements the foundation for an async-first, OpenAPI-driven Python SDK with generated typed service clients. The architecture now supports multi-service expansion such as OSC/OAPI, OKS and future services through a modular core plus generated service layers.
Main goals:
Fixes: NA
Type of Change
Please check the relevant option(s):
How Has This Been Tested?
Please describe the test strategy:
Commands used (if applicable):
Checklist