Skip to content

Commit 85fc085

Browse files
stackit-pipelinerubenhoenle
andauthoredMar 27, 2025··
Generator: Update SDK /services/observability (#805)
Co-authored-by: Ruben Hoenle <Ruben.Hoenle@stackit.cloud>
1 parent f428363 commit 85fc085

17 files changed

+5330
-891
lines changed
 

‎CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
- `iaas`: [v0.5.0](services/iaas/CHANGELOG.md#v050-2025-03-24)
3232
- **Improvement:** Upgrading from IaaS **beta** endpoints to **v1**
3333
- **Feature:** Add new method to filter `ListMachineTypes`: `Filter`
34+
- `observability`: [v0.3.0](services/observability/CHANGELOG.md#v030-2025-03-27)
35+
- **Feature:** Added support for alert groups and alert rules.
3436

3537
## Release (2025-03-05)
3638

‎services/observability/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v0.3.0 (2025-03-27)
2+
3+
- **Feature:** Added support for alert groups and alert rules.
4+
15
## v0.2.0 (2025-01-13)
26

37
- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL.

‎services/observability/pyproject.toml

+1-1
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.2.0"
6+
version = "v0.3.0"
77
authors = [
88
"STACKIT Developer Tools <developer-tools@stackit.cloud>",
99
]

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

+21
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
from stackit.observability.models.alert_config_route_response import (
4242
AlertConfigRouteResponse,
4343
)
44+
from stackit.observability.models.alert_group import AlertGroup
45+
from stackit.observability.models.alert_group_response import AlertGroupResponse
46+
from stackit.observability.models.alert_groups_response import AlertGroupsResponse
47+
from stackit.observability.models.alert_rule import AlertRule
48+
from stackit.observability.models.alert_rule_record import AlertRuleRecord
49+
from stackit.observability.models.alert_rules_response import AlertRulesResponse
4450
from stackit.observability.models.basic_auth import BasicAuth
4551
from stackit.observability.models.create_alert_config_receiver_payload import (
4652
CreateAlertConfigReceiverPayload,
@@ -60,6 +66,12 @@
6066
from stackit.observability.models.create_alert_config_route_payload_routes_inner import (
6167
CreateAlertConfigRoutePayloadRoutesInner,
6268
)
69+
from stackit.observability.models.create_alertgroups_payload import (
70+
CreateAlertgroupsPayload,
71+
)
72+
from stackit.observability.models.create_alertrules_payload import (
73+
CreateAlertrulesPayload,
74+
)
6375
from stackit.observability.models.create_credentials_response import (
6476
CreateCredentialsResponse,
6577
)
@@ -168,6 +180,15 @@
168180
from stackit.observability.models.update_alert_configs_response import (
169181
UpdateAlertConfigsResponse,
170182
)
183+
from stackit.observability.models.update_alertgroup_payload import (
184+
UpdateAlertgroupPayload,
185+
)
186+
from stackit.observability.models.update_alertgroups_request_inner import (
187+
UpdateAlertgroupsRequestInner,
188+
)
189+
from stackit.observability.models.update_alertgroups_request_inner_rules_inner import (
190+
UpdateAlertgroupsRequestInnerRulesInner,
191+
)
171192
from stackit.observability.models.update_credentials_remote_write_config_payload import (
172193
UpdateCredentialsRemoteWriteConfigPayload,
173194
)

‎services/observability/src/stackit/observability/api/default_api.py

+4,159-890
Large diffs are not rendered by default.

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

+21
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
from stackit.observability.models.alert_config_route_response import (
2323
AlertConfigRouteResponse,
2424
)
25+
from stackit.observability.models.alert_group import AlertGroup
26+
from stackit.observability.models.alert_group_response import AlertGroupResponse
27+
from stackit.observability.models.alert_groups_response import AlertGroupsResponse
28+
from stackit.observability.models.alert_rule import AlertRule
29+
from stackit.observability.models.alert_rule_record import AlertRuleRecord
30+
from stackit.observability.models.alert_rules_response import AlertRulesResponse
2531
from stackit.observability.models.basic_auth import BasicAuth
2632
from stackit.observability.models.create_alert_config_receiver_payload import (
2733
CreateAlertConfigReceiverPayload,
@@ -41,6 +47,12 @@
4147
from stackit.observability.models.create_alert_config_route_payload_routes_inner import (
4248
CreateAlertConfigRoutePayloadRoutesInner,
4349
)
50+
from stackit.observability.models.create_alertgroups_payload import (
51+
CreateAlertgroupsPayload,
52+
)
53+
from stackit.observability.models.create_alertrules_payload import (
54+
CreateAlertrulesPayload,
55+
)
4456
from stackit.observability.models.create_credentials_response import (
4557
CreateCredentialsResponse,
4658
)
@@ -149,6 +161,15 @@
149161
from stackit.observability.models.update_alert_configs_response import (
150162
UpdateAlertConfigsResponse,
151163
)
164+
from stackit.observability.models.update_alertgroup_payload import (
165+
UpdateAlertgroupPayload,
166+
)
167+
from stackit.observability.models.update_alertgroups_request_inner import (
168+
UpdateAlertgroupsRequestInner,
169+
)
170+
from stackit.observability.models.update_alertgroups_request_inner_rules_inner import (
171+
UpdateAlertgroupsRequestInnerRulesInner,
172+
)
152173
from stackit.observability.models.update_credentials_remote_write_config_payload import (
153174
UpdateCredentialsRemoteWriteConfigPayload,
154175
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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+
Contact: stackit-argus@mail.schwarz
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501 docstring might be too long
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
22+
from typing_extensions import Annotated, Self
23+
24+
from stackit.observability.models.alert_rule_record import AlertRuleRecord
25+
26+
27+
class AlertGroup(BaseModel):
28+
"""
29+
AlertGroup
30+
"""
31+
32+
interval: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = "60s"
33+
name: Annotated[str, Field(min_length=1, strict=True, max_length=200)]
34+
rules: List[AlertRuleRecord]
35+
__properties: ClassVar[List[str]] = ["interval", "name", "rules"]
36+
37+
model_config = ConfigDict(
38+
populate_by_name=True,
39+
validate_assignment=True,
40+
protected_namespaces=(),
41+
)
42+
43+
def to_str(self) -> str:
44+
"""Returns the string representation of the model using alias"""
45+
return pprint.pformat(self.model_dump(by_alias=True))
46+
47+
def to_json(self) -> str:
48+
"""Returns the JSON representation of the model using alias"""
49+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50+
return json.dumps(self.to_dict())
51+
52+
@classmethod
53+
def from_json(cls, json_str: str) -> Optional[Self]:
54+
"""Create an instance of AlertGroup from a JSON string"""
55+
return cls.from_dict(json.loads(json_str))
56+
57+
def to_dict(self) -> Dict[str, Any]:
58+
"""Return the dictionary representation of the model using alias.
59+
60+
This has the following differences from calling pydantic's
61+
`self.model_dump(by_alias=True)`:
62+
63+
* `None` is only added to the output dict for nullable fields that
64+
were set at model initialization. Other fields with value `None`
65+
are ignored.
66+
"""
67+
excluded_fields: Set[str] = set([])
68+
69+
_dict = self.model_dump(
70+
by_alias=True,
71+
exclude=excluded_fields,
72+
exclude_none=True,
73+
)
74+
# override the default output from pydantic by calling `to_dict()` of each item in rules (list)
75+
_items = []
76+
if self.rules:
77+
for _item in self.rules:
78+
if _item:
79+
_items.append(_item.to_dict())
80+
_dict["rules"] = _items
81+
return _dict
82+
83+
@classmethod
84+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85+
"""Create an instance of AlertGroup from a dict"""
86+
if obj is None:
87+
return None
88+
89+
if not isinstance(obj, dict):
90+
return cls.model_validate(obj)
91+
92+
_obj = cls.model_validate(
93+
{
94+
"interval": obj.get("interval") if obj.get("interval") is not None else "60s",
95+
"name": obj.get("name"),
96+
"rules": (
97+
[AlertRuleRecord.from_dict(_item) for _item in obj["rules"]]
98+
if obj.get("rules") is not None
99+
else None
100+
),
101+
}
102+
)
103+
return _obj
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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+
Contact: stackit-argus@mail.schwarz
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501 docstring might be too long
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
22+
from typing_extensions import Annotated, Self
23+
24+
from stackit.observability.models.alert_group import AlertGroup
25+
26+
27+
class AlertGroupResponse(BaseModel):
28+
"""
29+
AlertGroupResponse
30+
"""
31+
32+
data: AlertGroup
33+
message: Annotated[str, Field(min_length=1, strict=True)]
34+
__properties: ClassVar[List[str]] = ["data", "message"]
35+
36+
model_config = ConfigDict(
37+
populate_by_name=True,
38+
validate_assignment=True,
39+
protected_namespaces=(),
40+
)
41+
42+
def to_str(self) -> str:
43+
"""Returns the string representation of the model using alias"""
44+
return pprint.pformat(self.model_dump(by_alias=True))
45+
46+
def to_json(self) -> str:
47+
"""Returns the JSON representation of the model using alias"""
48+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49+
return json.dumps(self.to_dict())
50+
51+
@classmethod
52+
def from_json(cls, json_str: str) -> Optional[Self]:
53+
"""Create an instance of AlertGroupResponse from a JSON string"""
54+
return cls.from_dict(json.loads(json_str))
55+
56+
def to_dict(self) -> Dict[str, Any]:
57+
"""Return the dictionary representation of the model using alias.
58+
59+
This has the following differences from calling pydantic's
60+
`self.model_dump(by_alias=True)`:
61+
62+
* `None` is only added to the output dict for nullable fields that
63+
were set at model initialization. Other fields with value `None`
64+
are ignored.
65+
"""
66+
excluded_fields: Set[str] = set([])
67+
68+
_dict = self.model_dump(
69+
by_alias=True,
70+
exclude=excluded_fields,
71+
exclude_none=True,
72+
)
73+
# override the default output from pydantic by calling `to_dict()` of data
74+
if self.data:
75+
_dict["data"] = self.data.to_dict()
76+
return _dict
77+
78+
@classmethod
79+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80+
"""Create an instance of AlertGroupResponse 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(
88+
{
89+
"data": AlertGroup.from_dict(obj["data"]) if obj.get("data") is not None else None,
90+
"message": obj.get("message"),
91+
}
92+
)
93+
return _obj
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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+
Contact: stackit-argus@mail.schwarz
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501 docstring might be too long
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
22+
from typing_extensions import Annotated, Self
23+
24+
from stackit.observability.models.alert_group import AlertGroup
25+
26+
27+
class AlertGroupsResponse(BaseModel):
28+
"""
29+
AlertGroupsResponse
30+
"""
31+
32+
data: List[AlertGroup]
33+
message: Annotated[str, Field(min_length=1, strict=True)]
34+
__properties: ClassVar[List[str]] = ["data", "message"]
35+
36+
model_config = ConfigDict(
37+
populate_by_name=True,
38+
validate_assignment=True,
39+
protected_namespaces=(),
40+
)
41+
42+
def to_str(self) -> str:
43+
"""Returns the string representation of the model using alias"""
44+
return pprint.pformat(self.model_dump(by_alias=True))
45+
46+
def to_json(self) -> str:
47+
"""Returns the JSON representation of the model using alias"""
48+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49+
return json.dumps(self.to_dict())
50+
51+
@classmethod
52+
def from_json(cls, json_str: str) -> Optional[Self]:
53+
"""Create an instance of AlertGroupsResponse from a JSON string"""
54+
return cls.from_dict(json.loads(json_str))
55+
56+
def to_dict(self) -> Dict[str, Any]:
57+
"""Return the dictionary representation of the model using alias.
58+
59+
This has the following differences from calling pydantic's
60+
`self.model_dump(by_alias=True)`:
61+
62+
* `None` is only added to the output dict for nullable fields that
63+
were set at model initialization. Other fields with value `None`
64+
are ignored.
65+
"""
66+
excluded_fields: Set[str] = set([])
67+
68+
_dict = self.model_dump(
69+
by_alias=True,
70+
exclude=excluded_fields,
71+
exclude_none=True,
72+
)
73+
# override the default output from pydantic by calling `to_dict()` of each item in data (list)
74+
_items = []
75+
if self.data:
76+
for _item in self.data:
77+
if _item:
78+
_items.append(_item.to_dict())
79+
_dict["data"] = _items
80+
return _dict
81+
82+
@classmethod
83+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84+
"""Create an instance of AlertGroupsResponse from a dict"""
85+
if obj is None:
86+
return None
87+
88+
if not isinstance(obj, dict):
89+
return cls.model_validate(obj)
90+
91+
_obj = cls.model_validate(
92+
{
93+
"data": [AlertGroup.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None,
94+
"message": obj.get("message"),
95+
}
96+
)
97+
return _obj
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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+
Contact: stackit-argus@mail.schwarz
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501 docstring might be too long
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
22+
from typing_extensions import Annotated, Self
23+
24+
25+
class AlertRule(BaseModel):
26+
"""
27+
AlertRule
28+
"""
29+
30+
alert: Annotated[str, Field(min_length=1, strict=True, max_length=200)]
31+
annotations: Optional[Dict[str, Annotated[str, Field(min_length=1, strict=True)]]] = None
32+
expr: Annotated[str, Field(min_length=1, strict=True, max_length=600)]
33+
var_for: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field(default="0s", alias="for")
34+
labels: Optional[Dict[str, Annotated[str, Field(min_length=1, strict=True)]]] = None
35+
__properties: ClassVar[List[str]] = ["alert", "annotations", "expr", "for", "labels"]
36+
37+
model_config = ConfigDict(
38+
populate_by_name=True,
39+
validate_assignment=True,
40+
protected_namespaces=(),
41+
)
42+
43+
def to_str(self) -> str:
44+
"""Returns the string representation of the model using alias"""
45+
return pprint.pformat(self.model_dump(by_alias=True))
46+
47+
def to_json(self) -> str:
48+
"""Returns the JSON representation of the model using alias"""
49+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50+
return json.dumps(self.to_dict())
51+
52+
@classmethod
53+
def from_json(cls, json_str: str) -> Optional[Self]:
54+
"""Create an instance of AlertRule from a JSON string"""
55+
return cls.from_dict(json.loads(json_str))
56+
57+
def to_dict(self) -> Dict[str, Any]:
58+
"""Return the dictionary representation of the model using alias.
59+
60+
This has the following differences from calling pydantic's
61+
`self.model_dump(by_alias=True)`:
62+
63+
* `None` is only added to the output dict for nullable fields that
64+
were set at model initialization. Other fields with value `None`
65+
are ignored.
66+
"""
67+
excluded_fields: Set[str] = set([])
68+
69+
_dict = self.model_dump(
70+
by_alias=True,
71+
exclude=excluded_fields,
72+
exclude_none=True,
73+
)
74+
return _dict
75+
76+
@classmethod
77+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78+
"""Create an instance of AlertRule from a dict"""
79+
if obj is None:
80+
return None
81+
82+
if not isinstance(obj, dict):
83+
return cls.model_validate(obj)
84+
85+
_obj = cls.model_validate(
86+
{
87+
"alert": obj.get("alert"),
88+
"annotations": obj.get("annotations"),
89+
"expr": obj.get("expr"),
90+
"for": obj.get("for") if obj.get("for") is not None else "0s",
91+
"labels": obj.get("labels"),
92+
}
93+
)
94+
return _obj
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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+
Contact: stackit-argus@mail.schwarz
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501 docstring might be too long
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
22+
from typing_extensions import Annotated, Self
23+
24+
25+
class AlertRuleRecord(BaseModel):
26+
"""
27+
AlertRuleRecord
28+
"""
29+
30+
alert: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=200)]] = None
31+
annotations: Optional[Dict[str, Annotated[str, Field(min_length=1, strict=True)]]] = None
32+
expr: Annotated[str, Field(min_length=1, strict=True, max_length=600)]
33+
var_for: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field(default=None, alias="for")
34+
labels: Optional[Dict[str, Annotated[str, Field(min_length=1, strict=True)]]] = None
35+
record: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=300)]] = None
36+
__properties: ClassVar[List[str]] = ["alert", "annotations", "expr", "for", "labels", "record"]
37+
38+
model_config = ConfigDict(
39+
populate_by_name=True,
40+
validate_assignment=True,
41+
protected_namespaces=(),
42+
)
43+
44+
def to_str(self) -> str:
45+
"""Returns the string representation of the model using alias"""
46+
return pprint.pformat(self.model_dump(by_alias=True))
47+
48+
def to_json(self) -> str:
49+
"""Returns the JSON representation of the model using alias"""
50+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51+
return json.dumps(self.to_dict())
52+
53+
@classmethod
54+
def from_json(cls, json_str: str) -> Optional[Self]:
55+
"""Create an instance of AlertRuleRecord from a JSON string"""
56+
return cls.from_dict(json.loads(json_str))
57+
58+
def to_dict(self) -> Dict[str, Any]:
59+
"""Return the dictionary representation of the model using alias.
60+
61+
This has the following differences from calling pydantic's
62+
`self.model_dump(by_alias=True)`:
63+
64+
* `None` is only added to the output dict for nullable fields that
65+
were set at model initialization. Other fields with value `None`
66+
are ignored.
67+
"""
68+
excluded_fields: Set[str] = set([])
69+
70+
_dict = self.model_dump(
71+
by_alias=True,
72+
exclude=excluded_fields,
73+
exclude_none=True,
74+
)
75+
return _dict
76+
77+
@classmethod
78+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79+
"""Create an instance of AlertRuleRecord from a dict"""
80+
if obj is None:
81+
return None
82+
83+
if not isinstance(obj, dict):
84+
return cls.model_validate(obj)
85+
86+
_obj = cls.model_validate(
87+
{
88+
"alert": obj.get("alert"),
89+
"annotations": obj.get("annotations"),
90+
"expr": obj.get("expr"),
91+
"for": obj.get("for"),
92+
"labels": obj.get("labels"),
93+
"record": obj.get("record"),
94+
}
95+
)
96+
return _obj
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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+
Contact: stackit-argus@mail.schwarz
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501 docstring might be too long
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
22+
from typing_extensions import Annotated, Self
23+
24+
from stackit.observability.models.alert_rule import AlertRule
25+
26+
27+
class AlertRulesResponse(BaseModel):
28+
"""
29+
AlertRulesResponse
30+
"""
31+
32+
data: List[AlertRule]
33+
message: Annotated[str, Field(min_length=1, strict=True)]
34+
__properties: ClassVar[List[str]] = ["data", "message"]
35+
36+
model_config = ConfigDict(
37+
populate_by_name=True,
38+
validate_assignment=True,
39+
protected_namespaces=(),
40+
)
41+
42+
def to_str(self) -> str:
43+
"""Returns the string representation of the model using alias"""
44+
return pprint.pformat(self.model_dump(by_alias=True))
45+
46+
def to_json(self) -> str:
47+
"""Returns the JSON representation of the model using alias"""
48+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49+
return json.dumps(self.to_dict())
50+
51+
@classmethod
52+
def from_json(cls, json_str: str) -> Optional[Self]:
53+
"""Create an instance of AlertRulesResponse from a JSON string"""
54+
return cls.from_dict(json.loads(json_str))
55+
56+
def to_dict(self) -> Dict[str, Any]:
57+
"""Return the dictionary representation of the model using alias.
58+
59+
This has the following differences from calling pydantic's
60+
`self.model_dump(by_alias=True)`:
61+
62+
* `None` is only added to the output dict for nullable fields that
63+
were set at model initialization. Other fields with value `None`
64+
are ignored.
65+
"""
66+
excluded_fields: Set[str] = set([])
67+
68+
_dict = self.model_dump(
69+
by_alias=True,
70+
exclude=excluded_fields,
71+
exclude_none=True,
72+
)
73+
# override the default output from pydantic by calling `to_dict()` of each item in data (list)
74+
_items = []
75+
if self.data:
76+
for _item in self.data:
77+
if _item:
78+
_items.append(_item.to_dict())
79+
_dict["data"] = _items
80+
return _dict
81+
82+
@classmethod
83+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84+
"""Create an instance of AlertRulesResponse from a dict"""
85+
if obj is None:
86+
return None
87+
88+
if not isinstance(obj, dict):
89+
return cls.model_validate(obj)
90+
91+
_obj = cls.model_validate(
92+
{
93+
"data": [AlertRule.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None,
94+
"message": obj.get("message"),
95+
}
96+
)
97+
return _obj
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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+
Contact: stackit-argus@mail.schwarz
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501 docstring might be too long
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
22+
from typing_extensions import Annotated, Self
23+
24+
from stackit.observability.models.update_alertgroups_request_inner_rules_inner import (
25+
UpdateAlertgroupsRequestInnerRulesInner,
26+
)
27+
28+
29+
class CreateAlertgroupsPayload(BaseModel):
30+
"""
31+
Alert group that should be created or updated `Additional Validators:` * total config should not be bigger than 500000 characters as string since this the limitation of prometheus.
32+
"""
33+
34+
interval: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field(
35+
default="60s",
36+
description="How often rules in the group are evaluated. `Additional Validators:` * must be a valid time string * should be >=60s",
37+
)
38+
name: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(
39+
description="The name of the group. Must be unique. `Additional Validators:` * is the identifier and so unique * should only include the characters: a-zA-Z0-9-"
40+
)
41+
rules: List[UpdateAlertgroupsRequestInnerRulesInner] = Field(description="rules for the alert group")
42+
__properties: ClassVar[List[str]] = ["interval", "name", "rules"]
43+
44+
model_config = ConfigDict(
45+
populate_by_name=True,
46+
validate_assignment=True,
47+
protected_namespaces=(),
48+
)
49+
50+
def to_str(self) -> str:
51+
"""Returns the string representation of the model using alias"""
52+
return pprint.pformat(self.model_dump(by_alias=True))
53+
54+
def to_json(self) -> str:
55+
"""Returns the JSON representation of the model using alias"""
56+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57+
return json.dumps(self.to_dict())
58+
59+
@classmethod
60+
def from_json(cls, json_str: str) -> Optional[Self]:
61+
"""Create an instance of CreateAlertgroupsPayload from a JSON string"""
62+
return cls.from_dict(json.loads(json_str))
63+
64+
def to_dict(self) -> Dict[str, Any]:
65+
"""Return the dictionary representation of the model using alias.
66+
67+
This has the following differences from calling pydantic's
68+
`self.model_dump(by_alias=True)`:
69+
70+
* `None` is only added to the output dict for nullable fields that
71+
were set at model initialization. Other fields with value `None`
72+
are ignored.
73+
"""
74+
excluded_fields: Set[str] = set([])
75+
76+
_dict = self.model_dump(
77+
by_alias=True,
78+
exclude=excluded_fields,
79+
exclude_none=True,
80+
)
81+
# override the default output from pydantic by calling `to_dict()` of each item in rules (list)
82+
_items = []
83+
if self.rules:
84+
for _item in self.rules:
85+
if _item:
86+
_items.append(_item.to_dict())
87+
_dict["rules"] = _items
88+
return _dict
89+
90+
@classmethod
91+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92+
"""Create an instance of CreateAlertgroupsPayload from a dict"""
93+
if obj is None:
94+
return None
95+
96+
if not isinstance(obj, dict):
97+
return cls.model_validate(obj)
98+
99+
_obj = cls.model_validate(
100+
{
101+
"interval": obj.get("interval") if obj.get("interval") is not None else "60s",
102+
"name": obj.get("name"),
103+
"rules": (
104+
[UpdateAlertgroupsRequestInnerRulesInner.from_dict(_item) for _item in obj["rules"]]
105+
if obj.get("rules") is not None
106+
else None
107+
),
108+
}
109+
)
110+
return _obj
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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+
Contact: stackit-argus@mail.schwarz
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501 docstring might be too long
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
22+
from typing_extensions import Annotated, Self
23+
24+
25+
class CreateAlertrulesPayload(BaseModel):
26+
"""
27+
Alert rule. `Additional Validators:` * total config (all alert groups/rules) should not be bigger than 500000 characters as string since this the limitation of prometheus.
28+
"""
29+
30+
alert: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(
31+
description="The name of the alert. `Additional Validators:` * is the identifier and so unique in the group * should only include the characters: a-zA-Z0-9-"
32+
)
33+
annotations: Optional[Dict[str, Any]] = Field(
34+
default=None,
35+
description="map of key:value. Annotations to add to each alert. `Additional Validators:` * should not contain more than 5 keys * each key and value should not be longer than 200 characters",
36+
)
37+
expr: Annotated[str, Field(min_length=1, strict=True, max_length=600)] = Field(
38+
description="The PromQL expression to evaluate. Every evaluation cycle this is evaluated at the current time, and all resultant time series become pending/firing alerts."
39+
)
40+
var_for: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field(
41+
default="0s",
42+
description="Alerts are considered firing once they have been returned for this long. Alerts which have not yet fired for long enough are considered pending. `Additional Validators:` * must be a valid time string",
43+
alias="for",
44+
)
45+
labels: Optional[Dict[str, Any]] = Field(
46+
default=None,
47+
description="map of key:value. Labels to add or overwrite for each alert. `Additional Validators:` * should not contain more than 10 keys * each key and value should not be longer than 200 characters",
48+
)
49+
__properties: ClassVar[List[str]] = ["alert", "annotations", "expr", "for", "labels"]
50+
51+
model_config = ConfigDict(
52+
populate_by_name=True,
53+
validate_assignment=True,
54+
protected_namespaces=(),
55+
)
56+
57+
def to_str(self) -> str:
58+
"""Returns the string representation of the model using alias"""
59+
return pprint.pformat(self.model_dump(by_alias=True))
60+
61+
def to_json(self) -> str:
62+
"""Returns the JSON representation of the model using alias"""
63+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
64+
return json.dumps(self.to_dict())
65+
66+
@classmethod
67+
def from_json(cls, json_str: str) -> Optional[Self]:
68+
"""Create an instance of CreateAlertrulesPayload from a JSON string"""
69+
return cls.from_dict(json.loads(json_str))
70+
71+
def to_dict(self) -> Dict[str, Any]:
72+
"""Return the dictionary representation of the model using alias.
73+
74+
This has the following differences from calling pydantic's
75+
`self.model_dump(by_alias=True)`:
76+
77+
* `None` is only added to the output dict for nullable fields that
78+
were set at model initialization. Other fields with value `None`
79+
are ignored.
80+
"""
81+
excluded_fields: Set[str] = set([])
82+
83+
_dict = self.model_dump(
84+
by_alias=True,
85+
exclude=excluded_fields,
86+
exclude_none=True,
87+
)
88+
return _dict
89+
90+
@classmethod
91+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92+
"""Create an instance of CreateAlertrulesPayload from a dict"""
93+
if obj is None:
94+
return None
95+
96+
if not isinstance(obj, dict):
97+
return cls.model_validate(obj)
98+
99+
_obj = cls.model_validate(
100+
{
101+
"alert": obj.get("alert"),
102+
"annotations": obj.get("annotations"),
103+
"expr": obj.get("expr"),
104+
"for": obj.get("for") if obj.get("for") is not None else "0s",
105+
"labels": obj.get("labels"),
106+
}
107+
)
108+
return _obj
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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+
Contact: stackit-argus@mail.schwarz
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501 docstring might be too long
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
22+
from typing_extensions import Annotated, Self
23+
24+
from stackit.observability.models.update_alertgroups_request_inner_rules_inner import (
25+
UpdateAlertgroupsRequestInnerRulesInner,
26+
)
27+
28+
29+
class UpdateAlertgroupPayload(BaseModel):
30+
"""
31+
Alert group that should be created or updated `Additional Validators:` * total config should not be bigger than 500000 characters as string since this the limitation of prometheus.
32+
"""
33+
34+
interval: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field(
35+
default="60s",
36+
description="How often rules in the group are evaluated. `Additional Validators:` * must be a valid time string * should be >=60s",
37+
)
38+
rules: List[UpdateAlertgroupsRequestInnerRulesInner] = Field(description="rules for the alert group")
39+
__properties: ClassVar[List[str]] = ["interval", "rules"]
40+
41+
model_config = ConfigDict(
42+
populate_by_name=True,
43+
validate_assignment=True,
44+
protected_namespaces=(),
45+
)
46+
47+
def to_str(self) -> str:
48+
"""Returns the string representation of the model using alias"""
49+
return pprint.pformat(self.model_dump(by_alias=True))
50+
51+
def to_json(self) -> str:
52+
"""Returns the JSON representation of the model using alias"""
53+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54+
return json.dumps(self.to_dict())
55+
56+
@classmethod
57+
def from_json(cls, json_str: str) -> Optional[Self]:
58+
"""Create an instance of UpdateAlertgroupPayload from a JSON string"""
59+
return cls.from_dict(json.loads(json_str))
60+
61+
def to_dict(self) -> Dict[str, Any]:
62+
"""Return the dictionary representation of the model using alias.
63+
64+
This has the following differences from calling pydantic's
65+
`self.model_dump(by_alias=True)`:
66+
67+
* `None` is only added to the output dict for nullable fields that
68+
were set at model initialization. Other fields with value `None`
69+
are ignored.
70+
"""
71+
excluded_fields: Set[str] = set([])
72+
73+
_dict = self.model_dump(
74+
by_alias=True,
75+
exclude=excluded_fields,
76+
exclude_none=True,
77+
)
78+
# override the default output from pydantic by calling `to_dict()` of each item in rules (list)
79+
_items = []
80+
if self.rules:
81+
for _item in self.rules:
82+
if _item:
83+
_items.append(_item.to_dict())
84+
_dict["rules"] = _items
85+
return _dict
86+
87+
@classmethod
88+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89+
"""Create an instance of UpdateAlertgroupPayload from a dict"""
90+
if obj is None:
91+
return None
92+
93+
if not isinstance(obj, dict):
94+
return cls.model_validate(obj)
95+
96+
_obj = cls.model_validate(
97+
{
98+
"interval": obj.get("interval") if obj.get("interval") is not None else "60s",
99+
"rules": (
100+
[UpdateAlertgroupsRequestInnerRulesInner.from_dict(_item) for _item in obj["rules"]]
101+
if obj.get("rules") is not None
102+
else None
103+
),
104+
}
105+
)
106+
return _obj
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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+
Contact: stackit-argus@mail.schwarz
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501 docstring might be too long
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
22+
from typing_extensions import Annotated, Self
23+
24+
from stackit.observability.models.update_alertgroups_request_inner_rules_inner import (
25+
UpdateAlertgroupsRequestInnerRulesInner,
26+
)
27+
28+
29+
class UpdateAlertgroupsRequestInner(BaseModel):
30+
"""
31+
Alert group that should be created or updated `Additional Validators:` * total config should not be bigger than 500000 characters as string since this the limitation of prometheus.
32+
"""
33+
34+
interval: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field(
35+
default="60s",
36+
description="How often rules in the group are evaluated. `Additional Validators:` * must be a valid time string * should be >=60s",
37+
)
38+
name: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(
39+
description="The name of the group. Must be unique. `Additional Validators:` * is the identifier and so unique * should only include the characters: a-zA-Z0-9-"
40+
)
41+
rules: List[UpdateAlertgroupsRequestInnerRulesInner] = Field(description="rules for the alert group")
42+
__properties: ClassVar[List[str]] = ["interval", "name", "rules"]
43+
44+
model_config = ConfigDict(
45+
populate_by_name=True,
46+
validate_assignment=True,
47+
protected_namespaces=(),
48+
)
49+
50+
def to_str(self) -> str:
51+
"""Returns the string representation of the model using alias"""
52+
return pprint.pformat(self.model_dump(by_alias=True))
53+
54+
def to_json(self) -> str:
55+
"""Returns the JSON representation of the model using alias"""
56+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57+
return json.dumps(self.to_dict())
58+
59+
@classmethod
60+
def from_json(cls, json_str: str) -> Optional[Self]:
61+
"""Create an instance of UpdateAlertgroupsRequestInner from a JSON string"""
62+
return cls.from_dict(json.loads(json_str))
63+
64+
def to_dict(self) -> Dict[str, Any]:
65+
"""Return the dictionary representation of the model using alias.
66+
67+
This has the following differences from calling pydantic's
68+
`self.model_dump(by_alias=True)`:
69+
70+
* `None` is only added to the output dict for nullable fields that
71+
were set at model initialization. Other fields with value `None`
72+
are ignored.
73+
"""
74+
excluded_fields: Set[str] = set([])
75+
76+
_dict = self.model_dump(
77+
by_alias=True,
78+
exclude=excluded_fields,
79+
exclude_none=True,
80+
)
81+
# override the default output from pydantic by calling `to_dict()` of each item in rules (list)
82+
_items = []
83+
if self.rules:
84+
for _item in self.rules:
85+
if _item:
86+
_items.append(_item.to_dict())
87+
_dict["rules"] = _items
88+
return _dict
89+
90+
@classmethod
91+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92+
"""Create an instance of UpdateAlertgroupsRequestInner from a dict"""
93+
if obj is None:
94+
return None
95+
96+
if not isinstance(obj, dict):
97+
return cls.model_validate(obj)
98+
99+
_obj = cls.model_validate(
100+
{
101+
"interval": obj.get("interval") if obj.get("interval") is not None else "60s",
102+
"name": obj.get("name"),
103+
"rules": (
104+
[UpdateAlertgroupsRequestInnerRulesInner.from_dict(_item) for _item in obj["rules"]]
105+
if obj.get("rules") is not None
106+
else None
107+
),
108+
}
109+
)
110+
return _obj
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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+
Contact: stackit-argus@mail.schwarz
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501 docstring might be too long
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
22+
from typing_extensions import Annotated, Self
23+
24+
25+
class UpdateAlertgroupsRequestInnerRulesInner(BaseModel):
26+
"""
27+
Alert rule. `Additional Validators:` * total config (all alert groups/rules) should not be bigger than 500000 characters as string since this the limitation of prometheus.
28+
"""
29+
30+
alert: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(
31+
description="The name of the alert. `Additional Validators:` * is the identifier and so unique in the group * should only include the characters: a-zA-Z0-9-"
32+
)
33+
annotations: Optional[Dict[str, Any]] = Field(
34+
default=None,
35+
description="map of key:value. Annotations to add to each alert. `Additional Validators:` * should not contain more than 5 keys * each key and value should not be longer than 200 characters",
36+
)
37+
expr: Annotated[str, Field(min_length=1, strict=True, max_length=600)] = Field(
38+
description="The PromQL expression to evaluate. Every evaluation cycle this is evaluated at the current time, and all resultant time series become pending/firing alerts."
39+
)
40+
var_for: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field(
41+
default="0s",
42+
description="Alerts are considered firing once they have been returned for this long. Alerts which have not yet fired for long enough are considered pending. `Additional Validators:` * must be a valid time string",
43+
alias="for",
44+
)
45+
labels: Optional[Dict[str, Any]] = Field(
46+
default=None,
47+
description="map of key:value. Labels to add or overwrite for each alert. `Additional Validators:` * should not contain more than 10 keys * each key and value should not be longer than 200 characters",
48+
)
49+
__properties: ClassVar[List[str]] = ["alert", "annotations", "expr", "for", "labels"]
50+
51+
model_config = ConfigDict(
52+
populate_by_name=True,
53+
validate_assignment=True,
54+
protected_namespaces=(),
55+
)
56+
57+
def to_str(self) -> str:
58+
"""Returns the string representation of the model using alias"""
59+
return pprint.pformat(self.model_dump(by_alias=True))
60+
61+
def to_json(self) -> str:
62+
"""Returns the JSON representation of the model using alias"""
63+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
64+
return json.dumps(self.to_dict())
65+
66+
@classmethod
67+
def from_json(cls, json_str: str) -> Optional[Self]:
68+
"""Create an instance of UpdateAlertgroupsRequestInnerRulesInner from a JSON string"""
69+
return cls.from_dict(json.loads(json_str))
70+
71+
def to_dict(self) -> Dict[str, Any]:
72+
"""Return the dictionary representation of the model using alias.
73+
74+
This has the following differences from calling pydantic's
75+
`self.model_dump(by_alias=True)`:
76+
77+
* `None` is only added to the output dict for nullable fields that
78+
were set at model initialization. Other fields with value `None`
79+
are ignored.
80+
"""
81+
excluded_fields: Set[str] = set([])
82+
83+
_dict = self.model_dump(
84+
by_alias=True,
85+
exclude=excluded_fields,
86+
exclude_none=True,
87+
)
88+
return _dict
89+
90+
@classmethod
91+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92+
"""Create an instance of UpdateAlertgroupsRequestInnerRulesInner from a dict"""
93+
if obj is None:
94+
return None
95+
96+
if not isinstance(obj, dict):
97+
return cls.model_validate(obj)
98+
99+
_obj = cls.model_validate(
100+
{
101+
"alert": obj.get("alert"),
102+
"annotations": obj.get("annotations"),
103+
"expr": obj.get("expr"),
104+
"for": obj.get("for") if obj.get("for") is not None else "0s",
105+
"labels": obj.get("labels"),
106+
}
107+
)
108+
return _obj

0 commit comments

Comments
 (0)
Please sign in to comment.