Skip to content

Commit cd84c05

Browse files
authored
Merge branch 'main' into v1.6749.0
2 parents 5b281fe + 034a780 commit cd84c05

File tree

33 files changed

+775
-186
lines changed

33 files changed

+775
-186
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/cockpit/v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This file was automatically generated. DO NOT EDIT.
22
# If you have any remark or suggestion do not hesitate to open an issue.
33
from .types import AlertState
4+
from .types import AlertStatus
45
from .types import DataSourceOrigin
56
from .types import DataSourceType
67
from .types import GrafanaUserRole
@@ -78,6 +79,7 @@
7879

7980
__all__ = [
8081
"AlertState",
82+
"AlertStatus",
8183
"DataSourceOrigin",
8284
"DataSourceType",
8385
"GrafanaUserRole",

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
)
1414
from .types import (
1515
AlertState,
16+
AlertStatus,
1617
DataSourceOrigin,
1718
DataSourceType,
1819
GrafanaUserRole,
@@ -1473,7 +1474,7 @@ async def list_alerts(
14731474
*,
14741475
region: Optional[ScwRegion] = None,
14751476
project_id: Optional[str] = None,
1476-
is_enabled: Optional[bool] = None,
1477+
rule_status: Optional[AlertStatus] = None,
14771478
is_preconfigured: Optional[bool] = None,
14781479
state: Optional[AlertState] = None,
14791480
data_source_id: Optional[str] = None,
@@ -1483,7 +1484,7 @@ async def list_alerts(
14831484
List preconfigured and/or custom alerts for the specified Project and data source.
14841485
:param region: Region to target. If none is passed will use default region from the config.
14851486
:param project_id: Project ID to filter for, only alerts from this Project will be returned.
1486-
:param is_enabled: True returns only enabled alerts. False returns only disabled alerts. If omitted, no alert filtering is applied. Other filters may still apply.
1487+
:param rule_status: Returns only alerts with the given activation status. If omitted, no alert filtering is applied. Other filters may still apply.
14871488
:param is_preconfigured: True returns only preconfigured alerts. False returns only custom alerts. If omitted, no filtering is applied on alert types. Other filters may still apply.
14881489
:param state: Valid values to filter on are `inactive`, `pending` and `firing`. If omitted, no filtering is applied on alert states. Other filters may still apply.
14891490
:param data_source_id: If omitted, only alerts from the default Scaleway metrics data source will be listed.
@@ -1504,9 +1505,9 @@ async def list_alerts(
15041505
f"/cockpit/v1/regions/{param_region}/alerts",
15051506
params={
15061507
"data_source_id": data_source_id,
1507-
"is_enabled": is_enabled,
15081508
"is_preconfigured": is_preconfigured,
15091509
"project_id": project_id or self.client.default_project_id,
1510+
"rule_status": rule_status,
15101511
"state": state,
15111512
},
15121513
)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,9 @@ def unmarshal_Alert(data: Any) -> Alert:
559559
if field is not None:
560560
args["duration"] = field
561561

562-
field = data.get("enabled", None)
562+
field = data.get("rule_status", None)
563563
if field is not None:
564-
args["enabled"] = field
564+
args["rule_status"] = field
565565

566566
field = data.get("annotations", None)
567567
if field is not None:

0 commit comments

Comments
 (0)