|
40 | 40 | from .client import ApiException |
41 | 41 | from .client.apis.tags.default_api import DefaultApi |
42 | 42 | from .client.components.schema.cluster_member import ClusterMemberDict |
| 43 | + from .client.components.schema.ipv6_config import Ipv6ConfigDict |
| 44 | + from .client.components.schema.network_config import NetworkConfigDict |
43 | 45 | from .client.schemas import Unset |
44 | 46 |
|
45 | 47 |
|
@@ -356,11 +358,35 @@ class LoggingConfig: |
356 | 358 | port: int |
357 | 359 |
|
358 | 360 |
|
| 361 | +@dataclass |
| 362 | +class Ipv6Config: |
| 363 | + cidr: Optional[str] |
| 364 | + gateway: Optional[str] |
| 365 | + |
| 366 | + @staticmethod |
| 367 | + def _from_api(item: "Ipv6ConfigDict") -> "Ipv6Config": |
| 368 | + return Ipv6Config( |
| 369 | + cidr=_unset_to_optional(item.cidr), |
| 370 | + gateway=_unset_to_optional(item.gateway), |
| 371 | + ) |
| 372 | + |
| 373 | + |
359 | 374 | @dataclass |
360 | 375 | class NetworkConfig: |
361 | 376 | gateway: Optional[str] |
362 | 377 | ip_address: str |
363 | 378 | netmask: str |
| 379 | + ipv6: Optional[Ipv6Config] |
| 380 | + |
| 381 | + @staticmethod |
| 382 | + def _from_api(item: "NetworkConfigDict") -> "NetworkConfig": |
| 383 | + ipv6 = _unset_to_optional(item.ipv6) |
| 384 | + return NetworkConfig( |
| 385 | + gateway=_unset_to_optional(item.gateway), |
| 386 | + ip_address=item.ipAddress, |
| 387 | + netmask=item.netmask, |
| 388 | + ipv6=Ipv6Config._from_api(ipv6) if ipv6 is not None else None, |
| 389 | + ) |
364 | 390 |
|
365 | 391 |
|
366 | 392 | @dataclass |
@@ -1324,11 +1350,7 @@ def get_config_network(self) -> NetworkConfig: |
1324 | 1350 | response = self._get_api().config_network_get() |
1325 | 1351 | except Exception as e: |
1326 | 1352 | _handle_exception(e, state=State.OPERATIONAL, roles=[Role.ADMINISTRATOR]) |
1327 | | - return NetworkConfig( |
1328 | | - gateway=_unset_to_optional(response.body.gateway), |
1329 | | - ip_address=response.body.ipAddress, |
1330 | | - netmask=response.body.netmask, |
1331 | | - ) |
| 1353 | + return NetworkConfig._from_api(response.body) |
1332 | 1354 |
|
1333 | 1355 | def get_config_time(self) -> datetime: |
1334 | 1356 | try: |
|
0 commit comments