Skip to content

Commit 1ab54c5

Browse files
committed
feat: update generated APIs
1 parent fc7551d commit 1ab54c5

File tree

6 files changed

+136
-88
lines changed

6 files changed

+136
-88
lines changed

scaleway-async/scaleway_async/instance/v1/api.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,14 +511,15 @@ async def list_servers_all(
511511
async def _create_server(
512512
self,
513513
*,
514-
commercial_type: str,
515514
zone: Optional[ScwZone] = None,
515+
commercial_type: str,
516516
name: Optional[str] = None,
517517
dynamic_ip_required: Optional[bool] = None,
518518
routed_ip_enabled: Optional[bool] = None,
519519
image: Optional[str] = None,
520520
volumes: Optional[Dict[str, VolumeServerTemplate]] = None,
521521
enable_ipv6: Optional[bool] = None,
522+
protected: bool,
522523
public_ip: Optional[str] = None,
523524
public_ips: Optional[List[str]] = None,
524525
boot_type: Optional[BootType] = None,
@@ -533,14 +534,15 @@ async def _create_server(
533534
Create an Instance.
534535
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.
535536
Get more information in the [Technical Information](#technical-information) section of the introduction.
536-
:param commercial_type: Define the Instance commercial type (i.e. GP1-S).
537537
:param zone: Zone to target. If none is passed will use default zone from the config.
538+
:param commercial_type: Define the Instance commercial type (i.e. GP1-S).
538539
:param name: Instance name.
539540
:param dynamic_ip_required: Define if a dynamic IPv4 is required for the Instance.
540541
:param routed_ip_enabled: If true, configure the Instance so it uses the new routed IP mode.
541542
:param image: Instance image ID or label.
542543
:param volumes: Volumes attached to the server.
543544
:param enable_ipv6: True if IPv6 is enabled on the server (deprecated and always `False` when `routed_ip_enabled` is `True`).
545+
:param protected: True to activate server protection option.
544546
:param public_ip: ID of the reserved IP to attach to the Instance.
545547
:param public_ips: A list of reserved IP IDs to attach to the Instance.
546548
:param boot_type: Boot type to use.
@@ -559,6 +561,7 @@ async def _create_server(
559561
560562
result = await api._create_server(
561563
commercial_type="example",
564+
protected=False,
562565
)
563566
"""
564567

@@ -569,14 +572,15 @@ async def _create_server(
569572
f"/instance/v1/zones/{param_zone}/servers",
570573
body=marshal_CreateServerRequest(
571574
CreateServerRequest(
572-
commercial_type=commercial_type,
573575
zone=zone,
576+
commercial_type=commercial_type,
574577
name=name or random_name(prefix="srv"),
575578
dynamic_ip_required=dynamic_ip_required,
576579
routed_ip_enabled=routed_ip_enabled,
577580
image=image,
578581
volumes=volumes,
579582
enable_ipv6=enable_ipv6,
583+
protected=protected,
580584
public_ip=public_ip,
581585
public_ips=public_ips,
582586
boot_type=boot_type,
@@ -819,7 +823,7 @@ async def _update_server(
819823
: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).
820824
:param public_ips: A list of reserved IP IDs to attach to the Instance.
821825
:param enable_ipv6:
822-
:param protected:
826+
:param protected: True to activate server protection option.
823827
:param security_group:
824828
:param placement_group: Placement group ID if Instance must be part of a placement group.
825829
:param private_nics: Instance private NICs.

scaleway-async/scaleway_async/instance/v1/marshalling.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,10 @@ def unmarshal_Server(data: Any) -> Server:
898898
if field is not None:
899899
args["zone"] = field
900900

901+
field = data.get("end_of_service", None)
902+
if field is not None:
903+
args["end_of_service"] = field
904+
901905
field = data.get("admin_password_encryption_ssh_key_id", None)
902906
if field is not None:
903907
args["admin_password_encryption_ssh_key_id"] = field
@@ -3119,6 +3123,9 @@ def marshal_CreateServerRequest(
31193123
if request.enable_ipv6 is not None:
31203124
output["enable_ipv6"] = request.enable_ipv6
31213125

3126+
if request.protected is not None:
3127+
output["protected"] = request.protected
3128+
31223129
if request.public_ip is not None:
31233130
output["public_ip"] = request.public_ip
31243131

scaleway-async/scaleway_async/instance/v1/types.py

Lines changed: 53 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -832,94 +832,99 @@ class Server:
832832
Defines whether the Instance protection option is activated.
833833
"""
834834

835-
routed_ip_enabled: Optional[bool]
835+
public_ips: List[ServerIp]
836836
"""
837-
True to configure the instance so it uses the routed IP mode. Use of `routed_ip_enabled` as `False` is deprecated.
837+
Information about all the public IPs attached to the server.
838838
"""
839839

840-
enable_ipv6: Optional[bool]
840+
mac_address: str
841841
"""
842-
True if IPv6 is enabled (deprecated and always `False` when `routed_ip_enabled` is `True`).
842+
The server's MAC address.
843843
"""
844844

845-
image: Optional[Image]
845+
state: ServerState
846846
"""
847-
Information about the Instance image.
847+
Instance state.
848848
"""
849849

850-
private_ip: Optional[str]
850+
boot_type: BootType
851851
"""
852-
Private IP address of the Instance (deprecated and always `null` when `routed_ip_enabled` is `True`).
852+
Instance boot type.
853853
"""
854854

855-
public_ip: Optional[ServerIp]
855+
volumes: Dict[str, VolumeServer]
856856
"""
857-
Information about the public IP (deprecated in favor of `public_ips`).
857+
Instance volumes.
858858
"""
859859

860-
public_ips: List[ServerIp]
860+
maintenances: List[ServerMaintenance]
861861
"""
862-
Information about all the public IPs attached to the server.
862+
Instance planned maintenance.
863863
"""
864864

865-
mac_address: str
865+
state_detail: str
866866
"""
867-
The server's MAC address.
867+
Detailed information about the Instance state.
868868
"""
869869

870-
state: ServerState
870+
arch: Arch
871871
"""
872-
Instance state.
872+
Instance architecture.
873873
"""
874874

875-
boot_type: BootType
875+
private_nics: List[PrivateNIC]
876876
"""
877-
Instance boot type.
877+
Instance private NICs.
878878
"""
879879

880-
volumes: Dict[str, VolumeServer]
880+
zone: ScwZone
881881
"""
882-
Instance volumes.
882+
Zone in which the Instance is located.
883883
"""
884884

885-
modification_date: Optional[datetime]
885+
end_of_service: bool
886886
"""
887-
Instance modification date.
887+
True if the Instance type has reached end of service.
888888
"""
889889

890-
location: Optional[ServerLocation]
890+
routed_ip_enabled: Optional[bool]
891891
"""
892-
Instance location.
892+
True to configure the instance so it uses the routed IP mode. Use of `routed_ip_enabled` as `False` is deprecated.
893893
"""
894894

895-
ipv6: Optional[ServerIpv6]
895+
enable_ipv6: Optional[bool]
896896
"""
897-
Instance IPv6 address (deprecated when `routed_ip_enabled` is `True`).
897+
True if IPv6 is enabled (deprecated and always `False` when `routed_ip_enabled` is `True`).
898898
"""
899899

900-
maintenances: List[ServerMaintenance]
900+
image: Optional[Image]
901901
"""
902-
Instance planned maintenance.
902+
Information about the Instance image.
903903
"""
904904

905-
state_detail: str
905+
private_ip: Optional[str]
906906
"""
907-
Detailed information about the Instance state.
907+
Private IP address of the Instance (deprecated and always `null` when `routed_ip_enabled` is `True`).
908908
"""
909909

910-
arch: Arch
910+
public_ip: Optional[ServerIp]
911911
"""
912-
Instance architecture.
912+
Information about the public IP (deprecated in favor of `public_ips`).
913913
"""
914914

915-
private_nics: List[PrivateNIC]
915+
modification_date: Optional[datetime]
916916
"""
917-
Instance private NICs.
917+
Instance modification date.
918918
"""
919919

920-
zone: ScwZone
920+
location: Optional[ServerLocation]
921921
"""
922-
Zone in which the Instance is located.
922+
Instance location.
923+
"""
924+
925+
ipv6: Optional[ServerIpv6]
926+
"""
927+
Instance IPv6 address (deprecated when `routed_ip_enabled` is `True`).
923928
"""
924929

925930
security_group: Optional[SecurityGroupSummary]
@@ -1793,14 +1798,14 @@ class CreateSecurityGroupRuleResponse:
17931798

17941799
@dataclass
17951800
class CreateServerRequest:
1796-
commercial_type: str
1801+
zone: Optional[ScwZone]
17971802
"""
1798-
Define the Instance commercial type (i.e. GP1-S).
1803+
Zone to target. If none is passed will use default zone from the config.
17991804
"""
18001805

1801-
zone: Optional[ScwZone]
1806+
commercial_type: str
18021807
"""
1803-
Zone to target. If none is passed will use default zone from the config.
1808+
Define the Instance commercial type (i.e. GP1-S).
18041809
"""
18051810

18061811
name: Optional[str]
@@ -1833,6 +1838,11 @@ class CreateServerRequest:
18331838
True if IPv6 is enabled on the server (deprecated and always `False` when `routed_ip_enabled` is `True`).
18341839
"""
18351840

1841+
protected: bool
1842+
"""
1843+
True to activate server protection option.
1844+
"""
1845+
18361846
public_ip: Optional[str]
18371847
"""
18381848
ID of the reserved IP to attach to the Instance.
@@ -3488,6 +3498,9 @@ class UpdateServerRequest:
34883498
enable_ipv6: Optional[bool]
34893499

34903500
protected: Optional[bool]
3501+
"""
3502+
True to activate server protection option.
3503+
"""
34913504

34923505
security_group: Optional[SecurityGroupTemplate]
34933506

scaleway/scaleway/instance/v1/api.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,14 +511,15 @@ def list_servers_all(
511511
def _create_server(
512512
self,
513513
*,
514-
commercial_type: str,
515514
zone: Optional[ScwZone] = None,
515+
commercial_type: str,
516516
name: Optional[str] = None,
517517
dynamic_ip_required: Optional[bool] = None,
518518
routed_ip_enabled: Optional[bool] = None,
519519
image: Optional[str] = None,
520520
volumes: Optional[Dict[str, VolumeServerTemplate]] = None,
521521
enable_ipv6: Optional[bool] = None,
522+
protected: bool,
522523
public_ip: Optional[str] = None,
523524
public_ips: Optional[List[str]] = None,
524525
boot_type: Optional[BootType] = None,
@@ -533,14 +534,15 @@ def _create_server(
533534
Create an Instance.
534535
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.
535536
Get more information in the [Technical Information](#technical-information) section of the introduction.
536-
:param commercial_type: Define the Instance commercial type (i.e. GP1-S).
537537
:param zone: Zone to target. If none is passed will use default zone from the config.
538+
:param commercial_type: Define the Instance commercial type (i.e. GP1-S).
538539
:param name: Instance name.
539540
:param dynamic_ip_required: Define if a dynamic IPv4 is required for the Instance.
540541
:param routed_ip_enabled: If true, configure the Instance so it uses the new routed IP mode.
541542
:param image: Instance image ID or label.
542543
:param volumes: Volumes attached to the server.
543544
:param enable_ipv6: True if IPv6 is enabled on the server (deprecated and always `False` when `routed_ip_enabled` is `True`).
545+
:param protected: True to activate server protection option.
544546
:param public_ip: ID of the reserved IP to attach to the Instance.
545547
:param public_ips: A list of reserved IP IDs to attach to the Instance.
546548
:param boot_type: Boot type to use.
@@ -559,6 +561,7 @@ def _create_server(
559561
560562
result = api._create_server(
561563
commercial_type="example",
564+
protected=False,
562565
)
563566
"""
564567

@@ -569,14 +572,15 @@ def _create_server(
569572
f"/instance/v1/zones/{param_zone}/servers",
570573
body=marshal_CreateServerRequest(
571574
CreateServerRequest(
572-
commercial_type=commercial_type,
573575
zone=zone,
576+
commercial_type=commercial_type,
574577
name=name or random_name(prefix="srv"),
575578
dynamic_ip_required=dynamic_ip_required,
576579
routed_ip_enabled=routed_ip_enabled,
577580
image=image,
578581
volumes=volumes,
579582
enable_ipv6=enable_ipv6,
583+
protected=protected,
580584
public_ip=public_ip,
581585
public_ips=public_ips,
582586
boot_type=boot_type,
@@ -819,7 +823,7 @@ def _update_server(
819823
: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).
820824
:param public_ips: A list of reserved IP IDs to attach to the Instance.
821825
:param enable_ipv6:
822-
:param protected:
826+
:param protected: True to activate server protection option.
823827
:param security_group:
824828
:param placement_group: Placement group ID if Instance must be part of a placement group.
825829
:param private_nics: Instance private NICs.

scaleway/scaleway/instance/v1/marshalling.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,10 @@ def unmarshal_Server(data: Any) -> Server:
898898
if field is not None:
899899
args["zone"] = field
900900

901+
field = data.get("end_of_service", None)
902+
if field is not None:
903+
args["end_of_service"] = field
904+
901905
field = data.get("admin_password_encryption_ssh_key_id", None)
902906
if field is not None:
903907
args["admin_password_encryption_ssh_key_id"] = field
@@ -3119,6 +3123,9 @@ def marshal_CreateServerRequest(
31193123
if request.enable_ipv6 is not None:
31203124
output["enable_ipv6"] = request.enable_ipv6
31213125

3126+
if request.protected is not None:
3127+
output["protected"] = request.protected
3128+
31223129
if request.public_ip is not None:
31233130
output["public_ip"] = request.public_ip
31243131

0 commit comments

Comments
 (0)