Skip to content

Commit be0d82a

Browse files
committed
Revert "fix(core): management one_of"
This reverts commit 90d61b3.
1 parent c41f7d2 commit be0d82a

File tree

227 files changed

+65845
-42951
lines changed

Some content is hidden

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

227 files changed

+65845
-42951
lines changed

scaleway-core/scaleway_core/utils/resolve_one_of.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,13 @@ def resolve_one_of(
2828
# Get the first non-empty default
2929
for possibility in possibilities:
3030
if possibility.default is not None:
31-
<<<<<<< HEAD
3231
if possibility.marshal_func is not None:
3332
# When no actual value, call with None as value
3433
return {
3534
possibility.param: possibility.marshal_func(
3635
None, possibility.default
3736
)
3837
}
39-
=======
40-
>>>>>>> 539c303 (Revert "fix(core): management one_of")
4138
return {possibility.param: possibility.default}
4239

4340
# If required, raise an error

scaleway/scaleway/__init__.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
"""Scaleway SDK for Python"""
2+
3+
import importlib.metadata
4+
5+
__version__: str = importlib.metadata.version(__name__)
6+
7+
from scaleway_core.api import (
8+
API,
9+
ScalewayException,
10+
)
11+
12+
from scaleway_core.client import Client
13+
14+
from scaleway_core.profile import (
15+
Profile,
16+
ProfileConfig,
17+
ProfileDefaults,
18+
)
19+
20+
from scaleway_core.utils.waiter import (
21+
WaitForOptions,
22+
WaitForStopCondition,
23+
)
24+
25+
from scaleway_core.bridge import (
26+
Money,
27+
Region,
28+
ALL_REGIONS,
29+
Zone,
30+
ALL_ZONES,
31+
ScwFile,
32+
ServiceInfo,
33+
TimeSeriesPoint,
34+
TimeSeries,
35+
)
36+
37+
__all__ = [
38+
"API",
39+
"ScalewayException",
40+
"Client",
41+
"Profile",
42+
"ProfileConfig",
43+
"ProfileDefaults",
44+
"WaitForOptions",
45+
"WaitForStopCondition",
46+
"Money",
47+
"Region",
48+
"ALL_REGIONS",
49+
"Zone",
50+
"ALL_ZONES",
51+
"ScwFile",
52+
"ServiceInfo",
53+
"TimeSeriesPoint",
54+
"TimeSeries",
55+
]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This file was automatically generated. DO NOT EDIT.
2+
# If you have any remark or suggestion do not hesitate to open an issue.
3+
from .types import ListProjectsRequestOrderBy
4+
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
11+
from .api import AccountV2API
12+
13+
__all__ = [
14+
"ListProjectsRequestOrderBy",
15+
"Project",
16+
"CreateProjectRequest",
17+
"DeleteProjectRequest",
18+
"GetProjectRequest",
19+
"ListProjectsRequest",
20+
"ListProjectsResponse",
21+
"UpdateProjectRequest",
22+
"AccountV2API",
23+
]
Lines changed: 261 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
1+
# This file was automatically generated. DO NOT EDIT.
2+
# If you have any remark or suggestion do not hesitate to open an issue.
3+
4+
from typing import List, Optional
5+
6+
from scaleway_core.api import API
7+
from scaleway_core.utils import (
8+
random_name,
9+
validate_path_param,
10+
fetch_all_pages,
11+
)
12+
from .types import (
13+
ListProjectsRequestOrderBy,
14+
CreateProjectRequest,
15+
ListProjectsResponse,
16+
Project,
17+
UpdateProjectRequest,
18+
)
19+
from .marshalling import (
20+
unmarshal_Project,
21+
unmarshal_ListProjectsResponse,
22+
marshal_CreateProjectRequest,
23+
marshal_UpdateProjectRequest,
24+
)
25+
26+
27+
class AccountV2API(API):
28+
"""
29+
This API allows you to manage your Scaleway Projects.
30+
"""
31+
32+
def create_project(
33+
self,
34+
*,
35+
name: Optional[str] = None,
36+
organization_id: Optional[str] = None,
37+
description: Optional[str] = None,
38+
) -> Project:
39+
"""
40+
Create a new Project for an Organization.
41+
Deprecated in favor of Account API v3.
42+
Generate a new Project for an Organization, specifying its configuration including name and description.
43+
:param name: Name of the Project.
44+
:param organization_id: Organization ID of the Project.
45+
:param description: Description of the Project.
46+
:return: :class:`Project <Project>`
47+
:deprecated
48+
49+
Usage:
50+
::
51+
52+
result = api.create_project()
53+
"""
54+
55+
res = self._request(
56+
"POST",
57+
"/account/v2/projects",
58+
body=marshal_CreateProjectRequest(
59+
CreateProjectRequest(
60+
name=name or random_name(prefix="proj"),
61+
organization_id=organization_id,
62+
description=description,
63+
),
64+
self.client,
65+
),
66+
)
67+
68+
self._throw_on_error(res)
69+
return unmarshal_Project(res.json())
70+
71+
def list_projects(
72+
self,
73+
*,
74+
organization_id: Optional[str] = None,
75+
name: Optional[str] = None,
76+
page: Optional[int] = None,
77+
page_size: Optional[int] = None,
78+
order_by: Optional[ListProjectsRequestOrderBy] = None,
79+
project_ids: Optional[List[str]] = None,
80+
) -> ListProjectsResponse:
81+
"""
82+
List all Projects of an Organization.
83+
Deprecated in favor of Account API v3.
84+
List all Projects of an Organization. The response will include the total number of Projects as well as their associated Organizations, names and IDs. Other information include the creation and update date of the Project.
85+
:param organization_id: Organization ID of the Project.
86+
:param name: Name of the Project.
87+
:param page: Page number for the returned Projects.
88+
:param page_size: Maximum number of Project per page.
89+
:param order_by: Sort order of the returned Projects.
90+
:param project_ids: Project IDs to filter for. The results will be limited to any Projects with an ID in this array.
91+
:return: :class:`ListProjectsResponse <ListProjectsResponse>`
92+
:deprecated
93+
94+
Usage:
95+
::
96+
97+
result = api.list_projects()
98+
"""
99+
100+
res = self._request(
101+
"GET",
102+
"/account/v2/projects",
103+
params={
104+
"name": name,
105+
"order_by": order_by,
106+
"organization_id": organization_id
107+
or self.client.default_organization_id,
108+
"page": page,
109+
"page_size": page_size or self.client.default_page_size,
110+
"project_ids": project_ids,
111+
},
112+
)
113+
114+
self._throw_on_error(res)
115+
return unmarshal_ListProjectsResponse(res.json())
116+
117+
def list_projects_all(
118+
self,
119+
*,
120+
organization_id: Optional[str] = None,
121+
name: Optional[str] = None,
122+
page: Optional[int] = None,
123+
page_size: Optional[int] = None,
124+
order_by: Optional[ListProjectsRequestOrderBy] = None,
125+
project_ids: Optional[List[str]] = None,
126+
) -> List[Project]:
127+
"""
128+
List all Projects of an Organization.
129+
Deprecated in favor of Account API v3.
130+
List all Projects of an Organization. The response will include the total number of Projects as well as their associated Organizations, names and IDs. Other information include the creation and update date of the Project.
131+
:param organization_id: Organization ID of the Project.
132+
:param name: Name of the Project.
133+
:param page: Page number for the returned Projects.
134+
:param page_size: Maximum number of Project per page.
135+
:param order_by: Sort order of the returned Projects.
136+
:param project_ids: Project IDs to filter for. The results will be limited to any Projects with an ID in this array.
137+
:return: :class:`List[Project] <List[Project]>`
138+
:deprecated
139+
140+
Usage:
141+
::
142+
143+
result = api.list_projects_all()
144+
"""
145+
146+
return fetch_all_pages(
147+
type=ListProjectsResponse,
148+
key="projects",
149+
fetcher=self.list_projects,
150+
args={
151+
"organization_id": organization_id,
152+
"name": name,
153+
"page": page,
154+
"page_size": page_size,
155+
"order_by": order_by,
156+
"project_ids": project_ids,
157+
},
158+
)
159+
160+
def get_project(
161+
self,
162+
*,
163+
project_id: Optional[str] = None,
164+
) -> Project:
165+
"""
166+
Get an existing Project.
167+
Deprecated in favor of Account API v3.
168+
Retrieve information about an existing Project, specified by its Project ID. Its full details, including ID, name and description, are returned in the response object.
169+
:param project_id: Project ID of the Project.
170+
:return: :class:`Project <Project>`
171+
:deprecated
172+
173+
Usage:
174+
::
175+
176+
result = api.get_project()
177+
"""
178+
179+
param_project_id = validate_path_param(
180+
"project_id", project_id or self.client.default_project_id
181+
)
182+
183+
res = self._request(
184+
"GET",
185+
f"/account/v2/projects/{param_project_id}",
186+
)
187+
188+
self._throw_on_error(res)
189+
return unmarshal_Project(res.json())
190+
191+
def delete_project(
192+
self,
193+
*,
194+
project_id: Optional[str] = None,
195+
) -> None:
196+
"""
197+
Delete an existing Project.
198+
Deprecated in favor of Account API v3.
199+
Delete an existing Project, specified by its Project ID. The Project needs to be empty (meaning there are no resources left in it) to be deleted effectively. Note that deleting a Project is permanent, and cannot be undone.
200+
:param project_id: Project ID of the Project.
201+
:deprecated
202+
203+
Usage:
204+
::
205+
206+
result = api.delete_project()
207+
"""
208+
209+
param_project_id = validate_path_param(
210+
"project_id", project_id or self.client.default_project_id
211+
)
212+
213+
res = self._request(
214+
"DELETE",
215+
f"/account/v2/projects/{param_project_id}",
216+
)
217+
218+
self._throw_on_error(res)
219+
220+
def update_project(
221+
self,
222+
*,
223+
project_id: Optional[str] = None,
224+
name: Optional[str] = None,
225+
description: Optional[str] = None,
226+
) -> Project:
227+
"""
228+
Update Project.
229+
Deprecated in favor of Account API v3.
230+
Update the parameters of an existing Project, specified by its Project ID. These parameters include the name and description.
231+
:param project_id: Project ID of the Project.
232+
:param name: Name of the Project.
233+
:param description: Description of the Project.
234+
:return: :class:`Project <Project>`
235+
:deprecated
236+
237+
Usage:
238+
::
239+
240+
result = api.update_project()
241+
"""
242+
243+
param_project_id = validate_path_param(
244+
"project_id", project_id or self.client.default_project_id
245+
)
246+
247+
res = self._request(
248+
"PATCH",
249+
f"/account/v2/projects/{param_project_id}",
250+
body=marshal_UpdateProjectRequest(
251+
UpdateProjectRequest(
252+
project_id=project_id,
253+
name=name,
254+
description=description,
255+
),
256+
self.client,
257+
),
258+
)
259+
260+
self._throw_on_error(res)
261+
return unmarshal_Project(res.json())

0 commit comments

Comments
 (0)