From 825a789e81c282b8b3e4849cbdaf2ee203ce695c Mon Sep 17 00:00:00 2001 From: Estelle Soulard Date: Fri, 27 Mar 2026 09:59:08 +0100 Subject: [PATCH] chore(lb): handle deprecated_optional fields --- .../scaleway_async/lb/v1/marshalling.py | 50 +++++++++---------- scaleway-async/scaleway_async/lb/v1/types.py | 50 +++++++++---------- scaleway/scaleway/lb/v1/marshalling.py | 14 +++--- scaleway/scaleway/lb/v1/types.py | 50 +++++++++---------- 4 files changed, 82 insertions(+), 82 deletions(-) diff --git a/scaleway-async/scaleway_async/lb/v1/marshalling.py b/scaleway-async/scaleway_async/lb/v1/marshalling.py index 74c013a69..6a3eee0e1 100644 --- a/scaleway-async/scaleway_async/lb/v1/marshalling.py +++ b/scaleway-async/scaleway_async/lb/v1/marshalling.py @@ -515,12 +515,6 @@ def unmarshal_Instance(data: Any) -> Instance: else: args["ip_address"] = None - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - field = data.get("zone", None) if field is not None: args["zone"] = field @@ -539,6 +533,12 @@ def unmarshal_Instance(data: Any) -> Instance: else: args["updated_at"] = None + field = data.get("region", None) + if field is not None: + args["region"] = field + else: + args["region"] = None + return Instance(**args) @@ -644,12 +644,6 @@ def unmarshal_Lb(data: Any) -> Lb: else: args["route_count"] = 0 - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - field = data.get("zone", None) if field is not None: args["zone"] = field @@ -674,6 +668,12 @@ def unmarshal_Lb(data: Any) -> Lb: else: args["updated_at"] = None + field = data.get("region", None) + if field is not None: + args["region"] = field + else: + args["region"] = None + return Lb(**args) @@ -733,12 +733,6 @@ def unmarshal_Backend(data: Any) -> Backend: else: args["pool"] = [] - field = data.get("send_proxy_v2", None) - if field is not None: - args["send_proxy_v2"] = field - else: - args["send_proxy_v2"] = False - field = data.get("on_marked_down_action", None) if field is not None: args["on_marked_down_action"] = field @@ -763,6 +757,12 @@ def unmarshal_Backend(data: Any) -> Backend: else: args["lb"] = None + field = data.get("send_proxy_v2", None) + if field is not None: + args["send_proxy_v2"] = field + else: + args["send_proxy_v2"] = None + field = data.get("timeout_server", None) if field is not None: args["timeout_server"] = field @@ -1224,7 +1224,7 @@ def unmarshal_PrivateNetworkStaticConfig(data: Any) -> PrivateNetworkStaticConfi if field is not None: args["ip_address"] = field else: - args["ip_address"] = [] + args["ip_address"] = None return PrivateNetworkStaticConfig(**args) @@ -1645,18 +1645,18 @@ def unmarshal_LbType(data: Any) -> LbType: else: args["description"] = None - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - field = data.get("zone", None) if field is not None: args["zone"] = field else: args["zone"] = None + field = data.get("region", None) + if field is not None: + args["region"] = field + else: + args["region"] = None + return LbType(**args) diff --git a/scaleway-async/scaleway_async/lb/v1/types.py b/scaleway-async/scaleway_async/lb/v1/types.py index 850072a83..780a5ce34 100644 --- a/scaleway-async/scaleway_async/lb/v1/types.py +++ b/scaleway-async/scaleway_async/lb/v1/types.py @@ -393,11 +393,6 @@ class Instance: Instance IP address. """ - region: ScwRegion - """ - The region the Instance is in. - """ - zone: ScwZone """ The zone the Instance is in. @@ -413,6 +408,11 @@ class Instance: Date on which the Instance was last updated. """ + region: Optional[ScwRegion] = None + """ + The region the Instance is in. + """ + @dataclass class Ip: @@ -446,11 +446,6 @@ class Ip: IP tags. """ - region: ScwRegion - """ - The region the IP address is in. - """ - zone: ScwZone """ The zone the IP address is in. @@ -461,6 +456,11 @@ class Ip: Load Balancer ID. """ + region: Optional[ScwRegion] = None + """ + The region the IP address is in. + """ + @dataclass class Subscriber: @@ -607,11 +607,6 @@ class Lb: Number of routes configured on the Load Balancer. """ - region: ScwRegion - """ - The region the Load Balancer is in. - """ - zone: ScwZone """ The zone the Load Balancer is in. @@ -632,6 +627,11 @@ class Lb: Date on which the Load Balancer was last updated. """ + region: Optional[ScwRegion] = None + """ + The region the Load Balancer is in. + """ + @dataclass class AclActionRedirect: @@ -713,7 +713,7 @@ class Backend: Load Balancer the backend is attached to. """ - send_proxy_v2: Optional[bool] = False + send_proxy_v2: Optional[bool] = None """ Deprecated in favor of proxy_protocol field. """ @@ -973,7 +973,7 @@ class PrivateNetworkIpamConfig: @dataclass class PrivateNetworkStaticConfig: - ip_address: list[str] + ip_address: Optional[list[str]] = field(default_factory=list) """ Array of a local IP address for the Load Balancer on this Private Network. """ @@ -1151,14 +1151,14 @@ class LbType: Load Balancer commercial offer type description. """ - region: ScwRegion + zone: ScwZone """ - The region the Load Balancer stock is in. + The zone the Load Balancer stock is in. """ - zone: ScwZone + region: Optional[ScwRegion] = None """ - The zone the Load Balancer stock is in. + The region the Load Balancer stock is in. """ @@ -1364,7 +1364,7 @@ class CreateBackendRequest: Name for the backend. """ - send_proxy_v2: Optional[bool] = False + send_proxy_v2: Optional[bool] = None """ Deprecated in favor of proxy_protocol field. """ @@ -2598,7 +2598,7 @@ class UpdateBackendRequest: Region to target. If none is passed will use default region from the config. """ - send_proxy_v2: Optional[bool] = False + send_proxy_v2: Optional[bool] = None """ Deprecated in favor of proxy_protocol field. """ @@ -3048,7 +3048,7 @@ class ZonedApiCreateBackendRequest: Name for the backend. """ - send_proxy_v2: Optional[bool] = False + send_proxy_v2: Optional[bool] = None """ Deprecated in favor of proxy_protocol field. """ @@ -4136,7 +4136,7 @@ class ZonedApiUpdateBackendRequest: Zone to target. If none is passed will use default zone from the config. """ - send_proxy_v2: Optional[bool] = False + send_proxy_v2: Optional[bool] = None """ Deprecated in favor of proxy_protocol field. """ diff --git a/scaleway/scaleway/lb/v1/marshalling.py b/scaleway/scaleway/lb/v1/marshalling.py index 649132581..6a3eee0e1 100644 --- a/scaleway/scaleway/lb/v1/marshalling.py +++ b/scaleway/scaleway/lb/v1/marshalling.py @@ -733,12 +733,6 @@ def unmarshal_Backend(data: Any) -> Backend: else: args["pool"] = [] - field = data.get("send_proxy_v2", None) - if field is not None: - args["send_proxy_v2"] = field - else: - args["send_proxy_v2"] = False - field = data.get("on_marked_down_action", None) if field is not None: args["on_marked_down_action"] = field @@ -763,6 +757,12 @@ def unmarshal_Backend(data: Any) -> Backend: else: args["lb"] = None + field = data.get("send_proxy_v2", None) + if field is not None: + args["send_proxy_v2"] = field + else: + args["send_proxy_v2"] = None + field = data.get("timeout_server", None) if field is not None: args["timeout_server"] = field @@ -1224,7 +1224,7 @@ def unmarshal_PrivateNetworkStaticConfig(data: Any) -> PrivateNetworkStaticConfi if field is not None: args["ip_address"] = field else: - args["ip_address"] = [] + args["ip_address"] = None return PrivateNetworkStaticConfig(**args) diff --git a/scaleway/scaleway/lb/v1/types.py b/scaleway/scaleway/lb/v1/types.py index 850072a83..780a5ce34 100644 --- a/scaleway/scaleway/lb/v1/types.py +++ b/scaleway/scaleway/lb/v1/types.py @@ -393,11 +393,6 @@ class Instance: Instance IP address. """ - region: ScwRegion - """ - The region the Instance is in. - """ - zone: ScwZone """ The zone the Instance is in. @@ -413,6 +408,11 @@ class Instance: Date on which the Instance was last updated. """ + region: Optional[ScwRegion] = None + """ + The region the Instance is in. + """ + @dataclass class Ip: @@ -446,11 +446,6 @@ class Ip: IP tags. """ - region: ScwRegion - """ - The region the IP address is in. - """ - zone: ScwZone """ The zone the IP address is in. @@ -461,6 +456,11 @@ class Ip: Load Balancer ID. """ + region: Optional[ScwRegion] = None + """ + The region the IP address is in. + """ + @dataclass class Subscriber: @@ -607,11 +607,6 @@ class Lb: Number of routes configured on the Load Balancer. """ - region: ScwRegion - """ - The region the Load Balancer is in. - """ - zone: ScwZone """ The zone the Load Balancer is in. @@ -632,6 +627,11 @@ class Lb: Date on which the Load Balancer was last updated. """ + region: Optional[ScwRegion] = None + """ + The region the Load Balancer is in. + """ + @dataclass class AclActionRedirect: @@ -713,7 +713,7 @@ class Backend: Load Balancer the backend is attached to. """ - send_proxy_v2: Optional[bool] = False + send_proxy_v2: Optional[bool] = None """ Deprecated in favor of proxy_protocol field. """ @@ -973,7 +973,7 @@ class PrivateNetworkIpamConfig: @dataclass class PrivateNetworkStaticConfig: - ip_address: list[str] + ip_address: Optional[list[str]] = field(default_factory=list) """ Array of a local IP address for the Load Balancer on this Private Network. """ @@ -1151,14 +1151,14 @@ class LbType: Load Balancer commercial offer type description. """ - region: ScwRegion + zone: ScwZone """ - The region the Load Balancer stock is in. + The zone the Load Balancer stock is in. """ - zone: ScwZone + region: Optional[ScwRegion] = None """ - The zone the Load Balancer stock is in. + The region the Load Balancer stock is in. """ @@ -1364,7 +1364,7 @@ class CreateBackendRequest: Name for the backend. """ - send_proxy_v2: Optional[bool] = False + send_proxy_v2: Optional[bool] = None """ Deprecated in favor of proxy_protocol field. """ @@ -2598,7 +2598,7 @@ class UpdateBackendRequest: Region to target. If none is passed will use default region from the config. """ - send_proxy_v2: Optional[bool] = False + send_proxy_v2: Optional[bool] = None """ Deprecated in favor of proxy_protocol field. """ @@ -3048,7 +3048,7 @@ class ZonedApiCreateBackendRequest: Name for the backend. """ - send_proxy_v2: Optional[bool] = False + send_proxy_v2: Optional[bool] = None """ Deprecated in favor of proxy_protocol field. """ @@ -4136,7 +4136,7 @@ class ZonedApiUpdateBackendRequest: Zone to target. If none is passed will use default zone from the config. """ - send_proxy_v2: Optional[bool] = False + send_proxy_v2: Optional[bool] = None """ Deprecated in favor of proxy_protocol field. """