4040 from .client import ApiException
4141 from .client .apis .tags .default_api import DefaultApi
4242 from .client .components .schema .cluster_member import ClusterMemberDict
43+ from .client .components .schema .ipv6_config import Ipv6ConfigDict
44+ from .client .components .schema .network_config_output import NetworkConfigOutputDict
4345 from .client .schemas import Unset
4446
4547
@@ -356,11 +358,35 @@ class LoggingConfig:
356358 port : int
357359
358360
361+ @dataclass
362+ class Ipv6Config :
363+ cidr : Optional [str ] = None
364+ gateway : Optional [str ] = None
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+
359374@dataclass
360375class NetworkConfig :
361376 gateway : str
362377 ip_address : str
363378 netmask : str
379+ ipv6 : Optional [Ipv6Config ] = None
380+
381+ @staticmethod
382+ def _from_api (item : "NetworkConfigOutputDict" ) -> "NetworkConfig" :
383+ ipv6 = _unset_to_optional (item .ipv6 )
384+ return NetworkConfig (
385+ gateway = 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+ )
364390
365391
366392@dataclass
@@ -470,14 +496,22 @@ def __init__(self, type: RequestErrorType, reason: Exception) -> None:
470496_T = TypeVar ("_T" )
471497
472498
473- def _optional (value : Optional [_T ]) -> Union [_T , "Unset" ]:
499+ def _optional_to_unset (value : Optional [_T ]) -> Union [_T , "Unset" ]:
474500 from .client .schemas import Unset
475501
476502 if value is None :
477503 return Unset ()
478504 return value
479505
480506
507+ def _unset_to_optional (value : Union [_T , "Unset" ]) -> Optional [_T ]:
508+ from .client .schemas import Unset
509+
510+ if isinstance (value , Unset ):
511+ return None
512+ return value
513+
514+
481515class NetHSM :
482516 def __init__ (
483517 self ,
@@ -1310,11 +1344,7 @@ def get_config_network(self) -> NetworkConfig:
13101344 response = self ._get_api ().config_network_get ()
13111345 except Exception as e :
13121346 _handle_exception (e , state = State .OPERATIONAL , roles = [Role .ADMINISTRATOR ])
1313- return NetworkConfig (
1314- gateway = response .body .gateway ,
1315- ip_address = response .body .ipAddress ,
1316- netmask = response .body .netmask ,
1317- )
1347+ return NetworkConfig ._from_api (response .body )
13181348
13191349 def get_config_time (self ) -> datetime :
13201350 try :
@@ -1447,13 +1477,13 @@ def csr(
14471477
14481478 body = DistinguishedNameDict (
14491479 commonName = common_name ,
1450- countryName = _optional (country ),
1451- stateOrProvinceName = _optional (state_or_province ),
1452- localityName = _optional (locality ),
1453- organizationName = _optional (organization ),
1454- organizationalUnitName = _optional (organizational_unit ),
1455- emailAddress = _optional (email_address ),
1456- subjectAltNames = _optional (subject_alt_names ),
1480+ countryName = _optional_to_unset (country ),
1481+ stateOrProvinceName = _optional_to_unset (state_or_province ),
1482+ localityName = _optional_to_unset (locality ),
1483+ organizationName = _optional_to_unset (organization ),
1484+ organizationalUnitName = _optional_to_unset (organizational_unit ),
1485+ emailAddress = _optional_to_unset (email_address ),
1486+ subjectAltNames = _optional_to_unset (subject_alt_names ),
14571487 )
14581488 try :
14591489 response = self ._get_api ().config_tls_csr_pem_post (
@@ -1474,7 +1504,7 @@ def generate_tls_key(
14741504
14751505 body = TlsKeyGenerateRequestDataDict (
14761506 type = type .value ,
1477- length = _optional (length ),
1507+ length = _optional_to_unset (length ),
14781508 )
14791509
14801510 try :
@@ -1503,13 +1533,13 @@ def key_csr(
15031533 path_params = PathParametersDict (KeyID = key_id )
15041534 body = DistinguishedNameDict (
15051535 commonName = common_name ,
1506- countryName = _optional (country ),
1507- stateOrProvinceName = _optional (state_or_province ),
1508- localityName = _optional (locality ),
1509- organizationName = _optional (organization ),
1510- organizationalUnitName = _optional (organizational_unit ),
1511- emailAddress = _optional (email_address ),
1512- subjectAltNames = _optional (subject_alt_names ),
1536+ countryName = _optional_to_unset (country ),
1537+ stateOrProvinceName = _optional_to_unset (state_or_province ),
1538+ localityName = _optional_to_unset (locality ),
1539+ organizationName = _optional_to_unset (organization ),
1540+ organizationalUnitName = _optional_to_unset (organizational_unit ),
1541+ emailAddress = _optional_to_unset (email_address ),
1542+ subjectAltNames = _optional_to_unset (subject_alt_names ),
15131543 )
15141544 try :
15151545 response = self ._get_api ().keys_key_id_csr_pem_post (
0 commit comments