Skip to content

Commit

Permalink
fix: adjust unmarshalling for protected field name and set none value…
Browse files Browse the repository at this point in the history
… for not optional field (#498)
  • Loading branch information
scaleway-bot authored Apr 19, 2024
1 parent da4950a commit 51152d9
Show file tree
Hide file tree
Showing 72 changed files with 3,414 additions and 130 deletions.
4 changes: 4 additions & 0 deletions scaleway-async/scaleway_async/account/v2/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ def unmarshal_Project(data: Any) -> Project:
field = data.get("created_at", None)
if field is not None:
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["created_at"] = None

field = data.get("updated_at", None)
if field is not None:
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["updated_at"] = None

return Project(**args)

Expand Down
4 changes: 4 additions & 0 deletions scaleway-async/scaleway_async/account/v3/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ def unmarshal_Project(data: Any) -> Project:
field = data.get("created_at", None)
if field is not None:
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["created_at"] = None

field = data.get("updated_at", None)
if field is not None:
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["updated_at"] = None

return Project(**args)

Expand Down
20 changes: 17 additions & 3 deletions scaleway-async/scaleway_async/applesilicon/v1alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def unmarshal_ServerTypeDisk(data: Any) -> ServerTypeDisk:
if field is not None:
args["capacity"] = field

field = data.get("type_", None)
field = data.get("type", None)
if field is not None:
args["type_"] = field

Expand All @@ -101,7 +101,7 @@ def unmarshal_ServerTypeMemory(data: Any) -> ServerTypeMemory:
if field is not None:
args["capacity"] = field

field = data.get("type_", None)
field = data.get("type", None)
if field is not None:
args["type_"] = field

Expand All @@ -127,18 +127,26 @@ def unmarshal_ServerType(data: Any) -> ServerType:
field = data.get("cpu", None)
if field is not None:
args["cpu"] = unmarshal_ServerTypeCPU(field)
else:
args["cpu"] = None

field = data.get("disk", None)
if field is not None:
args["disk"] = unmarshal_ServerTypeDisk(field)
else:
args["disk"] = None

field = data.get("memory", None)
if field is not None:
args["memory"] = unmarshal_ServerTypeMemory(field)
else:
args["memory"] = None

field = data.get("minimum_lease_duration", None)
if field is not None:
args["minimum_lease_duration"] = field
else:
args["minimum_lease_duration"] = None

return ServerType(**args)

Expand All @@ -155,7 +163,7 @@ def unmarshal_Server(data: Any) -> Server:
if field is not None:
args["id"] = field

field = data.get("type_", None)
field = data.get("type", None)
if field is not None:
args["type_"] = field

Expand Down Expand Up @@ -190,16 +198,22 @@ def unmarshal_Server(data: Any) -> Server:
field = data.get("created_at", None)
if field is not None:
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["created_at"] = None

field = data.get("updated_at", None)
if field is not None:
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["updated_at"] = None

field = data.get("deletable_at", None)
if field is not None:
args["deletable_at"] = (
parser.isoparse(field) if isinstance(field, str) else field
)
else:
args["deletable_at"] = None

return Server(**args)

Expand Down
54 changes: 50 additions & 4 deletions scaleway-async/scaleway_async/baremetal/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ def unmarshal_OSOSField(data: Any) -> OSOSField:
field = data.get("default_value", None)
if field is not None:
args["default_value"] = field
else:
args["default_value"] = None

return OSOSField(**args)

Expand Down Expand Up @@ -154,22 +156,32 @@ def unmarshal_OS(data: Any) -> OS:
field = data.get("ssh", None)
if field is not None:
args["ssh"] = unmarshal_OSOSField(field)
else:
args["ssh"] = None

field = data.get("user", None)
if field is not None:
args["user"] = unmarshal_OSOSField(field)
else:
args["user"] = None

field = data.get("password", None)
if field is not None:
args["password"] = unmarshal_OSOSField(field)
else:
args["password"] = None

field = data.get("service_user", None)
if field is not None:
args["service_user"] = unmarshal_OSOSField(field)
else:
args["service_user"] = None

field = data.get("service_password", None)
if field is not None:
args["service_password"] = unmarshal_OSOSField(field)
else:
args["service_password"] = None

return OS(**args)

Expand Down Expand Up @@ -217,7 +229,7 @@ def unmarshal_Disk(data: Any) -> Disk:
if field is not None:
args["capacity"] = field

field = data.get("type_", None)
field = data.get("type", None)
if field is not None:
args["type_"] = field

Expand All @@ -236,7 +248,7 @@ def unmarshal_Memory(data: Any) -> Memory:
if field is not None:
args["capacity"] = field

field = data.get("type_", None)
field = data.get("type", None)
if field is not None:
args["type_"] = field

Expand Down Expand Up @@ -282,10 +294,14 @@ def unmarshal_OfferOptionOffer(data: Any) -> OfferOptionOffer:
field = data.get("price", None)
if field is not None:
args["price"] = unmarshal_Money(field)
else:
args["price"] = None

field = data.get("os_id", None)
if field is not None:
args["os_id"] = field
else:
args["os_id"] = None

return OfferOptionOffer(**args)

Expand All @@ -302,7 +318,7 @@ def unmarshal_PersistentMemory(data: Any) -> PersistentMemory:
if field is not None:
args["capacity"] = field

field = data.get("type_", None)
field = data.get("type", None)
if field is not None:
args["type_"] = field

Expand Down Expand Up @@ -373,10 +389,14 @@ def unmarshal_Offer(data: Any) -> Offer:
field = data.get("price_per_hour", None)
if field is not None:
args["price_per_hour"] = unmarshal_Money(field)
else:
args["price_per_hour"] = None

field = data.get("price_per_month", None)
if field is not None:
args["price_per_month"] = unmarshal_Money(field)
else:
args["price_per_month"] = None

field = data.get("cpus", None)
if field is not None:
Expand Down Expand Up @@ -441,6 +461,8 @@ def unmarshal_Offer(data: Any) -> Offer:
field = data.get("fee", None)
if field is not None:
args["fee"] = unmarshal_Money(field)
else:
args["fee"] = None

return Offer(**args)

Expand Down Expand Up @@ -499,14 +521,20 @@ def unmarshal_ServerPrivateNetwork(data: Any) -> ServerPrivateNetwork:
field = data.get("vlan", None)
if field is not None:
args["vlan"] = field
else:
args["vlan"] = None

field = data.get("created_at", None)
if field is not None:
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["created_at"] = None

field = data.get("updated_at", None)
if field is not None:
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["updated_at"] = None

return ServerPrivateNetwork(**args)

Expand Down Expand Up @@ -577,6 +605,8 @@ def unmarshal_ServerOption(data: Any) -> ServerOption:
field = data.get("expires_at", None)
if field is not None:
args["expires_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["expires_at"] = None

return ServerOption(**args)

Expand Down Expand Up @@ -635,10 +665,14 @@ def unmarshal_Server(data: Any) -> Server:
field = data.get("updated_at", None)
if field is not None:
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["updated_at"] = None

field = data.get("created_at", None)
if field is not None:
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["created_at"] = None

field = data.get("offer_id", None)
if field is not None:
Expand Down Expand Up @@ -681,10 +715,14 @@ def unmarshal_Server(data: Any) -> Server:
field = data.get("install", None)
if field is not None:
args["install"] = unmarshal_ServerInstall(field)
else:
args["install"] = None

field = data.get("rescue_server", None)
if field is not None:
args["rescue_server"] = unmarshal_ServerRescueServer(field)
else:
args["rescue_server"] = None

return Server(**args)

Expand All @@ -701,7 +739,7 @@ def unmarshal_Setting(data: Any) -> Setting:
if field is not None:
args["id"] = field

field = data.get("type_", None)
field = data.get("type", None)
if field is not None:
args["type_"] = field

Expand Down Expand Up @@ -739,6 +777,8 @@ def unmarshal_BMCAccess(data: Any) -> BMCAccess:
field = data.get("expires_at", None)
if field is not None:
args["expires_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["expires_at"] = None

return BMCAccess(**args)

Expand All @@ -754,6 +794,8 @@ def unmarshal_GetServerMetricsResponse(data: Any) -> GetServerMetricsResponse:
field = data.get("pings", None)
if field is not None:
args["pings"] = unmarshal_TimeSeries(field)
else:
args["pings"] = None

return GetServerMetricsResponse(**args)

Expand Down Expand Up @@ -838,10 +880,14 @@ def unmarshal_ServerEvent(data: Any) -> ServerEvent:
field = data.get("updated_at", None)
if field is not None:
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["updated_at"] = None

field = data.get("created_at", None)
if field is not None:
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["created_at"] = None

return ServerEvent(**args)

Expand Down
Loading

0 comments on commit 51152d9

Please sign in to comment.