-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstance_sensitive_data.py
More file actions
184 lines (162 loc) · 8.18 KB
/
instance_sensitive_data.py
File metadata and controls
184 lines (162 loc) · 8.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# coding: utf-8
"""
STACKIT Observability API
API endpoints for Observability on STACKIT
The version of the OpenAPI document: 1.1.1
Contact: stackit-argus@mail.schwarz
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import json
import pprint
from typing import Any, ClassVar, Dict, List, Optional, Set
from pydantic import BaseModel, ConfigDict, Field, StrictBool
from typing_extensions import Annotated, Self
from stackit.observability.models.plan_model import PlanModel
class InstanceSensitiveData(BaseModel):
"""
InstanceSensitiveData
""" # noqa: E501
alerting_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="alertingUrl")
cluster: Annotated[str, Field(min_length=1, strict=True, max_length=63)]
dashboard_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="dashboardUrl")
grafana_admin_enabled: StrictBool = Field(alias="grafanaAdminEnabled")
grafana_admin_password: Annotated[str, Field(min_length=32, strict=True)] = Field(alias="grafanaAdminPassword")
grafana_admin_user: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="grafanaAdminUser")
grafana_public_read_access: StrictBool = Field(alias="grafanaPublicReadAccess")
grafana_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="grafanaUrl")
grafana_use_stackit_sso: StrictBool = Field(alias="grafanaUseStackitSso")
instance: Annotated[str, Field(min_length=1, strict=True, max_length=63)]
jaeger_http_traces_url: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(
default=None, alias="jaegerHttpTracesUrl"
)
jaeger_http_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="jaegerHttpUrl")
jaeger_traces_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="jaegerTracesUrl")
jaeger_ui_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="jaegerUiUrl")
logs_push_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="logsPushUrl")
logs_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="logsUrl")
metrics_endpoint_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="metricsEndpointUrl")
metrics_retention_time1h: Annotated[int, Field(strict=True, ge=0)] = Field(alias="metricsRetentionTime1h")
metrics_retention_time5m: Annotated[int, Field(strict=True, ge=0)] = Field(alias="metricsRetentionTime5m")
metrics_retention_time_raw: Annotated[int, Field(strict=True, ge=0)] = Field(alias="metricsRetentionTimeRaw")
metrics_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="metricsUrl")
name: Optional[Annotated[str, Field(strict=True, max_length=300)]] = ""
otlp_grpc_traces_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="otlpGrpcTracesUrl")
otlp_http_logs_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="otlpHttpLogsUrl")
otlp_http_traces_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="otlpHttpTracesUrl")
otlp_traces_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="otlpTracesUrl")
plan: PlanModel
push_metrics_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="pushMetricsUrl")
targets_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="targetsUrl")
zipkin_spans_url: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="zipkinSpansUrl")
__properties: ClassVar[List[str]] = [
"alertingUrl",
"cluster",
"dashboardUrl",
"grafanaAdminEnabled",
"grafanaAdminPassword",
"grafanaAdminUser",
"grafanaPublicReadAccess",
"grafanaUrl",
"grafanaUseStackitSso",
"instance",
"jaegerHttpTracesUrl",
"jaegerHttpUrl",
"jaegerTracesUrl",
"jaegerUiUrl",
"logsPushUrl",
"logsUrl",
"metricsEndpointUrl",
"metricsRetentionTime1h",
"metricsRetentionTime5m",
"metricsRetentionTimeRaw",
"metricsUrl",
"name",
"otlpGrpcTracesUrl",
"otlpHttpLogsUrl",
"otlpHttpTracesUrl",
"otlpTracesUrl",
"plan",
"pushMetricsUrl",
"targetsUrl",
"zipkinSpansUrl",
]
model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of InstanceSensitiveData from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of plan
if self.plan:
_dict["plan"] = self.plan.to_dict()
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of InstanceSensitiveData from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"alertingUrl": obj.get("alertingUrl"),
"cluster": obj.get("cluster"),
"dashboardUrl": obj.get("dashboardUrl"),
"grafanaAdminEnabled": (
obj.get("grafanaAdminEnabled") if obj.get("grafanaAdminEnabled") is not None else True
),
"grafanaAdminPassword": obj.get("grafanaAdminPassword"),
"grafanaAdminUser": obj.get("grafanaAdminUser"),
"grafanaPublicReadAccess": obj.get("grafanaPublicReadAccess"),
"grafanaUrl": obj.get("grafanaUrl"),
"grafanaUseStackitSso": obj.get("grafanaUseStackitSso"),
"instance": obj.get("instance"),
"jaegerHttpTracesUrl": obj.get("jaegerHttpTracesUrl"),
"jaegerHttpUrl": obj.get("jaegerHttpUrl"),
"jaegerTracesUrl": obj.get("jaegerTracesUrl"),
"jaegerUiUrl": obj.get("jaegerUiUrl"),
"logsPushUrl": obj.get("logsPushUrl"),
"logsUrl": obj.get("logsUrl"),
"metricsEndpointUrl": obj.get("metricsEndpointUrl"),
"metricsRetentionTime1h": obj.get("metricsRetentionTime1h"),
"metricsRetentionTime5m": obj.get("metricsRetentionTime5m"),
"metricsRetentionTimeRaw": obj.get("metricsRetentionTimeRaw"),
"metricsUrl": obj.get("metricsUrl"),
"name": obj.get("name") if obj.get("name") is not None else "",
"otlpGrpcTracesUrl": obj.get("otlpGrpcTracesUrl"),
"otlpHttpLogsUrl": obj.get("otlpHttpLogsUrl"),
"otlpHttpTracesUrl": obj.get("otlpHttpTracesUrl"),
"otlpTracesUrl": obj.get("otlpTracesUrl"),
"plan": PlanModel.from_dict(obj["plan"]) if obj.get("plan") is not None else None,
"pushMetricsUrl": obj.get("pushMetricsUrl"),
"targetsUrl": obj.get("targetsUrl"),
"zipkinSpansUrl": obj.get("zipkinSpansUrl"),
}
)
return _obj