Skip to content

Commit 23d1f74

Browse files
Generator: Update SDK /services/observability (#2250)
Co-authored-by: Ruben Hoenle <[email protected]>
1 parent a052591 commit 23d1f74

File tree

7 files changed

+147
-12
lines changed

7 files changed

+147
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
- **Deprecation:** The `backend` field is now deprecated in all relevant models. Use the new `protection` field instead
88
- `iaas`: [v0.8.1](services/iaas/CHANGELOG.md#v081)
99
- **Internal:** Add workaround to fix upstream OpenAPI generator issue where regex patterns include leading/trailing slashes that need to be removed for validation in `AllowedAddressesInner`, `AreaId`, and `CreateProtocol` models
10-
- `observability`: [v0.9.0](services/observability/CHANGELOG.md#v090)
10+
- `observability`:
11+
- [v0.9.1](services/observability/CHANGELOG.md#v091)
12+
- Introduce new model `UpdateAlertConfigsPayloadRouteRoutesInner`
13+
- [v0.9.0](services/observability/CHANGELOG.md#v090)
1114
- **Feature:** Add new `GoogleChat` webhook
1215

1316
## Release (2025-08-13)

services/observability/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v0.9.1
2+
- Introduce new model `UpdateAlertConfigsPayloadRouteRoutesInner`
3+
14
## v0.9.0
25
- **Feature:** Add new `GoogleChat` webhook
36

services/observability/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "stackit-observability"
33

44
[tool.poetry]
55
name = "stackit-observability"
6-
version = "v0.9.0"
6+
version = "v0.9.1"
77
authors = [
88
"STACKIT Developer Tools <[email protected]>",
99
]

services/observability/src/stackit/observability/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
"UpdateAlertConfigsPayloadInhibitRules",
113113
"UpdateAlertConfigsPayloadReceiversInner",
114114
"UpdateAlertConfigsPayloadRoute",
115+
"UpdateAlertConfigsPayloadRouteRoutesInner",
115116
"UpdateAlertConfigsResponse",
116117
"UpdateAlertgroupPayload",
117118
"UpdateAlertgroupsRequestInner",
@@ -343,6 +344,9 @@
343344
from stackit.observability.models.update_alert_configs_payload_route import (
344345
UpdateAlertConfigsPayloadRoute as UpdateAlertConfigsPayloadRoute,
345346
)
347+
from stackit.observability.models.update_alert_configs_payload_route_routes_inner import (
348+
UpdateAlertConfigsPayloadRouteRoutesInner as UpdateAlertConfigsPayloadRouteRoutesInner,
349+
)
346350
from stackit.observability.models.update_alert_configs_response import (
347351
UpdateAlertConfigsResponse as UpdateAlertConfigsResponse,
348352
)

services/observability/src/stackit/observability/models/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@
168168
from stackit.observability.models.update_alert_configs_payload_route import (
169169
UpdateAlertConfigsPayloadRoute,
170170
)
171+
from stackit.observability.models.update_alert_configs_payload_route_routes_inner import (
172+
UpdateAlertConfigsPayloadRouteRoutesInner,
173+
)
171174
from stackit.observability.models.update_alert_configs_response import (
172175
UpdateAlertConfigsResponse,
173176
)

services/observability/src/stackit/observability/models/update_alert_configs_payload_route.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
from pydantic import BaseModel, ConfigDict, Field, StrictBool
2222
from typing_extensions import Annotated, Self
2323

24-
from stackit.observability.models.create_alert_config_route_payload_routes_inner import (
25-
CreateAlertConfigRoutePayloadRoutesInner,
24+
from stackit.observability.models.update_alert_configs_payload_route_routes_inner import (
25+
UpdateAlertConfigsPayloadRouteRoutesInner,
2626
)
2727

2828

@@ -60,10 +60,6 @@ class UpdateAlertConfigsPayloadRoute(BaseModel):
6060
description="map of key:value. A set of regex-matchers an alert has to fulfill to match the node. `Additional Validators:` * should not contain more than 5 keys * each key and value should not be longer than 200 characters",
6161
alias="matchRe",
6262
)
63-
matchers: Optional[List[Annotated[str, Field(min_length=1, strict=True, max_length=200)]]] = Field(
64-
default=None,
65-
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",
66-
)
6763
receiver: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(
6864
description="Receiver that should be one item of receivers `Additional Validators:` * must be a in name of receivers"
6965
)
@@ -72,7 +68,7 @@ class UpdateAlertConfigsPayloadRoute(BaseModel):
7268
description="How long to wait before sending a notification again if it has already been sent successfully for an alert. (Usually ~3h or more). `Additional Validators:` * must be a valid time format",
7369
alias="repeatInterval",
7470
)
75-
routes: Optional[List[CreateAlertConfigRoutePayloadRoutesInner]] = Field(
71+
routes: Optional[List[UpdateAlertConfigsPayloadRouteRoutesInner]] = Field(
7672
default=None, description="Zero or more child routes."
7773
)
7874
__properties: ClassVar[List[str]] = [
@@ -82,7 +78,6 @@ class UpdateAlertConfigsPayloadRoute(BaseModel):
8278
"groupWait",
8379
"match",
8480
"matchRe",
85-
"matchers",
8681
"receiver",
8782
"repeatInterval",
8883
"routes",
@@ -151,11 +146,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
151146
"groupWait": obj.get("groupWait") if obj.get("groupWait") is not None else "30s",
152147
"match": obj.get("match"),
153148
"matchRe": obj.get("matchRe"),
154-
"matchers": obj.get("matchers"),
155149
"receiver": obj.get("receiver"),
156150
"repeatInterval": obj.get("repeatInterval") if obj.get("repeatInterval") is not None else "4h",
157151
"routes": (
158-
[CreateAlertConfigRoutePayloadRoutesInner.from_dict(_item) for _item in obj["routes"]]
152+
[UpdateAlertConfigsPayloadRouteRoutesInner.from_dict(_item) for _item in obj["routes"]]
159153
if obj.get("routes") is not None
160154
else None
161155
),
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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

Comments
 (0)