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,267 @@
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, Union
20
+
21
+ from pydantic import (
22
+ BaseModel,
23
+ ConfigDict,
24
+ Field,
25
+ StrictBool,
26
+ StrictFloat,
27
+ StrictInt,
28
+ StrictStr,
29
+ field_validator,
30
+ )
31
+ from typing_extensions import Annotated, Self
32
+
33
+ from stackit.observability.models.create_scrape_config_payload_basic_auth import (
34
+ CreateScrapeConfigPayloadBasicAuth,
35
+ )
36
+ from stackit.observability.models.create_scrape_config_payload_http_sd_configs_inner import (
37
+ CreateScrapeConfigPayloadHttpSdConfigsInner,
38
+ )
39
+ from stackit.observability.models.create_scrape_config_payload_http_sd_configs_inner_oauth2 import (
40
+ CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2,
41
+ )
42
+ from stackit.observability.models.create_scrape_config_payload_http_sd_configs_inner_oauth2_tls_config import (
43
+ CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2TlsConfig,
44
+ )
45
+ from stackit.observability.models.create_scrape_config_payload_metrics_relabel_configs_inner import (
46
+ CreateScrapeConfigPayloadMetricsRelabelConfigsInner,
47
+ )
48
+ from stackit.observability.models.create_scrape_config_payload_static_configs_inner import (
49
+ CreateScrapeConfigPayloadStaticConfigsInner,
50
+ )
51
+
52
+
53
+ class CreateScrapeConfigPayload(BaseModel):
54
+ """
55
+ CreateScrapeConfigPayload
56
+ """
57
+
58
+ basic_auth: Optional[CreateScrapeConfigPayloadBasicAuth] = Field(default=None, alias="basicAuth")
59
+ bearer_token: Optional[StrictStr] = Field(
60
+ default=None,
61
+ description="Sets the 'Authorization' header on every scrape request with the configured bearer token. It is mutually exclusive with 'bearer_token_file'. `Additional Validators:` * needs to be a valid bearer token * if bearerToken is in the body no other authentication method should be in the body",
62
+ alias="bearerToken",
63
+ )
64
+ honor_labels: Optional[StrictBool] = Field(
65
+ default=False,
66
+ description="Note that any globally configured 'external_labels' are unaffected by this setting. In communication with external systems, they are always applied only when a time series does not have a given label yet and are ignored otherwise.",
67
+ alias="honorLabels",
68
+ )
69
+ honor_time_stamps: Optional[StrictBool] = Field(
70
+ default=False,
71
+ description="honor_timestamps controls whether Prometheus respects the timestamps present in scraped data. If honor_timestamps is set to 'true', the timestamps of the metrics exposed by the target will be used.",
72
+ alias="honorTimeStamps",
73
+ )
74
+ http_sd_configs: Optional[List[CreateScrapeConfigPayloadHttpSdConfigsInner]] = Field(
75
+ default=None,
76
+ description="HTTP-based service discovery provides a more generic way to configure static targets and serves as an interface to plug in custom service discovery mechanisms.",
77
+ alias="httpSdConfigs",
78
+ )
79
+ job_name: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(
80
+ description="The job name assigned to scraped metrics by default. `Additional Validators:` * must be unique * key and values should only include the characters: a-zA-Z0-9-",
81
+ alias="jobName",
82
+ )
83
+ metrics_path: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=200)]] = Field(
84
+ default="/metrics",
85
+ description="The HTTP resource path on which to fetch metrics from targets. E.g. /metrics",
86
+ alias="metricsPath",
87
+ )
88
+ metrics_relabel_configs: Optional[List[CreateScrapeConfigPayloadMetricsRelabelConfigsInner]] = Field(
89
+ default=None, description="List of metric relabel configurations", alias="metricsRelabelConfigs"
90
+ )
91
+ oauth2: Optional[CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2] = None
92
+ params: Optional[Dict[str, Any]] = Field(
93
+ default=None,
94
+ description="Optional http params `Additional Validators:` * should not contain more than 5 keys * each key and value should not have more than 200 characters",
95
+ )
96
+ sample_limit: Optional[Union[StrictFloat, StrictInt]] = Field(
97
+ default=None,
98
+ description="Per-scrape limit on number of scraped samples that will be accepted. If more than this number of samples are present after metric relabeling the entire scrape will be treated as failed. The total limit depends on the service plan target limits * samples",
99
+ alias="sampleLimit",
100
+ )
101
+ scheme: StrictStr = Field(description="Configures the protocol scheme used for requests. https or http")
102
+ scrape_interval: Annotated[str, Field(min_length=2, strict=True, max_length=8)] = Field(
103
+ description="How frequently to scrape targets from this job. E.g. 5m `Additional Validators:` * must be a valid time format* must be >= 60s",
104
+ alias="scrapeInterval",
105
+ )
106
+ scrape_timeout: Annotated[str, Field(min_length=2, strict=True, max_length=8)] = Field(
107
+ description="Per-scrape timeout when scraping this job. `Additional Validators:` * must be a valid time format* must be smaller than scrapeInterval",
108
+ alias="scrapeTimeout",
109
+ )
110
+ static_configs: List[CreateScrapeConfigPayloadStaticConfigsInner] = Field(
111
+ description="A list of scrape configurations.", alias="staticConfigs"
112
+ )
113
+ tls_config: Optional[CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2TlsConfig] = Field(
114
+ default=None, alias="tlsConfig"
115
+ )
116
+ __properties: ClassVar[List[str]] = [
117
+ "basicAuth",
118
+ "bearerToken",
119
+ "honorLabels",
120
+ "honorTimeStamps",
121
+ "httpSdConfigs",
122
+ "jobName",
123
+ "metricsPath",
124
+ "metricsRelabelConfigs",
125
+ "oauth2",
126
+ "params",
127
+ "sampleLimit",
128
+ "scheme",
129
+ "scrapeInterval",
130
+ "scrapeTimeout",
131
+ "staticConfigs",
132
+ "tlsConfig",
133
+ ]
134
+
135
+ @field_validator("scheme")
136
+ def scheme_validate_enum(cls, value):
137
+ """Validates the enum"""
138
+ if value not in set(["http", "https"]):
139
+ raise ValueError("must be one of enum values ('http', 'https')")
140
+ return value
141
+
142
+ model_config = ConfigDict(
143
+ populate_by_name=True,
144
+ validate_assignment=True,
145
+ protected_namespaces=(),
146
+ )
147
+
148
+ def to_str(self) -> str:
149
+ """Returns the string representation of the model using alias"""
150
+ return pprint.pformat(self.model_dump(by_alias=True))
151
+
152
+ def to_json(self) -> str:
153
+ """Returns the JSON representation of the model using alias"""
154
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
155
+ return json.dumps(self.to_dict())
156
+
157
+ @classmethod
158
+ def from_json(cls, json_str: str) -> Optional[Self]:
159
+ """Create an instance of CreateScrapeConfigPayload from a JSON string"""
160
+ return cls.from_dict(json.loads(json_str))
161
+
162
+ def to_dict(self) -> Dict[str, Any]:
163
+ """Return the dictionary representation of the model using alias.
164
+
165
+ This has the following differences from calling pydantic's
166
+ `self.model_dump(by_alias=True)`:
167
+
168
+ * `None` is only added to the output dict for nullable fields that
169
+ were set at model initialization. Other fields with value `None`
170
+ are ignored.
171
+ """
172
+ excluded_fields: Set[str] = set([])
173
+
174
+ _dict = self.model_dump(
175
+ by_alias=True,
176
+ exclude=excluded_fields,
177
+ exclude_none=True,
178
+ )
179
+ # override the default output from pydantic by calling `to_dict()` of basic_auth
180
+ if self.basic_auth:
181
+ _dict["basicAuth"] = self.basic_auth.to_dict()
182
+ # override the default output from pydantic by calling `to_dict()` of each item in http_sd_configs (list)
183
+ _items = []
184
+ if self.http_sd_configs:
185
+ for _item in self.http_sd_configs:
186
+ if _item:
187
+ _items.append(_item.to_dict())
188
+ _dict["httpSdConfigs"] = _items
189
+ # override the default output from pydantic by calling `to_dict()` of each item in metrics_relabel_configs (list)
190
+ _items = []
191
+ if self.metrics_relabel_configs:
192
+ for _item in self.metrics_relabel_configs:
193
+ if _item:
194
+ _items.append(_item.to_dict())
195
+ _dict["metricsRelabelConfigs"] = _items
196
+ # override the default output from pydantic by calling `to_dict()` of oauth2
197
+ if self.oauth2:
198
+ _dict["oauth2"] = self.oauth2.to_dict()
199
+ # override the default output from pydantic by calling `to_dict()` of each item in static_configs (list)
200
+ _items = []
201
+ if self.static_configs:
202
+ for _item in self.static_configs:
203
+ if _item:
204
+ _items.append(_item.to_dict())
205
+ _dict["staticConfigs"] = _items
206
+ # override the default output from pydantic by calling `to_dict()` of tls_config
207
+ if self.tls_config:
208
+ _dict["tlsConfig"] = self.tls_config.to_dict()
209
+ return _dict
210
+
211
+ @classmethod
212
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
213
+ """Create an instance of CreateScrapeConfigPayload from a dict"""
214
+ if obj is None:
215
+ return None
216
+
217
+ if not isinstance(obj, dict):
218
+ return cls.model_validate(obj)
219
+
220
+ _obj = cls.model_validate(
221
+ {
222
+ "basicAuth": (
223
+ CreateScrapeConfigPayloadBasicAuth.from_dict(obj["basicAuth"])
224
+ if obj.get("basicAuth") is not None
225
+ else None
226
+ ),
227
+ "bearerToken": obj.get("bearerToken"),
228
+ "honorLabels": obj.get("honorLabels") if obj.get("honorLabels") is not None else False,
229
+ "honorTimeStamps": obj.get("honorTimeStamps") if obj.get("honorTimeStamps") is not None else False,
230
+ "httpSdConfigs": (
231
+ [CreateScrapeConfigPayloadHttpSdConfigsInner.from_dict(_item) for _item in obj["httpSdConfigs"]]
232
+ if obj.get("httpSdConfigs") is not None
233
+ else None
234
+ ),
235
+ "jobName": obj.get("jobName"),
236
+ "metricsPath": obj.get("metricsPath") if obj.get("metricsPath") is not None else "/metrics",
237
+ "metricsRelabelConfigs": (
238
+ [
239
+ CreateScrapeConfigPayloadMetricsRelabelConfigsInner.from_dict(_item)
240
+ for _item in obj["metricsRelabelConfigs"]
241
+ ]
242
+ if obj.get("metricsRelabelConfigs") is not None
243
+ else None
244
+ ),
245
+ "oauth2": (
246
+ CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2.from_dict(obj["oauth2"])
247
+ if obj.get("oauth2") is not None
248
+ else None
249
+ ),
250
+ "params": obj.get("params"),
251
+ "sampleLimit": obj.get("sampleLimit"),
252
+ "scheme": obj.get("scheme"),
253
+ "scrapeInterval": obj.get("scrapeInterval"),
254
+ "scrapeTimeout": obj.get("scrapeTimeout"),
255
+ "staticConfigs": (
256
+ [CreateScrapeConfigPayloadStaticConfigsInner.from_dict(_item) for _item in obj["staticConfigs"]]
257
+ if obj.get("staticConfigs") is not None
258
+ else None
259
+ ),
260
+ "tlsConfig": (
261
+ CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2TlsConfig.from_dict(obj["tlsConfig"])
262
+ if obj.get("tlsConfig") is not None
263
+ else None
264
+ ),
265
+ }
266
+ )
267
+ return _obj
@@ -0,0 +1,87 @@
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 CreateScrapeConfigPayloadBasicAuth(BaseModel):
26
+ """
27
+ Sets the 'Authorization' header on every scrape request with the configured username and password. `Additional Validators:` * if basicAuth is in the body no other authentication method should be in the body
28
+ """
29
+
30
+ password: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=200)]] = Field(
31
+ default=None, description="password"
32
+ )
33
+ username: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=200)]] = Field(
34
+ default=None, description="username"
35
+ )
36
+ __properties: ClassVar[List[str]] = ["password", "username"]
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 CreateScrapeConfigPayloadBasicAuth 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 CreateScrapeConfigPayloadBasicAuth 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({"password": obj.get("password"), "username": obj.get("username")})
87
+ return _obj
@@ -0,0 +1,133 @@
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.create_scrape_config_payload_basic_auth import (
25
+ CreateScrapeConfigPayloadBasicAuth,
26
+ )
27
+ from stackit.observability.models.create_scrape_config_payload_http_sd_configs_inner_oauth2 import (
28
+ CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2,
29
+ )
30
+ from stackit.observability.models.create_scrape_config_payload_http_sd_configs_inner_oauth2_tls_config import (
31
+ CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2TlsConfig,
32
+ )
33
+
34
+
35
+ class CreateScrapeConfigPayloadHttpSdConfigsInner(BaseModel):
36
+ """
37
+ CreateScrapeConfigPayloadHttpSdConfigsInner
38
+ """
39
+
40
+ basic_auth: Optional[CreateScrapeConfigPayloadBasicAuth] = Field(default=None, alias="basicAuth")
41
+ oauth2: Optional[CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2] = None
42
+ refresh_interval: Optional[Annotated[str, Field(min_length=2, strict=True, max_length=8)]] = Field(
43
+ default="60s",
44
+ description="Refresh interval to re-query the endpoint. E.g. 60s `Additional Validators:` * must be a valid time format* must be >= 60s",
45
+ alias="refreshInterval",
46
+ )
47
+ tls_config: Optional[CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2TlsConfig] = Field(
48
+ default=None, alias="tlsConfig"
49
+ )
50
+ url: Annotated[str, Field(strict=True, max_length=400)] = Field(
51
+ description="URL from which the targets are fetched."
52
+ )
53
+ __properties: ClassVar[List[str]] = ["basicAuth", "oauth2", "refreshInterval", "tlsConfig", "url"]
54
+
55
+ model_config = ConfigDict(
56
+ populate_by_name=True,
57
+ validate_assignment=True,
58
+ protected_namespaces=(),
59
+ )
60
+
61
+ def to_str(self) -> str:
62
+ """Returns the string representation of the model using alias"""
63
+ return pprint.pformat(self.model_dump(by_alias=True))
64
+
65
+ def to_json(self) -> str:
66
+ """Returns the JSON representation of the model using alias"""
67
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
68
+ return json.dumps(self.to_dict())
69
+
70
+ @classmethod
71
+ def from_json(cls, json_str: str) -> Optional[Self]:
72
+ """Create an instance of CreateScrapeConfigPayloadHttpSdConfigsInner from a JSON string"""
73
+ return cls.from_dict(json.loads(json_str))
74
+
75
+ def to_dict(self) -> Dict[str, Any]:
76
+ """Return the dictionary representation of the model using alias.
77
+
78
+ This has the following differences from calling pydantic's
79
+ `self.model_dump(by_alias=True)`:
80
+
81
+ * `None` is only added to the output dict for nullable fields that
82
+ were set at model initialization. Other fields with value `None`
83
+ are ignored.
84
+ """
85
+ excluded_fields: Set[str] = set([])
86
+
87
+ _dict = self.model_dump(
88
+ by_alias=True,
89
+ exclude=excluded_fields,
90
+ exclude_none=True,
91
+ )
92
+ # override the default output from pydantic by calling `to_dict()` of basic_auth
93
+ if self.basic_auth:
94
+ _dict["basicAuth"] = self.basic_auth.to_dict()
95
+ # override the default output from pydantic by calling `to_dict()` of oauth2
96
+ if self.oauth2:
97
+ _dict["oauth2"] = self.oauth2.to_dict()
98
+ # override the default output from pydantic by calling `to_dict()` of tls_config
99
+ if self.tls_config:
100
+ _dict["tlsConfig"] = self.tls_config.to_dict()
101
+ return _dict
102
+
103
+ @classmethod
104
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
105
+ """Create an instance of CreateScrapeConfigPayloadHttpSdConfigsInner from a dict"""
106
+ if obj is None:
107
+ return None
108
+
109
+ if not isinstance(obj, dict):
110
+ return cls.model_validate(obj)
111
+
112
+ _obj = cls.model_validate(
113
+ {
114
+ "basicAuth": (
115
+ CreateScrapeConfigPayloadBasicAuth.from_dict(obj["basicAuth"])
116
+ if obj.get("basicAuth") is not None
117
+ else None
118
+ ),
119
+ "oauth2": (
120
+ CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2.from_dict(obj["oauth2"])
121
+ if obj.get("oauth2") is not None
122
+ else None
123
+ ),
124
+ "refreshInterval": obj.get("refreshInterval") if obj.get("refreshInterval") is not None else "60s",
125
+ "tlsConfig": (
126
+ CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2TlsConfig.from_dict(obj["tlsConfig"])
127
+ if obj.get("tlsConfig") is not None
128
+ else None
129
+ ),
130
+ "url": obj.get("url"),
131
+ }
132
+ )
133
+ return _obj
@@ -0,0 +1,115 @@
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.create_scrape_config_payload_http_sd_configs_inner_oauth2_tls_config import (
25
+ CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2TlsConfig,
26
+ )
27
+
28
+
29
+ class CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2(BaseModel):
30
+ """
31
+ OAuth 2.0 authentication using the client credentials grant type. Prometheus fetches an access token from the specified endpoint with the given client access and secret keys. `Additional Validators:` * if oauth2 is in the body no other authentication method should be in the body
32
+ """
33
+
34
+ client_id: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(
35
+ description="clientId", alias="clientId"
36
+ )
37
+ client_secret: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(
38
+ description="clientSecret", alias="clientSecret"
39
+ )
40
+ scopes: Optional[List[Annotated[str, Field(min_length=1, strict=True, max_length=200)]]] = Field(
41
+ default=None, description="The URL to fetch the token from."
42
+ )
43
+ tls_config: Optional[CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2TlsConfig] = Field(
44
+ default=None, alias="tlsConfig"
45
+ )
46
+ token_url: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(
47
+ description="The URL to fetch the token from.", alias="tokenUrl"
48
+ )
49
+ __properties: ClassVar[List[str]] = ["clientId", "clientSecret", "scopes", "tlsConfig", "tokenUrl"]
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 CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2 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
+ # override the default output from pydantic by calling `to_dict()` of tls_config
89
+ if self.tls_config:
90
+ _dict["tlsConfig"] = self.tls_config.to_dict()
91
+ return _dict
92
+
93
+ @classmethod
94
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
95
+ """Create an instance of CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2 from a dict"""
96
+ if obj is None:
97
+ return None
98
+
99
+ if not isinstance(obj, dict):
100
+ return cls.model_validate(obj)
101
+
102
+ _obj = cls.model_validate(
103
+ {
104
+ "clientId": obj.get("clientId"),
105
+ "clientSecret": obj.get("clientSecret"),
106
+ "scopes": obj.get("scopes"),
107
+ "tlsConfig": (
108
+ CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2TlsConfig.from_dict(obj["tlsConfig"])
109
+ if obj.get("tlsConfig") is not None
110
+ else None
111
+ ),
112
+ "tokenUrl": obj.get("tokenUrl"),
113
+ }
114
+ )
115
+ return _obj