|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | +STACKIT DNS API |
| 5 | +
|
| 6 | +This api provides dns |
| 7 | +
|
| 8 | +The version of the OpenAPI document: 1.0 |
| 9 | +Contact: dns@stackit.cloud |
| 10 | +Generated by OpenAPI Generator (https://openapi-generator.tech) |
| 11 | +
|
| 12 | +Do not edit the class manually. |
| 13 | +""" # noqa: E501 |
| 14 | + |
| 15 | +from __future__ import annotations |
| 16 | + |
| 17 | +import json |
| 18 | +import pprint |
| 19 | +from typing import Any, ClassVar, Dict, List, Optional, Set |
| 20 | + |
| 21 | +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator |
| 22 | +from pydantic_core import to_jsonable_python |
| 23 | +from typing_extensions import Self |
| 24 | + |
| 25 | + |
| 26 | +class FlushDomainPayload(BaseModel): |
| 27 | + """ |
| 28 | + FlushDomainPayload |
| 29 | + """ # noqa: E501 |
| 30 | + |
| 31 | + domain: StrictStr |
| 32 | + type: Optional[StrictStr] = None |
| 33 | + __properties: ClassVar[List[str]] = ["domain", "type"] |
| 34 | + |
| 35 | + @field_validator("type") |
| 36 | + def type_validate_enum(cls, value): |
| 37 | + """Validates the enum""" |
| 38 | + if value is None: |
| 39 | + return value |
| 40 | + |
| 41 | + if value not in set( |
| 42 | + [ |
| 43 | + "A", |
| 44 | + "AAAA", |
| 45 | + "SOA", |
| 46 | + "CNAME", |
| 47 | + "NS", |
| 48 | + "MX", |
| 49 | + "TXT", |
| 50 | + "SRV", |
| 51 | + "PTR", |
| 52 | + "DNAME", |
| 53 | + "CAA", |
| 54 | + "DNSKEY", |
| 55 | + "DS", |
| 56 | + "LOC", |
| 57 | + "NAPTR", |
| 58 | + "SSHFP", |
| 59 | + "TLSA", |
| 60 | + "URI", |
| 61 | + "CERT", |
| 62 | + "SVCB", |
| 63 | + "CSYNC", |
| 64 | + "HINFO", |
| 65 | + "HTTPS", |
| 66 | + ] |
| 67 | + ): |
| 68 | + raise ValueError( |
| 69 | + "must be one of enum values ('A', 'AAAA', 'SOA', 'CNAME', 'NS', 'MX', 'TXT', 'SRV', 'PTR', 'DNAME', 'CAA', 'DNSKEY', 'DS', 'LOC', 'NAPTR', 'SSHFP', 'TLSA', 'URI', 'CERT', 'SVCB', 'CSYNC', 'HINFO', 'HTTPS')" |
| 70 | + ) |
| 71 | + return value |
| 72 | + |
| 73 | + model_config = ConfigDict( |
| 74 | + validate_by_name=True, |
| 75 | + validate_by_alias=True, |
| 76 | + validate_assignment=True, |
| 77 | + protected_namespaces=(), |
| 78 | + ) |
| 79 | + |
| 80 | + def to_str(self) -> str: |
| 81 | + """Returns the string representation of the model using alias""" |
| 82 | + return pprint.pformat(self.model_dump(by_alias=True)) |
| 83 | + |
| 84 | + def to_json(self) -> str: |
| 85 | + """Returns the JSON representation of the model using alias""" |
| 86 | + return json.dumps(to_jsonable_python(self.to_dict())) |
| 87 | + |
| 88 | + @classmethod |
| 89 | + def from_json(cls, json_str: str) -> Optional[Self]: |
| 90 | + """Create an instance of FlushDomainPayload from a JSON string""" |
| 91 | + return cls.from_dict(json.loads(json_str)) |
| 92 | + |
| 93 | + def to_dict(self) -> Dict[str, Any]: |
| 94 | + """Return the dictionary representation of the model using alias. |
| 95 | +
|
| 96 | + This has the following differences from calling pydantic's |
| 97 | + `self.model_dump(by_alias=True)`: |
| 98 | +
|
| 99 | + * `None` is only added to the output dict for nullable fields that |
| 100 | + were set at model initialization. Other fields with value `None` |
| 101 | + are ignored. |
| 102 | + """ |
| 103 | + excluded_fields: Set[str] = set([]) |
| 104 | + |
| 105 | + _dict = self.model_dump( |
| 106 | + by_alias=True, |
| 107 | + exclude=excluded_fields, |
| 108 | + exclude_none=True, |
| 109 | + ) |
| 110 | + return _dict |
| 111 | + |
| 112 | + @classmethod |
| 113 | + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: |
| 114 | + """Create an instance of FlushDomainPayload from a dict""" |
| 115 | + if obj is None: |
| 116 | + return None |
| 117 | + |
| 118 | + if not isinstance(obj, dict): |
| 119 | + return cls.model_validate(obj) |
| 120 | + |
| 121 | + _obj = cls.model_validate({"domain": obj.get("domain"), "type": obj.get("type")}) |
| 122 | + return _obj |
0 commit comments