Develop core#2
Conversation
anton-sidelnikov
left a comment
There was a problem hiding this comment.
Overall really good, please review comments, problem occurred because original service from go sdk was in old style not refactored, please update service description and others things
| │ ├── client.go # Factories: NewDNSV2(), NewComputeV2(), etc. | ||
| │ ├── common/ # Shared utilities (tags, metadata, pointerto) | ||
| │ │ | ||
| │ ├── dns/v2/ # ← Typical service |
There was a problem hiding this comment.
please look at you current implementation it goes agains this structure
| |------|----------| | ||
| | `requests.go` | CRUD functions (free functions, not methods). Input parameter types (`CreateOpts`, `ListOpts`) with builder interfaces (`CreateOptsBuilder`). Validation via struct tags. | | ||
| | `results.go` | Response models (`Zone`, `CreateResult`, `GetResult`). Inherit from `golangsdk.Result` for lazy extraction via `Extract()`. | | ||
| | `urls.go` | Pure URL construction functions using `ServiceClient.ServiceURL()`. | |
There was a problem hiding this comment.
this is an old approach we decided not to use it, please use as plain as it possible, separate file for each endpoint like:
│ │ ├── clusters/
│ │ │ ├── common.py # Cluster, Spec, Status (shared models)
│ │ │ ├── create.py # CreateOpts + create()
│ │ │ ├── get.py # get()
│ │ │ ├── list.py # ListOpts + list_clusters()
│ │ │ ├── delete.py # DeleteOpts + delete()
│ │ │ └── update.py # UpdateOpts + update()
| | `requests.go` (free functions) | `requests.py` (free functions) | Not class methods | | ||
| | `results.go` (struct + Extract) | `models.py` (pydantic BaseModel) | model_validate instead of Extract | | ||
| | `urls.go` | `urls.py` | Pure functions | |
| @@ -0,0 +1,155 @@ | |||
| """VPC v1 data models. | |||
There was a problem hiding this comment.
look at arch describption, use more plain approach
| cidr: str = "" | ||
| enterprise_project_id: str = "" | ||
|
|
||
| def to_request_body(self) -> dict: |
There was a problem hiding this comment.
is it possible to make this meta method for base class(create it), to not write every time all parameters but process it automatically based on type
| @@ -0,0 +1,5 @@ | |||
| """OTC SDK — Python SDK for Open Telekom Cloud.""" | |||
There was a problem hiding this comment.
T Cloud Public in all files please
|
|
||
|
|
||
| @pytest.fixture(scope="module") | ||
| def vpc_client() -> Iterator[ServiceClient]: |
There was a problem hiding this comment.
extract client in tests/clients.py to have posiblity to reuse clients easily
| assert fetched.cidr == "192.168.0.0/16" | ||
| logger.info("Get VPC: %s, status=%s", fetched.id, fetched.status) | ||
|
|
||
| # ── List ──────────────────────────────────────────── |
There was a problem hiding this comment.
need to create extra test to check how pagination works
Guys, I implemented core part and tested it on CRUD for VPC v1. Feel free to check my code and suggest improvements