Skip to content

Commit 1a456af

Browse files
authored
feat(instance): expose IP state in server.public_ips (#347)
1 parent a0e12f3 commit 1a456af

File tree

8 files changed

+64
-0
lines changed

8 files changed

+64
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from .types import ServerAction
1818
from .types import ServerIpIpFamily
1919
from .types import ServerIpProvisioningMode
20+
from .types import ServerIpState
2021
from .types import ServerState
2122
from .types import ServerTypesAvailability
2223
from .types import SnapshotState
@@ -114,6 +115,7 @@
114115
from .content import IP_TRANSIENT_STATUSES
115116
from .content import PRIVATE_NIC_TRANSIENT_STATUSES
116117
from .content import SECURITY_GROUP_TRANSIENT_STATUSES
118+
from .content import SERVER_IP_TRANSIENT_STATUSES
117119
from .content import SERVER_TRANSIENT_STATUSES
118120
from .content import SNAPSHOT_TRANSIENT_STATUSES
119121
from .content import TASK_TRANSIENT_STATUSES
@@ -139,6 +141,7 @@
139141
"ServerAction",
140142
"ServerIpIpFamily",
141143
"ServerIpProvisioningMode",
144+
"ServerIpState",
142145
"ServerState",
143146
"ServerTypesAvailability",
144147
"SnapshotState",
@@ -236,6 +239,7 @@
236239
"IP_TRANSIENT_STATUSES",
237240
"PRIVATE_NIC_TRANSIENT_STATUSES",
238241
"SECURITY_GROUP_TRANSIENT_STATUSES",
242+
"SERVER_IP_TRANSIENT_STATUSES",
239243
"SERVER_TRANSIENT_STATUSES",
240244
"SNAPSHOT_TRANSIENT_STATUSES",
241245
"TASK_TRANSIENT_STATUSES",

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+
ServerIpState,
1011
ServerState,
1112
SnapshotState,
1213
TaskStatus,
@@ -43,6 +44,13 @@
4344
Lists transient statutes of the enum :class:`SecurityGroupState <SecurityGroupState>`.
4445
"""
4546

47+
SERVER_IP_TRANSIENT_STATUSES: List[ServerIpState] = [
48+
ServerIpState.PENDING,
49+
]
50+
"""
51+
Lists transient statutes of the enum :class:`ServerIpState <ServerIpState>`.
52+
"""
53+
4654
SERVER_TRANSIENT_STATUSES: List[ServerState] = [
4755
ServerState.STARTING,
4856
ServerState.STOPPING,

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
ServerAction,
2525
ServerIpIpFamily,
2626
ServerIpProvisioningMode,
27+
ServerIpState,
2728
ServerState,
2829
SnapshotState,
2930
SnapshotVolumeType,
@@ -498,6 +499,9 @@ def unmarshal_ServerIp(data: Any) -> ServerIp:
498499
field = data.get("provisioning_mode", None)
499500
args["provisioning_mode"] = field
500501

502+
field = data.get("state", None)
503+
args["state"] = field
504+
501505
field = data.get("tags", None)
502506
args["tags"] = field
503507

@@ -2428,6 +2432,9 @@ def marshal_ServerIp(
24282432
request.provisioning_mode
24292433
)
24302434

2435+
if request.state is not None:
2436+
output["state"] = ServerIpState(request.state)
2437+
24312438
if request.tags is not None:
24322439
output["tags"] = request.tags
24332440

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,17 @@ def __str__(self) -> str:
171171
return str(self.value)
172172

173173

174+
class ServerIpState(str, Enum, metaclass=StrEnumMeta):
175+
UNKNOWN_STATE = "unknown_state"
176+
DETACHED = "detached"
177+
ATTACHED = "attached"
178+
PENDING = "pending"
179+
ERROR = "error"
180+
181+
def __str__(self) -> str:
182+
return str(self.value)
183+
184+
174185
class ServerState(str, Enum, metaclass=StrEnumMeta):
175186
RUNNING = "running"
176187
STOPPED = "stopped"
@@ -1272,6 +1283,8 @@ class ServerIp:
12721283
Tags associated with the IP.
12731284
"""
12741285

1286+
state: ServerIpState
1287+
12751288

12761289
@dataclass
12771290
class ServerIpv6:

scaleway/scaleway/instance/v1/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from .types import ServerAction
1818
from .types import ServerIpIpFamily
1919
from .types import ServerIpProvisioningMode
20+
from .types import ServerIpState
2021
from .types import ServerState
2122
from .types import ServerTypesAvailability
2223
from .types import SnapshotState
@@ -114,6 +115,7 @@
114115
from .content import IP_TRANSIENT_STATUSES
115116
from .content import PRIVATE_NIC_TRANSIENT_STATUSES
116117
from .content import SECURITY_GROUP_TRANSIENT_STATUSES
118+
from .content import SERVER_IP_TRANSIENT_STATUSES
117119
from .content import SERVER_TRANSIENT_STATUSES
118120
from .content import SNAPSHOT_TRANSIENT_STATUSES
119121
from .content import TASK_TRANSIENT_STATUSES
@@ -139,6 +141,7 @@
139141
"ServerAction",
140142
"ServerIpIpFamily",
141143
"ServerIpProvisioningMode",
144+
"ServerIpState",
142145
"ServerState",
143146
"ServerTypesAvailability",
144147
"SnapshotState",
@@ -236,6 +239,7 @@
236239
"IP_TRANSIENT_STATUSES",
237240
"PRIVATE_NIC_TRANSIENT_STATUSES",
238241
"SECURITY_GROUP_TRANSIENT_STATUSES",
242+
"SERVER_IP_TRANSIENT_STATUSES",
239243
"SERVER_TRANSIENT_STATUSES",
240244
"SNAPSHOT_TRANSIENT_STATUSES",
241245
"TASK_TRANSIENT_STATUSES",

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+
ServerIpState,
1011
ServerState,
1112
SnapshotState,
1213
TaskStatus,
@@ -43,6 +44,13 @@
4344
Lists transient statutes of the enum :class:`SecurityGroupState <SecurityGroupState>`.
4445
"""
4546

47+
SERVER_IP_TRANSIENT_STATUSES: List[ServerIpState] = [
48+
ServerIpState.PENDING,
49+
]
50+
"""
51+
Lists transient statutes of the enum :class:`ServerIpState <ServerIpState>`.
52+
"""
53+
4654
SERVER_TRANSIENT_STATUSES: List[ServerState] = [
4755
ServerState.STARTING,
4856
ServerState.STOPPING,

scaleway/scaleway/instance/v1/marshalling.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
ServerAction,
2525
ServerIpIpFamily,
2626
ServerIpProvisioningMode,
27+
ServerIpState,
2728
ServerState,
2829
SnapshotState,
2930
SnapshotVolumeType,
@@ -498,6 +499,9 @@ def unmarshal_ServerIp(data: Any) -> ServerIp:
498499
field = data.get("provisioning_mode", None)
499500
args["provisioning_mode"] = field
500501

502+
field = data.get("state", None)
503+
args["state"] = field
504+
501505
field = data.get("tags", None)
502506
args["tags"] = field
503507

@@ -2428,6 +2432,9 @@ def marshal_ServerIp(
24282432
request.provisioning_mode
24292433
)
24302434

2435+
if request.state is not None:
2436+
output["state"] = ServerIpState(request.state)
2437+
24312438
if request.tags is not None:
24322439
output["tags"] = request.tags
24332440

scaleway/scaleway/instance/v1/types.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,17 @@ def __str__(self) -> str:
171171
return str(self.value)
172172

173173

174+
class ServerIpState(str, Enum, metaclass=StrEnumMeta):
175+
UNKNOWN_STATE = "unknown_state"
176+
DETACHED = "detached"
177+
ATTACHED = "attached"
178+
PENDING = "pending"
179+
ERROR = "error"
180+
181+
def __str__(self) -> str:
182+
return str(self.value)
183+
184+
174185
class ServerState(str, Enum, metaclass=StrEnumMeta):
175186
RUNNING = "running"
176187
STOPPED = "stopped"
@@ -1272,6 +1283,8 @@ class ServerIp:
12721283
Tags associated with the IP.
12731284
"""
12741285

1286+
state: ServerIpState
1287+
12751288

12761289
@dataclass
12771290
class ServerIpv6:

0 commit comments

Comments
 (0)