Skip to content

Commit 9a4038c

Browse files
authored
Merge branch 'main' into v1.6778.0
2 parents 0c8b993 + bf82ca3 commit 9a4038c

File tree

61 files changed

+2145
-226
lines changed

Some content is hidden

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

61 files changed

+2145
-226
lines changed

scaleway-async/poetry.lock

Lines changed: 55 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scaleway-async/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ scaleway-core = "*"
2828

2929
[tool.poetry.group.dev.dependencies]
3030
scaleway-core = { path = "../scaleway-core", develop = true }
31-
ruff = ">=0.5.0,<0.11.13"
31+
ruff = ">=0.5.0,<0.12.2"
3232
mypy = "^1.5.1"
3333

3434
[build-system]

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@
1919
from .types import ServerTypeGPU
2020
from .types import ServerTypeMemory
2121
from .types import ServerTypeNetwork
22+
from .types import BatchCreateServersRequestBatchInnerCreateServerRequest
2223
from .types import Server
2324
from .types import ConnectivityDiagnosticServerHealth
2425
from .types import ServerPrivateNetwork
2526
from .types import ServerType
2627
from .types import CommitmentTypeValue
28+
from .types import BatchCreateServersRequest
29+
from .types import BatchCreateServersResponse
2730
from .types import ConnectivityDiagnostic
2831
from .types import CreateServerRequest
2932
from .types import DeleteServerRequest
@@ -72,11 +75,14 @@
7275
"ServerTypeGPU",
7376
"ServerTypeMemory",
7477
"ServerTypeNetwork",
78+
"BatchCreateServersRequestBatchInnerCreateServerRequest",
7579
"Server",
7680
"ConnectivityDiagnosticServerHealth",
7781
"ServerPrivateNetwork",
7882
"ServerType",
7983
"CommitmentTypeValue",
84+
"BatchCreateServersRequest",
85+
"BatchCreateServersResponse",
8086
"ConnectivityDiagnostic",
8187
"CreateServerRequest",
8288
"DeleteServerRequest",

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

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
CommitmentType,
1919
ListServerPrivateNetworksRequestOrderBy,
2020
ListServersRequestOrderBy,
21+
BatchCreateServersRequest,
22+
BatchCreateServersRequestBatchInnerCreateServerRequest,
23+
BatchCreateServersResponse,
2124
CommitmentTypeValue,
2225
ConnectivityDiagnostic,
2326
CreateServerRequest,
@@ -46,13 +49,15 @@
4649
unmarshal_Server,
4750
unmarshal_ServerPrivateNetwork,
4851
unmarshal_ServerType,
52+
unmarshal_BatchCreateServersResponse,
4953
unmarshal_ConnectivityDiagnostic,
5054
unmarshal_ListOSResponse,
5155
unmarshal_ListServerPrivateNetworksResponse,
5256
unmarshal_ListServerTypesResponse,
5357
unmarshal_ListServersResponse,
5458
unmarshal_SetServerPrivateNetworksResponse,
5559
unmarshal_StartConnectivityDiagnosticResponse,
60+
marshal_BatchCreateServersRequest,
5661
marshal_CreateServerRequest,
5762
marshal_PrivateNetworkApiAddServerPrivateNetworkRequest,
5863
marshal_PrivateNetworkApiSetServerPrivateNetworksRequest,
@@ -184,6 +189,66 @@ async def create_server(
184189
self._throw_on_error(res)
185190
return unmarshal_Server(res.json())
186191

192+
async def batch_create_servers(
193+
self,
194+
*,
195+
type_: str,
196+
enable_vpc: bool,
197+
public_bandwidth_bps: int,
198+
zone: Optional[ScwZone] = None,
199+
project_id: Optional[str] = None,
200+
os_id: Optional[str] = None,
201+
commitment_type: Optional[CommitmentType] = None,
202+
requests: Optional[
203+
List[BatchCreateServersRequestBatchInnerCreateServerRequest]
204+
] = None,
205+
) -> BatchCreateServersResponse:
206+
"""
207+
Create multiple servers atomically.
208+
Create multiple servers in the targeted zone specifying their configurations. If the request cannot entirely be fullfilled, no servers are created.
209+
:param type_: Create servers of the given type.
210+
:param enable_vpc: Activate the Private Network feature for these servers. This feature is configured through the Apple Silicon - Private Networks API.
211+
:param public_bandwidth_bps: Public bandwidth to configure for these servers. This defaults to the minimum bandwidth for the corresponding server type. For compatible server types, the bandwidth can be increased which incurs additional costs.
212+
:param zone: Zone to target. If none is passed will use default zone from the config.
213+
:param project_id: Create servers in the given project ID.
214+
:param os_id: Create servers & install the given os_id, when no os_id provided the default OS for this server type is chosen. Requesting a non-default OS will induce an extended delivery time.
215+
:param commitment_type: Activate commitment for these servers. If not specified, there is a 24h commitment due to Apple licensing (commitment_type `duration_24h`). It can be updated with the Update Server request. Available commitment depends on server type.
216+
:param requests: List of servers to create.
217+
:return: :class:`BatchCreateServersResponse <BatchCreateServersResponse>`
218+
219+
Usage:
220+
::
221+
222+
result = await api.batch_create_servers(
223+
type="example",
224+
enable_vpc=False,
225+
public_bandwidth_bps=1,
226+
)
227+
"""
228+
229+
param_zone = validate_path_param("zone", zone or self.client.default_zone)
230+
231+
res = self._request(
232+
"POST",
233+
f"/apple-silicon/v1alpha1/zones/{param_zone}/batch-create-servers",
234+
body=marshal_BatchCreateServersRequest(
235+
BatchCreateServersRequest(
236+
type_=type_,
237+
enable_vpc=enable_vpc,
238+
public_bandwidth_bps=public_bandwidth_bps,
239+
zone=zone,
240+
project_id=project_id,
241+
os_id=os_id,
242+
commitment_type=commitment_type,
243+
requests=requests,
244+
),
245+
self.client,
246+
),
247+
)
248+
249+
self._throw_on_error(res)
250+
return unmarshal_BatchCreateServersResponse(res.json())
251+
187252
async def list_servers(
188253
self,
189254
*,

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

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
ServerTypeMemory,
1818
ServerTypeNetwork,
1919
ServerType,
20+
BatchCreateServersResponse,
2021
ConnectivityDiagnosticServerHealth,
2122
ConnectivityDiagnostic,
2223
ListOSResponse,
@@ -25,6 +26,8 @@
2526
ListServersResponse,
2627
SetServerPrivateNetworksResponse,
2728
StartConnectivityDiagnosticResponse,
29+
BatchCreateServersRequestBatchInnerCreateServerRequest,
30+
BatchCreateServersRequest,
2831
CreateServerRequest,
2932
PrivateNetworkApiAddServerPrivateNetworkRequest,
3033
PrivateNetworkApiSetServerPrivateNetworksRequest,
@@ -417,6 +420,23 @@ def unmarshal_ServerType(data: Any) -> ServerType:
417420
return ServerType(**args)
418421

419422

423+
def unmarshal_BatchCreateServersResponse(data: Any) -> BatchCreateServersResponse:
424+
if not isinstance(data, dict):
425+
raise TypeError(
426+
"Unmarshalling the type 'BatchCreateServersResponse' failed as data isn't a dictionary."
427+
)
428+
429+
args: Dict[str, Any] = {}
430+
431+
field = data.get("servers", None)
432+
if field is not None:
433+
args["servers"] = (
434+
[unmarshal_Server(v) for v in field] if field is not None else None
435+
)
436+
437+
return BatchCreateServersResponse(**args)
438+
439+
420440
def unmarshal_ConnectivityDiagnosticServerHealth(
421441
data: Any,
422442
) -> ConnectivityDiagnosticServerHealth:
@@ -619,6 +639,53 @@ def unmarshal_StartConnectivityDiagnosticResponse(
619639
return StartConnectivityDiagnosticResponse(**args)
620640

621641

642+
def marshal_BatchCreateServersRequestBatchInnerCreateServerRequest(
643+
request: BatchCreateServersRequestBatchInnerCreateServerRequest,
644+
defaults: ProfileDefaults,
645+
) -> Dict[str, Any]:
646+
output: Dict[str, Any] = {}
647+
648+
if request.name is not None:
649+
output["name"] = request.name
650+
651+
return output
652+
653+
654+
def marshal_BatchCreateServersRequest(
655+
request: BatchCreateServersRequest,
656+
defaults: ProfileDefaults,
657+
) -> Dict[str, Any]:
658+
output: Dict[str, Any] = {}
659+
660+
if request.type_ is not None:
661+
output["type"] = request.type_
662+
663+
if request.enable_vpc is not None:
664+
output["enable_vpc"] = request.enable_vpc
665+
666+
if request.public_bandwidth_bps is not None:
667+
output["public_bandwidth_bps"] = request.public_bandwidth_bps
668+
669+
if request.project_id is not None:
670+
output["project_id"] = request.project_id or defaults.default_project_id
671+
672+
if request.os_id is not None:
673+
output["os_id"] = request.os_id
674+
675+
if request.commitment_type is not None:
676+
output["commitment_type"] = str(request.commitment_type)
677+
678+
if request.requests is not None:
679+
output["requests"] = [
680+
marshal_BatchCreateServersRequestBatchInnerCreateServerRequest(
681+
item, defaults
682+
)
683+
for item in request.requests
684+
]
685+
686+
return output
687+
688+
622689
def marshal_CreateServerRequest(
623690
request: CreateServerRequest,
624691
defaults: ProfileDefaults,

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

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ class ServerTypeNetwork:
199199
supported_bandwidth: List[int]
200200

201201

202+
@dataclass
203+
class BatchCreateServersRequestBatchInnerCreateServerRequest:
204+
name: str
205+
206+
202207
@dataclass
203208
class Server:
204209
id: str
@@ -423,6 +428,57 @@ class CommitmentTypeValue:
423428
commitment_type: CommitmentType
424429

425430

431+
@dataclass
432+
class BatchCreateServersRequest:
433+
type_: str
434+
"""
435+
Create servers of the given type.
436+
"""
437+
438+
enable_vpc: bool
439+
"""
440+
Activate the Private Network feature for these servers. This feature is configured through the Apple Silicon - Private Networks API.
441+
"""
442+
443+
public_bandwidth_bps: int
444+
"""
445+
Public bandwidth to configure for these servers. This defaults to the minimum bandwidth for the corresponding server type. For compatible server types, the bandwidth can be increased which incurs additional costs.
446+
"""
447+
448+
zone: Optional[ScwZone]
449+
"""
450+
Zone to target. If none is passed will use default zone from the config.
451+
"""
452+
453+
project_id: Optional[str]
454+
"""
455+
Create servers in the given project ID.
456+
"""
457+
458+
os_id: Optional[str]
459+
"""
460+
Create servers & install the given os_id, when no os_id provided the default OS for this server type is chosen. Requesting a non-default OS will induce an extended delivery time.
461+
"""
462+
463+
commitment_type: Optional[CommitmentType]
464+
"""
465+
Activate commitment for these servers. If not specified, there is a 24h commitment due to Apple licensing (commitment_type `duration_24h`). It can be updated with the Update Server request. Available commitment depends on server type.
466+
"""
467+
468+
requests: Optional[List[BatchCreateServersRequestBatchInnerCreateServerRequest]]
469+
"""
470+
List of servers to create.
471+
"""
472+
473+
474+
@dataclass
475+
class BatchCreateServersResponse:
476+
servers: List[Server]
477+
"""
478+
List of created servers.
479+
"""
480+
481+
426482
@dataclass
427483
class ConnectivityDiagnostic:
428484
id: str

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from .types import ResourceType
55
from .types import AccountOrganizationInfo
66
from .types import AccountUserInfo
7+
from .types import AppleSiliconServerInfo
78
from .types import InstanceServerInfo
89
from .types import KeyManagerKeyInfo
910
from .types import KubernetesACLInfo
@@ -28,6 +29,7 @@
2829
"ResourceType",
2930
"AccountOrganizationInfo",
3031
"AccountUserInfo",
32+
"AppleSiliconServerInfo",
3133
"InstanceServerInfo",
3234
"KeyManagerKeyInfo",
3335
"KubernetesACLInfo",

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

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from .types import (
88
AccountOrganizationInfo,
99
AccountUserInfo,
10+
AppleSiliconServerInfo,
1011
InstanceServerInfo,
1112
KeyManagerKeyInfo,
1213
KubernetesACLInfo,
@@ -57,6 +58,25 @@ def unmarshal_AccountUserInfo(data: Any) -> AccountUserInfo:
5758
return AccountUserInfo(**args)
5859

5960

61+
def unmarshal_AppleSiliconServerInfo(data: Any) -> AppleSiliconServerInfo:
62+
if not isinstance(data, dict):
63+
raise TypeError(
64+
"Unmarshalling the type 'AppleSiliconServerInfo' failed as data isn't a dictionary."
65+
)
66+
67+
args: Dict[str, Any] = {}
68+
69+
field = data.get("id", None)
70+
if field is not None:
71+
args["id"] = field
72+
73+
field = data.get("name", None)
74+
if field is not None:
75+
args["name"] = field
76+
77+
return AppleSiliconServerInfo(**args)
78+
79+
6080
def unmarshal_InstanceServerInfo(data: Any) -> InstanceServerInfo:
6181
if not isinstance(data, dict):
6282
raise TypeError(
@@ -318,6 +338,12 @@ def unmarshal_Resource(data: Any) -> Resource:
318338
else:
319339
args["instance_server_info"] = None
320340

341+
field = data.get("apple_silicon_server_info", None)
342+
if field is not None:
343+
args["apple_silicon_server_info"] = unmarshal_AppleSiliconServerInfo(field)
344+
else:
345+
args["apple_silicon_server_info"] = None
346+
321347
return Resource(**args)
322348

323349

@@ -345,6 +371,10 @@ def unmarshal_Event(data: Any) -> Event:
345371
if field is not None:
346372
args["source_ip"] = field
347373

374+
field = data.get("product_name", None)
375+
if field is not None:
376+
args["product_name"] = field
377+
348378
field = data.get("recorded_at", None)
349379
if field is not None:
350380
args["recorded_at"] = (
@@ -371,10 +401,6 @@ def unmarshal_Event(data: Any) -> Event:
371401
else:
372402
args["user_agent"] = None
373403

374-
field = data.get("product_name", None)
375-
if field is not None:
376-
args["product_name"] = field
377-
378404
field = data.get("service_name", None)
379405
if field is not None:
380406
args["service_name"] = field
@@ -397,12 +423,6 @@ def unmarshal_Event(data: Any) -> Event:
397423
if field is not None:
398424
args["status_code"] = field
399425

400-
field = data.get("resource", None)
401-
if field is not None:
402-
args["resource"] = unmarshal_Resource(field)
403-
else:
404-
args["resource"] = None
405-
406426
field = data.get("request_body", None)
407427
if field is not None:
408428
args["request_body"] = field

0 commit comments

Comments
 (0)