Skip to content

feat(apple_silicon): add public bandwidth configuration feature #1017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions scaleway-async/scaleway_async/applesilicon/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ async def create_server(
*,
type_: str,
enable_vpc: bool,
public_bandwidth_bps: int,
zone: Optional[ScwZone] = None,
name: Optional[str] = None,
project_id: Optional[str] = None,
Expand All @@ -142,6 +143,7 @@ async def create_server(
Create a new server in the targeted zone, specifying its configuration including name and type.
:param type_: Create a server of the given type.
:param enable_vpc: Activate the Private Network feature for this server. This feature is configured through the Apple Silicon - Private Networks API.
: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.
:param zone: Zone to target. If none is passed will use default zone from the config.
:param name: Create a server with this given name.
:param project_id: Create a server in the given project ID.
Expand All @@ -155,6 +157,7 @@ async def create_server(
result = await api.create_server(
type="example",
enable_vpc=False,
public_bandwidth_bps=1,
)
"""

Expand All @@ -167,6 +170,7 @@ async def create_server(
CreateServerRequest(
type_=type_,
enable_vpc=enable_vpc,
public_bandwidth_bps=public_bandwidth_bps,
zone=zone,
name=name or random_name(prefix="as"),
project_id=project_id,
Expand Down Expand Up @@ -455,6 +459,7 @@ async def update_server(
schedule_deletion: Optional[bool] = None,
enable_vpc: Optional[bool] = None,
commitment_type: Optional[CommitmentTypeValue] = None,
public_bandwidth_bps: Optional[int] = None,
) -> Server:
"""
Update a server.
Expand All @@ -465,6 +470,7 @@ async def update_server(
:param schedule_deletion: Specify whether the server should be flagged for automatic deletion.
:param enable_vpc: Activate or deactivate Private Network support for this server.
:param commitment_type: Change commitment. Use 'none' to automatically cancel a renewing commitment.
: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.
:return: :class:`Server <Server>`

Usage:
Expand All @@ -489,6 +495,7 @@ async def update_server(
schedule_deletion=schedule_deletion,
enable_vpc=enable_vpc,
commitment_type=commitment_type,
public_bandwidth_bps=public_bandwidth_bps,
),
self.client,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ def unmarshal_ServerTypeNetwork(data: Any) -> ServerTypeNetwork:
if field is not None:
args["public_bandwidth_bps"] = field

field = data.get("supported_bandwidth", None)
if field is not None:
args["supported_bandwidth"] = field

return ServerTypeNetwork(**args)


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

field = data.get("public_bandwidth_bps", None)
if field is not None:
args["public_bandwidth_bps"] = field

field = data.get("commitment", None)
if field is not None:
args["commitment"] = unmarshal_Commitment(field)
Expand Down Expand Up @@ -623,6 +631,9 @@ def marshal_CreateServerRequest(
if request.enable_vpc is not None:
output["enable_vpc"] = request.enable_vpc

if request.public_bandwidth_bps is not None:
output["public_bandwidth_bps"] = request.public_bandwidth_bps

if request.name is not None:
output["name"] = request.name

Expand Down Expand Up @@ -723,4 +734,7 @@ def marshal_UpdateServerRequest(
request.commitment_type, defaults
)

if request.public_bandwidth_bps is not None:
output["public_bandwidth_bps"] = request.public_bandwidth_bps

return output
17 changes: 17 additions & 0 deletions scaleway-async/scaleway_async/applesilicon/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ class ServerTypeMemory:
class ServerTypeNetwork:
public_bandwidth_bps: int

supported_bandwidth: List[int]


@dataclass
class Commitment:
Expand Down Expand Up @@ -405,6 +407,11 @@ class Server:
Activation status of optional Private Network feature support for this server.
"""

public_bandwidth_bps: int
"""
Public bandwidth configured for this server. Expressed in bits per second.
"""

commitment: Optional[Commitment]
"""
Commitment scheme applied to this server.
Expand Down Expand Up @@ -443,6 +450,11 @@ class CreateServerRequest:
Activate the Private Network feature for this server. This feature is configured through the Apple Silicon - Private Networks API.
"""

public_bandwidth_bps: int
"""
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.
"""

zone: Optional[ScwZone]
"""
Zone to target. If none is passed will use default zone from the config.
Expand Down Expand Up @@ -842,3 +854,8 @@ class UpdateServerRequest:
"""
Change commitment. Use 'none' to automatically cancel a renewing commitment.
"""

public_bandwidth_bps: Optional[int]
"""
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.
"""
7 changes: 7 additions & 0 deletions scaleway/scaleway/applesilicon/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def create_server(
*,
type_: str,
enable_vpc: bool,
public_bandwidth_bps: int,
zone: Optional[ScwZone] = None,
name: Optional[str] = None,
project_id: Optional[str] = None,
Expand All @@ -142,6 +143,7 @@ def create_server(
Create a new server in the targeted zone, specifying its configuration including name and type.
:param type_: Create a server of the given type.
:param enable_vpc: Activate the Private Network feature for this server. This feature is configured through the Apple Silicon - Private Networks API.
: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.
:param zone: Zone to target. If none is passed will use default zone from the config.
:param name: Create a server with this given name.
:param project_id: Create a server in the given project ID.
Expand All @@ -155,6 +157,7 @@ def create_server(
result = api.create_server(
type="example",
enable_vpc=False,
public_bandwidth_bps=1,
)
"""

Expand All @@ -167,6 +170,7 @@ def create_server(
CreateServerRequest(
type_=type_,
enable_vpc=enable_vpc,
public_bandwidth_bps=public_bandwidth_bps,
zone=zone,
name=name or random_name(prefix="as"),
project_id=project_id,
Expand Down Expand Up @@ -455,6 +459,7 @@ def update_server(
schedule_deletion: Optional[bool] = None,
enable_vpc: Optional[bool] = None,
commitment_type: Optional[CommitmentTypeValue] = None,
public_bandwidth_bps: Optional[int] = None,
) -> Server:
"""
Update a server.
Expand All @@ -465,6 +470,7 @@ def update_server(
:param schedule_deletion: Specify whether the server should be flagged for automatic deletion.
:param enable_vpc: Activate or deactivate Private Network support for this server.
:param commitment_type: Change commitment. Use 'none' to automatically cancel a renewing commitment.
: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.
:return: :class:`Server <Server>`

Usage:
Expand All @@ -489,6 +495,7 @@ def update_server(
schedule_deletion=schedule_deletion,
enable_vpc=enable_vpc,
commitment_type=commitment_type,
public_bandwidth_bps=public_bandwidth_bps,
),
self.client,
),
Expand Down
14 changes: 14 additions & 0 deletions scaleway/scaleway/applesilicon/v1alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ def unmarshal_ServerTypeNetwork(data: Any) -> ServerTypeNetwork:
if field is not None:
args["public_bandwidth_bps"] = field

field = data.get("supported_bandwidth", None)
if field is not None:
args["supported_bandwidth"] = field

return ServerTypeNetwork(**args)


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

field = data.get("public_bandwidth_bps", None)
if field is not None:
args["public_bandwidth_bps"] = field

field = data.get("commitment", None)
if field is not None:
args["commitment"] = unmarshal_Commitment(field)
Expand Down Expand Up @@ -623,6 +631,9 @@ def marshal_CreateServerRequest(
if request.enable_vpc is not None:
output["enable_vpc"] = request.enable_vpc

if request.public_bandwidth_bps is not None:
output["public_bandwidth_bps"] = request.public_bandwidth_bps

if request.name is not None:
output["name"] = request.name

Expand Down Expand Up @@ -723,4 +734,7 @@ def marshal_UpdateServerRequest(
request.commitment_type, defaults
)

if request.public_bandwidth_bps is not None:
output["public_bandwidth_bps"] = request.public_bandwidth_bps

return output
17 changes: 17 additions & 0 deletions scaleway/scaleway/applesilicon/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ class ServerTypeMemory:
class ServerTypeNetwork:
public_bandwidth_bps: int

supported_bandwidth: List[int]


@dataclass
class Commitment:
Expand Down Expand Up @@ -405,6 +407,11 @@ class Server:
Activation status of optional Private Network feature support for this server.
"""

public_bandwidth_bps: int
"""
Public bandwidth configured for this server. Expressed in bits per second.
"""

commitment: Optional[Commitment]
"""
Commitment scheme applied to this server.
Expand Down Expand Up @@ -443,6 +450,11 @@ class CreateServerRequest:
Activate the Private Network feature for this server. This feature is configured through the Apple Silicon - Private Networks API.
"""

public_bandwidth_bps: int
"""
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.
"""

zone: Optional[ScwZone]
"""
Zone to target. If none is passed will use default zone from the config.
Expand Down Expand Up @@ -842,3 +854,8 @@ class UpdateServerRequest:
"""
Change commitment. Use 'none' to automatically cancel a renewing commitment.
"""

public_bandwidth_bps: Optional[int]
"""
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.
"""