Skip to content

Commit 475f56c

Browse files
authored
feat(instance): set CreateServerRequest.image as optional (#701)
1 parent dbd9284 commit 475f56c

File tree

6 files changed

+22
-24
lines changed

6 files changed

+22
-24
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,11 @@ async def _create_server(
508508
self,
509509
*,
510510
commercial_type: str,
511-
image: str,
512511
zone: Optional[Zone] = None,
513512
name: Optional[str] = None,
514513
dynamic_ip_required: Optional[bool] = None,
515514
routed_ip_enabled: Optional[bool] = None,
515+
image: Optional[str] = None,
516516
volumes: Optional[Dict[str, VolumeServerTemplate]] = None,
517517
enable_ipv6: Optional[bool] = None,
518518
public_ip: Optional[str] = None,
@@ -530,11 +530,11 @@ async def _create_server(
530530
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.
531531
Get more information in the [Technical Information](#technical-information) section of the introduction.
532532
:param commercial_type: Define the Instance commercial type (i.e. GP1-S).
533-
:param image: Instance image ID or label.
534533
:param zone: Zone to target. If none is passed will use default zone from the config.
535534
:param name: Instance name.
536535
:param dynamic_ip_required: Define if a dynamic IPv4 is required for the Instance.
537536
:param routed_ip_enabled: If true, configure the Instance so it uses the new routed IP mode.
537+
:param image: Instance image ID or label.
538538
:param volumes: Volumes attached to the server.
539539
:param enable_ipv6: True if IPv6 is enabled on the server (deprecated and always `False` when `routed_ip_enabled` is `True`).
540540
:param public_ip: ID of the reserved IP to attach to the Instance.
@@ -555,7 +555,6 @@ async def _create_server(
555555
556556
result = await api._create_server(
557557
commercial_type="example",
558-
image="example",
559558
)
560559
"""
561560

@@ -567,11 +566,11 @@ async def _create_server(
567566
body=marshal_CreateServerRequest(
568567
CreateServerRequest(
569568
commercial_type=commercial_type,
570-
image=image,
571569
zone=zone,
572570
name=name or random_name(prefix="srv"),
573571
dynamic_ip_required=dynamic_ip_required,
574572
routed_ip_enabled=routed_ip_enabled,
573+
image=image,
575574
volumes=volumes,
576575
enable_ipv6=enable_ipv6,
577576
public_ip=public_ip,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3023,9 +3023,6 @@ def marshal_CreateServerRequest(
30233023
if request.commercial_type is not None:
30243024
output["commercial_type"] = request.commercial_type
30253025

3026-
if request.image is not None:
3027-
output["image"] = request.image
3028-
30293026
if request.name is not None:
30303027
output["name"] = request.name
30313028

@@ -3035,6 +3032,9 @@ def marshal_CreateServerRequest(
30353032
if request.routed_ip_enabled is not None:
30363033
output["routed_ip_enabled"] = request.routed_ip_enabled
30373034

3035+
if request.image is not None:
3036+
output["image"] = request.image
3037+
30383038
if request.volumes is not None:
30393039
output["volumes"] = {
30403040
key: marshal_VolumeServerTemplate(value, defaults)

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,11 +1765,6 @@ class CreateServerRequest:
17651765
Define the Instance commercial type (i.e. GP1-S).
17661766
"""
17671767

1768-
image: str
1769-
"""
1770-
Instance image ID or label.
1771-
"""
1772-
17731768
zone: Optional[Zone]
17741769
"""
17751770
Zone to target. If none is passed will use default zone from the config.
@@ -1790,6 +1785,11 @@ class CreateServerRequest:
17901785
If true, configure the Instance so it uses the new routed IP mode.
17911786
"""
17921787

1788+
image: Optional[str]
1789+
"""
1790+
Instance image ID or label.
1791+
"""
1792+
17931793
volumes: Optional[Dict[str, VolumeServerTemplate]]
17941794
"""
17951795
Volumes attached to the server.

scaleway/scaleway/instance/v1/api.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,11 @@ def _create_server(
508508
self,
509509
*,
510510
commercial_type: str,
511-
image: str,
512511
zone: Optional[Zone] = None,
513512
name: Optional[str] = None,
514513
dynamic_ip_required: Optional[bool] = None,
515514
routed_ip_enabled: Optional[bool] = None,
515+
image: Optional[str] = None,
516516
volumes: Optional[Dict[str, VolumeServerTemplate]] = None,
517517
enable_ipv6: Optional[bool] = None,
518518
public_ip: Optional[str] = None,
@@ -530,11 +530,11 @@ def _create_server(
530530
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.
531531
Get more information in the [Technical Information](#technical-information) section of the introduction.
532532
:param commercial_type: Define the Instance commercial type (i.e. GP1-S).
533-
:param image: Instance image ID or label.
534533
:param zone: Zone to target. If none is passed will use default zone from the config.
535534
:param name: Instance name.
536535
:param dynamic_ip_required: Define if a dynamic IPv4 is required for the Instance.
537536
:param routed_ip_enabled: If true, configure the Instance so it uses the new routed IP mode.
537+
:param image: Instance image ID or label.
538538
:param volumes: Volumes attached to the server.
539539
:param enable_ipv6: True if IPv6 is enabled on the server (deprecated and always `False` when `routed_ip_enabled` is `True`).
540540
:param public_ip: ID of the reserved IP to attach to the Instance.
@@ -555,7 +555,6 @@ def _create_server(
555555
556556
result = api._create_server(
557557
commercial_type="example",
558-
image="example",
559558
)
560559
"""
561560

@@ -567,11 +566,11 @@ def _create_server(
567566
body=marshal_CreateServerRequest(
568567
CreateServerRequest(
569568
commercial_type=commercial_type,
570-
image=image,
571569
zone=zone,
572570
name=name or random_name(prefix="srv"),
573571
dynamic_ip_required=dynamic_ip_required,
574572
routed_ip_enabled=routed_ip_enabled,
573+
image=image,
575574
volumes=volumes,
576575
enable_ipv6=enable_ipv6,
577576
public_ip=public_ip,

scaleway/scaleway/instance/v1/marshalling.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3023,9 +3023,6 @@ def marshal_CreateServerRequest(
30233023
if request.commercial_type is not None:
30243024
output["commercial_type"] = request.commercial_type
30253025

3026-
if request.image is not None:
3027-
output["image"] = request.image
3028-
30293026
if request.name is not None:
30303027
output["name"] = request.name
30313028

@@ -3035,6 +3032,9 @@ def marshal_CreateServerRequest(
30353032
if request.routed_ip_enabled is not None:
30363033
output["routed_ip_enabled"] = request.routed_ip_enabled
30373034

3035+
if request.image is not None:
3036+
output["image"] = request.image
3037+
30383038
if request.volumes is not None:
30393039
output["volumes"] = {
30403040
key: marshal_VolumeServerTemplate(value, defaults)

scaleway/scaleway/instance/v1/types.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,11 +1765,6 @@ class CreateServerRequest:
17651765
Define the Instance commercial type (i.e. GP1-S).
17661766
"""
17671767

1768-
image: str
1769-
"""
1770-
Instance image ID or label.
1771-
"""
1772-
17731768
zone: Optional[Zone]
17741769
"""
17751770
Zone to target. If none is passed will use default zone from the config.
@@ -1790,6 +1785,11 @@ class CreateServerRequest:
17901785
If true, configure the Instance so it uses the new routed IP mode.
17911786
"""
17921787

1788+
image: Optional[str]
1789+
"""
1790+
Instance image ID or label.
1791+
"""
1792+
17931793
volumes: Optional[Dict[str, VolumeServerTemplate]]
17941794
"""
17951795
Volumes attached to the server.

0 commit comments

Comments
 (0)