From e140c18298841644b5dfa4982c763286e05aeffa Mon Sep 17 00:00:00 2001 From: Scaleway Bot Date: Wed, 27 Nov 2024 17:38:27 +0100 Subject: [PATCH] feat(instance): set some fields of VolumeServer as optional (#765) --- .../scaleway_async/instance/v1/marshalling.py | 42 ++++++++++++------- .../scaleway_async/instance/v1/types.py | 18 ++++---- scaleway/scaleway/instance/v1/marshalling.py | 42 ++++++++++++------- scaleway/scaleway/instance/v1/types.py | 18 ++++---- 4 files changed, 70 insertions(+), 50 deletions(-) diff --git a/scaleway-async/scaleway_async/instance/v1/marshalling.py b/scaleway-async/scaleway_async/instance/v1/marshalling.py index 97147792..741e9ecd 100644 --- a/scaleway-async/scaleway_async/instance/v1/marshalling.py +++ b/scaleway-async/scaleway_async/instance/v1/marshalling.py @@ -653,14 +653,8 @@ def unmarshal_VolumeServer(data: Any) -> VolumeServer: field = data.get("name", None) if field is not None: args["name"] = field - - field = data.get("organization", None) - if field is not None: - args["organization"] = field - - field = data.get("size", None) - if field is not None: - args["size"] = field + else: + args["name"] = None field = data.get("export_uri", None) if field is not None: @@ -668,23 +662,27 @@ def unmarshal_VolumeServer(data: Any) -> VolumeServer: else: args["export_uri"] = None + field = data.get("organization", None) + if field is not None: + args["organization"] = field + else: + args["organization"] = None + field = data.get("server", None) if field is not None: args["server"] = unmarshal_ServerSummary(field) else: args["server"] = None - field = data.get("volume_type", None) - if field is not None: - args["volume_type"] = field - - field = data.get("state", None) + field = data.get("size", None) if field is not None: - args["state"] = field + args["size"] = field + else: + args["size"] = None - field = data.get("project", None) + field = data.get("volume_type", None) if field is not None: - args["project"] = field + args["volume_type"] = field field = data.get("boot", None) if field is not None: @@ -710,6 +708,18 @@ def unmarshal_VolumeServer(data: Any) -> VolumeServer: else: args["modification_date"] = None + field = data.get("state", None) + if field is not None: + args["state"] = field + else: + args["state"] = None + + field = data.get("project", None) + if field is not None: + args["project"] = field + else: + args["project"] = None + return VolumeServer(**args) diff --git a/scaleway-async/scaleway_async/instance/v1/types.py b/scaleway-async/scaleway_async/instance/v1/types.py index cc50888d..6c7edf46 100644 --- a/scaleway-async/scaleway_async/instance/v1/types.py +++ b/scaleway-async/scaleway_async/instance/v1/types.py @@ -660,21 +660,17 @@ class ServerMaintenance: class VolumeServer: id: str - name: str - - organization: str - - size: int + name: Optional[str] export_uri: Optional[str] - server: Optional[ServerSummary] + organization: Optional[str] - volume_type: VolumeServerVolumeType + server: Optional[ServerSummary] - state: VolumeServerState + size: Optional[int] - project: str + volume_type: VolumeServerVolumeType boot: bool @@ -687,6 +683,10 @@ class VolumeServer: modification_date: Optional[datetime] + state: Optional[VolumeServerState] + + project: Optional[str] + @dataclass class SnapshotBaseVolume: diff --git a/scaleway/scaleway/instance/v1/marshalling.py b/scaleway/scaleway/instance/v1/marshalling.py index 97147792..741e9ecd 100644 --- a/scaleway/scaleway/instance/v1/marshalling.py +++ b/scaleway/scaleway/instance/v1/marshalling.py @@ -653,14 +653,8 @@ def unmarshal_VolumeServer(data: Any) -> VolumeServer: field = data.get("name", None) if field is not None: args["name"] = field - - field = data.get("organization", None) - if field is not None: - args["organization"] = field - - field = data.get("size", None) - if field is not None: - args["size"] = field + else: + args["name"] = None field = data.get("export_uri", None) if field is not None: @@ -668,23 +662,27 @@ def unmarshal_VolumeServer(data: Any) -> VolumeServer: else: args["export_uri"] = None + field = data.get("organization", None) + if field is not None: + args["organization"] = field + else: + args["organization"] = None + field = data.get("server", None) if field is not None: args["server"] = unmarshal_ServerSummary(field) else: args["server"] = None - field = data.get("volume_type", None) - if field is not None: - args["volume_type"] = field - - field = data.get("state", None) + field = data.get("size", None) if field is not None: - args["state"] = field + args["size"] = field + else: + args["size"] = None - field = data.get("project", None) + field = data.get("volume_type", None) if field is not None: - args["project"] = field + args["volume_type"] = field field = data.get("boot", None) if field is not None: @@ -710,6 +708,18 @@ def unmarshal_VolumeServer(data: Any) -> VolumeServer: else: args["modification_date"] = None + field = data.get("state", None) + if field is not None: + args["state"] = field + else: + args["state"] = None + + field = data.get("project", None) + if field is not None: + args["project"] = field + else: + args["project"] = None + return VolumeServer(**args) diff --git a/scaleway/scaleway/instance/v1/types.py b/scaleway/scaleway/instance/v1/types.py index cc50888d..6c7edf46 100644 --- a/scaleway/scaleway/instance/v1/types.py +++ b/scaleway/scaleway/instance/v1/types.py @@ -660,21 +660,17 @@ class ServerMaintenance: class VolumeServer: id: str - name: str - - organization: str - - size: int + name: Optional[str] export_uri: Optional[str] - server: Optional[ServerSummary] + organization: Optional[str] - volume_type: VolumeServerVolumeType + server: Optional[ServerSummary] - state: VolumeServerState + size: Optional[int] - project: str + volume_type: VolumeServerVolumeType boot: bool @@ -687,6 +683,10 @@ class VolumeServer: modification_date: Optional[datetime] + state: Optional[VolumeServerState] + + project: Optional[str] + @dataclass class SnapshotBaseVolume: