Skip to content

Commit 11b5dfa

Browse files
committed
feat: v2
feat: remove instance utils regen Signed-off-by: Nathanael DEMACON <quantumsheep@users.noreply.github.com>
1 parent f00ca20 commit 11b5dfa

File tree

358 files changed

+105662
-58079
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

358 files changed

+105662
-58079
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
env:
3434
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
3535
- name: Wait for package to be available
36-
run: sleep 10
36+
run: sleep 60
3737

3838
release:
3939
needs:

docs/poetry.lock

Lines changed: 168 additions & 112 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "scaleway-docs"
3-
version = "1.0.0"
3+
version = "2.0.0"
44
description = ""
55
authors = ["Scaleway <opensource@scaleway.com>"]
66
license = "BSD"

scaleway-async/poetry.lock

Lines changed: 173 additions & 152 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scaleway-async/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "scaleway-async"
3-
version = "0.0.1"
3+
version = "2.0.0"
44
description = "Scaleway SDK for Python"
55
authors = ["Scaleway <opensource@scaleway.com>"]
66
license = "BSD"
@@ -24,7 +24,7 @@ classifiers = [
2424

2525
[tool.poetry.dependencies]
2626
python = "^3.8"
27-
scaleway-core = "^1"
27+
scaleway-core = "*"
2828

2929
[tool.poetry.group.dev.dependencies]
3030
scaleway-core = { path = "../scaleway-core", develop = true }
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
# This file was automatically generated. DO NOT EDIT.
22
# If you have any remark or suggestion do not hesitate to open an issue.
33
from .types import ListProjectsRequestOrderBy
4-
from .types import ListProjectsResponse
54
from .types import Project
5+
from .types import CreateProjectRequest
6+
from .types import DeleteProjectRequest
7+
from .types import GetProjectRequest
8+
from .types import ListProjectsRequest
9+
from .types import ListProjectsResponse
10+
from .types import UpdateProjectRequest
611
from .api import AccountV2API
712

813
__all__ = [
914
"ListProjectsRequestOrderBy",
10-
"ListProjectsResponse",
1115
"Project",
16+
"CreateProjectRequest",
17+
"DeleteProjectRequest",
18+
"GetProjectRequest",
19+
"ListProjectsRequest",
20+
"ListProjectsResponse",
21+
"UpdateProjectRequest",
1222
"AccountV2API",
1323
]

scaleway-async/scaleway_async/account/v2/api.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,27 @@
55

66
from scaleway_core.api import API
77
from scaleway_core.utils import (
8-
fetch_all_pages_async,
98
random_name,
109
validate_path_param,
10+
fetch_all_pages_async,
1111
)
1212
from .types import (
1313
ListProjectsRequestOrderBy,
14+
CreateProjectRequest,
1415
ListProjectsResponse,
1516
Project,
16-
CreateProjectRequest,
1717
UpdateProjectRequest,
1818
)
1919
from .marshalling import (
20-
marshal_CreateProjectRequest,
21-
marshal_UpdateProjectRequest,
2220
unmarshal_Project,
2321
unmarshal_ListProjectsResponse,
22+
marshal_CreateProjectRequest,
23+
marshal_UpdateProjectRequest,
2424
)
2525

2626

2727
class AccountV2API(API):
2828
"""
29-
Account API.
30-
31-
User related data.
3229
This API allows you to manage projects.
3330
"""
3431

@@ -57,7 +54,7 @@ async def create_project(
5754

5855
res = self._request(
5956
"POST",
60-
f"/account/v2/projects",
57+
"/account/v2/projects",
6158
body=marshal_CreateProjectRequest(
6259
CreateProjectRequest(
6360
name=name or random_name(prefix="proj"),
@@ -78,7 +75,7 @@ async def list_projects(
7875
name: Optional[str] = None,
7976
page: Optional[int] = None,
8077
page_size: Optional[int] = None,
81-
order_by: ListProjectsRequestOrderBy = ListProjectsRequestOrderBy.CREATED_AT_ASC,
78+
order_by: Optional[ListProjectsRequestOrderBy] = None,
8279
project_ids: Optional[List[str]] = None,
8380
) -> ListProjectsResponse:
8481
"""
@@ -102,7 +99,7 @@ async def list_projects(
10299

103100
res = self._request(
104101
"GET",
105-
f"/account/v2/projects",
102+
"/account/v2/projects",
106103
params={
107104
"name": name,
108105
"order_by": order_by,
@@ -137,7 +134,7 @@ async def list_projects_all(
137134
:param page_size: Maximum number of Project per page.
138135
:param order_by: Sort order of the returned Projects.
139136
:param project_ids: Project IDs to filter for. The results will be limited to any Projects with an ID in this array.
140-
:return: :class:`List[ListProjectsResponse] <List[ListProjectsResponse]>`
137+
:return: :class:`List[Project] <List[Project]>`
141138
:deprecated
142139
143140
Usage:
@@ -195,7 +192,7 @@ async def delete_project(
195192
self,
196193
*,
197194
project_id: Optional[str] = None,
198-
) -> Optional[None]:
195+
) -> None:
199196
"""
200197
Delete an existing Project.
201198
Deprecated in favor of Account API v3.
@@ -219,7 +216,6 @@ async def delete_project(
219216
)
220217

221218
self._throw_on_error(res)
222-
return None
223219

224220
async def update_project(
225221
self,

scaleway-async/scaleway_async/account/v2/marshalling.py

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,69 @@
22
# If you have any remark or suggestion do not hesitate to open an issue.
33

44
from typing import Any, Dict
5+
from dateutil import parser
56

67
from scaleway_core.profile import ProfileDefaults
7-
from dateutil import parser
88
from .types import (
9-
ListProjectsResponse,
109
Project,
10+
ListProjectsResponse,
1111
CreateProjectRequest,
1212
UpdateProjectRequest,
1313
)
1414

1515

1616
def unmarshal_Project(data: Any) -> Project:
17-
if type(data) is not dict:
17+
if not isinstance(data, dict):
1818
raise TypeError(
19-
f"Unmarshalling the type 'Project' failed as data isn't a dictionary."
19+
"Unmarshalling the type 'Project' failed as data isn't a dictionary."
2020
)
2121

2222
args: Dict[str, Any] = {}
2323

24-
field = data.get("created_at", None)
25-
args["created_at"] = parser.isoparse(field) if type(field) is str else field
26-
27-
field = data.get("description", None)
28-
args["description"] = field
29-
3024
field = data.get("id", None)
31-
args["id"] = field
25+
if field is not None:
26+
args["id"] = field
3227

3328
field = data.get("name", None)
34-
args["name"] = field
29+
if field is not None:
30+
args["name"] = field
3531

3632
field = data.get("organization_id", None)
37-
args["organization_id"] = field
33+
if field is not None:
34+
args["organization_id"] = field
35+
36+
field = data.get("description", None)
37+
if field is not None:
38+
args["description"] = field
39+
40+
field = data.get("created_at", None)
41+
if field is not None:
42+
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
3843

3944
field = data.get("updated_at", None)
40-
args["updated_at"] = parser.isoparse(field) if type(field) is str else field
45+
if field is not None:
46+
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
4147

4248
return Project(**args)
4349

4450

4551
def unmarshal_ListProjectsResponse(data: Any) -> ListProjectsResponse:
46-
if type(data) is not dict:
52+
if not isinstance(data, dict):
4753
raise TypeError(
48-
f"Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary."
54+
"Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary."
4955
)
5056

5157
args: Dict[str, Any] = {}
5258

53-
field = data.get("projects", None)
54-
args["projects"] = (
55-
[unmarshal_Project(v) for v in field] if field is not None else None
56-
)
57-
5859
field = data.get("total_count", None)
59-
args["total_count"] = field
60+
if field is not None:
61+
args["total_count"] = field
62+
63+
field = data.get("projects", None)
64+
if field is not None:
65+
args["projects"] = (
66+
[unmarshal_Project(v) for v in field] if field is not None else None
67+
)
6068

6169
return ListProjectsResponse(**args)
6270

@@ -67,9 +75,6 @@ def marshal_CreateProjectRequest(
6775
) -> Dict[str, Any]:
6876
output: Dict[str, Any] = {}
6977

70-
if request.description is not None:
71-
output["description"] = request.description
72-
7378
if request.name is not None:
7479
output["name"] = request.name
7580

@@ -78,6 +83,9 @@ def marshal_CreateProjectRequest(
7883
request.organization_id or defaults.default_organization_id
7984
)
8085

86+
if request.description is not None:
87+
output["description"] = request.description
88+
8189
return output
8290

8391

@@ -87,10 +95,10 @@ def marshal_UpdateProjectRequest(
8795
) -> Dict[str, Any]:
8896
output: Dict[str, Any] = {}
8997

90-
if request.description is not None:
91-
output["description"] = request.description
92-
9398
if request.name is not None:
9499
output["name"] = request.name
95100

101+
if request.description is not None:
102+
output["description"] = request.description
103+
96104
return output

scaleway-async/scaleway_async/account/v2/types.py

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,8 @@ def __str__(self) -> str:
2222
return str(self.value)
2323

2424

25-
@dataclass
26-
class ListProjectsResponse:
27-
"""
28-
List projects response.
29-
"""
30-
31-
total_count: int
32-
"""
33-
Total number of Projects.
34-
"""
35-
36-
projects: List[Project]
37-
"""
38-
Paginated returned Projects.
39-
"""
40-
41-
4225
@dataclass
4326
class Project:
44-
"""
45-
Project.
46-
"""
47-
4827
id: str
4928
"""
5029
ID of the Project.
@@ -60,6 +39,11 @@ class Project:
6039
Organization ID of the Project.
6140
"""
6241

42+
description: str
43+
"""
44+
Description of the Project.
45+
"""
46+
6347
created_at: Optional[datetime]
6448
"""
6549
Creation date of the Project.
@@ -70,11 +54,6 @@ class Project:
7054
Update date of the Project.
7155
"""
7256

73-
description: str
74-
"""
75-
Description of the Project.
76-
"""
77-
7857

7958
@dataclass
8059
class CreateProjectRequest:
@@ -94,6 +73,22 @@ class CreateProjectRequest:
9473
"""
9574

9675

76+
@dataclass
77+
class DeleteProjectRequest:
78+
project_id: Optional[str]
79+
"""
80+
Project ID of the Project.
81+
"""
82+
83+
84+
@dataclass
85+
class GetProjectRequest:
86+
project_id: Optional[str]
87+
"""
88+
Project ID of the Project.
89+
"""
90+
91+
9792
@dataclass
9893
class ListProjectsRequest:
9994
organization_id: Optional[str]
@@ -128,18 +123,15 @@ class ListProjectsRequest:
128123

129124

130125
@dataclass
131-
class GetProjectRequest:
132-
project_id: Optional[str]
126+
class ListProjectsResponse:
127+
total_count: int
133128
"""
134-
Project ID of the Project.
129+
Total number of Projects.
135130
"""
136131

137-
138-
@dataclass
139-
class DeleteProjectRequest:
140-
project_id: Optional[str]
132+
projects: List[Project]
141133
"""
142-
Project ID of the Project.
134+
Paginated returned Projects.
143135
"""
144136

145137

0 commit comments

Comments
 (0)