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,155 @@
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 (
22
+ BaseModel,
23
+ ConfigDict,
24
+ Field,
25
+ StrictBool,
26
+ StrictStr,
27
+ field_validator,
28
+ )
29
+ from typing_extensions import Annotated, Self
30
+
31
+ from stackit.observability.models.plan_model import PlanModel
32
+
33
+
34
+ class Instance(BaseModel):
35
+ """
36
+ Instance
37
+ """
38
+
39
+ cluster: Annotated[str, Field(min_length=1, strict=True, max_length=63)]
40
+ grafana_public_read_access: StrictBool = Field(alias="grafanaPublicReadAccess")
41
+ grafana_use_stackit_sso: StrictBool = Field(alias="grafanaUseStackitSso")
42
+ instance: Annotated[str, Field(min_length=1, strict=True, max_length=63)]
43
+ metrics_retention_time1h: Annotated[int, Field(strict=True, ge=0)] = Field(alias="metricsRetentionTime1h")
44
+ metrics_retention_time5m: Annotated[int, Field(strict=True, ge=0)] = Field(alias="metricsRetentionTime5m")
45
+ metrics_retention_time_raw: Annotated[int, Field(strict=True, ge=0)] = Field(alias="metricsRetentionTimeRaw")
46
+ name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=300)]] = None
47
+ plan: PlanModel
48
+ state: Optional[StrictStr] = None
49
+ __properties: ClassVar[List[str]] = [
50
+ "cluster",
51
+ "grafanaPublicReadAccess",
52
+ "grafanaUseStackitSso",
53
+ "instance",
54
+ "metricsRetentionTime1h",
55
+ "metricsRetentionTime5m",
56
+ "metricsRetentionTimeRaw",
57
+ "name",
58
+ "plan",
59
+ "state",
60
+ ]
61
+
62
+ @field_validator("state")
63
+ def state_validate_enum(cls, value):
64
+ """Validates the enum"""
65
+ if value is None:
66
+ return value
67
+
68
+ if value not in set(
69
+ [
70
+ "Component creation started",
71
+ "Component creation failed",
72
+ "Component creation succeeded. Now need to check readiness",
73
+ "Component creation succeeded",
74
+ "Component deletion started",
75
+ "Component deletion failed",
76
+ "Component deletion succeeded",
77
+ "Component deletion of routine succeeded. Now need to check if resources gone",
78
+ "Component deletion buckets succeeded",
79
+ "Component update failed",
80
+ "Component update started",
81
+ "Component update creation succeeded",
82
+ "Component update downgrade deletion resources succeeded",
83
+ ]
84
+ ):
85
+ raise ValueError(
86
+ "must be one of enum values ('Component creation started', 'Component creation failed', 'Component creation succeeded. Now need to check readiness', 'Component creation succeeded', 'Component deletion started', 'Component deletion failed', 'Component deletion succeeded', 'Component deletion of routine succeeded. Now need to check if resources gone', 'Component deletion buckets succeeded', 'Component update failed', 'Component update started', 'Component update creation succeeded', 'Component update downgrade deletion resources succeeded')"
87
+ )
88
+ return value
89
+
90
+ model_config = ConfigDict(
91
+ populate_by_name=True,
92
+ validate_assignment=True,
93
+ protected_namespaces=(),
94
+ )
95
+
96
+ def to_str(self) -> str:
97
+ """Returns the string representation of the model using alias"""
98
+ return pprint.pformat(self.model_dump(by_alias=True))
99
+
100
+ def to_json(self) -> str:
101
+ """Returns the JSON representation of the model using alias"""
102
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
103
+ return json.dumps(self.to_dict())
104
+
105
+ @classmethod
106
+ def from_json(cls, json_str: str) -> Optional[Self]:
107
+ """Create an instance of Instance from a JSON string"""
108
+ return cls.from_dict(json.loads(json_str))
109
+
110
+ def to_dict(self) -> Dict[str, Any]:
111
+ """Return the dictionary representation of the model using alias.
112
+
113
+ This has the following differences from calling pydantic's
114
+ `self.model_dump(by_alias=True)`:
115
+
116
+ * `None` is only added to the output dict for nullable fields that
117
+ were set at model initialization. Other fields with value `None`
118
+ are ignored.
119
+ """
120
+ excluded_fields: Set[str] = set([])
121
+
122
+ _dict = self.model_dump(
123
+ by_alias=True,
124
+ exclude=excluded_fields,
125
+ exclude_none=True,
126
+ )
127
+ # override the default output from pydantic by calling `to_dict()` of plan
128
+ if self.plan:
129
+ _dict["plan"] = self.plan.to_dict()
130
+ return _dict
131
+
132
+ @classmethod
133
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
134
+ """Create an instance of Instance from a dict"""
135
+ if obj is None:
136
+ return None
137
+
138
+ if not isinstance(obj, dict):
139
+ return cls.model_validate(obj)
140
+
141
+ _obj = cls.model_validate(
142
+ {
143
+ "cluster": obj.get("cluster"),
144
+ "grafanaPublicReadAccess": obj.get("grafanaPublicReadAccess"),
145
+ "grafanaUseStackitSso": obj.get("grafanaUseStackitSso"),
146
+ "instance": obj.get("instance"),
147
+ "metricsRetentionTime1h": obj.get("metricsRetentionTime1h"),
148
+ "metricsRetentionTime5m": obj.get("metricsRetentionTime5m"),
149
+ "metricsRetentionTimeRaw": obj.get("metricsRetentionTimeRaw"),
150
+ "name": obj.get("name"),
151
+ "plan": PlanModel.from_dict(obj["plan"]) if obj.get("plan") is not None else None,
152
+ "state": obj.get("state"),
153
+ }
154
+ )
155
+ return _obj
@@ -0,0 +1,82 @@
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 InstanceResponse(BaseModel):
26
+ """
27
+ InstanceResponse
28
+ """
29
+
30
+ message: Annotated[str, Field(min_length=1, strict=True)]
31
+ __properties: ClassVar[List[str]] = ["message"]
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
38
+
39
+ def to_str(self) -> str:
40
+ """Returns the string representation of the model using alias"""
41
+ return pprint.pformat(self.model_dump(by_alias=True))
42
+
43
+ def to_json(self) -> str:
44
+ """Returns the JSON representation of the model using alias"""
45
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
+ return json.dumps(self.to_dict())
47
+
48
+ @classmethod
49
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
+ """Create an instance of InstanceResponse from a JSON string"""
51
+ return cls.from_dict(json.loads(json_str))
52
+
53
+ def to_dict(self) -> Dict[str, Any]:
54
+ """Return the dictionary representation of the model using alias.
55
+
56
+ This has the following differences from calling pydantic's
57
+ `self.model_dump(by_alias=True)`:
58
+
59
+ * `None` is only added to the output dict for nullable fields that
60
+ were set at model initialization. Other fields with value `None`
61
+ are ignored.
62
+ """
63
+ excluded_fields: Set[str] = set([])
64
+
65
+ _dict = self.model_dump(
66
+ by_alias=True,
67
+ exclude=excluded_fields,
68
+ exclude_none=True,
69
+ )
70
+ return _dict
71
+
72
+ @classmethod
73
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
74
+ """Create an instance of InstanceResponse from a dict"""
75
+ if obj is None:
76
+ return None
77
+
78
+ if not isinstance(obj, dict):
79
+ return cls.model_validate(obj)
80
+
81
+ _obj = cls.model_validate({"message": obj.get("message")})
82
+ return _obj
@@ -0,0 +1,159 @@
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.plan_model import PlanModel
25
+
26
+
27
+ class InstanceSensitiveData(BaseModel):
28
+ """
29
+ InstanceSensitiveData
30
+ """
31
+
32
+ alerting_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="alertingUrl")
33
+ cluster: Annotated[str, Field(min_length=1, strict=True, max_length=63)]
34
+ dashboard_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="dashboardUrl")
35
+ grafana_admin_password: Annotated[str, Field(min_length=32, strict=True)] = Field(alias="grafanaAdminPassword")
36
+ grafana_admin_user: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="grafanaAdminUser")
37
+ grafana_public_read_access: StrictBool = Field(alias="grafanaPublicReadAccess")
38
+ grafana_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="grafanaUrl")
39
+ grafana_use_stackit_sso: StrictBool = Field(alias="grafanaUseStackitSso")
40
+ instance: Annotated[str, Field(min_length=1, strict=True, max_length=63)]
41
+ jaeger_traces_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="jaegerTracesUrl")
42
+ jaeger_ui_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="jaegerUiUrl")
43
+ logs_push_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="logsPushUrl")
44
+ logs_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="logsUrl")
45
+ metrics_retention_time1h: Annotated[int, Field(strict=True, ge=0)] = Field(alias="metricsRetentionTime1h")
46
+ metrics_retention_time5m: Annotated[int, Field(strict=True, ge=0)] = Field(alias="metricsRetentionTime5m")
47
+ metrics_retention_time_raw: Annotated[int, Field(strict=True, ge=0)] = Field(alias="metricsRetentionTimeRaw")
48
+ metrics_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="metricsUrl")
49
+ name: Optional[Annotated[str, Field(strict=True, max_length=300)]] = ""
50
+ otlp_traces_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="otlpTracesUrl")
51
+ plan: PlanModel
52
+ push_metrics_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="pushMetricsUrl")
53
+ targets_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="targetsUrl")
54
+ zipkin_spans_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="zipkinSpansUrl")
55
+ __properties: ClassVar[List[str]] = [
56
+ "alertingUrl",
57
+ "cluster",
58
+ "dashboardUrl",
59
+ "grafanaAdminPassword",
60
+ "grafanaAdminUser",
61
+ "grafanaPublicReadAccess",
62
+ "grafanaUrl",
63
+ "grafanaUseStackitSso",
64
+ "instance",
65
+ "jaegerTracesUrl",
66
+ "jaegerUiUrl",
67
+ "logsPushUrl",
68
+ "logsUrl",
69
+ "metricsRetentionTime1h",
70
+ "metricsRetentionTime5m",
71
+ "metricsRetentionTimeRaw",
72
+ "metricsUrl",
73
+ "name",
74
+ "otlpTracesUrl",
75
+ "plan",
76
+ "pushMetricsUrl",
77
+ "targetsUrl",
78
+ "zipkinSpansUrl",
79
+ ]
80
+
81
+ model_config = ConfigDict(
82
+ populate_by_name=True,
83
+ validate_assignment=True,
84
+ protected_namespaces=(),
85
+ )
86
+
87
+ def to_str(self) -> str:
88
+ """Returns the string representation of the model using alias"""
89
+ return pprint.pformat(self.model_dump(by_alias=True))
90
+
91
+ def to_json(self) -> str:
92
+ """Returns the JSON representation of the model using alias"""
93
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
94
+ return json.dumps(self.to_dict())
95
+
96
+ @classmethod
97
+ def from_json(cls, json_str: str) -> Optional[Self]:
98
+ """Create an instance of InstanceSensitiveData from a JSON string"""
99
+ return cls.from_dict(json.loads(json_str))
100
+
101
+ def to_dict(self) -> Dict[str, Any]:
102
+ """Return the dictionary representation of the model using alias.
103
+
104
+ This has the following differences from calling pydantic's
105
+ `self.model_dump(by_alias=True)`:
106
+
107
+ * `None` is only added to the output dict for nullable fields that
108
+ were set at model initialization. Other fields with value `None`
109
+ are ignored.
110
+ """
111
+ excluded_fields: Set[str] = set([])
112
+
113
+ _dict = self.model_dump(
114
+ by_alias=True,
115
+ exclude=excluded_fields,
116
+ exclude_none=True,
117
+ )
118
+ # override the default output from pydantic by calling `to_dict()` of plan
119
+ if self.plan:
120
+ _dict["plan"] = self.plan.to_dict()
121
+ return _dict
122
+
123
+ @classmethod
124
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
125
+ """Create an instance of InstanceSensitiveData from a dict"""
126
+ if obj is None:
127
+ return None
128
+
129
+ if not isinstance(obj, dict):
130
+ return cls.model_validate(obj)
131
+
132
+ _obj = cls.model_validate(
133
+ {
134
+ "alertingUrl": obj.get("alertingUrl"),
135
+ "cluster": obj.get("cluster"),
136
+ "dashboardUrl": obj.get("dashboardUrl"),
137
+ "grafanaAdminPassword": obj.get("grafanaAdminPassword"),
138
+ "grafanaAdminUser": obj.get("grafanaAdminUser"),
139
+ "grafanaPublicReadAccess": obj.get("grafanaPublicReadAccess"),
140
+ "grafanaUrl": obj.get("grafanaUrl"),
141
+ "grafanaUseStackitSso": obj.get("grafanaUseStackitSso"),
142
+ "instance": obj.get("instance"),
143
+ "jaegerTracesUrl": obj.get("jaegerTracesUrl"),
144
+ "jaegerUiUrl": obj.get("jaegerUiUrl"),
145
+ "logsPushUrl": obj.get("logsPushUrl"),
146
+ "logsUrl": obj.get("logsUrl"),
147
+ "metricsRetentionTime1h": obj.get("metricsRetentionTime1h"),
148
+ "metricsRetentionTime5m": obj.get("metricsRetentionTime5m"),
149
+ "metricsRetentionTimeRaw": obj.get("metricsRetentionTimeRaw"),
150
+ "metricsUrl": obj.get("metricsUrl"),
151
+ "name": obj.get("name") if obj.get("name") is not None else "",
152
+ "otlpTracesUrl": obj.get("otlpTracesUrl"),
153
+ "plan": PlanModel.from_dict(obj["plan"]) if obj.get("plan") is not None else None,
154
+ "pushMetricsUrl": obj.get("pushMetricsUrl"),
155
+ "targetsUrl": obj.get("targetsUrl"),
156
+ "zipkinSpansUrl": obj.get("zipkinSpansUrl"),
157
+ }
158
+ )
159
+ return _obj
@@ -0,0 +1,207 @@
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 (
22
+ BaseModel,
23
+ ConfigDict,
24
+ Field,
25
+ StrictBool,
26
+ StrictStr,
27
+ field_validator,
28
+ )
29
+ from typing_extensions import Annotated, Self
30
+
31
+ from stackit.observability.models.basic_auth import BasicAuth
32
+ from stackit.observability.models.http_service_sd import HTTPServiceSD
33
+ from stackit.observability.models.metrics_relabel_config import MetricsRelabelConfig
34
+ from stackit.observability.models.o_auth2 import OAuth2
35
+ from stackit.observability.models.static_configs import StaticConfigs
36
+ from stackit.observability.models.tls_config import TLSConfig
37
+
38
+
39
+ class Job(BaseModel):
40
+ """
41
+ Job
42
+ """
43
+
44
+ basic_auth: Optional[BasicAuth] = Field(default=None, alias="basicAuth")
45
+ bearer_token: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, alias="bearerToken")
46
+ honor_labels: Optional[StrictBool] = Field(default=False, alias="honorLabels")
47
+ honor_time_stamps: Optional[StrictBool] = Field(default=False, alias="honorTimeStamps")
48
+ http_sd_configs: Optional[List[HTTPServiceSD]] = Field(default=None, alias="httpSdConfigs")
49
+ job_name: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(alias="jobName")
50
+ metrics_path: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=200)]] = Field(
51
+ default="/metrics", alias="metricsPath"
52
+ )
53
+ metrics_relabel_configs: Optional[List[MetricsRelabelConfig]] = Field(default=None, alias="metricsRelabelConfigs")
54
+ oauth2: Optional[OAuth2] = None
55
+ params: Optional[
56
+ Dict[
57
+ str, Annotated[List[Annotated[str, Field(min_length=1, strict=True, max_length=200)]], Field(max_length=5)]
58
+ ]
59
+ ] = None
60
+ sample_limit: Optional[Annotated[int, Field(le=1000000000, strict=True, ge=1)]] = Field(
61
+ default=None, alias="sampleLimit"
62
+ )
63
+ scheme: Optional[StrictStr] = "http"
64
+ scrape_interval: Annotated[str, Field(min_length=2, strict=True, max_length=8)] = Field(alias="scrapeInterval")
65
+ scrape_timeout: Annotated[str, Field(min_length=2, strict=True, max_length=8)] = Field(alias="scrapeTimeout")
66
+ static_configs: List[StaticConfigs] = Field(alias="staticConfigs")
67
+ tls_config: Optional[TLSConfig] = Field(default=None, alias="tlsConfig")
68
+ __properties: ClassVar[List[str]] = [
69
+ "basicAuth",
70
+ "bearerToken",
71
+ "honorLabels",
72
+ "honorTimeStamps",
73
+ "httpSdConfigs",
74
+ "jobName",
75
+ "metricsPath",
76
+ "metricsRelabelConfigs",
77
+ "oauth2",
78
+ "params",
79
+ "sampleLimit",
80
+ "scheme",
81
+ "scrapeInterval",
82
+ "scrapeTimeout",
83
+ "staticConfigs",
84
+ "tlsConfig",
85
+ ]
86
+
87
+ @field_validator("scheme")
88
+ def scheme_validate_enum(cls, value):
89
+ """Validates the enum"""
90
+ if value is None:
91
+ return value
92
+
93
+ if value not in set(["http", "https"]):
94
+ raise ValueError("must be one of enum values ('http', 'https')")
95
+ return value
96
+
97
+ model_config = ConfigDict(
98
+ populate_by_name=True,
99
+ validate_assignment=True,
100
+ protected_namespaces=(),
101
+ )
102
+
103
+ def to_str(self) -> str:
104
+ """Returns the string representation of the model using alias"""
105
+ return pprint.pformat(self.model_dump(by_alias=True))
106
+
107
+ def to_json(self) -> str:
108
+ """Returns the JSON representation of the model using alias"""
109
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
110
+ return json.dumps(self.to_dict())
111
+
112
+ @classmethod
113
+ def from_json(cls, json_str: str) -> Optional[Self]:
114
+ """Create an instance of Job from a JSON string"""
115
+ return cls.from_dict(json.loads(json_str))
116
+
117
+ def to_dict(self) -> Dict[str, Any]:
118
+ """Return the dictionary representation of the model using alias.
119
+
120
+ This has the following differences from calling pydantic's
121
+ `self.model_dump(by_alias=True)`:
122
+
123
+ * `None` is only added to the output dict for nullable fields that
124
+ were set at model initialization. Other fields with value `None`
125
+ are ignored.
126
+ """
127
+ excluded_fields: Set[str] = set([])
128
+
129
+ _dict = self.model_dump(
130
+ by_alias=True,
131
+ exclude=excluded_fields,
132
+ exclude_none=True,
133
+ )
134
+ # override the default output from pydantic by calling `to_dict()` of basic_auth
135
+ if self.basic_auth:
136
+ _dict["basicAuth"] = self.basic_auth.to_dict()
137
+ # override the default output from pydantic by calling `to_dict()` of each item in http_sd_configs (list)
138
+ _items = []
139
+ if self.http_sd_configs:
140
+ for _item in self.http_sd_configs:
141
+ if _item:
142
+ _items.append(_item.to_dict())
143
+ _dict["httpSdConfigs"] = _items
144
+ # override the default output from pydantic by calling `to_dict()` of each item in metrics_relabel_configs (list)
145
+ _items = []
146
+ if self.metrics_relabel_configs:
147
+ for _item in self.metrics_relabel_configs:
148
+ if _item:
149
+ _items.append(_item.to_dict())
150
+ _dict["metricsRelabelConfigs"] = _items
151
+ # override the default output from pydantic by calling `to_dict()` of oauth2
152
+ if self.oauth2:
153
+ _dict["oauth2"] = self.oauth2.to_dict()
154
+ # override the default output from pydantic by calling `to_dict()` of each item in static_configs (list)
155
+ _items = []
156
+ if self.static_configs:
157
+ for _item in self.static_configs:
158
+ if _item:
159
+ _items.append(_item.to_dict())
160
+ _dict["staticConfigs"] = _items
161
+ # override the default output from pydantic by calling `to_dict()` of tls_config
162
+ if self.tls_config:
163
+ _dict["tlsConfig"] = self.tls_config.to_dict()
164
+ return _dict
165
+
166
+ @classmethod
167
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
168
+ """Create an instance of Job from a dict"""
169
+ if obj is None:
170
+ return None
171
+
172
+ if not isinstance(obj, dict):
173
+ return cls.model_validate(obj)
174
+
175
+ _obj = cls.model_validate(
176
+ {
177
+ "basicAuth": BasicAuth.from_dict(obj["basicAuth"]) if obj.get("basicAuth") is not None else None,
178
+ "bearerToken": obj.get("bearerToken"),
179
+ "honorLabels": obj.get("honorLabels") if obj.get("honorLabels") is not None else False,
180
+ "honorTimeStamps": obj.get("honorTimeStamps") if obj.get("honorTimeStamps") is not None else False,
181
+ "httpSdConfigs": (
182
+ [HTTPServiceSD.from_dict(_item) for _item in obj["httpSdConfigs"]]
183
+ if obj.get("httpSdConfigs") is not None
184
+ else None
185
+ ),
186
+ "jobName": obj.get("jobName"),
187
+ "metricsPath": obj.get("metricsPath") if obj.get("metricsPath") is not None else "/metrics",
188
+ "metricsRelabelConfigs": (
189
+ [MetricsRelabelConfig.from_dict(_item) for _item in obj["metricsRelabelConfigs"]]
190
+ if obj.get("metricsRelabelConfigs") is not None
191
+ else None
192
+ ),
193
+ "oauth2": OAuth2.from_dict(obj["oauth2"]) if obj.get("oauth2") is not None else None,
194
+ "params": obj.get("params"),
195
+ "sampleLimit": obj.get("sampleLimit"),
196
+ "scheme": obj.get("scheme") if obj.get("scheme") is not None else "http",
197
+ "scrapeInterval": obj.get("scrapeInterval"),
198
+ "scrapeTimeout": obj.get("scrapeTimeout"),
199
+ "staticConfigs": (
200
+ [StaticConfigs.from_dict(_item) for _item in obj["staticConfigs"]]
201
+ if obj.get("staticConfigs") is not None
202
+ else None
203
+ ),
204
+ "tlsConfig": TLSConfig.from_dict(obj["tlsConfig"]) if obj.get("tlsConfig") is not None else None,
205
+ }
206
+ )
207
+ return _obj
@@ -0,0 +1,83 @@
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 ListACLResponse(BaseModel):
26
+ """
27
+ ListACLResponse
28
+ """
29
+
30
+ acl: List[Annotated[str, Field(min_length=1, strict=True, max_length=100)]]
31
+ message: Annotated[str, Field(min_length=1, strict=True)]
32
+ __properties: ClassVar[List[str]] = ["acl", "message"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of ListACLResponse from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([])
65
+
66
+ _dict = self.model_dump(
67
+ by_alias=True,
68
+ exclude=excluded_fields,
69
+ exclude_none=True,
70
+ )
71
+ return _dict
72
+
73
+ @classmethod
74
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
+ """Create an instance of ListACLResponse from a dict"""
76
+ if obj is None:
77
+ return None
78
+
79
+ if not isinstance(obj, dict):
80
+ return cls.model_validate(obj)
81
+
82
+ _obj = cls.model_validate({"acl": obj.get("acl"), "message": obj.get("message")})
83
+ return _obj