Skip to content

Commit f86f889

Browse files
authored
feat(apple_silicon): add public bandwidth configuration feature (#1017)
1 parent bc06854 commit f86f889

File tree

6 files changed

+76
-0
lines changed

6 files changed

+76
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ async def create_server(
131131
*,
132132
type_: str,
133133
enable_vpc: bool,
134+
public_bandwidth_bps: int,
134135
zone: Optional[ScwZone] = None,
135136
name: Optional[str] = None,
136137
project_id: Optional[str] = None,
@@ -142,6 +143,7 @@ async def create_server(
142143
Create a new server in the targeted zone, specifying its configuration including name and type.
143144
:param type_: Create a server of the given type.
144145
:param enable_vpc: Activate the Private Network feature for this server. This feature is configured through the Apple Silicon - Private Networks API.
146+
:param public_bandwidth_bps: Public bandwidth to configure for this server. This defaults to the minimum bandwidth for this server type. For compatible server types, the bandwidth can be increased which incurs additional costs.
145147
:param zone: Zone to target. If none is passed will use default zone from the config.
146148
:param name: Create a server with this given name.
147149
:param project_id: Create a server in the given project ID.
@@ -155,6 +157,7 @@ async def create_server(
155157
result = await api.create_server(
156158
type="example",
157159
enable_vpc=False,
160+
public_bandwidth_bps=1,
158161
)
159162
"""
160163

@@ -167,6 +170,7 @@ async def create_server(
167170
CreateServerRequest(
168171
type_=type_,
169172
enable_vpc=enable_vpc,
173+
public_bandwidth_bps=public_bandwidth_bps,
170174
zone=zone,
171175
name=name or random_name(prefix="as"),
172176
project_id=project_id,
@@ -455,6 +459,7 @@ async def update_server(
455459
schedule_deletion: Optional[bool] = None,
456460
enable_vpc: Optional[bool] = None,
457461
commitment_type: Optional[CommitmentTypeValue] = None,
462+
public_bandwidth_bps: Optional[int] = None,
458463
) -> Server:
459464
"""
460465
Update a server.
@@ -465,6 +470,7 @@ async def update_server(
465470
:param schedule_deletion: Specify whether the server should be flagged for automatic deletion.
466471
:param enable_vpc: Activate or deactivate Private Network support for this server.
467472
:param commitment_type: Change commitment. Use 'none' to automatically cancel a renewing commitment.
473+
:param public_bandwidth_bps: Public bandwidth to configure for this server. Setting an higher bandwidth incurs additional costs. Supported bandwidth levels depends on server type and can be queried using the `/server-types` endpoint.
468474
:return: :class:`Server <Server>`
469475
470476
Usage:
@@ -489,6 +495,7 @@ async def update_server(
489495
schedule_deletion=schedule_deletion,
490496
enable_vpc=enable_vpc,
491497
commitment_type=commitment_type,
498+
public_bandwidth_bps=public_bandwidth_bps,
492499
),
493500
self.client,
494501
),

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ def unmarshal_ServerTypeNetwork(data: Any) -> ServerTypeNetwork:
223223
if field is not None:
224224
args["public_bandwidth_bps"] = field
225225

226+
field = data.get("supported_bandwidth", None)
227+
if field is not None:
228+
args["supported_bandwidth"] = field
229+
226230
return ServerTypeNetwork(**args)
227231

228232

@@ -400,6 +404,10 @@ def unmarshal_Server(data: Any) -> Server:
400404
if field is not None:
401405
args["vpc_status"] = field
402406

407+
field = data.get("public_bandwidth_bps", None)
408+
if field is not None:
409+
args["public_bandwidth_bps"] = field
410+
403411
field = data.get("commitment", None)
404412
if field is not None:
405413
args["commitment"] = unmarshal_Commitment(field)
@@ -623,6 +631,9 @@ def marshal_CreateServerRequest(
623631
if request.enable_vpc is not None:
624632
output["enable_vpc"] = request.enable_vpc
625633

634+
if request.public_bandwidth_bps is not None:
635+
output["public_bandwidth_bps"] = request.public_bandwidth_bps
636+
626637
if request.name is not None:
627638
output["name"] = request.name
628639

@@ -723,4 +734,7 @@ def marshal_UpdateServerRequest(
723734
request.commitment_type, defaults
724735
)
725736

737+
if request.public_bandwidth_bps is not None:
738+
output["public_bandwidth_bps"] = request.public_bandwidth_bps
739+
726740
return output

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ class ServerTypeMemory:
189189
class ServerTypeNetwork:
190190
public_bandwidth_bps: int
191191

192+
supported_bandwidth: List[int]
193+
192194

193195
@dataclass
194196
class Commitment:
@@ -405,6 +407,11 @@ class Server:
405407
Activation status of optional Private Network feature support for this server.
406408
"""
407409

410+
public_bandwidth_bps: int
411+
"""
412+
Public bandwidth configured for this server. Expressed in bits per second.
413+
"""
414+
408415
commitment: Optional[Commitment]
409416
"""
410417
Commitment scheme applied to this server.
@@ -443,6 +450,11 @@ class CreateServerRequest:
443450
Activate the Private Network feature for this server. This feature is configured through the Apple Silicon - Private Networks API.
444451
"""
445452

453+
public_bandwidth_bps: int
454+
"""
455+
Public bandwidth to configure for this server. This defaults to the minimum bandwidth for this server type. For compatible server types, the bandwidth can be increased which incurs additional costs.
456+
"""
457+
446458
zone: Optional[ScwZone]
447459
"""
448460
Zone to target. If none is passed will use default zone from the config.
@@ -842,3 +854,8 @@ class UpdateServerRequest:
842854
"""
843855
Change commitment. Use 'none' to automatically cancel a renewing commitment.
844856
"""
857+
858+
public_bandwidth_bps: Optional[int]
859+
"""
860+
Public bandwidth to configure for this server. Setting an higher bandwidth incurs additional costs. Supported bandwidth levels depends on server type and can be queried using the `/server-types` endpoint.
861+
"""

scaleway/scaleway/applesilicon/v1alpha1/api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def create_server(
131131
*,
132132
type_: str,
133133
enable_vpc: bool,
134+
public_bandwidth_bps: int,
134135
zone: Optional[ScwZone] = None,
135136
name: Optional[str] = None,
136137
project_id: Optional[str] = None,
@@ -142,6 +143,7 @@ def create_server(
142143
Create a new server in the targeted zone, specifying its configuration including name and type.
143144
:param type_: Create a server of the given type.
144145
:param enable_vpc: Activate the Private Network feature for this server. This feature is configured through the Apple Silicon - Private Networks API.
146+
:param public_bandwidth_bps: Public bandwidth to configure for this server. This defaults to the minimum bandwidth for this server type. For compatible server types, the bandwidth can be increased which incurs additional costs.
145147
:param zone: Zone to target. If none is passed will use default zone from the config.
146148
:param name: Create a server with this given name.
147149
:param project_id: Create a server in the given project ID.
@@ -155,6 +157,7 @@ def create_server(
155157
result = api.create_server(
156158
type="example",
157159
enable_vpc=False,
160+
public_bandwidth_bps=1,
158161
)
159162
"""
160163

@@ -167,6 +170,7 @@ def create_server(
167170
CreateServerRequest(
168171
type_=type_,
169172
enable_vpc=enable_vpc,
173+
public_bandwidth_bps=public_bandwidth_bps,
170174
zone=zone,
171175
name=name or random_name(prefix="as"),
172176
project_id=project_id,
@@ -455,6 +459,7 @@ def update_server(
455459
schedule_deletion: Optional[bool] = None,
456460
enable_vpc: Optional[bool] = None,
457461
commitment_type: Optional[CommitmentTypeValue] = None,
462+
public_bandwidth_bps: Optional[int] = None,
458463
) -> Server:
459464
"""
460465
Update a server.
@@ -465,6 +470,7 @@ def update_server(
465470
:param schedule_deletion: Specify whether the server should be flagged for automatic deletion.
466471
:param enable_vpc: Activate or deactivate Private Network support for this server.
467472
:param commitment_type: Change commitment. Use 'none' to automatically cancel a renewing commitment.
473+
:param public_bandwidth_bps: Public bandwidth to configure for this server. Setting an higher bandwidth incurs additional costs. Supported bandwidth levels depends on server type and can be queried using the `/server-types` endpoint.
468474
:return: :class:`Server <Server>`
469475
470476
Usage:
@@ -489,6 +495,7 @@ def update_server(
489495
schedule_deletion=schedule_deletion,
490496
enable_vpc=enable_vpc,
491497
commitment_type=commitment_type,
498+
public_bandwidth_bps=public_bandwidth_bps,
492499
),
493500
self.client,
494501
),

scaleway/scaleway/applesilicon/v1alpha1/marshalling.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ def unmarshal_ServerTypeNetwork(data: Any) -> ServerTypeNetwork:
223223
if field is not None:
224224
args["public_bandwidth_bps"] = field
225225

226+
field = data.get("supported_bandwidth", None)
227+
if field is not None:
228+
args["supported_bandwidth"] = field
229+
226230
return ServerTypeNetwork(**args)
227231

228232

@@ -400,6 +404,10 @@ def unmarshal_Server(data: Any) -> Server:
400404
if field is not None:
401405
args["vpc_status"] = field
402406

407+
field = data.get("public_bandwidth_bps", None)
408+
if field is not None:
409+
args["public_bandwidth_bps"] = field
410+
403411
field = data.get("commitment", None)
404412
if field is not None:
405413
args["commitment"] = unmarshal_Commitment(field)
@@ -623,6 +631,9 @@ def marshal_CreateServerRequest(
623631
if request.enable_vpc is not None:
624632
output["enable_vpc"] = request.enable_vpc
625633

634+
if request.public_bandwidth_bps is not None:
635+
output["public_bandwidth_bps"] = request.public_bandwidth_bps
636+
626637
if request.name is not None:
627638
output["name"] = request.name
628639

@@ -723,4 +734,7 @@ def marshal_UpdateServerRequest(
723734
request.commitment_type, defaults
724735
)
725736

737+
if request.public_bandwidth_bps is not None:
738+
output["public_bandwidth_bps"] = request.public_bandwidth_bps
739+
726740
return output

scaleway/scaleway/applesilicon/v1alpha1/types.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ class ServerTypeMemory:
189189
class ServerTypeNetwork:
190190
public_bandwidth_bps: int
191191

192+
supported_bandwidth: List[int]
193+
192194

193195
@dataclass
194196
class Commitment:
@@ -405,6 +407,11 @@ class Server:
405407
Activation status of optional Private Network feature support for this server.
406408
"""
407409

410+
public_bandwidth_bps: int
411+
"""
412+
Public bandwidth configured for this server. Expressed in bits per second.
413+
"""
414+
408415
commitment: Optional[Commitment]
409416
"""
410417
Commitment scheme applied to this server.
@@ -443,6 +450,11 @@ class CreateServerRequest:
443450
Activate the Private Network feature for this server. This feature is configured through the Apple Silicon - Private Networks API.
444451
"""
445452

453+
public_bandwidth_bps: int
454+
"""
455+
Public bandwidth to configure for this server. This defaults to the minimum bandwidth for this server type. For compatible server types, the bandwidth can be increased which incurs additional costs.
456+
"""
457+
446458
zone: Optional[ScwZone]
447459
"""
448460
Zone to target. If none is passed will use default zone from the config.
@@ -842,3 +854,8 @@ class UpdateServerRequest:
842854
"""
843855
Change commitment. Use 'none' to automatically cancel a renewing commitment.
844856
"""
857+
858+
public_bandwidth_bps: Optional[int]
859+
"""
860+
Public bandwidth to configure for this server. Setting an higher bandwidth incurs additional costs. Supported bandwidth levels depends on server type and can be queried using the `/server-types` endpoint.
861+
"""

0 commit comments

Comments
 (0)