1919import re
2020from typing import Any , ClassVar , Dict , List , Optional , Set
2121
22- from pydantic import BaseModel , ConfigDict , Field , StrictBool , field_validator
22+ from pydantic import (
23+ BaseModel ,
24+ ConfigDict ,
25+ Field ,
26+ StrictBool ,
27+ StrictStr ,
28+ field_validator ,
29+ )
2330from typing_extensions import Annotated , Self
2431
25- from stackit .iaasalpha .models .allowed_addresses_inner import AllowedAddressesInner
26-
2732
2833class UpdateNICPayload (BaseModel ):
2934 """
3035 Object that represents a network interface update.
3136 """
3237
33- allowed_addresses : Optional [List [AllowedAddressesInner ]] = Field (
38+ allowed_addresses : Optional [List [StrictStr ]] = Field (
3439 default = None , description = "A list of IPs or CIDR notations." , alias = "allowedAddresses"
3540 )
3641 labels : Optional [Dict [str , Any ]] = Field (
@@ -96,13 +101,6 @@ def to_dict(self) -> Dict[str, Any]:
96101 exclude = excluded_fields ,
97102 exclude_none = True ,
98103 )
99- # override the default output from pydantic by calling `to_dict()` of each item in allowed_addresses (list)
100- _items = []
101- if self .allowed_addresses :
102- for _item in self .allowed_addresses :
103- if _item :
104- _items .append (_item .to_dict ())
105- _dict ["allowedAddresses" ] = _items
106104 return _dict
107105
108106 @classmethod
@@ -116,11 +114,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
116114
117115 _obj = cls .model_validate (
118116 {
119- "allowedAddresses" : (
120- [AllowedAddressesInner .from_dict (_item ) for _item in obj ["allowedAddresses" ]]
121- if obj .get ("allowedAddresses" ) is not None
122- else None
123- ),
117+ "allowedAddresses" : obj .get ("allowedAddresses" ),
124118 "labels" : obj .get ("labels" ),
125119 "name" : obj .get ("name" ),
126120 "nicSecurity" : obj .get ("nicSecurity" ),
0 commit comments