Skip to content

Commit 2be75d7

Browse files
authored
feat(account/v2): default generated project name (#168)
1 parent 1546616 commit 2be75d7

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from scaleway_core.api import API
77
from scaleway_core.utils import (
88
fetch_all_pages_async,
9+
random_name,
910
validate_path_param,
1011
)
1112
from .types import (
@@ -34,7 +35,7 @@ class AccountV2API(API):
3435
async def create_project(
3536
self,
3637
*,
37-
name: str,
38+
name: Optional[str] = None,
3839
organization_id: Optional[str] = None,
3940
description: Optional[str] = None,
4041
) -> Project:
@@ -49,15 +50,15 @@ async def create_project(
4950
Usage:
5051
::
5152
52-
result = await api.create_project(name="example")
53+
result = await api.create_project()
5354
"""
5455

5556
res = self._request(
5657
"POST",
5758
f"/account/v2/projects",
5859
body=marshal_CreateProjectRequest(
5960
CreateProjectRequest(
60-
name=name,
61+
name=name or random_name(prefix="proj"),
6162
organization_id=organization_id,
6263
description=description,
6364
),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class Project:
7474

7575
@dataclass
7676
class CreateProjectRequest:
77-
name: str
77+
name: Optional[str]
7878
"""
7979
Name of the Project.
8080
"""

scaleway/scaleway/account/v2/api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from scaleway_core.api import API
77
from scaleway_core.utils import (
88
fetch_all_pages,
9+
random_name,
910
validate_path_param,
1011
)
1112
from .types import (
@@ -34,7 +35,7 @@ class AccountV2API(API):
3435
def create_project(
3536
self,
3637
*,
37-
name: str,
38+
name: Optional[str] = None,
3839
organization_id: Optional[str] = None,
3940
description: Optional[str] = None,
4041
) -> Project:
@@ -49,15 +50,15 @@ def create_project(
4950
Usage:
5051
::
5152
52-
result = api.create_project(name="example")
53+
result = api.create_project()
5354
"""
5455

5556
res = self._request(
5657
"POST",
5758
f"/account/v2/projects",
5859
body=marshal_CreateProjectRequest(
5960
CreateProjectRequest(
60-
name=name,
61+
name=name or random_name(prefix="proj"),
6162
organization_id=organization_id,
6263
description=description,
6364
),

scaleway/scaleway/account/v2/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class Project:
7474

7575
@dataclass
7676
class CreateProjectRequest:
77-
name: str
77+
name: Optional[str]
7878
"""
7979
Name of the Project.
8080
"""

0 commit comments

Comments
 (0)