Skip to content
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
12 changes: 8 additions & 4 deletions scaleway-async/scaleway_async/instance/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
Expand All @@ -559,6 +561,7 @@ async def _create_server(

result = await api._create_server(
commercial_type="example",
protected=False,
)
"""

Expand All @@ -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,
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions scaleway-async/scaleway_async/instance/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 12 additions & 4 deletions scaleway-async/scaleway_async/instance/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -3488,6 +3493,9 @@ class UpdateServerRequest:
enable_ipv6: Optional[bool]

protected: Optional[bool]
"""
True to activate server protection option.
"""

security_group: Optional[SecurityGroupTemplate]

Expand Down
12 changes: 8 additions & 4 deletions scaleway/scaleway/instance/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
Expand All @@ -559,6 +561,7 @@ def _create_server(

result = api._create_server(
commercial_type="example",
protected=False,
)
"""

Expand All @@ -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,
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions scaleway/scaleway/instance/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions scaleway/scaleway/instance/v1/test_user_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
16 changes: 12 additions & 4 deletions scaleway/scaleway/instance/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -3488,6 +3493,9 @@ class UpdateServerRequest:
enable_ipv6: Optional[bool]

protected: Optional[bool]
"""
True to activate server protection option.
"""

security_group: Optional[SecurityGroupTemplate]

Expand Down