Skip to content

Commit 7b9deb4

Browse files
authored
Merge branch 'main' into v1.5905.0
2 parents da77986 + 4968c75 commit 7b9deb4

File tree

22 files changed

+414
-0
lines changed

22 files changed

+414
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from .types import ConnectivityDiagnosticActionType
44
from .types import ConnectivityDiagnosticDiagnosticStatus
55
from .types import ListServersRequestOrderBy
6+
from .types import ServerPrivateNetworkStatus
7+
from .content import SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES
68
from .types import ServerStatus
79
from .content import SERVER_TRANSIENT_STATUSES
810
from .types import ServerTypeStock
@@ -39,6 +41,8 @@
3941
"ConnectivityDiagnosticActionType",
4042
"ConnectivityDiagnosticDiagnosticStatus",
4143
"ListServersRequestOrderBy",
44+
"ServerPrivateNetworkStatus",
45+
"SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES",
4246
"ServerStatus",
4347
"SERVER_TRANSIENT_STATUSES",
4448
"ServerTypeStock",

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ async def create_server(
116116
self,
117117
*,
118118
type_: str,
119+
enable_vpc: bool,
119120
zone: Optional[Zone] = None,
120121
name: Optional[str] = None,
121122
project_id: Optional[str] = None,
@@ -125,6 +126,7 @@ async def create_server(
125126
Create a server.
126127
Create a new server in the targeted zone, specifying its configuration including name and type.
127128
:param type_: Create a server of the given type.
129+
:param enable_vpc: Activate the Private Network feature for this server. This feature is configured through the Apple Silicon - Private Networks API.
128130
:param zone: Zone to target. If none is passed will use default zone from the config.
129131
:param name: Create a server with this given name.
130132
:param project_id: Create a server in the given project ID.
@@ -136,6 +138,7 @@ async def create_server(
136138
137139
result = await api.create_server(
138140
type="example",
141+
enable_vpc=False,
139142
)
140143
"""
141144

@@ -147,6 +150,7 @@ async def create_server(
147150
body=marshal_CreateServerRequest(
148151
CreateServerRequest(
149152
type_=type_,
153+
enable_vpc=enable_vpc,
150154
zone=zone,
151155
name=name or random_name(prefix="as"),
152156
project_id=project_id,
@@ -432,6 +436,7 @@ async def update_server(
432436
zone: Optional[Zone] = None,
433437
name: Optional[str] = None,
434438
schedule_deletion: Optional[bool] = None,
439+
enable_vpc: Optional[bool] = None,
435440
) -> Server:
436441
"""
437442
Update a server.
@@ -440,6 +445,7 @@ async def update_server(
440445
:param zone: Zone to target. If none is passed will use default zone from the config.
441446
:param name: Updated name for your server.
442447
:param schedule_deletion: Specify whether the server should be flagged for automatic deletion.
448+
:param enable_vpc: Activate or deactivate Private Network support for this server.
443449
:return: :class:`Server <Server>`
444450
445451
Usage:
@@ -462,6 +468,7 @@ async def update_server(
462468
zone=zone,
463469
name=name,
464470
schedule_deletion=schedule_deletion,
471+
enable_vpc=enable_vpc,
465472
),
466473
self.client,
467474
),

scaleway-async/scaleway_async/applesilicon/v1alpha1/content.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@
33
from typing import List
44

55
from .types import (
6+
ServerPrivateNetworkStatus,
67
ServerStatus,
78
)
89

10+
SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES: List[ServerPrivateNetworkStatus] = [
11+
ServerPrivateNetworkStatus.VPC_UPDATING,
12+
]
13+
"""
14+
Lists transient statutes of the enum :class:`ServerPrivateNetworkStatus <ServerPrivateNetworkStatus>`.
15+
"""
916
SERVER_TRANSIENT_STATUSES: List[ServerStatus] = [
1017
ServerStatus.STARTING,
1118
ServerStatus.REBOOTING,

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,10 @@ def unmarshal_Server(data: Any) -> Server:
291291
if field is not None:
292292
args["delivered"] = field
293293

294+
field = data.get("vpc_status", None)
295+
if field is not None:
296+
args["vpc_status"] = field
297+
294298
field = data.get("os", None)
295299
if field is not None:
296300
args["os"] = unmarshal_OS(field)
@@ -485,6 +489,9 @@ def marshal_CreateServerRequest(
485489
if request.type_ is not None:
486490
output["type"] = request.type_
487491

492+
if request.enable_vpc is not None:
493+
output["enable_vpc"] = request.enable_vpc
494+
488495
if request.name is not None:
489496
output["name"] = request.name
490497

@@ -533,4 +540,7 @@ def marshal_UpdateServerRequest(
533540
if request.schedule_deletion is not None:
534541
output["schedule_deletion"] = request.schedule_deletion
535542

543+
if request.enable_vpc is not None:
544+
output["enable_vpc"] = request.enable_vpc
545+
536546
return output

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ def __str__(self) -> str:
4141
return str(self.value)
4242

4343

44+
class ServerPrivateNetworkStatus(str, Enum, metaclass=StrEnumMeta):
45+
VPC_UNKNOWN_STATUS = "vpc_unknown_status"
46+
VPC_ENABLED = "vpc_enabled"
47+
VPC_UPDATING = "vpc_updating"
48+
VPC_DISABLED = "vpc_disabled"
49+
50+
def __str__(self) -> str:
51+
return str(self.value)
52+
53+
4454
class ServerStatus(str, Enum, metaclass=StrEnumMeta):
4555
UNKNOWN_STATUS = "unknown_status"
4656
STARTING = "starting"
@@ -284,6 +294,11 @@ class Server:
284294
Set to true once the server has completed its provisioning steps and is ready to use. Some OS configurations might require a reinstallation of the server before delivery depending on the available stock. A reinstallation after the initial delivery will not change this flag and can be tracked using the server status.
285295
"""
286296

297+
vpc_status: ServerPrivateNetworkStatus
298+
"""
299+
Activation status of optional Private Network feature support for this server.
300+
"""
301+
287302
os: Optional[OS]
288303
"""
289304
Initially installed OS, this does not necessarily reflect the current OS version.
@@ -327,6 +342,11 @@ class CreateServerRequest:
327342
Create a server of the given type.
328343
"""
329344

345+
enable_vpc: bool
346+
"""
347+
Activate the Private Network feature for this server. This feature is configured through the Apple Silicon - Private Networks API.
348+
"""
349+
330350
zone: Optional[Zone]
331351
"""
332352
Zone to target. If none is passed will use default zone from the config.
@@ -580,3 +600,8 @@ class UpdateServerRequest:
580600
"""
581601
Specify whether the server should be flagged for automatic deletion.
582602
"""
603+
604+
enable_vpc: Optional[bool]
605+
"""
606+
Activate or deactivate Private Network support for this server.
607+
"""

scaleway-async/scaleway_async/secret/v1beta1/marshalling.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ def unmarshal_SecretVersion(data: Any) -> SecretVersion:
9292
else:
9393
args["updated_at"] = None
9494

95+
field = data.get("deleted_at", None)
96+
if field is not None:
97+
args["deleted_at"] = parser.isoparse(field) if isinstance(field, str) else field
98+
else:
99+
args["deleted_at"] = None
100+
95101
field = data.get("description", None)
96102
if field is not None:
97103
args["description"] = field

scaleway-async/scaleway_async/secret/v1beta1/types.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ class SecretVersion:
192192
Last update of the version.
193193
"""
194194

195+
deleted_at: Optional[datetime]
196+
"""
197+
Date and time of the version's deletion.
198+
"""
199+
195200
description: Optional[str]
196201
"""
197202
Description of the version.

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from .types import CreateDatabaseRequestUser
2525
from .types import CreateHostingRequestDomainConfiguration
2626
from .types import OfferOptionRequest
27+
from .types import SyncDomainDnsRecordsRequestRecord
2728
from .types import DnsRecord
2829
from .types import Nameserver
2930
from .types import HostingUser
@@ -51,6 +52,7 @@
5152
from .types import DatabaseApiUnassignDatabaseUserRequest
5253
from .types import DnsApiCheckUserOwnsDomainRequest
5354
from .types import DnsApiGetDomainDnsRecordsRequest
55+
from .types import DnsApiSyncDomainDnsRecordsRequest
5456
from .types import DnsRecords
5557
from .types import FtpAccountApiChangeFtpAccountPasswordRequest
5658
from .types import FtpAccountApiCreateFtpAccountRequest
@@ -116,6 +118,7 @@
116118
"CreateDatabaseRequestUser",
117119
"CreateHostingRequestDomainConfiguration",
118120
"OfferOptionRequest",
121+
"SyncDomainDnsRecordsRequestRecord",
119122
"DnsRecord",
120123
"Nameserver",
121124
"HostingUser",
@@ -143,6 +146,7 @@
143146
"DatabaseApiUnassignDatabaseUserRequest",
144147
"DnsApiCheckUserOwnsDomainRequest",
145148
"DnsApiGetDomainDnsRecordsRequest",
149+
"DnsApiSyncDomainDnsRecordsRequest",
146150
"DnsRecords",
147151
"FtpAccountApiChangeFtpAccountPasswordRequest",
148152
"FtpAccountApiCreateFtpAccountRequest",

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

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
DatabaseApiUnassignDatabaseUserRequest,
3535
DatabaseUser,
3636
DnsApiCheckUserOwnsDomainRequest,
37+
DnsApiSyncDomainDnsRecordsRequest,
3738
DnsRecords,
3839
FtpAccount,
3940
FtpAccountApiChangeFtpAccountPasswordRequest,
@@ -59,6 +60,7 @@
5960
ResetHostingPasswordResponse,
6061
ResourceSummary,
6162
Session,
63+
SyncDomainDnsRecordsRequestRecord,
6264
Website,
6365
)
6466
from .content import (
@@ -89,6 +91,7 @@
8991
marshal_DatabaseApiCreateDatabaseUserRequest,
9092
marshal_DatabaseApiUnassignDatabaseUserRequest,
9193
marshal_DnsApiCheckUserOwnsDomainRequest,
94+
marshal_DnsApiSyncDomainDnsRecordsRequest,
9295
marshal_FtpAccountApiChangeFtpAccountPasswordRequest,
9396
marshal_FtpAccountApiCreateFtpAccountRequest,
9497
marshal_HostingApiCreateHostingRequest,
@@ -824,6 +827,61 @@ async def check_user_owns_domain(
824827
self._throw_on_error(res)
825828
return unmarshal_CheckUserOwnsDomainResponse(res.json())
826829

830+
async def sync_domain_dns_records(
831+
self,
832+
*,
833+
domain: str,
834+
update_web_records: bool,
835+
update_mail_records: bool,
836+
update_all_records: bool,
837+
region: Optional[Region] = None,
838+
custom_records: Optional[List[SyncDomainDnsRecordsRequestRecord]] = None,
839+
) -> DnsRecords:
840+
"""
841+
"Synchronize your DNS records on the Elements Console and on cPanel.".
842+
:param domain: Domain for which the DNS records will be synchronized.
843+
:param update_web_records: Whether or not to synchronize the web records.
844+
:param update_mail_records: Whether or not to synchronize the mail records.
845+
:param update_all_records: Whether or not to synchronize all types of records. This one has priority.
846+
:param region: Region to target. If none is passed will use default region from the config.
847+
:param custom_records: Custom records to synchronize.
848+
:return: :class:`DnsRecords <DnsRecords>`
849+
850+
Usage:
851+
::
852+
853+
result = await api.sync_domain_dns_records(
854+
domain="example",
855+
update_web_records=False,
856+
update_mail_records=False,
857+
update_all_records=False,
858+
)
859+
"""
860+
861+
param_region = validate_path_param(
862+
"region", region or self.client.default_region
863+
)
864+
param_domain = validate_path_param("domain", domain)
865+
866+
res = self._request(
867+
"POST",
868+
f"/webhosting/v1/regions/{param_region}/domains/{param_domain}/sync-domain-dns-records",
869+
body=marshal_DnsApiSyncDomainDnsRecordsRequest(
870+
DnsApiSyncDomainDnsRecordsRequest(
871+
domain=domain,
872+
update_web_records=update_web_records,
873+
update_mail_records=update_mail_records,
874+
update_all_records=update_all_records,
875+
region=region,
876+
custom_records=custom_records,
877+
),
878+
self.client,
879+
),
880+
)
881+
882+
self._throw_on_error(res)
883+
return unmarshal_DnsRecords(res.json())
884+
827885

828886
class WebhostingV1OfferAPI(API):
829887
"""

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
DatabaseApiCreateDatabaseUserRequest,
5050
DatabaseApiUnassignDatabaseUserRequest,
5151
DnsApiCheckUserOwnsDomainRequest,
52+
SyncDomainDnsRecordsRequestRecord,
53+
DnsApiSyncDomainDnsRecordsRequest,
5254
FtpAccountApiChangeFtpAccountPasswordRequest,
5355
FtpAccountApiCreateFtpAccountRequest,
5456
CreateHostingRequestDomainConfiguration,
@@ -939,6 +941,45 @@ def marshal_DnsApiCheckUserOwnsDomainRequest(
939941
return output
940942

941943

944+
def marshal_SyncDomainDnsRecordsRequestRecord(
945+
request: SyncDomainDnsRecordsRequestRecord,
946+
defaults: ProfileDefaults,
947+
) -> Dict[str, Any]:
948+
output: Dict[str, Any] = {}
949+
950+
if request.name is not None:
951+
output["name"] = request.name
952+
953+
if request.type_ is not None:
954+
output["type"] = str(request.type_)
955+
956+
return output
957+
958+
959+
def marshal_DnsApiSyncDomainDnsRecordsRequest(
960+
request: DnsApiSyncDomainDnsRecordsRequest,
961+
defaults: ProfileDefaults,
962+
) -> Dict[str, Any]:
963+
output: Dict[str, Any] = {}
964+
965+
if request.update_web_records is not None:
966+
output["update_web_records"] = request.update_web_records
967+
968+
if request.update_mail_records is not None:
969+
output["update_mail_records"] = request.update_mail_records
970+
971+
if request.update_all_records is not None:
972+
output["update_all_records"] = request.update_all_records
973+
974+
if request.custom_records is not None:
975+
output["custom_records"] = [
976+
marshal_SyncDomainDnsRecordsRequestRecord(item, defaults)
977+
for item in request.custom_records
978+
]
979+
980+
return output
981+
982+
942983
def marshal_FtpAccountApiChangeFtpAccountPasswordRequest(
943984
request: FtpAccountApiChangeFtpAccountPasswordRequest,
944985
defaults: ProfileDefaults,

0 commit comments

Comments
 (0)