diff --git a/scaleway-async/scaleway_async/applesilicon/v1alpha1/__init__.py b/scaleway-async/scaleway_async/applesilicon/v1alpha1/__init__.py index 55d659e8..e893d2fb 100644 --- a/scaleway-async/scaleway_async/applesilicon/v1alpha1/__init__.py +++ b/scaleway-async/scaleway_async/applesilicon/v1alpha1/__init__.py @@ -3,6 +3,8 @@ from .types import ConnectivityDiagnosticActionType from .types import ConnectivityDiagnosticDiagnosticStatus from .types import ListServersRequestOrderBy +from .types import ServerPrivateNetworkStatus +from .content import SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES from .types import ServerStatus from .content import SERVER_TRANSIENT_STATUSES from .types import ServerTypeStock @@ -39,6 +41,8 @@ "ConnectivityDiagnosticActionType", "ConnectivityDiagnosticDiagnosticStatus", "ListServersRequestOrderBy", + "ServerPrivateNetworkStatus", + "SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES", "ServerStatus", "SERVER_TRANSIENT_STATUSES", "ServerTypeStock", diff --git a/scaleway-async/scaleway_async/applesilicon/v1alpha1/api.py b/scaleway-async/scaleway_async/applesilicon/v1alpha1/api.py index a05f9b8b..e9a58d4d 100644 --- a/scaleway-async/scaleway_async/applesilicon/v1alpha1/api.py +++ b/scaleway-async/scaleway_async/applesilicon/v1alpha1/api.py @@ -116,6 +116,7 @@ async def create_server( self, *, type_: str, + enable_vpc: bool, zone: Optional[Zone] = None, name: Optional[str] = None, project_id: Optional[str] = None, @@ -125,6 +126,7 @@ async def create_server( Create a 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 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. @@ -136,6 +138,7 @@ async def create_server( result = await api.create_server( type="example", + enable_vpc=False, ) """ @@ -147,6 +150,7 @@ async def create_server( body=marshal_CreateServerRequest( CreateServerRequest( type_=type_, + enable_vpc=enable_vpc, zone=zone, name=name or random_name(prefix="as"), project_id=project_id, @@ -432,6 +436,7 @@ async def update_server( zone: Optional[Zone] = None, name: Optional[str] = None, schedule_deletion: Optional[bool] = None, + enable_vpc: Optional[bool] = None, ) -> Server: """ Update a server. @@ -440,6 +445,7 @@ async def update_server( :param zone: Zone to target. If none is passed will use default zone from the config. :param name: Updated name for your 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. :return: :class:`Server ` Usage: @@ -462,6 +468,7 @@ async def update_server( zone=zone, name=name, schedule_deletion=schedule_deletion, + enable_vpc=enable_vpc, ), self.client, ), diff --git a/scaleway-async/scaleway_async/applesilicon/v1alpha1/content.py b/scaleway-async/scaleway_async/applesilicon/v1alpha1/content.py index 6d8396fa..a80a0aaf 100644 --- a/scaleway-async/scaleway_async/applesilicon/v1alpha1/content.py +++ b/scaleway-async/scaleway_async/applesilicon/v1alpha1/content.py @@ -3,9 +3,16 @@ from typing import List from .types import ( + ServerPrivateNetworkStatus, ServerStatus, ) +SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES: List[ServerPrivateNetworkStatus] = [ + ServerPrivateNetworkStatus.VPC_UPDATING, +] +""" +Lists transient statutes of the enum :class:`ServerPrivateNetworkStatus `. +""" SERVER_TRANSIENT_STATUSES: List[ServerStatus] = [ ServerStatus.STARTING, ServerStatus.REBOOTING, diff --git a/scaleway-async/scaleway_async/applesilicon/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/applesilicon/v1alpha1/marshalling.py index 2d7ac679..760bfa2e 100644 --- a/scaleway-async/scaleway_async/applesilicon/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/applesilicon/v1alpha1/marshalling.py @@ -291,6 +291,10 @@ def unmarshal_Server(data: Any) -> Server: if field is not None: args["delivered"] = field + field = data.get("vpc_status", None) + if field is not None: + args["vpc_status"] = field + field = data.get("os", None) if field is not None: args["os"] = unmarshal_OS(field) @@ -485,6 +489,9 @@ def marshal_CreateServerRequest( if request.type_ is not None: output["type"] = request.type_ + if request.enable_vpc is not None: + output["enable_vpc"] = request.enable_vpc + if request.name is not None: output["name"] = request.name @@ -533,4 +540,7 @@ def marshal_UpdateServerRequest( if request.schedule_deletion is not None: output["schedule_deletion"] = request.schedule_deletion + if request.enable_vpc is not None: + output["enable_vpc"] = request.enable_vpc + return output diff --git a/scaleway-async/scaleway_async/applesilicon/v1alpha1/types.py b/scaleway-async/scaleway_async/applesilicon/v1alpha1/types.py index 08fce83e..722bfc1e 100644 --- a/scaleway-async/scaleway_async/applesilicon/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/applesilicon/v1alpha1/types.py @@ -41,6 +41,16 @@ def __str__(self) -> str: return str(self.value) +class ServerPrivateNetworkStatus(str, Enum, metaclass=StrEnumMeta): + VPC_UNKNOWN_STATUS = "vpc_unknown_status" + VPC_ENABLED = "vpc_enabled" + VPC_UPDATING = "vpc_updating" + VPC_DISABLED = "vpc_disabled" + + def __str__(self) -> str: + return str(self.value) + + class ServerStatus(str, Enum, metaclass=StrEnumMeta): UNKNOWN_STATUS = "unknown_status" STARTING = "starting" @@ -284,6 +294,11 @@ class Server: 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. """ + vpc_status: ServerPrivateNetworkStatus + """ + Activation status of optional Private Network feature support for this server. + """ + os: Optional[OS] """ Initially installed OS, this does not necessarily reflect the current OS version. @@ -327,6 +342,11 @@ class CreateServerRequest: Create a server of the given type. """ + enable_vpc: bool + """ + Activate the Private Network feature for this server. This feature is configured through the Apple Silicon - Private Networks API. + """ + zone: Optional[Zone] """ Zone to target. If none is passed will use default zone from the config. @@ -580,3 +600,8 @@ class UpdateServerRequest: """ Specify whether the server should be flagged for automatic deletion. """ + + enable_vpc: Optional[bool] + """ + Activate or deactivate Private Network support for this server. + """ diff --git a/scaleway/scaleway/applesilicon/v1alpha1/__init__.py b/scaleway/scaleway/applesilicon/v1alpha1/__init__.py index 55d659e8..e893d2fb 100644 --- a/scaleway/scaleway/applesilicon/v1alpha1/__init__.py +++ b/scaleway/scaleway/applesilicon/v1alpha1/__init__.py @@ -3,6 +3,8 @@ from .types import ConnectivityDiagnosticActionType from .types import ConnectivityDiagnosticDiagnosticStatus from .types import ListServersRequestOrderBy +from .types import ServerPrivateNetworkStatus +from .content import SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES from .types import ServerStatus from .content import SERVER_TRANSIENT_STATUSES from .types import ServerTypeStock @@ -39,6 +41,8 @@ "ConnectivityDiagnosticActionType", "ConnectivityDiagnosticDiagnosticStatus", "ListServersRequestOrderBy", + "ServerPrivateNetworkStatus", + "SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES", "ServerStatus", "SERVER_TRANSIENT_STATUSES", "ServerTypeStock", diff --git a/scaleway/scaleway/applesilicon/v1alpha1/api.py b/scaleway/scaleway/applesilicon/v1alpha1/api.py index d295da15..749ad82c 100644 --- a/scaleway/scaleway/applesilicon/v1alpha1/api.py +++ b/scaleway/scaleway/applesilicon/v1alpha1/api.py @@ -116,6 +116,7 @@ def create_server( self, *, type_: str, + enable_vpc: bool, zone: Optional[Zone] = None, name: Optional[str] = None, project_id: Optional[str] = None, @@ -125,6 +126,7 @@ def create_server( Create a 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 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. @@ -136,6 +138,7 @@ def create_server( result = api.create_server( type="example", + enable_vpc=False, ) """ @@ -147,6 +150,7 @@ def create_server( body=marshal_CreateServerRequest( CreateServerRequest( type_=type_, + enable_vpc=enable_vpc, zone=zone, name=name or random_name(prefix="as"), project_id=project_id, @@ -432,6 +436,7 @@ def update_server( zone: Optional[Zone] = None, name: Optional[str] = None, schedule_deletion: Optional[bool] = None, + enable_vpc: Optional[bool] = None, ) -> Server: """ Update a server. @@ -440,6 +445,7 @@ def update_server( :param zone: Zone to target. If none is passed will use default zone from the config. :param name: Updated name for your 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. :return: :class:`Server ` Usage: @@ -462,6 +468,7 @@ def update_server( zone=zone, name=name, schedule_deletion=schedule_deletion, + enable_vpc=enable_vpc, ), self.client, ), diff --git a/scaleway/scaleway/applesilicon/v1alpha1/content.py b/scaleway/scaleway/applesilicon/v1alpha1/content.py index 6d8396fa..a80a0aaf 100644 --- a/scaleway/scaleway/applesilicon/v1alpha1/content.py +++ b/scaleway/scaleway/applesilicon/v1alpha1/content.py @@ -3,9 +3,16 @@ from typing import List from .types import ( + ServerPrivateNetworkStatus, ServerStatus, ) +SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES: List[ServerPrivateNetworkStatus] = [ + ServerPrivateNetworkStatus.VPC_UPDATING, +] +""" +Lists transient statutes of the enum :class:`ServerPrivateNetworkStatus `. +""" SERVER_TRANSIENT_STATUSES: List[ServerStatus] = [ ServerStatus.STARTING, ServerStatus.REBOOTING, diff --git a/scaleway/scaleway/applesilicon/v1alpha1/marshalling.py b/scaleway/scaleway/applesilicon/v1alpha1/marshalling.py index 2d7ac679..760bfa2e 100644 --- a/scaleway/scaleway/applesilicon/v1alpha1/marshalling.py +++ b/scaleway/scaleway/applesilicon/v1alpha1/marshalling.py @@ -291,6 +291,10 @@ def unmarshal_Server(data: Any) -> Server: if field is not None: args["delivered"] = field + field = data.get("vpc_status", None) + if field is not None: + args["vpc_status"] = field + field = data.get("os", None) if field is not None: args["os"] = unmarshal_OS(field) @@ -485,6 +489,9 @@ def marshal_CreateServerRequest( if request.type_ is not None: output["type"] = request.type_ + if request.enable_vpc is not None: + output["enable_vpc"] = request.enable_vpc + if request.name is not None: output["name"] = request.name @@ -533,4 +540,7 @@ def marshal_UpdateServerRequest( if request.schedule_deletion is not None: output["schedule_deletion"] = request.schedule_deletion + if request.enable_vpc is not None: + output["enable_vpc"] = request.enable_vpc + return output diff --git a/scaleway/scaleway/applesilicon/v1alpha1/types.py b/scaleway/scaleway/applesilicon/v1alpha1/types.py index 08fce83e..722bfc1e 100644 --- a/scaleway/scaleway/applesilicon/v1alpha1/types.py +++ b/scaleway/scaleway/applesilicon/v1alpha1/types.py @@ -41,6 +41,16 @@ def __str__(self) -> str: return str(self.value) +class ServerPrivateNetworkStatus(str, Enum, metaclass=StrEnumMeta): + VPC_UNKNOWN_STATUS = "vpc_unknown_status" + VPC_ENABLED = "vpc_enabled" + VPC_UPDATING = "vpc_updating" + VPC_DISABLED = "vpc_disabled" + + def __str__(self) -> str: + return str(self.value) + + class ServerStatus(str, Enum, metaclass=StrEnumMeta): UNKNOWN_STATUS = "unknown_status" STARTING = "starting" @@ -284,6 +294,11 @@ class Server: 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. """ + vpc_status: ServerPrivateNetworkStatus + """ + Activation status of optional Private Network feature support for this server. + """ + os: Optional[OS] """ Initially installed OS, this does not necessarily reflect the current OS version. @@ -327,6 +342,11 @@ class CreateServerRequest: Create a server of the given type. """ + enable_vpc: bool + """ + Activate the Private Network feature for this server. This feature is configured through the Apple Silicon - Private Networks API. + """ + zone: Optional[Zone] """ Zone to target. If none is passed will use default zone from the config. @@ -580,3 +600,8 @@ class UpdateServerRequest: """ Specify whether the server should be flagged for automatic deletion. """ + + enable_vpc: Optional[bool] + """ + Activate or deactivate Private Network support for this server. + """