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,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, StrictStr
22
+ from typing_extensions import Self
23
+
24
+
25
+ class UpdateGrafanaConfigsPayloadGenericOauth(BaseModel):
26
+ """
27
+ UpdateGrafanaConfigsPayloadGenericOauth
28
+ """
29
+
30
+ api_url: StrictStr = Field(
31
+ description="Set api_url to the resource that returns OpenID UserInfo compatible information.", alias="apiUrl"
32
+ )
33
+ auth_url: StrictStr = Field(description="Authentication endpoint of idp.", alias="authUrl")
34
+ enabled: StrictBool = Field(description="enable or disable generic oauth login")
35
+ name: Optional[StrictStr] = Field(default=None, description="Display name for the oAuth provider")
36
+ oauth_client_id: StrictStr = Field(description="Oauth client id for auth endpoint.", alias="oauthClientId")
37
+ oauth_client_secret: StrictStr = Field(
38
+ description="Oauth client secret for auth endpoint.", alias="oauthClientSecret"
39
+ )
40
+ role_attribute_path: StrictStr = Field(
41
+ description="Grafana checks for the presence of a role using the JMESPath specified via the role_attribute_path configuration option. The JMESPath is applied to the id_token first. If there is no match, then the UserInfo endpoint specified via the api_url configuration option is tried next. The result after evaluation of the role_attribute_path JMESPath expression should be a valid Grafana role, for example, Viewer, Editor or Admin For example: contains(roles[\\*], 'grafana-admin') && 'Admin' || contains(roles[\\*], 'grafana-editor') && 'Editor' || contains(roles[\\*], 'grafana-viewer') && 'Viewer'",
42
+ alias="roleAttributePath",
43
+ )
44
+ role_attribute_strict: Optional[StrictBool] = Field(
45
+ default=True,
46
+ description="If therole_attribute_path property does not return a role, then the user is assigned the Viewer role by default. You can disable the role assignment by setting role_attribute_strict = true. It denies user access if no role or an invalid role is returned.",
47
+ alias="roleAttributeStrict",
48
+ )
49
+ scopes: Optional[StrictStr] = Field(
50
+ default="openid profile email", description="Space seperated list of scopes of the token"
51
+ )
52
+ token_url: StrictStr = Field(description="Token endpoint of the idp.", alias="tokenUrl")
53
+ use_pkce: Optional[StrictBool] = Field(
54
+ default=None, description="enable or disable Proof Key for Code Exchange", alias="usePkce"
55
+ )
56
+ __properties: ClassVar[List[str]] = [
57
+ "apiUrl",
58
+ "authUrl",
59
+ "enabled",
60
+ "name",
61
+ "oauthClientId",
62
+ "oauthClientSecret",
63
+ "roleAttributePath",
64
+ "roleAttributeStrict",
65
+ "scopes",
66
+ "tokenUrl",
67
+ "usePkce",
68
+ ]
69
+
70
+ model_config = ConfigDict(
71
+ populate_by_name=True,
72
+ validate_assignment=True,
73
+ protected_namespaces=(),
74
+ )
75
+
76
+ def to_str(self) -> str:
77
+ """Returns the string representation of the model using alias"""
78
+ return pprint.pformat(self.model_dump(by_alias=True))
79
+
80
+ def to_json(self) -> str:
81
+ """Returns the JSON representation of the model using alias"""
82
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
83
+ return json.dumps(self.to_dict())
84
+
85
+ @classmethod
86
+ def from_json(cls, json_str: str) -> Optional[Self]:
87
+ """Create an instance of UpdateGrafanaConfigsPayloadGenericOauth from a JSON string"""
88
+ return cls.from_dict(json.loads(json_str))
89
+
90
+ def to_dict(self) -> Dict[str, Any]:
91
+ """Return the dictionary representation of the model using alias.
92
+
93
+ This has the following differences from calling pydantic's
94
+ `self.model_dump(by_alias=True)`:
95
+
96
+ * `None` is only added to the output dict for nullable fields that
97
+ were set at model initialization. Other fields with value `None`
98
+ are ignored.
99
+ """
100
+ excluded_fields: Set[str] = set([])
101
+
102
+ _dict = self.model_dump(
103
+ by_alias=True,
104
+ exclude=excluded_fields,
105
+ exclude_none=True,
106
+ )
107
+ return _dict
108
+
109
+ @classmethod
110
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
111
+ """Create an instance of UpdateGrafanaConfigsPayloadGenericOauth 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
+ "apiUrl": obj.get("apiUrl"),
121
+ "authUrl": obj.get("authUrl"),
122
+ "enabled": obj.get("enabled"),
123
+ "name": obj.get("name"),
124
+ "oauthClientId": obj.get("oauthClientId"),
125
+ "oauthClientSecret": obj.get("oauthClientSecret"),
126
+ "roleAttributePath": obj.get("roleAttributePath"),
127
+ "roleAttributeStrict": (
128
+ obj.get("roleAttributeStrict") if obj.get("roleAttributeStrict") is not None else True
129
+ ),
130
+ "scopes": obj.get("scopes") if obj.get("scopes") is not None else "openid profile email",
131
+ "tokenUrl": obj.get("tokenUrl"),
132
+ "usePkce": obj.get("usePkce"),
133
+ }
134
+ )
135
+ return _obj
@@ -0,0 +1,88 @@
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
22
+ from typing_extensions import Annotated, Self
23
+
24
+
25
+ class UpdateInstancePayload(BaseModel):
26
+ """
27
+ Create update instance body.
28
+ """
29
+
30
+ name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=200)]] = Field(
31
+ default=None, description="Name of the service"
32
+ )
33
+ parameter: Optional[Dict[str, Any]] = Field(default=None, description="additional parameters")
34
+ plan_id: StrictStr = Field(description="uuid of the plan to create/update", alias="planId")
35
+ __properties: ClassVar[List[str]] = ["name", "parameter", "planId"]
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 UpdateInstancePayload 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 UpdateInstancePayload 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
+ {"name": obj.get("name"), "parameter": obj.get("parameter"), "planId": obj.get("planId")}
87
+ )
88
+ return _obj
@@ -0,0 +1,99 @@
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 UpdateMetricsStorageRetentionPayload(BaseModel):
26
+ """
27
+ UpdateMetricsStorageRetentionPayload
28
+ """
29
+
30
+ metrics_retention_time1h: Annotated[str, Field(min_length=2, strict=True, max_length=8)] = Field(
31
+ description="Retention time of longtime storage of 1h sampled data. After that time the data will be deleted permanently. `Additional Validators:` * Should be a valid time string * Should not be bigger than metricsRetentionTime5m",
32
+ alias="metricsRetentionTime1h",
33
+ )
34
+ metrics_retention_time5m: Annotated[str, Field(min_length=2, strict=True, max_length=8)] = Field(
35
+ description="Retention time of longtime storage of 5m sampled data. After that time the data will be down sampled to 1h. `Additional Validators:` * Should be a valid time string * Should not be bigger than metricsRetentionTimeRaw",
36
+ alias="metricsRetentionTime5m",
37
+ )
38
+ metrics_retention_time_raw: Annotated[str, Field(min_length=2, strict=True, max_length=8)] = Field(
39
+ description="Retention time of longtime storage of raw sampled data. After that time the data will be down sampled to 5m. Keep in mind, that the initial goal of downsampling is not saving disk or object storage space. In fact, downsampling doesn't save you any space but instead, it adds 2 more blocks for each raw block which are only slightly smaller or relatively similar size to raw block. This is done by internal downsampling implementation which to be mathematically correct holds various aggregations. This means that downsampling can increase the size of your storage a bit (~3x), if you choose to store all resolutions (recommended). The goal of downsampling is to provide an opportunity to get fast results for range queries of big time intervals like months or years. `Additional Validators:` * Should be a valid time string * Should not be bigger than 13 months",
40
+ alias="metricsRetentionTimeRaw",
41
+ )
42
+ __properties: ClassVar[List[str]] = ["metricsRetentionTime1h", "metricsRetentionTime5m", "metricsRetentionTimeRaw"]
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 UpdateMetricsStorageRetentionPayload 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
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of UpdateMetricsStorageRetentionPayload 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
+ "metricsRetentionTime1h": obj.get("metricsRetentionTime1h"),
95
+ "metricsRetentionTime5m": obj.get("metricsRetentionTime5m"),
96
+ "metricsRetentionTimeRaw": obj.get("metricsRetentionTimeRaw"),
97
+ }
98
+ )
99
+ return _obj
@@ -0,0 +1,225 @@
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_oauth2_tls_config import (
37
+ CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2TlsConfig,
38
+ )
39
+ from stackit.observability.models.create_scrape_config_payload_metrics_relabel_configs_inner import (
40
+ CreateScrapeConfigPayloadMetricsRelabelConfigsInner,
41
+ )
42
+ from stackit.observability.models.update_scrape_config_payload_static_configs_inner import (
43
+ UpdateScrapeConfigPayloadStaticConfigsInner,
44
+ )
45
+
46
+
47
+ class UpdateScrapeConfigPayload(BaseModel):
48
+ """
49
+ UpdateScrapeConfigPayload
50
+ """
51
+
52
+ basic_auth: Optional[CreateScrapeConfigPayloadBasicAuth] = Field(default=None, alias="basicAuth")
53
+ bearer_token: Optional[StrictStr] = Field(
54
+ default=None,
55
+ 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",
56
+ alias="bearerToken",
57
+ )
58
+ honor_labels: Optional[StrictBool] = Field(
59
+ default=False,
60
+ 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.",
61
+ alias="honorLabels",
62
+ )
63
+ honor_time_stamps: Optional[StrictBool] = Field(
64
+ default=False,
65
+ 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.",
66
+ alias="honorTimeStamps",
67
+ )
68
+ metrics_path: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(
69
+ description="The HTTP resource path on which to fetch metrics from targets. E.g. /metrics", alias="metricsPath"
70
+ )
71
+ metrics_relabel_configs: Optional[List[CreateScrapeConfigPayloadMetricsRelabelConfigsInner]] = Field(
72
+ default=None, description="List of metric relabel configurations", alias="metricsRelabelConfigs"
73
+ )
74
+ params: Optional[Dict[str, Any]] = Field(
75
+ default=None,
76
+ description="Optional http params `Additional Validators:` * should not contain more than 5 keys * each key and value should not have more than 200 characters",
77
+ )
78
+ sample_limit: Optional[Union[StrictFloat, StrictInt]] = Field(
79
+ default=None,
80
+ 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",
81
+ alias="sampleLimit",
82
+ )
83
+ scheme: StrictStr = Field(description="Configures the protocol scheme used for requests. https or http")
84
+ scrape_interval: Annotated[str, Field(min_length=2, strict=True, max_length=8)] = Field(
85
+ description="How frequently to scrape targets from this job. E.g. 5m `Additional Validators:` * must be a valid time format* must be >= 60s",
86
+ alias="scrapeInterval",
87
+ )
88
+ scrape_timeout: Annotated[str, Field(min_length=2, strict=True, max_length=8)] = Field(
89
+ description="Per-scrape timeout when scraping this job. `Additional Validators:` * must be a valid time format* must be smaller than scrapeInterval",
90
+ alias="scrapeTimeout",
91
+ )
92
+ static_configs: List[UpdateScrapeConfigPayloadStaticConfigsInner] = Field(
93
+ description="A list of scrape configurations.", alias="staticConfigs"
94
+ )
95
+ tls_config: Optional[CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2TlsConfig] = Field(
96
+ default=None, alias="tlsConfig"
97
+ )
98
+ __properties: ClassVar[List[str]] = [
99
+ "basicAuth",
100
+ "bearerToken",
101
+ "honorLabels",
102
+ "honorTimeStamps",
103
+ "metricsPath",
104
+ "metricsRelabelConfigs",
105
+ "params",
106
+ "sampleLimit",
107
+ "scheme",
108
+ "scrapeInterval",
109
+ "scrapeTimeout",
110
+ "staticConfigs",
111
+ "tlsConfig",
112
+ ]
113
+
114
+ @field_validator("scheme")
115
+ def scheme_validate_enum(cls, value):
116
+ """Validates the enum"""
117
+ if value not in set(["http", "https"]):
118
+ raise ValueError("must be one of enum values ('http', 'https')")
119
+ return value
120
+
121
+ model_config = ConfigDict(
122
+ populate_by_name=True,
123
+ validate_assignment=True,
124
+ protected_namespaces=(),
125
+ )
126
+
127
+ def to_str(self) -> str:
128
+ """Returns the string representation of the model using alias"""
129
+ return pprint.pformat(self.model_dump(by_alias=True))
130
+
131
+ def to_json(self) -> str:
132
+ """Returns the JSON representation of the model using alias"""
133
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
134
+ return json.dumps(self.to_dict())
135
+
136
+ @classmethod
137
+ def from_json(cls, json_str: str) -> Optional[Self]:
138
+ """Create an instance of UpdateScrapeConfigPayload from a JSON string"""
139
+ return cls.from_dict(json.loads(json_str))
140
+
141
+ def to_dict(self) -> Dict[str, Any]:
142
+ """Return the dictionary representation of the model using alias.
143
+
144
+ This has the following differences from calling pydantic's
145
+ `self.model_dump(by_alias=True)`:
146
+
147
+ * `None` is only added to the output dict for nullable fields that
148
+ were set at model initialization. Other fields with value `None`
149
+ are ignored.
150
+ """
151
+ excluded_fields: Set[str] = set([])
152
+
153
+ _dict = self.model_dump(
154
+ by_alias=True,
155
+ exclude=excluded_fields,
156
+ exclude_none=True,
157
+ )
158
+ # override the default output from pydantic by calling `to_dict()` of basic_auth
159
+ if self.basic_auth:
160
+ _dict["basicAuth"] = self.basic_auth.to_dict()
161
+ # override the default output from pydantic by calling `to_dict()` of each item in metrics_relabel_configs (list)
162
+ _items = []
163
+ if self.metrics_relabel_configs:
164
+ for _item in self.metrics_relabel_configs:
165
+ if _item:
166
+ _items.append(_item.to_dict())
167
+ _dict["metricsRelabelConfigs"] = _items
168
+ # override the default output from pydantic by calling `to_dict()` of each item in static_configs (list)
169
+ _items = []
170
+ if self.static_configs:
171
+ for _item in self.static_configs:
172
+ if _item:
173
+ _items.append(_item.to_dict())
174
+ _dict["staticConfigs"] = _items
175
+ # override the default output from pydantic by calling `to_dict()` of tls_config
176
+ if self.tls_config:
177
+ _dict["tlsConfig"] = self.tls_config.to_dict()
178
+ return _dict
179
+
180
+ @classmethod
181
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
182
+ """Create an instance of UpdateScrapeConfigPayload from a dict"""
183
+ if obj is None:
184
+ return None
185
+
186
+ if not isinstance(obj, dict):
187
+ return cls.model_validate(obj)
188
+
189
+ _obj = cls.model_validate(
190
+ {
191
+ "basicAuth": (
192
+ CreateScrapeConfigPayloadBasicAuth.from_dict(obj["basicAuth"])
193
+ if obj.get("basicAuth") is not None
194
+ else None
195
+ ),
196
+ "bearerToken": obj.get("bearerToken"),
197
+ "honorLabels": obj.get("honorLabels") if obj.get("honorLabels") is not None else False,
198
+ "honorTimeStamps": obj.get("honorTimeStamps") if obj.get("honorTimeStamps") is not None else False,
199
+ "metricsPath": obj.get("metricsPath") if obj.get("metricsPath") is not None else "/metrics",
200
+ "metricsRelabelConfigs": (
201
+ [
202
+ CreateScrapeConfigPayloadMetricsRelabelConfigsInner.from_dict(_item)
203
+ for _item in obj["metricsRelabelConfigs"]
204
+ ]
205
+ if obj.get("metricsRelabelConfigs") is not None
206
+ else None
207
+ ),
208
+ "params": obj.get("params"),
209
+ "sampleLimit": obj.get("sampleLimit"),
210
+ "scheme": obj.get("scheme"),
211
+ "scrapeInterval": obj.get("scrapeInterval"),
212
+ "scrapeTimeout": obj.get("scrapeTimeout"),
213
+ "staticConfigs": (
214
+ [UpdateScrapeConfigPayloadStaticConfigsInner.from_dict(_item) for _item in obj["staticConfigs"]]
215
+ if obj.get("staticConfigs") is not None
216
+ else None
217
+ ),
218
+ "tlsConfig": (
219
+ CreateScrapeConfigPayloadHttpSdConfigsInnerOauth2TlsConfig.from_dict(obj["tlsConfig"])
220
+ if obj.get("tlsConfig") is not None
221
+ else None
222
+ ),
223
+ }
224
+ )
225
+ return _obj
@@ -0,0 +1,88 @@
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 UpdateScrapeConfigPayloadStaticConfigsInner(BaseModel):
26
+ """
27
+ UpdateScrapeConfigPayloadStaticConfigsInner
28
+ """
29
+
30
+ labels: Optional[Dict[str, Any]] = Field(
31
+ default=None,
32
+ description="Labels assigned to all metrics scraped from the targets. `Additional Validators:` * should not contain more than 5 keys * each key and value should not be longer than 200 characters",
33
+ )
34
+ targets: List[Annotated[str, Field(min_length=1, strict=True, max_length=500)]] = Field(
35
+ description="The targets specified by the static config."
36
+ )
37
+ __properties: ClassVar[List[str]] = ["labels", "targets"]
38
+
39
+ model_config = ConfigDict(
40
+ populate_by_name=True,
41
+ validate_assignment=True,
42
+ protected_namespaces=(),
43
+ )
44
+
45
+ def to_str(self) -> str:
46
+ """Returns the string representation of the model using alias"""
47
+ return pprint.pformat(self.model_dump(by_alias=True))
48
+
49
+ def to_json(self) -> str:
50
+ """Returns the JSON representation of the model using alias"""
51
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
+ return json.dumps(self.to_dict())
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
+ """Create an instance of UpdateScrapeConfigPayloadStaticConfigsInner from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ """
69
+ excluded_fields: Set[str] = set([])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ return _dict
77
+
78
+ @classmethod
79
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
+ """Create an instance of UpdateScrapeConfigPayloadStaticConfigsInner 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({"labels": obj.get("labels"), "targets": obj.get("targets")})
88
+ return _obj