diff --git a/scaleway-async/scaleway_async/instance/v1/__init__.py b/scaleway-async/scaleway_async/instance/v1/__init__.py index 05aba600d..094437876 100644 --- a/scaleway-async/scaleway_async/instance/v1/__init__.py +++ b/scaleway-async/scaleway_async/instance/v1/__init__.py @@ -20,6 +20,8 @@ from .types import SecurityGroupState from .content import SECURITY_GROUP_TRANSIENT_STATUSES from .types import ServerAction +from .types import ServerFilesystemState +from .content import SERVER_FILESYSTEM_TRANSIENT_STATUSES from .types import ServerIpIpFamily from .types import ServerIpProvisioningMode from .types import ServerIpState @@ -48,6 +50,7 @@ from .types import PlacementGroup from .types import PrivateNIC from .types import SecurityGroupSummary +from .types import ServerFilesystem from .types import ServerIp from .types import ServerIpv6 from .types import ServerLocation @@ -223,6 +226,8 @@ "SecurityGroupState", "SECURITY_GROUP_TRANSIENT_STATUSES", "ServerAction", + "ServerFilesystemState", + "SERVER_FILESYSTEM_TRANSIENT_STATUSES", "ServerIpIpFamily", "ServerIpProvisioningMode", "ServerIpState", @@ -251,6 +256,7 @@ "PlacementGroup", "PrivateNIC", "SecurityGroupSummary", + "ServerFilesystem", "ServerIp", "ServerIpv6", "ServerLocation", diff --git a/scaleway-async/scaleway_async/instance/v1/content.py b/scaleway-async/scaleway_async/instance/v1/content.py index 6a6c6317f..638b0e225 100644 --- a/scaleway-async/scaleway_async/instance/v1/content.py +++ b/scaleway-async/scaleway_async/instance/v1/content.py @@ -7,6 +7,7 @@ IpState, PrivateNICState, SecurityGroupState, + ServerFilesystemState, ServerIpState, ServerState, SnapshotState, @@ -39,6 +40,13 @@ """ Lists transient statutes of the enum :class:`SecurityGroupState `. """ +SERVER_FILESYSTEM_TRANSIENT_STATUSES: List[ServerFilesystemState] = [ + ServerFilesystemState.ATTACHING, + ServerFilesystemState.DETACHING, +] +""" +Lists transient statutes of the enum :class:`ServerFilesystemState `. +""" SERVER_IP_TRANSIENT_STATUSES: List[ServerIpState] = [ ServerIpState.PENDING, ] diff --git a/scaleway-async/scaleway_async/instance/v1/marshalling.py b/scaleway-async/scaleway_async/instance/v1/marshalling.py index 86c38fc2b..9f0d7bf75 100644 --- a/scaleway-async/scaleway_async/instance/v1/marshalling.py +++ b/scaleway-async/scaleway_async/instance/v1/marshalling.py @@ -31,6 +31,7 @@ Image, PlacementGroup, SecurityGroupSummary, + ServerFilesystem, ServerIp, ServerIpv6, ServerLocation, @@ -519,6 +520,25 @@ def unmarshal_SecurityGroupSummary(data: Any) -> SecurityGroupSummary: return SecurityGroupSummary(**args) +def unmarshal_ServerFilesystem(data: Any) -> ServerFilesystem: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ServerFilesystem' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("filesystem_id", None) + if field is not None: + args["filesystem_id"] = field + + field = data.get("state", None) + if field is not None: + args["state"] = field + + return ServerFilesystem(**args) + + def unmarshal_ServerIp(data: Any) -> ServerIp: if not isinstance(data, dict): raise TypeError( @@ -902,6 +922,14 @@ def unmarshal_Server(data: Any) -> Server: if field is not None: args["zone"] = field + field = data.get("filesystems", None) + if field is not None: + args["filesystems"] = ( + [unmarshal_ServerFilesystem(v) for v in field] + if field is not None + else None + ) + field = data.get("end_of_service", None) if field is not None: args["end_of_service"] = field diff --git a/scaleway-async/scaleway_async/instance/v1/types.py b/scaleway-async/scaleway_async/instance/v1/types.py index fb8865a73..f600d38ed 100644 --- a/scaleway-async/scaleway_async/instance/v1/types.py +++ b/scaleway-async/scaleway_async/instance/v1/types.py @@ -168,6 +168,16 @@ def __str__(self) -> str: return str(self.value) +class ServerFilesystemState(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_STATE = "unknown_state" + ATTACHING = "attaching" + AVAILABLE = "available" + DETACHING = "detaching" + + def __str__(self) -> str: + return str(self.value) + + class ServerIpIpFamily(str, Enum, metaclass=StrEnumMeta): INET = "inet" INET6 = "inet6" @@ -565,6 +575,13 @@ class SecurityGroupSummary: name: str +@dataclass +class ServerFilesystem: + filesystem_id: str + + state: ServerFilesystemState + + @dataclass class ServerIp: id: str @@ -887,6 +904,11 @@ class Server: Zone in which the Instance is located. """ + filesystems: List[ServerFilesystem] + """ + List of attached filesystems. + """ + end_of_service: bool """ True if the Instance type has reached end of service. diff --git a/scaleway/scaleway/instance/v1/__init__.py b/scaleway/scaleway/instance/v1/__init__.py index 05aba600d..094437876 100644 --- a/scaleway/scaleway/instance/v1/__init__.py +++ b/scaleway/scaleway/instance/v1/__init__.py @@ -20,6 +20,8 @@ from .types import SecurityGroupState from .content import SECURITY_GROUP_TRANSIENT_STATUSES from .types import ServerAction +from .types import ServerFilesystemState +from .content import SERVER_FILESYSTEM_TRANSIENT_STATUSES from .types import ServerIpIpFamily from .types import ServerIpProvisioningMode from .types import ServerIpState @@ -48,6 +50,7 @@ from .types import PlacementGroup from .types import PrivateNIC from .types import SecurityGroupSummary +from .types import ServerFilesystem from .types import ServerIp from .types import ServerIpv6 from .types import ServerLocation @@ -223,6 +226,8 @@ "SecurityGroupState", "SECURITY_GROUP_TRANSIENT_STATUSES", "ServerAction", + "ServerFilesystemState", + "SERVER_FILESYSTEM_TRANSIENT_STATUSES", "ServerIpIpFamily", "ServerIpProvisioningMode", "ServerIpState", @@ -251,6 +256,7 @@ "PlacementGroup", "PrivateNIC", "SecurityGroupSummary", + "ServerFilesystem", "ServerIp", "ServerIpv6", "ServerLocation", diff --git a/scaleway/scaleway/instance/v1/content.py b/scaleway/scaleway/instance/v1/content.py index 6a6c6317f..638b0e225 100644 --- a/scaleway/scaleway/instance/v1/content.py +++ b/scaleway/scaleway/instance/v1/content.py @@ -7,6 +7,7 @@ IpState, PrivateNICState, SecurityGroupState, + ServerFilesystemState, ServerIpState, ServerState, SnapshotState, @@ -39,6 +40,13 @@ """ Lists transient statutes of the enum :class:`SecurityGroupState `. """ +SERVER_FILESYSTEM_TRANSIENT_STATUSES: List[ServerFilesystemState] = [ + ServerFilesystemState.ATTACHING, + ServerFilesystemState.DETACHING, +] +""" +Lists transient statutes of the enum :class:`ServerFilesystemState `. +""" SERVER_IP_TRANSIENT_STATUSES: List[ServerIpState] = [ ServerIpState.PENDING, ] diff --git a/scaleway/scaleway/instance/v1/marshalling.py b/scaleway/scaleway/instance/v1/marshalling.py index 86c38fc2b..9f0d7bf75 100644 --- a/scaleway/scaleway/instance/v1/marshalling.py +++ b/scaleway/scaleway/instance/v1/marshalling.py @@ -31,6 +31,7 @@ Image, PlacementGroup, SecurityGroupSummary, + ServerFilesystem, ServerIp, ServerIpv6, ServerLocation, @@ -519,6 +520,25 @@ def unmarshal_SecurityGroupSummary(data: Any) -> SecurityGroupSummary: return SecurityGroupSummary(**args) +def unmarshal_ServerFilesystem(data: Any) -> ServerFilesystem: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ServerFilesystem' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("filesystem_id", None) + if field is not None: + args["filesystem_id"] = field + + field = data.get("state", None) + if field is not None: + args["state"] = field + + return ServerFilesystem(**args) + + def unmarshal_ServerIp(data: Any) -> ServerIp: if not isinstance(data, dict): raise TypeError( @@ -902,6 +922,14 @@ def unmarshal_Server(data: Any) -> Server: if field is not None: args["zone"] = field + field = data.get("filesystems", None) + if field is not None: + args["filesystems"] = ( + [unmarshal_ServerFilesystem(v) for v in field] + if field is not None + else None + ) + field = data.get("end_of_service", None) if field is not None: args["end_of_service"] = field diff --git a/scaleway/scaleway/instance/v1/types.py b/scaleway/scaleway/instance/v1/types.py index fb8865a73..f600d38ed 100644 --- a/scaleway/scaleway/instance/v1/types.py +++ b/scaleway/scaleway/instance/v1/types.py @@ -168,6 +168,16 @@ def __str__(self) -> str: return str(self.value) +class ServerFilesystemState(str, Enum, metaclass=StrEnumMeta): + UNKNOWN_STATE = "unknown_state" + ATTACHING = "attaching" + AVAILABLE = "available" + DETACHING = "detaching" + + def __str__(self) -> str: + return str(self.value) + + class ServerIpIpFamily(str, Enum, metaclass=StrEnumMeta): INET = "inet" INET6 = "inet6" @@ -565,6 +575,13 @@ class SecurityGroupSummary: name: str +@dataclass +class ServerFilesystem: + filesystem_id: str + + state: ServerFilesystemState + + @dataclass class ServerIp: id: str @@ -887,6 +904,11 @@ class Server: Zone in which the Instance is located. """ + filesystems: List[ServerFilesystem] + """ + List of attached filesystems. + """ + end_of_service: bool """ True if the Instance type has reached end of service.