|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | + STACKIT Observability API |
| 5 | +
|
| 6 | + API endpoints for Observability on STACKIT |
| 7 | +
|
| 8 | + The version of the OpenAPI document: 1.1.1 |
| 9 | + |
| 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, Field, StrictBool |
| 22 | +from typing_extensions import Annotated, Self |
| 23 | + |
| 24 | + |
| 25 | +class UpdateAlertConfigsPayloadRouteRoutesInner(BaseModel): |
| 26 | + """ |
| 27 | + As in one level above |
| 28 | + """ # noqa: E501 |
| 29 | + |
| 30 | + var_continue: Optional[StrictBool] = Field(default=False, description="As in one level above", alias="continue") |
| 31 | + group_by: Optional[List[Annotated[str, Field(min_length=1, strict=True, max_length=200)]]] = Field( |
| 32 | + default=None, alias="groupBy" |
| 33 | + ) |
| 34 | + group_interval: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field( |
| 35 | + default=None, description="As in one level above", alias="groupInterval" |
| 36 | + ) |
| 37 | + group_wait: Optional[Annotated[str, Field(strict=True, max_length=8)]] = Field( |
| 38 | + default=None, description="As in one level above", alias="groupWait" |
| 39 | + ) |
| 40 | + match: Optional[Dict[str, Any]] = Field(default=None, description="As in one level above") |
| 41 | + match_re: Optional[Dict[str, Any]] = Field(default=None, description="As in one level above", alias="matchRe") |
| 42 | + matchers: Optional[List[Annotated[str, Field(min_length=1, strict=True, max_length=200)]]] = Field( |
| 43 | + default=None, |
| 44 | + description="A list of matchers that an alert has to fulfill to match the node. A matcher is a string with a syntax inspired by PromQL and OpenMetrics. The syntax of a matcher consists of three tokens: * A valid Prometheus label name. * One of =, !=, =~, or !~. = means equals, != means that the strings are not equal, =~ is used for equality of regex expressions and !~ is used for un-equality of regex expressions. They have the same meaning as known from PromQL selectors. * A UTF-8 string, which may be enclosed in double quotes. Before or after each token, there may be any amount of whitespace. `Additional Validators:` * should not contain more than 5 keys * each key and value should not be longer than 200 characters", |
| 45 | + ) |
| 46 | + receiver: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=100)]] = Field( |
| 47 | + default=None, description="As in one level above" |
| 48 | + ) |
| 49 | + repeat_interval: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field( |
| 50 | + default=None, description="As in one level above", alias="repeatInterval" |
| 51 | + ) |
| 52 | + routes: Optional[List[Dict[str, Any]]] = Field(default=None, description="Another child routes") |
| 53 | + __properties: ClassVar[List[str]] = [ |
| 54 | + "continue", |
| 55 | + "groupBy", |
| 56 | + "groupInterval", |
| 57 | + "groupWait", |
| 58 | + "match", |
| 59 | + "matchRe", |
| 60 | + "matchers", |
| 61 | + "receiver", |
| 62 | + "repeatInterval", |
| 63 | + "routes", |
| 64 | + ] |
| 65 | + |
| 66 | + model_config = ConfigDict( |
| 67 | + populate_by_name=True, |
| 68 | + validate_assignment=True, |
| 69 | + protected_namespaces=(), |
| 70 | + ) |
| 71 | + |
| 72 | + def to_str(self) -> str: |
| 73 | + """Returns the string representation of the model using alias""" |
| 74 | + return pprint.pformat(self.model_dump(by_alias=True)) |
| 75 | + |
| 76 | + def to_json(self) -> str: |
| 77 | + """Returns the JSON representation of the model using alias""" |
| 78 | + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead |
| 79 | + return json.dumps(self.to_dict()) |
| 80 | + |
| 81 | + @classmethod |
| 82 | + def from_json(cls, json_str: str) -> Optional[Self]: |
| 83 | + """Create an instance of UpdateAlertConfigsPayloadRouteRoutesInner from a JSON string""" |
| 84 | + return cls.from_dict(json.loads(json_str)) |
| 85 | + |
| 86 | + def to_dict(self) -> Dict[str, Any]: |
| 87 | + """Return the dictionary representation of the model using alias. |
| 88 | +
|
| 89 | + This has the following differences from calling pydantic's |
| 90 | + `self.model_dump(by_alias=True)`: |
| 91 | +
|
| 92 | + * `None` is only added to the output dict for nullable fields that |
| 93 | + were set at model initialization. Other fields with value `None` |
| 94 | + are ignored. |
| 95 | + """ |
| 96 | + excluded_fields: Set[str] = set([]) |
| 97 | + |
| 98 | + _dict = self.model_dump( |
| 99 | + by_alias=True, |
| 100 | + exclude=excluded_fields, |
| 101 | + exclude_none=True, |
| 102 | + ) |
| 103 | + return _dict |
| 104 | + |
| 105 | + @classmethod |
| 106 | + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: |
| 107 | + """Create an instance of UpdateAlertConfigsPayloadRouteRoutesInner from a dict""" |
| 108 | + if obj is None: |
| 109 | + return None |
| 110 | + |
| 111 | + if not isinstance(obj, dict): |
| 112 | + return cls.model_validate(obj) |
| 113 | + |
| 114 | + _obj = cls.model_validate( |
| 115 | + { |
| 116 | + "continue": obj.get("continue") if obj.get("continue") is not None else False, |
| 117 | + "groupBy": obj.get("groupBy"), |
| 118 | + "groupInterval": obj.get("groupInterval"), |
| 119 | + "groupWait": obj.get("groupWait"), |
| 120 | + "match": obj.get("match"), |
| 121 | + "matchRe": obj.get("matchRe"), |
| 122 | + "matchers": obj.get("matchers"), |
| 123 | + "receiver": obj.get("receiver"), |
| 124 | + "repeatInterval": obj.get("repeatInterval"), |
| 125 | + "routes": obj.get("routes"), |
| 126 | + } |
| 127 | + ) |
| 128 | + return _obj |
0 commit comments