Skip to content
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
6 changes: 4 additions & 2 deletions scaleway-async/scaleway_async/instance/v2alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from .types import CreateServerRequestPublicNetworkInterface
from .types import CreateServerRequestServerVolume
from .types import PlacementGroup
from .types import PrivateNetworkInterface
from .types import PrivateNetworkInterfaceSummary
from .types import SecurityGroupSummary
from .types import ServerType
from .types import ServerSummary
Expand Down Expand Up @@ -108,6 +108,7 @@
from .types import ListUserDataKeysRequest
from .types import ListUserDataKeysResponse
from .types import PauseServerRequest
from .types import PrivateNetworkInterface
from .types import RebootServerRequest
from .types import ResourceCounts
from .types import Server
Expand Down Expand Up @@ -174,7 +175,7 @@
"CreateServerRequestPublicNetworkInterface",
"CreateServerRequestServerVolume",
"PlacementGroup",
"PrivateNetworkInterface",
"PrivateNetworkInterfaceSummary",
"SecurityGroupSummary",
"ServerType",
"ServerSummary",
Expand Down Expand Up @@ -239,6 +240,7 @@
"ListUserDataKeysRequest",
"ListUserDataKeysResponse",
"PauseServerRequest",
"PrivateNetworkInterface",
"RebootServerRequest",
"ResourceCounts",
"Server",
Expand Down
2 changes: 1 addition & 1 deletion scaleway-async/scaleway_async/instance/v2alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
from .marshalling import (
unmarshal_SecurityGroup,
unmarshal_PlacementGroup,
unmarshal_PrivateNetworkInterface,
unmarshal_AddSecurityGroupRulesResponse,
unmarshal_ListPlacementGroupsResponse,
unmarshal_ListPrivateNetworkInterfacesResponse,
Expand All @@ -98,6 +97,7 @@
unmarshal_ListTemplateUserDataKeysResponse,
unmarshal_ListTemplatesResponse,
unmarshal_ListUserDataKeysResponse,
unmarshal_PrivateNetworkInterface,
unmarshal_ResourceCounts,
unmarshal_Server,
unmarshal_Template,
Expand Down
206 changes: 143 additions & 63 deletions scaleway-async/scaleway_async/instance/v2alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
SecurityGroupRule,
SecurityGroup,
PlacementGroup,
PrivateNetworkInterface,
AddSecurityGroupRulesResponse,
ListPlacementGroupsResponse,
PrivateNetworkInterfaceSummary,
ListPrivateNetworkInterfacesResponse,
SecurityGroupSummary,
ListSecurityGroupsResponse,
Expand All @@ -30,6 +30,7 @@
TemplateSummary,
ListTemplatesResponse,
ListUserDataKeysResponse,
PrivateNetworkInterface,
ResourceCounts,
ServerIP,
ServerFilesystem,
Expand Down Expand Up @@ -339,10 +340,70 @@ def unmarshal_PlacementGroup(data: Any) -> PlacementGroup:
return PlacementGroup(**args)


def unmarshal_PrivateNetworkInterface(data: Any) -> PrivateNetworkInterface:
def unmarshal_AddSecurityGroupRulesResponse(data: Any) -> AddSecurityGroupRulesResponse:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'PrivateNetworkInterface' failed as data isn't a dictionary."
"Unmarshalling the type 'AddSecurityGroupRulesResponse' failed as data isn't a dictionary."
)

args: dict[str, Any] = {}

field = data.get("added_rules", None)
if field is not None:
args["added_rules"] = (
[unmarshal_SecurityGroupRule(v) for v in field]
if field is not None
else None
)
else:
args["added_rules"] = None

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

return AddSecurityGroupRulesResponse(**args)


def unmarshal_ListPlacementGroupsResponse(data: Any) -> ListPlacementGroupsResponse:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'ListPlacementGroupsResponse' failed as data isn't a dictionary."
)

args: dict[str, Any] = {}

field = data.get("placement_groups", None)
if field is not None:
args["placement_groups"] = (
[unmarshal_PlacementGroup(v) for v in field] if field is not None else None
)
else:
args["placement_groups"] = None

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

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

return ListPlacementGroupsResponse(**args)


def unmarshal_PrivateNetworkInterfaceSummary(
data: Any,
) -> PrivateNetworkInterfaceSummary:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'PrivateNetworkInterfaceSummary' failed as data isn't a dictionary."
)

args: dict[str, Any] = {}
Expand Down Expand Up @@ -413,65 +474,7 @@ def unmarshal_PrivateNetworkInterface(data: Any) -> PrivateNetworkInterface:
else:
args["updated_at"] = None

return PrivateNetworkInterface(**args)


def unmarshal_AddSecurityGroupRulesResponse(data: Any) -> AddSecurityGroupRulesResponse:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'AddSecurityGroupRulesResponse' failed as data isn't a dictionary."
)

args: dict[str, Any] = {}

field = data.get("added_rules", None)
if field is not None:
args["added_rules"] = (
[unmarshal_SecurityGroupRule(v) for v in field]
if field is not None
else None
)
else:
args["added_rules"] = None

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

return AddSecurityGroupRulesResponse(**args)


def unmarshal_ListPlacementGroupsResponse(data: Any) -> ListPlacementGroupsResponse:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'ListPlacementGroupsResponse' failed as data isn't a dictionary."
)

args: dict[str, Any] = {}

field = data.get("placement_groups", None)
if field is not None:
args["placement_groups"] = (
[unmarshal_PlacementGroup(v) for v in field] if field is not None else None
)
else:
args["placement_groups"] = None

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

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

return ListPlacementGroupsResponse(**args)
return PrivateNetworkInterfaceSummary(**args)


def unmarshal_ListPrivateNetworkInterfacesResponse(
Expand All @@ -487,7 +490,7 @@ def unmarshal_ListPrivateNetworkInterfacesResponse(
field = data.get("private_network_interfaces", None)
if field is not None:
args["private_network_interfaces"] = (
[unmarshal_PrivateNetworkInterface(v) for v in field]
[unmarshal_PrivateNetworkInterfaceSummary(v) for v in field]
if field is not None
else None
)
Expand Down Expand Up @@ -1115,6 +1118,83 @@ def unmarshal_ListUserDataKeysResponse(data: Any) -> ListUserDataKeysResponse:
return ListUserDataKeysResponse(**args)


def unmarshal_PrivateNetworkInterface(data: Any) -> PrivateNetworkInterface:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'PrivateNetworkInterface' failed as data isn't a dictionary."
)

args: dict[str, Any] = {}

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

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

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

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

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

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

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

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

field = data.get("tags", None)
if field is not None:
args["tags"] = field
else:
args["tags"] = 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 PrivateNetworkInterface(**args)


def unmarshal_ResourceCounts(data: Any) -> ResourceCounts:
if not isinstance(data, dict):
raise TypeError(
Expand Down
19 changes: 17 additions & 2 deletions scaleway-async/scaleway_async/instance/v2alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class PlacementGroup:


@dataclass
class PrivateNetworkInterface:
class PrivateNetworkInterfaceSummary:
id: str
private_network_id: str
project_id: str
Expand Down Expand Up @@ -962,7 +962,7 @@ class ListPrivateNetworkInterfacesRequest:

@dataclass
class ListPrivateNetworkInterfacesResponse:
private_network_interfaces: list[PrivateNetworkInterface]
private_network_interfaces: list[PrivateNetworkInterfaceSummary]
total_count: int
next_page_token: Optional[str] = None

Expand Down Expand Up @@ -1109,6 +1109,21 @@ class PauseServerRequest:
"""


@dataclass
class PrivateNetworkInterface:
id: str
private_network_id: str
project_id: str
server_id: str
security_group_id: str
mac_address: str
status: PrivateNetworkInterfaceStatus
ip_ids: list[str]
tags: list[str]
created_at: Optional[datetime] = None
updated_at: Optional[datetime] = None


@dataclass
class RebootServerRequest:
server_id: str
Expand Down
6 changes: 4 additions & 2 deletions scaleway/scaleway/instance/v2alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from .types import CreateServerRequestPublicNetworkInterface
from .types import CreateServerRequestServerVolume
from .types import PlacementGroup
from .types import PrivateNetworkInterface
from .types import PrivateNetworkInterfaceSummary
from .types import SecurityGroupSummary
from .types import ServerType
from .types import ServerSummary
Expand Down Expand Up @@ -108,6 +108,7 @@
from .types import ListUserDataKeysRequest
from .types import ListUserDataKeysResponse
from .types import PauseServerRequest
from .types import PrivateNetworkInterface
from .types import RebootServerRequest
from .types import ResourceCounts
from .types import Server
Expand Down Expand Up @@ -174,7 +175,7 @@
"CreateServerRequestPublicNetworkInterface",
"CreateServerRequestServerVolume",
"PlacementGroup",
"PrivateNetworkInterface",
"PrivateNetworkInterfaceSummary",
"SecurityGroupSummary",
"ServerType",
"ServerSummary",
Expand Down Expand Up @@ -239,6 +240,7 @@
"ListUserDataKeysRequest",
"ListUserDataKeysResponse",
"PauseServerRequest",
"PrivateNetworkInterface",
"RebootServerRequest",
"ResourceCounts",
"Server",
Expand Down
2 changes: 1 addition & 1 deletion scaleway/scaleway/instance/v2alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
from .marshalling import (
unmarshal_SecurityGroup,
unmarshal_PlacementGroup,
unmarshal_PrivateNetworkInterface,
unmarshal_AddSecurityGroupRulesResponse,
unmarshal_ListPlacementGroupsResponse,
unmarshal_ListPrivateNetworkInterfacesResponse,
Expand All @@ -98,6 +97,7 @@
unmarshal_ListTemplateUserDataKeysResponse,
unmarshal_ListTemplatesResponse,
unmarshal_ListUserDataKeysResponse,
unmarshal_PrivateNetworkInterface,
unmarshal_ResourceCounts,
unmarshal_Server,
unmarshal_Template,
Expand Down
Loading
Loading