Skip to content

Commit 06be066

Browse files
authored
feat(instance): activate filesystems integration (#1021)
1 parent fe62d35 commit 06be066

File tree

8 files changed

+128
-0
lines changed

8 files changed

+128
-0
lines changed

scaleway-async/scaleway_async/instance/v1/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
from .types import SecurityGroupState
2121
from .content import SECURITY_GROUP_TRANSIENT_STATUSES
2222
from .types import ServerAction
23+
from .types import ServerFilesystemState
24+
from .content import SERVER_FILESYSTEM_TRANSIENT_STATUSES
2325
from .types import ServerIpIpFamily
2426
from .types import ServerIpProvisioningMode
2527
from .types import ServerIpState
@@ -48,6 +50,7 @@
4850
from .types import PlacementGroup
4951
from .types import PrivateNIC
5052
from .types import SecurityGroupSummary
53+
from .types import ServerFilesystem
5154
from .types import ServerIp
5255
from .types import ServerIpv6
5356
from .types import ServerLocation
@@ -223,6 +226,8 @@
223226
"SecurityGroupState",
224227
"SECURITY_GROUP_TRANSIENT_STATUSES",
225228
"ServerAction",
229+
"ServerFilesystemState",
230+
"SERVER_FILESYSTEM_TRANSIENT_STATUSES",
226231
"ServerIpIpFamily",
227232
"ServerIpProvisioningMode",
228233
"ServerIpState",
@@ -251,6 +256,7 @@
251256
"PlacementGroup",
252257
"PrivateNIC",
253258
"SecurityGroupSummary",
259+
"ServerFilesystem",
254260
"ServerIp",
255261
"ServerIpv6",
256262
"ServerLocation",

scaleway-async/scaleway_async/instance/v1/content.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
IpState,
88
PrivateNICState,
99
SecurityGroupState,
10+
ServerFilesystemState,
1011
ServerIpState,
1112
ServerState,
1213
SnapshotState,
@@ -39,6 +40,13 @@
3940
"""
4041
Lists transient statutes of the enum :class:`SecurityGroupState <SecurityGroupState>`.
4142
"""
43+
SERVER_FILESYSTEM_TRANSIENT_STATUSES: List[ServerFilesystemState] = [
44+
ServerFilesystemState.ATTACHING,
45+
ServerFilesystemState.DETACHING,
46+
]
47+
"""
48+
Lists transient statutes of the enum :class:`ServerFilesystemState <ServerFilesystemState>`.
49+
"""
4250
SERVER_IP_TRANSIENT_STATUSES: List[ServerIpState] = [
4351
ServerIpState.PENDING,
4452
]

scaleway-async/scaleway_async/instance/v1/marshalling.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
Image,
3232
PlacementGroup,
3333
SecurityGroupSummary,
34+
ServerFilesystem,
3435
ServerIp,
3536
ServerIpv6,
3637
ServerLocation,
@@ -519,6 +520,25 @@ def unmarshal_SecurityGroupSummary(data: Any) -> SecurityGroupSummary:
519520
return SecurityGroupSummary(**args)
520521

521522

523+
def unmarshal_ServerFilesystem(data: Any) -> ServerFilesystem:
524+
if not isinstance(data, dict):
525+
raise TypeError(
526+
"Unmarshalling the type 'ServerFilesystem' failed as data isn't a dictionary."
527+
)
528+
529+
args: Dict[str, Any] = {}
530+
531+
field = data.get("filesystem_id", None)
532+
if field is not None:
533+
args["filesystem_id"] = field
534+
535+
field = data.get("state", None)
536+
if field is not None:
537+
args["state"] = field
538+
539+
return ServerFilesystem(**args)
540+
541+
522542
def unmarshal_ServerIp(data: Any) -> ServerIp:
523543
if not isinstance(data, dict):
524544
raise TypeError(
@@ -902,6 +922,14 @@ def unmarshal_Server(data: Any) -> Server:
902922
if field is not None:
903923
args["zone"] = field
904924

925+
field = data.get("filesystems", None)
926+
if field is not None:
927+
args["filesystems"] = (
928+
[unmarshal_ServerFilesystem(v) for v in field]
929+
if field is not None
930+
else None
931+
)
932+
905933
field = data.get("end_of_service", None)
906934
if field is not None:
907935
args["end_of_service"] = field

scaleway-async/scaleway_async/instance/v1/types.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,16 @@ def __str__(self) -> str:
168168
return str(self.value)
169169

170170

171+
class ServerFilesystemState(str, Enum, metaclass=StrEnumMeta):
172+
UNKNOWN_STATE = "unknown_state"
173+
ATTACHING = "attaching"
174+
AVAILABLE = "available"
175+
DETACHING = "detaching"
176+
177+
def __str__(self) -> str:
178+
return str(self.value)
179+
180+
171181
class ServerIpIpFamily(str, Enum, metaclass=StrEnumMeta):
172182
INET = "inet"
173183
INET6 = "inet6"
@@ -565,6 +575,13 @@ class SecurityGroupSummary:
565575
name: str
566576

567577

578+
@dataclass
579+
class ServerFilesystem:
580+
filesystem_id: str
581+
582+
state: ServerFilesystemState
583+
584+
568585
@dataclass
569586
class ServerIp:
570587
id: str
@@ -887,6 +904,11 @@ class Server:
887904
Zone in which the Instance is located.
888905
"""
889906

907+
filesystems: List[ServerFilesystem]
908+
"""
909+
List of attached filesystems.
910+
"""
911+
890912
end_of_service: bool
891913
"""
892914
True if the Instance type has reached end of service.

scaleway/scaleway/instance/v1/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
from .types import SecurityGroupState
2121
from .content import SECURITY_GROUP_TRANSIENT_STATUSES
2222
from .types import ServerAction
23+
from .types import ServerFilesystemState
24+
from .content import SERVER_FILESYSTEM_TRANSIENT_STATUSES
2325
from .types import ServerIpIpFamily
2426
from .types import ServerIpProvisioningMode
2527
from .types import ServerIpState
@@ -48,6 +50,7 @@
4850
from .types import PlacementGroup
4951
from .types import PrivateNIC
5052
from .types import SecurityGroupSummary
53+
from .types import ServerFilesystem
5154
from .types import ServerIp
5255
from .types import ServerIpv6
5356
from .types import ServerLocation
@@ -223,6 +226,8 @@
223226
"SecurityGroupState",
224227
"SECURITY_GROUP_TRANSIENT_STATUSES",
225228
"ServerAction",
229+
"ServerFilesystemState",
230+
"SERVER_FILESYSTEM_TRANSIENT_STATUSES",
226231
"ServerIpIpFamily",
227232
"ServerIpProvisioningMode",
228233
"ServerIpState",
@@ -251,6 +256,7 @@
251256
"PlacementGroup",
252257
"PrivateNIC",
253258
"SecurityGroupSummary",
259+
"ServerFilesystem",
254260
"ServerIp",
255261
"ServerIpv6",
256262
"ServerLocation",

scaleway/scaleway/instance/v1/content.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
IpState,
88
PrivateNICState,
99
SecurityGroupState,
10+
ServerFilesystemState,
1011
ServerIpState,
1112
ServerState,
1213
SnapshotState,
@@ -39,6 +40,13 @@
3940
"""
4041
Lists transient statutes of the enum :class:`SecurityGroupState <SecurityGroupState>`.
4142
"""
43+
SERVER_FILESYSTEM_TRANSIENT_STATUSES: List[ServerFilesystemState] = [
44+
ServerFilesystemState.ATTACHING,
45+
ServerFilesystemState.DETACHING,
46+
]
47+
"""
48+
Lists transient statutes of the enum :class:`ServerFilesystemState <ServerFilesystemState>`.
49+
"""
4250
SERVER_IP_TRANSIENT_STATUSES: List[ServerIpState] = [
4351
ServerIpState.PENDING,
4452
]

scaleway/scaleway/instance/v1/marshalling.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
Image,
3232
PlacementGroup,
3333
SecurityGroupSummary,
34+
ServerFilesystem,
3435
ServerIp,
3536
ServerIpv6,
3637
ServerLocation,
@@ -519,6 +520,25 @@ def unmarshal_SecurityGroupSummary(data: Any) -> SecurityGroupSummary:
519520
return SecurityGroupSummary(**args)
520521

521522

523+
def unmarshal_ServerFilesystem(data: Any) -> ServerFilesystem:
524+
if not isinstance(data, dict):
525+
raise TypeError(
526+
"Unmarshalling the type 'ServerFilesystem' failed as data isn't a dictionary."
527+
)
528+
529+
args: Dict[str, Any] = {}
530+
531+
field = data.get("filesystem_id", None)
532+
if field is not None:
533+
args["filesystem_id"] = field
534+
535+
field = data.get("state", None)
536+
if field is not None:
537+
args["state"] = field
538+
539+
return ServerFilesystem(**args)
540+
541+
522542
def unmarshal_ServerIp(data: Any) -> ServerIp:
523543
if not isinstance(data, dict):
524544
raise TypeError(
@@ -902,6 +922,14 @@ def unmarshal_Server(data: Any) -> Server:
902922
if field is not None:
903923
args["zone"] = field
904924

925+
field = data.get("filesystems", None)
926+
if field is not None:
927+
args["filesystems"] = (
928+
[unmarshal_ServerFilesystem(v) for v in field]
929+
if field is not None
930+
else None
931+
)
932+
905933
field = data.get("end_of_service", None)
906934
if field is not None:
907935
args["end_of_service"] = field

scaleway/scaleway/instance/v1/types.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,16 @@ def __str__(self) -> str:
168168
return str(self.value)
169169

170170

171+
class ServerFilesystemState(str, Enum, metaclass=StrEnumMeta):
172+
UNKNOWN_STATE = "unknown_state"
173+
ATTACHING = "attaching"
174+
AVAILABLE = "available"
175+
DETACHING = "detaching"
176+
177+
def __str__(self) -> str:
178+
return str(self.value)
179+
180+
171181
class ServerIpIpFamily(str, Enum, metaclass=StrEnumMeta):
172182
INET = "inet"
173183
INET6 = "inet6"
@@ -565,6 +575,13 @@ class SecurityGroupSummary:
565575
name: str
566576

567577

578+
@dataclass
579+
class ServerFilesystem:
580+
filesystem_id: str
581+
582+
state: ServerFilesystemState
583+
584+
568585
@dataclass
569586
class ServerIp:
570587
id: str
@@ -887,6 +904,11 @@ class Server:
887904
Zone in which the Instance is located.
888905
"""
889906

907+
filesystems: List[ServerFilesystem]
908+
"""
909+
List of attached filesystems.
910+
"""
911+
890912
end_of_service: bool
891913
"""
892914
True if the Instance type has reached end of service.

0 commit comments

Comments
 (0)