|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | + SKE-API |
| 5 | +
|
| 6 | + The SKE API provides endpoints to create, update, delete clusters within STACKIT portal projects and to trigger further cluster management tasks. |
| 7 | +
|
| 8 | + The version of the OpenAPI document: 2.0 |
| 9 | + Generated by OpenAPI Generator (https://openapi-generator.tech) |
| 10 | +
|
| 11 | + Do not edit the class manually. |
| 12 | +"""# noqa: E501 |
| 13 | + |
| 14 | +from __future__importannotations |
| 15 | + |
| 16 | +importjson |
| 17 | +importpprint |
| 18 | +importre# noqa: F401 |
| 19 | +fromtypingimportAny,ClassVar,Dict,List,Optional,Set |
| 20 | + |
| 21 | +frompydanticimportBaseModel,ConfigDict,Field,field_validator |
| 22 | +fromtyping_extensionsimportAnnotated,Self |
| 23 | + |
| 24 | + |
| 25 | +classNodepoolKubernetes(BaseModel): |
| 26 | +""" |
| 27 | + NodepoolKubernetes |
| 28 | + """# noqa: E501 |
| 29 | + |
| 30 | +version:Optional[Annotated[str,Field(strict=True)]]=Field( |
| 31 | +default=None, |
| 32 | +description="Override the Kubernetes version for the Kubelet of this Nodepool. Version must be equal or lower than the version of the cluster. Only one minor version difference to the version of the cluster is allowed. Downgrade of existing Nodepools is prohibited.", |
| 33 | + ) |
| 34 | +__properties:ClassVar[List[str]]= ["version"] |
| 35 | + |
| 36 | +@field_validator("version") |
| 37 | +defversion_validate_regular_expression(cls,value): |
| 38 | +"""Validates the regular expression""" |
| 39 | +ifvalueisNone: |
| 40 | +returnvalue |
| 41 | + |
| 42 | +ifnotre.match(r"^\d+\.\d+\.\d+$",value): |
| 43 | +raiseValueError(r"must validate the regular expression /^\d+\.\d+\.\d+$/") |
| 44 | +returnvalue |
| 45 | + |
| 46 | +model_config=ConfigDict( |
| 47 | +populate_by_name=True, |
| 48 | +validate_assignment=True, |
| 49 | +protected_namespaces=(), |
| 50 | + ) |
| 51 | + |
| 52 | +defto_str(self)->str: |
| 53 | +"""Returns the string representation of the model using alias""" |
| 54 | +returnpprint.pformat(self.model_dump(by_alias=True)) |
| 55 | + |
| 56 | +defto_json(self)->str: |
| 57 | +"""Returns the JSON representation of the model using alias""" |
| 58 | +# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead |
| 59 | +returnjson.dumps(self.to_dict()) |
| 60 | + |
| 61 | +@classmethod |
| 62 | +deffrom_json(cls,json_str:str)->Optional[Self]: |
| 63 | +"""Create an instance of NodepoolKubernetes from a JSON string""" |
| 64 | +returncls.from_dict(json.loads(json_str)) |
| 65 | + |
| 66 | +defto_dict(self)->Dict[str,Any]: |
| 67 | +"""Return the dictionary representation of the model using alias. |
| 68 | +
|
| 69 | + This has the following differences from calling pydantic's |
| 70 | + `self.model_dump(by_alias=True)`: |
| 71 | +
|
| 72 | + * `None` is only added to the output dict for nullable fields that |
| 73 | + were set at model initialization. Other fields with value `None` |
| 74 | + are ignored. |
| 75 | + """ |
| 76 | +excluded_fields:Set[str]=set([]) |
| 77 | + |
| 78 | +_dict=self.model_dump( |
| 79 | +by_alias=True, |
| 80 | +exclude=excluded_fields, |
| 81 | +exclude_none=True, |
| 82 | + ) |
| 83 | +return_dict |
| 84 | + |
| 85 | +@classmethod |
| 86 | +deffrom_dict(cls,obj:Optional[Dict[str,Any]])->Optional[Self]: |
| 87 | +"""Create an instance of NodepoolKubernetes from a dict""" |
| 88 | +ifobjisNone: |
| 89 | +returnNone |
| 90 | + |
| 91 | +ifnotisinstance(obj,dict): |
| 92 | +returncls.model_validate(obj) |
| 93 | + |
| 94 | +_obj=cls.model_validate({"version":obj.get("version")}) |
| 95 | +return_obj |