diff --git a/scaleway-async/scaleway_async/instance/v1/api.py b/scaleway-async/scaleway_async/instance/v1/api.py index a0167968d..c5a68706b 100644 --- a/scaleway-async/scaleway_async/instance/v1/api.py +++ b/scaleway-async/scaleway_async/instance/v1/api.py @@ -511,14 +511,15 @@ async def list_servers_all( async def _create_server( self, *, - commercial_type: str, zone: Optional[ScwZone] = None, + commercial_type: str, name: Optional[str] = None, dynamic_ip_required: Optional[bool] = None, routed_ip_enabled: Optional[bool] = None, image: Optional[str] = None, volumes: Optional[Dict[str, VolumeServerTemplate]] = None, enable_ipv6: Optional[bool] = None, + protected: bool, public_ip: Optional[str] = None, public_ips: Optional[List[str]] = None, boot_type: Optional[BootType] = None, @@ -533,14 +534,15 @@ async def _create_server( Create an Instance. Create a new Instance of the specified commercial type in the specified zone. Pay attention to the volumes parameter, which takes an object which can be used in different ways to achieve different behaviors. Get more information in the [Technical Information](#technical-information) section of the introduction. - :param commercial_type: Define the Instance commercial type (i.e. GP1-S). :param zone: Zone to target. If none is passed will use default zone from the config. + :param commercial_type: Define the Instance commercial type (i.e. GP1-S). :param name: Instance name. :param dynamic_ip_required: Define if a dynamic IPv4 is required for the Instance. :param routed_ip_enabled: If true, configure the Instance so it uses the new routed IP mode. :param image: Instance image ID or label. :param volumes: Volumes attached to the server. :param enable_ipv6: True if IPv6 is enabled on the server (deprecated and always `False` when `routed_ip_enabled` is `True`). + :param protected: True to activate server protection option. :param public_ip: ID of the reserved IP to attach to the Instance. :param public_ips: A list of reserved IP IDs to attach to the Instance. :param boot_type: Boot type to use. @@ -559,6 +561,7 @@ async def _create_server( result = await api._create_server( commercial_type="example", + protected=False, ) """ @@ -569,14 +572,15 @@ async def _create_server( f"/instance/v1/zones/{param_zone}/servers", body=marshal_CreateServerRequest( CreateServerRequest( - commercial_type=commercial_type, zone=zone, + commercial_type=commercial_type, name=name or random_name(prefix="srv"), dynamic_ip_required=dynamic_ip_required, routed_ip_enabled=routed_ip_enabled, image=image, volumes=volumes, enable_ipv6=enable_ipv6, + protected=protected, public_ip=public_ip, public_ips=public_ips, boot_type=boot_type, @@ -819,7 +823,7 @@ async def _update_server( :param routed_ip_enabled: True to configure the instance so it uses the new routed IP mode (once this is set to True you cannot set it back to False). :param public_ips: A list of reserved IP IDs to attach to the Instance. :param enable_ipv6: - :param protected: + :param protected: True to activate server protection option. :param security_group: :param placement_group: Placement group ID if Instance must be part of a placement group. :param private_nics: Instance private NICs. diff --git a/scaleway-async/scaleway_async/instance/v1/marshalling.py b/scaleway-async/scaleway_async/instance/v1/marshalling.py index 6a752f91e..5dd601490 100644 --- a/scaleway-async/scaleway_async/instance/v1/marshalling.py +++ b/scaleway-async/scaleway_async/instance/v1/marshalling.py @@ -3119,6 +3119,9 @@ def marshal_CreateServerRequest( if request.enable_ipv6 is not None: output["enable_ipv6"] = request.enable_ipv6 + if request.protected is not None: + output["protected"] = request.protected + if request.public_ip is not None: output["public_ip"] = request.public_ip diff --git a/scaleway-async/scaleway_async/instance/v1/types.py b/scaleway-async/scaleway_async/instance/v1/types.py index 9e95c13ae..8f6e48c5d 100644 --- a/scaleway-async/scaleway_async/instance/v1/types.py +++ b/scaleway-async/scaleway_async/instance/v1/types.py @@ -1793,14 +1793,14 @@ class CreateSecurityGroupRuleResponse: @dataclass class CreateServerRequest: - commercial_type: str + zone: Optional[ScwZone] """ - Define the Instance commercial type (i.e. GP1-S). + Zone to target. If none is passed will use default zone from the config. """ - zone: Optional[ScwZone] + commercial_type: str """ - Zone to target. If none is passed will use default zone from the config. + Define the Instance commercial type (i.e. GP1-S). """ name: Optional[str] @@ -1833,6 +1833,11 @@ class CreateServerRequest: True if IPv6 is enabled on the server (deprecated and always `False` when `routed_ip_enabled` is `True`). """ + protected: bool + """ + True to activate server protection option. + """ + public_ip: Optional[str] """ ID of the reserved IP to attach to the Instance. @@ -3488,6 +3493,9 @@ class UpdateServerRequest: enable_ipv6: Optional[bool] protected: Optional[bool] + """ + True to activate server protection option. + """ security_group: Optional[SecurityGroupTemplate] diff --git a/scaleway/scaleway/instance/v1/api.py b/scaleway/scaleway/instance/v1/api.py index 0e316238b..7e559de7a 100644 --- a/scaleway/scaleway/instance/v1/api.py +++ b/scaleway/scaleway/instance/v1/api.py @@ -511,14 +511,15 @@ def list_servers_all( def _create_server( self, *, - commercial_type: str, zone: Optional[ScwZone] = None, + commercial_type: str, name: Optional[str] = None, dynamic_ip_required: Optional[bool] = None, routed_ip_enabled: Optional[bool] = None, image: Optional[str] = None, volumes: Optional[Dict[str, VolumeServerTemplate]] = None, enable_ipv6: Optional[bool] = None, + protected: bool, public_ip: Optional[str] = None, public_ips: Optional[List[str]] = None, boot_type: Optional[BootType] = None, @@ -533,14 +534,15 @@ def _create_server( Create an Instance. Create a new Instance of the specified commercial type in the specified zone. Pay attention to the volumes parameter, which takes an object which can be used in different ways to achieve different behaviors. Get more information in the [Technical Information](#technical-information) section of the introduction. - :param commercial_type: Define the Instance commercial type (i.e. GP1-S). :param zone: Zone to target. If none is passed will use default zone from the config. + :param commercial_type: Define the Instance commercial type (i.e. GP1-S). :param name: Instance name. :param dynamic_ip_required: Define if a dynamic IPv4 is required for the Instance. :param routed_ip_enabled: If true, configure the Instance so it uses the new routed IP mode. :param image: Instance image ID or label. :param volumes: Volumes attached to the server. :param enable_ipv6: True if IPv6 is enabled on the server (deprecated and always `False` when `routed_ip_enabled` is `True`). + :param protected: True to activate server protection option. :param public_ip: ID of the reserved IP to attach to the Instance. :param public_ips: A list of reserved IP IDs to attach to the Instance. :param boot_type: Boot type to use. @@ -559,6 +561,7 @@ def _create_server( result = api._create_server( commercial_type="example", + protected=False, ) """ @@ -569,14 +572,15 @@ def _create_server( f"/instance/v1/zones/{param_zone}/servers", body=marshal_CreateServerRequest( CreateServerRequest( - commercial_type=commercial_type, zone=zone, + commercial_type=commercial_type, name=name or random_name(prefix="srv"), dynamic_ip_required=dynamic_ip_required, routed_ip_enabled=routed_ip_enabled, image=image, volumes=volumes, enable_ipv6=enable_ipv6, + protected=protected, public_ip=public_ip, public_ips=public_ips, boot_type=boot_type, @@ -819,7 +823,7 @@ def _update_server( :param routed_ip_enabled: True to configure the instance so it uses the new routed IP mode (once this is set to True you cannot set it back to False). :param public_ips: A list of reserved IP IDs to attach to the Instance. :param enable_ipv6: - :param protected: + :param protected: True to activate server protection option. :param security_group: :param placement_group: Placement group ID if Instance must be part of a placement group. :param private_nics: Instance private NICs. diff --git a/scaleway/scaleway/instance/v1/marshalling.py b/scaleway/scaleway/instance/v1/marshalling.py index 6a752f91e..5dd601490 100644 --- a/scaleway/scaleway/instance/v1/marshalling.py +++ b/scaleway/scaleway/instance/v1/marshalling.py @@ -3119,6 +3119,9 @@ def marshal_CreateServerRequest( if request.enable_ipv6 is not None: output["enable_ipv6"] = request.enable_ipv6 + if request.protected is not None: + output["protected"] = request.protected + if request.public_ip is not None: output["public_ip"] = request.public_ip diff --git a/scaleway/scaleway/instance/v1/test_user_data.py b/scaleway/scaleway/instance/v1/test_user_data.py index 175e289b3..3cb264273 100644 --- a/scaleway/scaleway/instance/v1/test_user_data.py +++ b/scaleway/scaleway/instance/v1/test_user_data.py @@ -22,6 +22,7 @@ def setUp(self) -> None: image="ubuntu_jammy", name="my-server-web", volumes={}, + protected=False, ) @unittest.skip("API Test is not up") diff --git a/scaleway/scaleway/instance/v1/types.py b/scaleway/scaleway/instance/v1/types.py index 9e95c13ae..8f6e48c5d 100644 --- a/scaleway/scaleway/instance/v1/types.py +++ b/scaleway/scaleway/instance/v1/types.py @@ -1793,14 +1793,14 @@ class CreateSecurityGroupRuleResponse: @dataclass class CreateServerRequest: - commercial_type: str + zone: Optional[ScwZone] """ - Define the Instance commercial type (i.e. GP1-S). + Zone to target. If none is passed will use default zone from the config. """ - zone: Optional[ScwZone] + commercial_type: str """ - Zone to target. If none is passed will use default zone from the config. + Define the Instance commercial type (i.e. GP1-S). """ name: Optional[str] @@ -1833,6 +1833,11 @@ class CreateServerRequest: True if IPv6 is enabled on the server (deprecated and always `False` when `routed_ip_enabled` is `True`). """ + protected: bool + """ + True to activate server protection option. + """ + public_ip: Optional[str] """ ID of the reserved IP to attach to the Instance. @@ -3488,6 +3493,9 @@ class UpdateServerRequest: enable_ipv6: Optional[bool] protected: Optional[bool] + """ + True to activate server protection option. + """ security_group: Optional[SecurityGroupTemplate]