Skip to content

Develop core#2

Open
RusselSand wants to merge 10 commits intomainfrom
develop-core
Open

Develop core#2
RusselSand wants to merge 10 commits intomainfrom
develop-core

Conversation

@RusselSand
Copy link
Copy Markdown
Contributor

@RusselSand RusselSand commented Apr 17, 2026

Guys, I implemented core part and tested it on CRUD for VPC v1. Feel free to check my code and suggest improvements

@RusselSand RusselSand self-assigned this Apr 17, 2026
Copy link
Copy Markdown
Member

@anton-sidelnikov anton-sidelnikov left a comment

Choose a reason for hiding this comment

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

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

Comment thread docs/conf.py Outdated
Comment thread docs/conf.py Outdated
Comment thread docs/new_arch.md
│ ├── client.go # Factories: NewDNSV2(), NewComputeV2(), etc.
│ ├── common/ # Shared utilities (tags, metadata, pointerto)
│ │
│ ├── dns/v2/ # ← Typical service
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.

please look at you current implementation it goes agains this structure

Comment thread docs/new_arch.md
|------|----------|
| `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()`. |
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 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()

Comment thread docs/new_arch.md
Comment on lines +464 to +466
| `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 |
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.

here is the same

@@ -0,0 +1,155 @@
"""VPC v1 data models.
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.

look at arch describption, use more plain approach

cidr: str = ""
enterprise_project_id: str = ""

def to_request_body(self) -> dict:
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.

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

Comment thread src/sdk/__init__.py
@@ -0,0 +1,5 @@
"""OTC SDK — Python SDK for Open Telekom Cloud."""
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.

T Cloud Public in all files please



@pytest.fixture(scope="module")
def vpc_client() -> Iterator[ServiceClient]:
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.

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 ────────────────────────────────────────────
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.

need to create extra test to check how pagination works

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.

3 participants