stackit-observability 0.0.1a0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. stackit/observability/__init__.py +190 -0
  2. stackit/observability/api/__init__.py +4 -0
  3. stackit/observability/api/default_api.py +9455 -0
  4. stackit/observability/api_client.py +627 -0
  5. stackit/observability/api_response.py +23 -0
  6. stackit/observability/configuration.py +112 -0
  7. stackit/observability/exceptions.py +199 -0
  8. stackit/observability/models/__init__.py +171 -0
  9. stackit/observability/models/alert.py +125 -0
  10. stackit/observability/models/alert_config_receivers_response.py +97 -0
  11. stackit/observability/models/alert_config_route_response.py +93 -0
  12. stackit/observability/models/basic_auth.py +83 -0
  13. stackit/observability/models/create_alert_config_receiver_payload.py +152 -0
  14. stackit/observability/models/create_alert_config_receiver_payload_email_configs_inner.py +114 -0
  15. stackit/observability/models/create_alert_config_receiver_payload_opsgenie_configs_inner.py +94 -0
  16. stackit/observability/models/create_alert_config_receiver_payload_web_hook_configs_inner.py +92 -0
  17. stackit/observability/models/create_alert_config_route_payload.py +157 -0
  18. stackit/observability/models/create_alert_config_route_payload_routes_inner.py +119 -0
  19. stackit/observability/models/create_credentials_response.py +95 -0
  20. stackit/observability/models/create_instance_payload.py +88 -0
  21. stackit/observability/models/create_instance_response.py +90 -0
  22. stackit/observability/models/create_scrape_config_payload.py +267 -0
  23. stackit/observability/models/create_scrape_config_payload_basic_auth.py +87 -0
  24. stackit/observability/models/create_scrape_config_payload_http_sd_configs_inner.py +133 -0
  25. stackit/observability/models/create_scrape_config_payload_http_sd_configs_inner_oauth2.py +115 -0
  26. stackit/observability/models/create_scrape_config_payload_http_sd_configs_inner_oauth2_tls_config.py +90 -0
  27. stackit/observability/models/create_scrape_config_payload_metrics_relabel_configs_inner.py +146 -0
  28. stackit/observability/models/create_scrape_config_payload_static_configs_inner.py +88 -0
  29. stackit/observability/models/credentials.py +83 -0
  30. stackit/observability/models/credentials_remote_write_config.py +90 -0
  31. stackit/observability/models/credentials_remote_write_delete_response.py +83 -0
  32. stackit/observability/models/delete_scrape_config_response.py +97 -0
  33. stackit/observability/models/email_config.py +114 -0
  34. stackit/observability/models/error.py +83 -0
  35. stackit/observability/models/get_alert_configs_response.py +93 -0
  36. stackit/observability/models/get_credentials_response.py +92 -0
  37. stackit/observability/models/get_instance_response.py +164 -0
  38. stackit/observability/models/get_metrics_storage_retention_response.py +103 -0
  39. stackit/observability/models/get_scrape_config_response.py +90 -0
  40. stackit/observability/models/grafana_configs.py +99 -0
  41. stackit/observability/models/grafana_oauth.py +124 -0
  42. stackit/observability/models/http_service_sd.py +109 -0
  43. stackit/observability/models/inhibit_rules.py +120 -0
  44. stackit/observability/models/instance.py +155 -0
  45. stackit/observability/models/instance_response.py +82 -0
  46. stackit/observability/models/instance_sensitive_data.py +159 -0
  47. stackit/observability/models/job.py +207 -0
  48. stackit/observability/models/list_acl_response.py +83 -0
  49. stackit/observability/models/list_credentials_response.py +101 -0
  50. stackit/observability/models/list_instances_response.py +101 -0
  51. stackit/observability/models/list_scrape_configs_response.py +97 -0
  52. stackit/observability/models/message.py +82 -0
  53. stackit/observability/models/metrics_relabel_config.py +122 -0
  54. stackit/observability/models/model_global.py +125 -0
  55. stackit/observability/models/o_auth2.py +101 -0
  56. stackit/observability/models/opsgenie_config.py +98 -0
  57. stackit/observability/models/permission_denied.py +82 -0
  58. stackit/observability/models/plan.py +156 -0
  59. stackit/observability/models/plan_model.py +147 -0
  60. stackit/observability/models/plans_response.py +97 -0
  61. stackit/observability/models/project_instance_full.py +124 -0
  62. stackit/observability/models/receiver.py +93 -0
  63. stackit/observability/models/receivers.py +129 -0
  64. stackit/observability/models/route.py +135 -0
  65. stackit/observability/models/route_serializer.py +127 -0
  66. stackit/observability/models/scrape_configs_response.py +97 -0
  67. stackit/observability/models/service_keys_list.py +86 -0
  68. stackit/observability/models/static_configs.py +83 -0
  69. stackit/observability/models/tls_config.py +88 -0
  70. stackit/observability/models/update_acl_payload.py +82 -0
  71. stackit/observability/models/update_alert_config_receiver_payload.py +152 -0
  72. stackit/observability/models/update_alert_config_route_payload.py +157 -0
  73. stackit/observability/models/update_alert_configs_payload.py +133 -0
  74. stackit/observability/models/update_alert_configs_payload_global.py +139 -0
  75. stackit/observability/models/update_alert_configs_payload_inhibit_rules.py +113 -0
  76. stackit/observability/models/update_alert_configs_payload_receivers_inner.py +152 -0
  77. stackit/observability/models/update_alert_configs_payload_route.py +157 -0
  78. stackit/observability/models/update_alert_configs_response.py +93 -0
  79. stackit/observability/models/update_credentials_remote_write_config_payload.py +86 -0
  80. stackit/observability/models/update_grafana_configs_payload.py +109 -0
  81. stackit/observability/models/update_grafana_configs_payload_generic_oauth.py +135 -0
  82. stackit/observability/models/update_instance_payload.py +88 -0
  83. stackit/observability/models/update_metrics_storage_retention_payload.py +99 -0
  84. stackit/observability/models/update_scrape_config_payload.py +225 -0
  85. stackit/observability/models/update_scrape_config_payload_static_configs_inner.py +88 -0
  86. stackit/observability/models/web_hook.py +90 -0
  87. stackit/observability/py.typed +0 -0
  88. stackit/observability/rest.py +149 -0
  89. stackit_observability-0.0.1a0.dist-info/METADATA +44 -0
  90. stackit_observability-0.0.1a0.dist-info/RECORD +91 -0
  91. stackit_observability-0.0.1a0.dist-info/WHEEL +4 -0
@@ -0,0 +1,124 @@
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, StrictStr, field_validator
22
+ from typing_extensions import Annotated, Self
23
+
24
+
25
+ class ProjectInstanceFull(BaseModel):
26
+ """
27
+ ProjectInstanceFull
28
+ """
29
+
30
+ error: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=200)]] = None
31
+ id: Annotated[str, Field(min_length=1, strict=True)]
32
+ instance: Annotated[str, Field(min_length=1, strict=True, max_length=63)]
33
+ name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=300)]] = None
34
+ plan_name: Annotated[str, Field(min_length=1, strict=True, max_length=40)] = Field(alias="planName")
35
+ service_name: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(alias="serviceName")
36
+ status: StrictStr
37
+ __properties: ClassVar[List[str]] = ["error", "id", "instance", "name", "planName", "serviceName", "status"]
38
+
39
+ @field_validator("status")
40
+ def status_validate_enum(cls, value):
41
+ """Validates the enum"""
42
+ if value not in set(
43
+ [
44
+ "CREATING",
45
+ "CREATE_SUCCEEDED",
46
+ "CREATE_FAILED",
47
+ "DELETING",
48
+ "DELETE_SUCCEEDED",
49
+ "DELETE_FAILED",
50
+ "UPDATING",
51
+ "UPDATE_SUCCEEDED",
52
+ "UPDATE_FAILED",
53
+ ]
54
+ ):
55
+ raise ValueError(
56
+ "must be one of enum values ('CREATING', 'CREATE_SUCCEEDED', 'CREATE_FAILED', 'DELETING', 'DELETE_SUCCEEDED', 'DELETE_FAILED', 'UPDATING', 'UPDATE_SUCCEEDED', 'UPDATE_FAILED')"
57
+ )
58
+ return value
59
+
60
+ model_config = ConfigDict(
61
+ populate_by_name=True,
62
+ validate_assignment=True,
63
+ protected_namespaces=(),
64
+ )
65
+
66
+ def to_str(self) -> str:
67
+ """Returns the string representation of the model using alias"""
68
+ return pprint.pformat(self.model_dump(by_alias=True))
69
+
70
+ def to_json(self) -> str:
71
+ """Returns the JSON representation of the model using alias"""
72
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
73
+ return json.dumps(self.to_dict())
74
+
75
+ @classmethod
76
+ def from_json(cls, json_str: str) -> Optional[Self]:
77
+ """Create an instance of ProjectInstanceFull from a JSON string"""
78
+ return cls.from_dict(json.loads(json_str))
79
+
80
+ def to_dict(self) -> Dict[str, Any]:
81
+ """Return the dictionary representation of the model using alias.
82
+
83
+ This has the following differences from calling pydantic's
84
+ `self.model_dump(by_alias=True)`:
85
+
86
+ * `None` is only added to the output dict for nullable fields that
87
+ were set at model initialization. Other fields with value `None`
88
+ are ignored.
89
+ """
90
+ excluded_fields: Set[str] = set([])
91
+
92
+ _dict = self.model_dump(
93
+ by_alias=True,
94
+ exclude=excluded_fields,
95
+ exclude_none=True,
96
+ )
97
+ # set to None if error (nullable) is None
98
+ # and model_fields_set contains the field
99
+ if self.error is None and "error" in self.model_fields_set:
100
+ _dict["error"] = None
101
+
102
+ return _dict
103
+
104
+ @classmethod
105
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
106
+ """Create an instance of ProjectInstanceFull from a dict"""
107
+ if obj is None:
108
+ return None
109
+
110
+ if not isinstance(obj, dict):
111
+ return cls.model_validate(obj)
112
+
113
+ _obj = cls.model_validate(
114
+ {
115
+ "error": obj.get("error"),
116
+ "id": obj.get("id"),
117
+ "instance": obj.get("instance"),
118
+ "name": obj.get("name"),
119
+ "planName": obj.get("planName"),
120
+ "serviceName": obj.get("serviceName"),
121
+ "status": obj.get("status"),
122
+ }
123
+ )
124
+ return _obj
@@ -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.receivers import Receivers
25
+
26
+
27
+ class Receiver(BaseModel):
28
+ """
29
+ Receiver
30
+ """
31
+
32
+ data: Receivers
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 Receiver 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 Receiver 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": Receivers.from_dict(obj["data"]) if obj.get("data") is not None else None,
90
+ "message": obj.get("message"),
91
+ }
92
+ )
93
+ return _obj
@@ -0,0 +1,129 @@
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.email_config import EmailConfig
25
+ from stackit.observability.models.opsgenie_config import OpsgenieConfig
26
+ from stackit.observability.models.web_hook import WebHook
27
+
28
+
29
+ class Receivers(BaseModel):
30
+ """
31
+ Receivers
32
+ """
33
+
34
+ email_configs: Optional[List[EmailConfig]] = Field(default=None, alias="emailConfigs")
35
+ name: Annotated[str, Field(min_length=1, strict=True, max_length=200)]
36
+ opsgenie_configs: Optional[List[OpsgenieConfig]] = Field(default=None, alias="opsgenieConfigs")
37
+ web_hook_configs: Optional[List[WebHook]] = Field(default=None, alias="webHookConfigs")
38
+ __properties: ClassVar[List[str]] = ["emailConfigs", "name", "opsgenieConfigs", "webHookConfigs"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
+ return json.dumps(self.to_dict())
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of Receivers from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ """
70
+ excluded_fields: Set[str] = set([])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ # override the default output from pydantic by calling `to_dict()` of each item in email_configs (list)
78
+ _items = []
79
+ if self.email_configs:
80
+ for _item in self.email_configs:
81
+ if _item:
82
+ _items.append(_item.to_dict())
83
+ _dict["emailConfigs"] = _items
84
+ # override the default output from pydantic by calling `to_dict()` of each item in opsgenie_configs (list)
85
+ _items = []
86
+ if self.opsgenie_configs:
87
+ for _item in self.opsgenie_configs:
88
+ if _item:
89
+ _items.append(_item.to_dict())
90
+ _dict["opsgenieConfigs"] = _items
91
+ # override the default output from pydantic by calling `to_dict()` of each item in web_hook_configs (list)
92
+ _items = []
93
+ if self.web_hook_configs:
94
+ for _item in self.web_hook_configs:
95
+ if _item:
96
+ _items.append(_item.to_dict())
97
+ _dict["webHookConfigs"] = _items
98
+ return _dict
99
+
100
+ @classmethod
101
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
102
+ """Create an instance of Receivers from a dict"""
103
+ if obj is None:
104
+ return None
105
+
106
+ if not isinstance(obj, dict):
107
+ return cls.model_validate(obj)
108
+
109
+ _obj = cls.model_validate(
110
+ {
111
+ "emailConfigs": (
112
+ [EmailConfig.from_dict(_item) for _item in obj["emailConfigs"]]
113
+ if obj.get("emailConfigs") is not None
114
+ else None
115
+ ),
116
+ "name": obj.get("name"),
117
+ "opsgenieConfigs": (
118
+ [OpsgenieConfig.from_dict(_item) for _item in obj["opsgenieConfigs"]]
119
+ if obj.get("opsgenieConfigs") is not None
120
+ else None
121
+ ),
122
+ "webHookConfigs": (
123
+ [WebHook.from_dict(_item) for _item in obj["webHookConfigs"]]
124
+ if obj.get("webHookConfigs") is not None
125
+ else None
126
+ ),
127
+ }
128
+ )
129
+ return _obj
@@ -0,0 +1,135 @@
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, StrictBool
22
+ from typing_extensions import Annotated, Self
23
+
24
+ from stackit.observability.models.route_serializer import RouteSerializer
25
+
26
+
27
+ class Route(BaseModel):
28
+ """
29
+ Route
30
+ """
31
+
32
+ var_continue: Optional[StrictBool] = Field(default=False, alias="continue")
33
+ group_by: Optional[
34
+ Annotated[List[Annotated[str, Field(min_length=1, strict=True, max_length=200)]], Field(max_length=5)]
35
+ ] = Field(default=None, alias="groupBy")
36
+ group_interval: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field(
37
+ default="5m", alias="groupInterval"
38
+ )
39
+ group_wait: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field(
40
+ default="30s", alias="groupWait"
41
+ )
42
+ match: Optional[Dict[str, Annotated[str, Field(min_length=1, strict=True, max_length=200)]]] = None
43
+ match_re: Optional[Dict[str, Annotated[str, Field(min_length=1, strict=True, max_length=200)]]] = Field(
44
+ default=None, alias="matchRe"
45
+ )
46
+ receiver: Annotated[str, Field(min_length=1, strict=True, max_length=200)]
47
+ repeat_interval: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field(
48
+ default="4h", alias="repeatInterval"
49
+ )
50
+ routes: Optional[List[RouteSerializer]] = None
51
+ __properties: ClassVar[List[str]] = [
52
+ "continue",
53
+ "groupBy",
54
+ "groupInterval",
55
+ "groupWait",
56
+ "match",
57
+ "matchRe",
58
+ "receiver",
59
+ "repeatInterval",
60
+ "routes",
61
+ ]
62
+
63
+ model_config = ConfigDict(
64
+ populate_by_name=True,
65
+ validate_assignment=True,
66
+ protected_namespaces=(),
67
+ )
68
+
69
+ def to_str(self) -> str:
70
+ """Returns the string representation of the model using alias"""
71
+ return pprint.pformat(self.model_dump(by_alias=True))
72
+
73
+ def to_json(self) -> str:
74
+ """Returns the JSON representation of the model using alias"""
75
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
76
+ return json.dumps(self.to_dict())
77
+
78
+ @classmethod
79
+ def from_json(cls, json_str: str) -> Optional[Self]:
80
+ """Create an instance of Route from a JSON string"""
81
+ return cls.from_dict(json.loads(json_str))
82
+
83
+ def to_dict(self) -> Dict[str, Any]:
84
+ """Return the dictionary representation of the model using alias.
85
+
86
+ This has the following differences from calling pydantic's
87
+ `self.model_dump(by_alias=True)`:
88
+
89
+ * `None` is only added to the output dict for nullable fields that
90
+ were set at model initialization. Other fields with value `None`
91
+ are ignored.
92
+ """
93
+ excluded_fields: Set[str] = set([])
94
+
95
+ _dict = self.model_dump(
96
+ by_alias=True,
97
+ exclude=excluded_fields,
98
+ exclude_none=True,
99
+ )
100
+ # override the default output from pydantic by calling `to_dict()` of each item in routes (list)
101
+ _items = []
102
+ if self.routes:
103
+ for _item in self.routes:
104
+ if _item:
105
+ _items.append(_item.to_dict())
106
+ _dict["routes"] = _items
107
+ return _dict
108
+
109
+ @classmethod
110
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
111
+ """Create an instance of Route from a dict"""
112
+ if obj is None:
113
+ return None
114
+
115
+ if not isinstance(obj, dict):
116
+ return cls.model_validate(obj)
117
+
118
+ _obj = cls.model_validate(
119
+ {
120
+ "continue": obj.get("continue") if obj.get("continue") is not None else False,
121
+ "groupBy": obj.get("groupBy"),
122
+ "groupInterval": obj.get("groupInterval") if obj.get("groupInterval") is not None else "5m",
123
+ "groupWait": obj.get("groupWait") if obj.get("groupWait") is not None else "30s",
124
+ "match": obj.get("match"),
125
+ "matchRe": obj.get("matchRe"),
126
+ "receiver": obj.get("receiver"),
127
+ "repeatInterval": obj.get("repeatInterval") if obj.get("repeatInterval") is not None else "4h",
128
+ "routes": (
129
+ [RouteSerializer.from_dict(_item) for _item in obj["routes"]]
130
+ if obj.get("routes") is not None
131
+ else None
132
+ ),
133
+ }
134
+ )
135
+ return _obj
@@ -0,0 +1,127 @@
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, StrictBool, StrictStr
22
+ from typing_extensions import Annotated, Self
23
+
24
+
25
+ class RouteSerializer(BaseModel):
26
+ """
27
+ RouteSerializer
28
+ """
29
+
30
+ var_continue: Optional[StrictBool] = Field(default=False, alias="continue")
31
+ group_by: Optional[
32
+ Annotated[List[Annotated[str, Field(min_length=1, strict=True, max_length=200)]], Field(max_length=5)]
33
+ ] = Field(default=None, alias="groupBy")
34
+ group_interval: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field(
35
+ default="5m", alias="groupInterval"
36
+ )
37
+ group_wait: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field(
38
+ default="30s", alias="groupWait"
39
+ )
40
+ match: Optional[Dict[str, Annotated[str, Field(min_length=1, strict=True, max_length=200)]]] = None
41
+ match_re: Optional[Dict[str, Annotated[str, Field(min_length=1, strict=True, max_length=200)]]] = Field(
42
+ default=None, alias="matchRe"
43
+ )
44
+ matchers: Optional[
45
+ Annotated[List[Annotated[str, Field(min_length=1, strict=True, max_length=200)]], Field(max_length=5)]
46
+ ] = None
47
+ receiver: Annotated[str, Field(min_length=1, strict=True, max_length=200)]
48
+ repeat_interval: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field(
49
+ default="4h", alias="repeatInterval"
50
+ )
51
+ routes: Optional[List[Dict[str, Optional[StrictStr]]]] = None
52
+ __properties: ClassVar[List[str]] = [
53
+ "continue",
54
+ "groupBy",
55
+ "groupInterval",
56
+ "groupWait",
57
+ "match",
58
+ "matchRe",
59
+ "matchers",
60
+ "receiver",
61
+ "repeatInterval",
62
+ "routes",
63
+ ]
64
+
65
+ model_config = ConfigDict(
66
+ populate_by_name=True,
67
+ validate_assignment=True,
68
+ protected_namespaces=(),
69
+ )
70
+
71
+ def to_str(self) -> str:
72
+ """Returns the string representation of the model using alias"""
73
+ return pprint.pformat(self.model_dump(by_alias=True))
74
+
75
+ def to_json(self) -> str:
76
+ """Returns the JSON representation of the model using alias"""
77
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
78
+ return json.dumps(self.to_dict())
79
+
80
+ @classmethod
81
+ def from_json(cls, json_str: str) -> Optional[Self]:
82
+ """Create an instance of RouteSerializer from a JSON string"""
83
+ return cls.from_dict(json.loads(json_str))
84
+
85
+ def to_dict(self) -> Dict[str, Any]:
86
+ """Return the dictionary representation of the model using alias.
87
+
88
+ This has the following differences from calling pydantic's
89
+ `self.model_dump(by_alias=True)`:
90
+
91
+ * `None` is only added to the output dict for nullable fields that
92
+ were set at model initialization. Other fields with value `None`
93
+ are ignored.
94
+ """
95
+ excluded_fields: Set[str] = set([])
96
+
97
+ _dict = self.model_dump(
98
+ by_alias=True,
99
+ exclude=excluded_fields,
100
+ exclude_none=True,
101
+ )
102
+ return _dict
103
+
104
+ @classmethod
105
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
106
+ """Create an instance of RouteSerializer from a dict"""
107
+ if obj is None:
108
+ return None
109
+
110
+ if not isinstance(obj, dict):
111
+ return cls.model_validate(obj)
112
+
113
+ _obj = cls.model_validate(
114
+ {
115
+ "continue": obj.get("continue") if obj.get("continue") is not None else False,
116
+ "groupBy": obj.get("groupBy"),
117
+ "groupInterval": obj.get("groupInterval") if obj.get("groupInterval") is not None else "5m",
118
+ "groupWait": obj.get("groupWait") if obj.get("groupWait") is not None else "30s",
119
+ "match": obj.get("match"),
120
+ "matchRe": obj.get("matchRe"),
121
+ "matchers": obj.get("matchers"),
122
+ "receiver": obj.get("receiver"),
123
+ "repeatInterval": obj.get("repeatInterval") if obj.get("repeatInterval") is not None else "4h",
124
+ "routes": obj.get("routes"),
125
+ }
126
+ )
127
+ return _obj