|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | + Application Load Balancer API |
| 5 | +
|
| 6 | + This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. |
| 7 | +
|
| 8 | + The version of the OpenAPI document: 2beta2.0.0 |
| 9 | + Generated by OpenAPI Generator (https://openapi-generator.tech) |
| 10 | +
|
| 11 | + Do not edit the class manually. |
| 12 | +""" # noqa: E501 docstring might be too long |
| 13 | + |
| 14 | +from __future__ import annotations |
| 15 | + |
| 16 | +import json |
| 17 | +import pprint |
| 18 | +from typing import Any, ClassVar, Dict, List, Optional, Set |
| 19 | + |
| 20 | +from pydantic import BaseModel, ConfigDict, Field, StrictStr |
| 21 | +from typing_extensions import Self |
| 22 | + |
| 23 | + |
| 24 | +class Path(BaseModel): |
| 25 | + """ |
| 26 | + Path |
| 27 | + """ |
| 28 | + |
| 29 | + exact: Optional[StrictStr] = Field( |
| 30 | + default=None, |
| 31 | + description="Exact path match. Only a request path exactly equal to the value will match, e.g. '/foo' matches only '/foo', not '/foo/bar' or '/foobar'.", |
| 32 | + ) |
| 33 | + prefix: Optional[StrictStr] = Field( |
| 34 | + default=None, |
| 35 | + description="Prefix path match. Only matches on full segment boundaries, e.g. '/foo' matches '/foo' and '/foo/bar' but NOT '/foobar'.", |
| 36 | + ) |
| 37 | + __properties: ClassVar[List[str]] = ["exact", "prefix"] |
| 38 | + |
| 39 | + model_config = ConfigDict( |
| 40 | + populate_by_name=True, |
| 41 | + validate_assignment=True, |
| 42 | + protected_namespaces=(), |
| 43 | + ) |
| 44 | + |
| 45 | + def to_str(self) -> str: |
| 46 | + """Returns the string representation of the model using alias""" |
| 47 | + return pprint.pformat(self.model_dump(by_alias=True)) |
| 48 | + |
| 49 | + def to_json(self) -> str: |
| 50 | + """Returns the JSON representation of the model using alias""" |
| 51 | + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead |
| 52 | + return json.dumps(self.to_dict()) |
| 53 | + |
| 54 | + @classmethod |
| 55 | + def from_json(cls, json_str: str) -> Optional[Self]: |
| 56 | + """Create an instance of Path from a JSON string""" |
| 57 | + return cls.from_dict(json.loads(json_str)) |
| 58 | + |
| 59 | + def to_dict(self) -> Dict[str, Any]: |
| 60 | + """Return the dictionary representation of the model using alias. |
| 61 | +
|
| 62 | + This has the following differences from calling pydantic's |
| 63 | + `self.model_dump(by_alias=True)`: |
| 64 | +
|
| 65 | + * `None` is only added to the output dict for nullable fields that |
| 66 | + were set at model initialization. Other fields with value `None` |
| 67 | + are ignored. |
| 68 | + """ |
| 69 | + excluded_fields: Set[str] = set([]) |
| 70 | + |
| 71 | + _dict = self.model_dump( |
| 72 | + by_alias=True, |
| 73 | + exclude=excluded_fields, |
| 74 | + exclude_none=True, |
| 75 | + ) |
| 76 | + return _dict |
| 77 | + |
| 78 | + @classmethod |
| 79 | + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: |
| 80 | + """Create an instance of Path from a dict""" |
| 81 | + if obj is None: |
| 82 | + return None |
| 83 | + |
| 84 | + if not isinstance(obj, dict): |
| 85 | + return cls.model_validate(obj) |
| 86 | + |
| 87 | + _obj = cls.model_validate({"exact": obj.get("exact"), "prefix": obj.get("prefix")}) |
| 88 | + return _obj |
0 commit comments