Skip to content

Commit ba21841

Browse files
committed
feat: update generated APIs
1 parent 1a5422b commit ba21841

File tree

8 files changed

+136
-0
lines changed

8 files changed

+136
-0
lines changed

scaleway-async/scaleway_async/webhosting/v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from .types import PlatformControlPanelUrls
2222
from .types import OfferOption
2323
from .types import PlatformControlPanel
24+
from .types import CreateDatabaseRequestUser
2425
from .types import CreateHostingRequestDomainConfiguration
2526
from .types import OfferOptionRequest
2627
from .types import DnsRecord
@@ -112,6 +113,7 @@
112113
"PlatformControlPanelUrls",
113114
"OfferOption",
114115
"PlatformControlPanel",
116+
"CreateDatabaseRequestUser",
115117
"CreateHostingRequestDomainConfiguration",
116118
"OfferOptionRequest",
117119
"DnsRecord",

scaleway-async/scaleway_async/webhosting/v1/api.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
ListWebsitesRequestOrderBy,
2525
CheckUserOwnsDomainResponse,
2626
ControlPanel,
27+
CreateDatabaseRequestUser,
2728
CreateHostingRequestDomainConfiguration,
2829
Database,
2930
DatabaseApiAssignDatabaseUserRequest,
@@ -185,12 +186,18 @@ async def create_database(
185186
hosting_id: str,
186187
database_name: str,
187188
region: Optional[Region] = None,
189+
new_user: Optional[CreateDatabaseRequestUser] = None,
190+
existing_username: Optional[str] = None,
188191
) -> Database:
189192
"""
190193
"Create a new database within your hosting plan".
191194
:param hosting_id: UUID of the hosting plan where the database will be created.
192195
:param database_name: Name of the database to be created.
193196
:param region: Region to target. If none is passed will use default region from the config.
197+
:param new_user: (Optional) Username and password to create a user and link to the database.
198+
One-Of ('user'): at most one of 'new_user', 'existing_username' could be set.
199+
:param existing_username: (Optional) Username to link an existing user to the database.
200+
One-Of ('user'): at most one of 'new_user', 'existing_username' could be set.
194201
:return: :class:`Database <Database>`
195202
196203
Usage:
@@ -215,6 +222,8 @@ async def create_database(
215222
hosting_id=hosting_id,
216223
database_name=database_name,
217224
region=region,
225+
new_user=new_user,
226+
existing_username=existing_username,
218227
),
219228
self.client,
220229
),

scaleway-async/scaleway_async/webhosting/v1/marshalling.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
from scaleway_core.bridge import (
99
unmarshal_Money,
1010
)
11+
from scaleway_core.utils import (
12+
OneOfPossibility,
13+
resolve_one_of,
14+
)
1115
from .types import (
1216
DatabaseUser,
1317
Database,
@@ -40,6 +44,7 @@
4044
Session,
4145
DatabaseApiAssignDatabaseUserRequest,
4246
DatabaseApiChangeDatabaseUserPasswordRequest,
47+
CreateDatabaseRequestUser,
4348
DatabaseApiCreateDatabaseRequest,
4449
DatabaseApiCreateDatabaseUserRequest,
4550
DatabaseApiUnassignDatabaseUserRequest,
@@ -645,6 +650,14 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary:
645650
if field is not None:
646651
args["protected"] = field
647652

653+
field = data.get("dns_status", None)
654+
if field is not None:
655+
args["dns_status"] = field
656+
657+
field = data.get("offer_name", None)
658+
if field is not None:
659+
args["offer_name"] = field
660+
648661
field = data.get("region", None)
649662
if field is not None:
650663
args["region"] = field
@@ -852,11 +865,34 @@ def marshal_DatabaseApiChangeDatabaseUserPasswordRequest(
852865
return output
853866

854867

868+
def marshal_CreateDatabaseRequestUser(
869+
request: CreateDatabaseRequestUser,
870+
defaults: ProfileDefaults,
871+
) -> Dict[str, Any]:
872+
output: Dict[str, Any] = {}
873+
874+
if request.username is not None:
875+
output["username"] = request.username
876+
877+
if request.password is not None:
878+
output["password"] = request.password
879+
880+
return output
881+
882+
855883
def marshal_DatabaseApiCreateDatabaseRequest(
856884
request: DatabaseApiCreateDatabaseRequest,
857885
defaults: ProfileDefaults,
858886
) -> Dict[str, Any]:
859887
output: Dict[str, Any] = {}
888+
output.update(
889+
resolve_one_of(
890+
[
891+
OneOfPossibility("new_user", request.new_user),
892+
OneOfPossibility("existing_username", request.existing_username),
893+
]
894+
),
895+
)
860896

861897
if request.database_name is not None:
862898
output["database_name"] = request.database_name

scaleway-async/scaleway_async/webhosting/v1/types.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,13 @@ class PlatformControlPanel:
243243
"""
244244

245245

246+
@dataclass
247+
class CreateDatabaseRequestUser:
248+
username: str
249+
250+
password: str
251+
252+
246253
@dataclass
247254
class CreateHostingRequestDomainConfiguration:
248255
update_nameservers: bool
@@ -496,6 +503,16 @@ class HostingSummary:
496503
Whether the hosting is protected or not.
497504
"""
498505

506+
dns_status: DnsRecordsStatus
507+
"""
508+
DNS status of the Web Hosting plan.
509+
"""
510+
511+
offer_name: str
512+
"""
513+
Name of the active offer for the Web Hosting plan.
514+
"""
515+
499516
region: Region
500517
"""
501518
Region where the Web Hosting plan is hosted.
@@ -632,6 +649,10 @@ class DatabaseApiCreateDatabaseRequest:
632649
Region to target. If none is passed will use default region from the config.
633650
"""
634651

652+
new_user: Optional[CreateDatabaseRequestUser]
653+
654+
existing_username: Optional[str]
655+
635656

636657
@dataclass
637658
class DatabaseApiCreateDatabaseUserRequest:

scaleway/scaleway/webhosting/v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from .types import PlatformControlPanelUrls
2222
from .types import OfferOption
2323
from .types import PlatformControlPanel
24+
from .types import CreateDatabaseRequestUser
2425
from .types import CreateHostingRequestDomainConfiguration
2526
from .types import OfferOptionRequest
2627
from .types import DnsRecord
@@ -112,6 +113,7 @@
112113
"PlatformControlPanelUrls",
113114
"OfferOption",
114115
"PlatformControlPanel",
116+
"CreateDatabaseRequestUser",
115117
"CreateHostingRequestDomainConfiguration",
116118
"OfferOptionRequest",
117119
"DnsRecord",

scaleway/scaleway/webhosting/v1/api.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
ListWebsitesRequestOrderBy,
2525
CheckUserOwnsDomainResponse,
2626
ControlPanel,
27+
CreateDatabaseRequestUser,
2728
CreateHostingRequestDomainConfiguration,
2829
Database,
2930
DatabaseApiAssignDatabaseUserRequest,
@@ -185,12 +186,18 @@ def create_database(
185186
hosting_id: str,
186187
database_name: str,
187188
region: Optional[Region] = None,
189+
new_user: Optional[CreateDatabaseRequestUser] = None,
190+
existing_username: Optional[str] = None,
188191
) -> Database:
189192
"""
190193
"Create a new database within your hosting plan".
191194
:param hosting_id: UUID of the hosting plan where the database will be created.
192195
:param database_name: Name of the database to be created.
193196
:param region: Region to target. If none is passed will use default region from the config.
197+
:param new_user: (Optional) Username and password to create a user and link to the database.
198+
One-Of ('user'): at most one of 'new_user', 'existing_username' could be set.
199+
:param existing_username: (Optional) Username to link an existing user to the database.
200+
One-Of ('user'): at most one of 'new_user', 'existing_username' could be set.
194201
:return: :class:`Database <Database>`
195202
196203
Usage:
@@ -215,6 +222,8 @@ def create_database(
215222
hosting_id=hosting_id,
216223
database_name=database_name,
217224
region=region,
225+
new_user=new_user,
226+
existing_username=existing_username,
218227
),
219228
self.client,
220229
),

scaleway/scaleway/webhosting/v1/marshalling.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
from scaleway_core.bridge import (
99
unmarshal_Money,
1010
)
11+
from scaleway_core.utils import (
12+
OneOfPossibility,
13+
resolve_one_of,
14+
)
1115
from .types import (
1216
DatabaseUser,
1317
Database,
@@ -40,6 +44,7 @@
4044
Session,
4145
DatabaseApiAssignDatabaseUserRequest,
4246
DatabaseApiChangeDatabaseUserPasswordRequest,
47+
CreateDatabaseRequestUser,
4348
DatabaseApiCreateDatabaseRequest,
4449
DatabaseApiCreateDatabaseUserRequest,
4550
DatabaseApiUnassignDatabaseUserRequest,
@@ -645,6 +650,14 @@ def unmarshal_HostingSummary(data: Any) -> HostingSummary:
645650
if field is not None:
646651
args["protected"] = field
647652

653+
field = data.get("dns_status", None)
654+
if field is not None:
655+
args["dns_status"] = field
656+
657+
field = data.get("offer_name", None)
658+
if field is not None:
659+
args["offer_name"] = field
660+
648661
field = data.get("region", None)
649662
if field is not None:
650663
args["region"] = field
@@ -852,11 +865,34 @@ def marshal_DatabaseApiChangeDatabaseUserPasswordRequest(
852865
return output
853866

854867

868+
def marshal_CreateDatabaseRequestUser(
869+
request: CreateDatabaseRequestUser,
870+
defaults: ProfileDefaults,
871+
) -> Dict[str, Any]:
872+
output: Dict[str, Any] = {}
873+
874+
if request.username is not None:
875+
output["username"] = request.username
876+
877+
if request.password is not None:
878+
output["password"] = request.password
879+
880+
return output
881+
882+
855883
def marshal_DatabaseApiCreateDatabaseRequest(
856884
request: DatabaseApiCreateDatabaseRequest,
857885
defaults: ProfileDefaults,
858886
) -> Dict[str, Any]:
859887
output: Dict[str, Any] = {}
888+
output.update(
889+
resolve_one_of(
890+
[
891+
OneOfPossibility("new_user", request.new_user),
892+
OneOfPossibility("existing_username", request.existing_username),
893+
]
894+
),
895+
)
860896

861897
if request.database_name is not None:
862898
output["database_name"] = request.database_name

scaleway/scaleway/webhosting/v1/types.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,13 @@ class PlatformControlPanel:
243243
"""
244244

245245

246+
@dataclass
247+
class CreateDatabaseRequestUser:
248+
username: str
249+
250+
password: str
251+
252+
246253
@dataclass
247254
class CreateHostingRequestDomainConfiguration:
248255
update_nameservers: bool
@@ -496,6 +503,16 @@ class HostingSummary:
496503
Whether the hosting is protected or not.
497504
"""
498505

506+
dns_status: DnsRecordsStatus
507+
"""
508+
DNS status of the Web Hosting plan.
509+
"""
510+
511+
offer_name: str
512+
"""
513+
Name of the active offer for the Web Hosting plan.
514+
"""
515+
499516
region: Region
500517
"""
501518
Region where the Web Hosting plan is hosted.
@@ -632,6 +649,10 @@ class DatabaseApiCreateDatabaseRequest:
632649
Region to target. If none is passed will use default region from the config.
633650
"""
634651

652+
new_user: Optional[CreateDatabaseRequestUser]
653+
654+
existing_username: Optional[str]
655+
635656

636657
@dataclass
637658
class DatabaseApiCreateDatabaseUserRequest:

0 commit comments

Comments
 (0)