Skip to content

feat(instance): set CreateServerRequest.image as optional #701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 18, 2024
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
7 changes: 3 additions & 4 deletions scaleway-async/scaleway_async/instance/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,11 @@ async def _create_server(
self,
*,
commercial_type: str,
image: str,
zone: Optional[Zone] = None,
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,
public_ip: Optional[str] = None,
Expand All @@ -530,11 +530,11 @@ async def _create_server(
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 image: Instance image ID or label.
:param zone: Zone to target. If none is passed will use default zone from the config.
: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 public_ip: ID of the reserved IP to attach to the Instance.
Expand All @@ -555,7 +555,6 @@ async def _create_server(

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

Expand All @@ -567,11 +566,11 @@ async def _create_server(
body=marshal_CreateServerRequest(
CreateServerRequest(
commercial_type=commercial_type,
image=image,
zone=zone,
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,
public_ip=public_ip,
Expand Down
6 changes: 3 additions & 3 deletions scaleway-async/scaleway_async/instance/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -3023,9 +3023,6 @@ def marshal_CreateServerRequest(
if request.commercial_type is not None:
output["commercial_type"] = request.commercial_type

if request.image is not None:
output["image"] = request.image

if request.name is not None:
output["name"] = request.name

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

if request.image is not None:
output["image"] = request.image

if request.volumes is not None:
output["volumes"] = {
key: marshal_VolumeServerTemplate(value, defaults)
Expand Down
10 changes: 5 additions & 5 deletions scaleway-async/scaleway_async/instance/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1765,11 +1765,6 @@ class CreateServerRequest:
Define the Instance commercial type (i.e. GP1-S).
"""

image: str
"""
Instance image ID or label.
"""

zone: Optional[Zone]
"""
Zone to target. If none is passed will use default zone from the config.
Expand All @@ -1790,6 +1785,11 @@ class CreateServerRequest:
If true, configure the Instance so it uses the new routed IP mode.
"""

image: Optional[str]
"""
Instance image ID or label.
"""

volumes: Optional[Dict[str, VolumeServerTemplate]]
"""
Volumes attached to the server.
Expand Down
7 changes: 3 additions & 4 deletions scaleway/scaleway/instance/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,11 @@ def _create_server(
self,
*,
commercial_type: str,
image: str,
zone: Optional[Zone] = None,
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,
public_ip: Optional[str] = None,
Expand All @@ -530,11 +530,11 @@ def _create_server(
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 image: Instance image ID or label.
:param zone: Zone to target. If none is passed will use default zone from the config.
: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 public_ip: ID of the reserved IP to attach to the Instance.
Expand All @@ -555,7 +555,6 @@ def _create_server(

result = api._create_server(
commercial_type="example",
image="example",
)
"""

Expand All @@ -567,11 +566,11 @@ def _create_server(
body=marshal_CreateServerRequest(
CreateServerRequest(
commercial_type=commercial_type,
image=image,
zone=zone,
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,
public_ip=public_ip,
Expand Down
6 changes: 3 additions & 3 deletions scaleway/scaleway/instance/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -3023,9 +3023,6 @@ def marshal_CreateServerRequest(
if request.commercial_type is not None:
output["commercial_type"] = request.commercial_type

if request.image is not None:
output["image"] = request.image

if request.name is not None:
output["name"] = request.name

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

if request.image is not None:
output["image"] = request.image

if request.volumes is not None:
output["volumes"] = {
key: marshal_VolumeServerTemplate(value, defaults)
Expand Down
10 changes: 5 additions & 5 deletions scaleway/scaleway/instance/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1765,11 +1765,6 @@ class CreateServerRequest:
Define the Instance commercial type (i.e. GP1-S).
"""

image: str
"""
Instance image ID or label.
"""

zone: Optional[Zone]
"""
Zone to target. If none is passed will use default zone from the config.
Expand All @@ -1790,6 +1785,11 @@ class CreateServerRequest:
If true, configure the Instance so it uses the new routed IP mode.
"""

image: Optional[str]
"""
Instance image ID or label.
"""

volumes: Optional[Dict[str, VolumeServerTemplate]]
"""
Volumes attached to the server.
Expand Down