Skip to content

Commit 2df2619

Browse files
authored
feat(webhosting): add language field at public hosting creation (#431)
1 parent 46f5e6d commit 2df2619

File tree

8 files changed

+52
-0
lines changed

8 files changed

+52
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from .types import DnsRecordsStatus
66
from .types import HostingDnsStatus
77
from .types import HostingStatus
8+
from .types import LanguageCode
89
from .types import ListHostingsRequestOrderBy
910
from .types import ListOffersRequestOrderBy
1011
from .types import NameserverStatus
@@ -30,6 +31,7 @@
3031
"DnsRecordsStatus",
3132
"HostingDnsStatus",
3233
"HostingStatus",
34+
"LanguageCode",
3335
"ListHostingsRequestOrderBy",
3436
"ListOffersRequestOrderBy",
3537
"NameserverStatus",

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
)
1616
from .types import (
1717
HostingStatus,
18+
LanguageCode,
1819
ListHostingsRequestOrderBy,
1920
ListOffersRequestOrderBy,
2021
ControlPanel,
@@ -52,6 +53,7 @@ async def create_hosting(
5253
*,
5354
offer_id: str,
5455
domain: str,
56+
language: LanguageCode,
5557
region: Optional[Region] = None,
5658
project_id: Optional[str] = None,
5759
email: Optional[str] = None,
@@ -68,6 +70,7 @@ async def create_hosting(
6870
:param tags: List of tags for the Web Hosting plan.
6971
:param domain: Domain name to link to the Web Hosting plan. You must already own this domain name, and have completed the DNS validation process beforehand.
7072
:param option_ids: IDs of any selected additional options for the Web Hosting plan.
73+
:param language: Default language for the control panel interface.
7174
:return: :class:`Hosting <Hosting>`
7275
7376
Usage:
@@ -76,6 +79,7 @@ async def create_hosting(
7679
result = await api.create_hosting(
7780
offer_id="example",
7881
domain="example",
82+
language=unknown_language_code,
7983
)
8084
"""
8185

@@ -90,6 +94,7 @@ async def create_hosting(
9094
CreateHostingRequest(
9195
offer_id=offer_id,
9296
domain=domain,
97+
language=language,
9398
region=region,
9499
project_id=project_id,
95100
email=email,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
)
1010
from dateutil import parser
1111
from .types import (
12+
LanguageCode,
1213
ControlPanel,
1314
DnsRecord,
1415
DnsRecords,
@@ -374,6 +375,9 @@ def marshal_CreateHostingRequest(
374375
if request.email is not None:
375376
output["email"] = request.email
376377

378+
if request.language is not None:
379+
output["language"] = LanguageCode(request.language)
380+
377381
if request.offer_id is not None:
378382
output["offer_id"] = request.offer_id
379383

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ def __str__(self) -> str:
6969
return str(self.value)
7070

7171

72+
class LanguageCode(str, Enum, metaclass=StrEnumMeta):
73+
UNKNOWN_LANGUAGE_CODE = "unknown_language_code"
74+
EN_US = "en_US"
75+
FR_FR = "fr_FR"
76+
DE_DE = "de_DE"
77+
78+
def __str__(self) -> str:
79+
return str(self.value)
80+
81+
7282
class ListHostingsRequestOrderBy(str, Enum, metaclass=StrEnumMeta):
7383
CREATED_AT_ASC = "created_at_asc"
7484
CREATED_AT_DESC = "created_at_desc"
@@ -534,6 +544,11 @@ class CreateHostingRequest:
534544
IDs of any selected additional options for the Web Hosting plan.
535545
"""
536546

547+
language: LanguageCode
548+
"""
549+
Default language for the control panel interface.
550+
"""
551+
537552

538553
@dataclass
539554
class ListHostingsRequest:

scaleway/scaleway/webhosting/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from .types import DnsRecordsStatus
66
from .types import HostingDnsStatus
77
from .types import HostingStatus
8+
from .types import LanguageCode
89
from .types import ListHostingsRequestOrderBy
910
from .types import ListOffersRequestOrderBy
1011
from .types import NameserverStatus
@@ -30,6 +31,7 @@
3031
"DnsRecordsStatus",
3132
"HostingDnsStatus",
3233
"HostingStatus",
34+
"LanguageCode",
3335
"ListHostingsRequestOrderBy",
3436
"ListOffersRequestOrderBy",
3537
"NameserverStatus",

scaleway/scaleway/webhosting/v1alpha1/api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
)
1616
from .types import (
1717
HostingStatus,
18+
LanguageCode,
1819
ListHostingsRequestOrderBy,
1920
ListOffersRequestOrderBy,
2021
ControlPanel,
@@ -52,6 +53,7 @@ def create_hosting(
5253
*,
5354
offer_id: str,
5455
domain: str,
56+
language: LanguageCode,
5557
region: Optional[Region] = None,
5658
project_id: Optional[str] = None,
5759
email: Optional[str] = None,
@@ -68,6 +70,7 @@ def create_hosting(
6870
:param tags: List of tags for the Web Hosting plan.
6971
:param domain: Domain name to link to the Web Hosting plan. You must already own this domain name, and have completed the DNS validation process beforehand.
7072
:param option_ids: IDs of any selected additional options for the Web Hosting plan.
73+
:param language: Default language for the control panel interface.
7174
:return: :class:`Hosting <Hosting>`
7275
7376
Usage:
@@ -76,6 +79,7 @@ def create_hosting(
7679
result = api.create_hosting(
7780
offer_id="example",
7881
domain="example",
82+
language=unknown_language_code,
7983
)
8084
"""
8185

@@ -90,6 +94,7 @@ def create_hosting(
9094
CreateHostingRequest(
9195
offer_id=offer_id,
9296
domain=domain,
97+
language=language,
9398
region=region,
9499
project_id=project_id,
95100
email=email,

scaleway/scaleway/webhosting/v1alpha1/marshalling.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
)
1010
from dateutil import parser
1111
from .types import (
12+
LanguageCode,
1213
ControlPanel,
1314
DnsRecord,
1415
DnsRecords,
@@ -374,6 +375,9 @@ def marshal_CreateHostingRequest(
374375
if request.email is not None:
375376
output["email"] = request.email
376377

378+
if request.language is not None:
379+
output["language"] = LanguageCode(request.language)
380+
377381
if request.offer_id is not None:
378382
output["offer_id"] = request.offer_id
379383

scaleway/scaleway/webhosting/v1alpha1/types.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ def __str__(self) -> str:
6969
return str(self.value)
7070

7171

72+
class LanguageCode(str, Enum, metaclass=StrEnumMeta):
73+
UNKNOWN_LANGUAGE_CODE = "unknown_language_code"
74+
EN_US = "en_US"
75+
FR_FR = "fr_FR"
76+
DE_DE = "de_DE"
77+
78+
def __str__(self) -> str:
79+
return str(self.value)
80+
81+
7282
class ListHostingsRequestOrderBy(str, Enum, metaclass=StrEnumMeta):
7383
CREATED_AT_ASC = "created_at_asc"
7484
CREATED_AT_DESC = "created_at_desc"
@@ -534,6 +544,11 @@ class CreateHostingRequest:
534544
IDs of any selected additional options for the Web Hosting plan.
535545
"""
536546

547+
language: LanguageCode
548+
"""
549+
Default language for the control panel interface.
550+
"""
551+
537552

538553
@dataclass
539554
class ListHostingsRequest:

0 commit comments

Comments
 (0)